PageRenderTime 27ms CodeModel.GetById 21ms RepoModel.GetById 0ms app.codeStats 0ms

/p1/workspace/STM32Cube_FW_F4_V1.19.0/Drivers/BSP/STM32469I_EVAL/stm32469i_eval_qspi.h

https://bitbucket.org/pedromalagon/lse2018
C Header | 172 lines | 60 code | 26 blank | 86 comment | 0 complexity | bc77b9ea6027369552d54018add1a4d3 MD5 | raw file
  1. /**
  2. ******************************************************************************
  3. * @file stm32469i_eval_qspi.h
  4. * @author MCD Application Team
  5. * @brief This file contains the common defines and functions prototypes for
  6. * the stm32469i_eval_qspi.c driver.
  7. ******************************************************************************
  8. * @attention
  9. *
  10. * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
  11. *
  12. * Redistribution and use in source and binary forms, with or without modification,
  13. * are permitted provided that the following conditions are met:
  14. * 1. Redistributions of source code must retain the above copyright notice,
  15. * this list of conditions and the following disclaimer.
  16. * 2. Redistributions in binary form must reproduce the above copyright notice,
  17. * this list of conditions and the following disclaimer in the documentation
  18. * and/or other materials provided with the distribution.
  19. * 3. Neither the name of STMicroelectronics nor the names of its contributors
  20. * may be used to endorse or promote products derived from this software
  21. * without specific prior written permission.
  22. *
  23. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  24. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  25. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  26. * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
  27. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  28. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  29. * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  30. * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  31. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  32. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  33. *
  34. ******************************************************************************
  35. */
  36. /** @addtogroup BSP
  37. * @{
  38. */
  39. /** @addtogroup STM32469I_EVAL
  40. * @{
  41. */
  42. /* Define to prevent recursive inclusion -------------------------------------*/
  43. #ifndef __STM32469I_EVAL_QSPI_H
  44. #define __STM32469I_EVAL_QSPI_H
  45. #ifdef __cplusplus
  46. extern "C" {
  47. #endif
  48. /* Includes ------------------------------------------------------------------*/
  49. #include "stm32f4xx_hal.h"
  50. #include "../Components/s25fl512s/s25fl512s.h"
  51. #include "../Components/n25q512a/n25q512a.h"
  52. /** @addtogroup STM32469I_EVAL_QSPI
  53. * @{
  54. */
  55. /* Exported constants --------------------------------------------------------*/
  56. /** @defgroup STM32446E_EVAL_QSPI_Exported_Constants STM32469I EVAL QSPI Exported Constants
  57. * @{
  58. */
  59. /* QSPI Error codes */
  60. #define QSPI_OK ((uint8_t)0x00)
  61. #define QSPI_ERROR ((uint8_t)0x01)
  62. #define QSPI_BUSY ((uint8_t)0x02)
  63. #define QSPI_NOT_SUPPORTED ((uint8_t)0x04)
  64. #define QSPI_SUSPENDED ((uint8_t)0x08)
  65. #define QSPI_PROTECTED ((uint8_t)0x10)
  66. #define QSPI_S25FL512S ((uint8_t)0x20)
  67. #define QSPI_N25Q512A ((uint8_t)0x40)
  68. /* Definition for QSPI clock resources */
  69. #define QSPI_CLK_ENABLE() __HAL_RCC_QSPI_CLK_ENABLE()
  70. #define QSPI_CLK_DISABLE() __HAL_RCC_QSPI_CLK_DISABLE()
  71. #define QSPI_CS_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE()
  72. #define QSPI_CS_GPIO_CLK_DISABLE() __HAL_RCC_GPIOB_CLK_DISABLE()
  73. #define QSPI_DX_CLK_GPIO_CLK_ENABLE() __HAL_RCC_GPIOF_CLK_ENABLE()
  74. #define QSPI_DX_CLK_GPIO_CLK_DISABLE() __HAL_RCC_GPIOF_CLK_DISABLE()
  75. #define QSPI_FORCE_RESET() __HAL_RCC_QSPI_FORCE_RESET()
  76. #define QSPI_RELEASE_RESET() __HAL_RCC_QSPI_RELEASE_RESET()
  77. /* Definition for QSPI Pins */
  78. #define QSPI_CS_PIN GPIO_PIN_6
  79. #define QSPI_CS_GPIO_PORT GPIOB
  80. #define QSPI_CLK_PIN GPIO_PIN_10
  81. #define QSPI_CLK_GPIO_PORT GPIOF
  82. #define QSPI_D0_PIN GPIO_PIN_8
  83. #define QSPI_D1_PIN GPIO_PIN_9
  84. #define QSPI_D2_PIN GPIO_PIN_7
  85. #define QSPI_D3_PIN GPIO_PIN_6
  86. #define QSPI_DX_GPIO_PORT GPIOF
  87. /**
  88. * @}
  89. */
  90. /* Exported types ------------------------------------------------------------*/
  91. /** @defgroup STM32446E_EVAL_QSPI_Exported_Types STM32469I EVAL QSPI Exported Types
  92. * @{
  93. */
  94. /**
  95. * @brief QSPI Info
  96. * */
  97. typedef struct {
  98. uint32_t FlashSize; /*!< Size of the flash */
  99. uint32_t EraseSectorSize; /*!< Size of sectors for the erase operation */
  100. uint32_t EraseSectorsNumber; /*!< Number of sectors for the erase operation */
  101. uint32_t ProgPageSize; /*!< Size of pages for the program operation */
  102. uint32_t ProgPagesNumber; /*!< Number of pages for the program operation */
  103. uint32_t DummyCyclesRead; /*!< Number of dummy read cycles */
  104. uint8_t ManufID; /*!< Manufacturor value */
  105. uint32_t SectorEraseMaxTime; /*!< Sector Erase max value */
  106. uint32_t BulkEraseMaxTime; /*!< Bulk Erase Max Time */
  107. } QSPI_InfoTypeDef;
  108. /**
  109. * @}
  110. */
  111. /* Exported functions --------------------------------------------------------*/
  112. /** @defgroup STM32469I_EVAL_QSPI_Exported_Functions STM32469I EVAL QSPI Exported Functions
  113. * @{
  114. */
  115. uint8_t BSP_QSPI_Init (void);
  116. uint8_t BSP_QSPI_DeInit (void);
  117. uint8_t BSP_QSPI_Read (uint8_t* pData, uint32_t ReadAddr, uint32_t Size);
  118. uint8_t BSP_QSPI_Write (uint8_t* pData, uint32_t WriteAddr, uint32_t Size);
  119. uint8_t BSP_QSPI_Erase_Block(uint32_t BlockAddress);
  120. uint8_t BSP_QSPI_Erase_Chip (void);
  121. uint8_t BSP_QSPI_GetStatus (void);
  122. uint8_t BSP_QSPI_GetInfo (QSPI_InfoTypeDef* pInfo);
  123. uint8_t BSP_QSPI_EnableMemoryMappedMode(void);
  124. /* BSP Aliased function maintained for legacy purpose */
  125. #define BSP_QSPI_MemoryMappedMode BSP_QSPI_EnableMemoryMappedMode
  126. /* These function can be modified in case the current settings (e.g. DMA stream)
  127. need to be changed for specific application needs */
  128. void BSP_QSPI_MspInit(QSPI_HandleTypeDef *hqspi, void *Params);
  129. void BSP_QSPI_MspDeInit(QSPI_HandleTypeDef *hqspi, void *Params);
  130. /**
  131. * @}
  132. */
  133. /**
  134. * @}
  135. */
  136. #ifdef __cplusplus
  137. }
  138. #endif
  139. #endif /* __STM32446E_EVAL_QSPI_H */
  140. /**
  141. * @}
  142. */
  143. /**
  144. * @}
  145. */
  146. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/