STM32F469NI Discovery board drivers

Dependents:   DISCO-F469NI_LCDTS_GUI_demo Configurable_Robots DISCO-F469NI_LCD_demo DISCO-F469NI_SD_demo ... more

Committer:
Jerome Coutant
Date:
Tue May 16 10:50:26 2017 +0200
Revision:
2:123b894b49dd
Child:
3:3cdfcc4f7c9d
STM32Cube_FW_BSP_DISCO_F469NI

Who changed what in which revision?

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