bremenpl

qspi.h

Mar 15th, 2018
254
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 4.88 KB | None | 0 0
  1. /**
  2.   ******************************************************************************
  3.   * @file    stm32l496g_discovery_qspi.h
  4.   * @author  MCD Application Team
  5.   * @version V1.0.0
  6.   * @date    17-February-2017
  7.   * @brief   This file contains the common defines and functions prototypes for
  8.   *          the stm32l496g_discovery_qspi.c driver.
  9.   ******************************************************************************
  10.   * @attention
  11.   *
  12.   * <h2><center>&copy; COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
  13.   *
  14.   * Redistribution and use in source and binary forms, with or without modification,
  15.   * are permitted provided that the following conditions are met:
  16.   *   1. Redistributions of source code must retain the above copyright notice,
  17.   *      this list of conditions and the following disclaimer.
  18.   *   2. Redistributions in binary form must reproduce the above copyright notice,
  19.   *      this list of conditions and the following disclaimer in the documentation
  20.   *      and/or other materials provided with the distribution.
  21.   *   3. Neither the name of STMicroelectronics nor the names of its contributors
  22.   *      may be used to endorse or promote products derived from this software
  23.   *      without specific prior written permission.
  24.   *
  25.   * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  26.   * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  27.   * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  28.   * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
  29.   * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  30.   * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  31.   * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  32.   * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  33.   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  34.   * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  35.   *
  36.   ******************************************************************************
  37.   */
  38.  
  39. /* Define to prevent recursive inclusion -------------------------------------*/
  40. #ifndef __STM32L496G_DISCOVERY_QSPI_H
  41. #define __STM32L496G_DISCOVERY_QSPI_H
  42.  
  43. #ifdef __cplusplus
  44.  extern "C" {
  45. #endif
  46.  
  47. /* Includes ------------------------------------------------------------------*/
  48. #include "stm32l4xx_hal.h"
  49. #include "../Components/mx25r6435f/mx25r6435f.h"
  50.  
  51. /** @addtogroup BSP
  52.   * @{
  53.   */
  54.  
  55. /** @addtogroup STM32L496G_DISCOVERY
  56.   * @{
  57.   */
  58.  
  59. /** @addtogroup STM32L496G_DISCOVERY_QSPI
  60.   * @{
  61.   */
  62.  
  63. /* Exported constants --------------------------------------------------------*/
  64. /** @defgroup STM32L496G_DISCOVERY_QSPI_Exported_Constants Exported Constants
  65.   * @{
  66.   */
  67. /* QSPI Error codes */
  68. #define QSPI_OK            ((uint8_t)0x00)
  69. #define QSPI_ERROR         ((uint8_t)0x01)
  70. #define QSPI_BUSY          ((uint8_t)0x02)
  71. #define QSPI_NOT_SUPPORTED ((uint8_t)0x04)
  72. #define QSPI_SUSPENDED     ((uint8_t)0x08)
  73.  
  74. /**
  75.   * @}
  76.   */
  77.  
  78. /* Exported types ------------------------------------------------------------*/
  79. /** @defgroup STM32L496G_DISCOVERY_QSPI_Exported_Types Exported Types
  80.   * @{
  81.   */
  82. /* QSPI Info */
  83. typedef struct {
  84.   uint32_t FlashSize;          /*!< Size of the flash */
  85.   uint32_t EraseSectorSize;    /*!< Size of sectors for the erase operation */
  86.   uint32_t EraseSectorsNumber; /*!< Number of sectors for the erase operation */
  87.   uint32_t ProgPageSize;       /*!< Size of pages for the program operation */
  88.   uint32_t ProgPagesNumber;    /*!< Number of pages for the program operation */
  89. } QSPI_Info;
  90.  
  91. /**
  92.   * @}
  93.   */
  94.  
  95. /* Exported functions --------------------------------------------------------*/
  96. /** @defgroup STM32L496G_DISCOVERY_QSPI_Exported_Functions Exported Functions
  97.   * @{
  98.   */
  99. uint8_t BSP_QSPI_Init                  (void);
  100. uint8_t BSP_QSPI_DeInit                (void);
  101. uint8_t BSP_QSPI_Read                  (uint8_t* pData, uint32_t ReadAddr, uint32_t Size);
  102. uint8_t BSP_QSPI_Write                 (uint8_t* pData, uint32_t WriteAddr, uint32_t Size);
  103. uint8_t BSP_QSPI_Erase_Block           (uint32_t BlockAddress);
  104. uint8_t BSP_QSPI_Erase_Sector          (uint32_t Sector);
  105. uint8_t BSP_QSPI_Erase_Chip            (void);
  106. uint8_t BSP_QSPI_GetStatus             (void);
  107. uint8_t BSP_QSPI_GetInfo               (QSPI_Info* pInfo);
  108. uint8_t BSP_QSPI_EnableMemoryMappedMode(void);
  109. uint8_t BSP_QSPI_SuspendErase          (void);
  110. uint8_t BSP_QSPI_ResumeErase           (void);
  111. uint8_t BSP_QSPI_EnterDeepPowerDown    (void);
  112. uint8_t BSP_QSPI_LeaveDeepPowerDown    (void);
  113.  
  114. /**
  115.   * @}
  116.   */
  117.  
  118. /**
  119.   * @}
  120.   */
  121.  
  122. /**
  123.   * @}
  124.   */
  125.  
  126. /**
  127.   * @}
  128.   */
  129.  
  130. #ifdef __cplusplus
  131. }
  132. #endif
  133.  
  134. #endif /* __STM32L496G_DISCOVERY_QSPI_H */
  135.  
  136. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
Advertisement
Add Comment
Please, Sign In to add comment