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