Initial commit
mbed-dev-master/targets/TARGET_STM/TARGET_STM32F4/device/stm32f4xx_hal_nand.h@0:bb348c97df44, 2020-09-16 (annotated)
- Committer:
- lypinator
- Date:
- Wed Sep 16 01:11:49 2020 +0000
- Revision:
- 0:bb348c97df44
Added PWM
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
lypinator | 0:bb348c97df44 | 1 | /** |
lypinator | 0:bb348c97df44 | 2 | ****************************************************************************** |
lypinator | 0:bb348c97df44 | 3 | * @file stm32f4xx_hal_nand.h |
lypinator | 0:bb348c97df44 | 4 | * @author MCD Application Team |
lypinator | 0:bb348c97df44 | 5 | * @brief Header file of NAND HAL module. |
lypinator | 0:bb348c97df44 | 6 | ****************************************************************************** |
lypinator | 0:bb348c97df44 | 7 | * @attention |
lypinator | 0:bb348c97df44 | 8 | * |
lypinator | 0:bb348c97df44 | 9 | * <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2> |
lypinator | 0:bb348c97df44 | 10 | * |
lypinator | 0:bb348c97df44 | 11 | * Redistribution and use in source and binary forms, with or without modification, |
lypinator | 0:bb348c97df44 | 12 | * are permitted provided that the following conditions are met: |
lypinator | 0:bb348c97df44 | 13 | * 1. Redistributions of source code must retain the above copyright notice, |
lypinator | 0:bb348c97df44 | 14 | * this list of conditions and the following disclaimer. |
lypinator | 0:bb348c97df44 | 15 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
lypinator | 0:bb348c97df44 | 16 | * this list of conditions and the following disclaimer in the documentation |
lypinator | 0:bb348c97df44 | 17 | * and/or other materials provided with the distribution. |
lypinator | 0:bb348c97df44 | 18 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
lypinator | 0:bb348c97df44 | 19 | * may be used to endorse or promote products derived from this software |
lypinator | 0:bb348c97df44 | 20 | * without specific prior written permission. |
lypinator | 0:bb348c97df44 | 21 | * |
lypinator | 0:bb348c97df44 | 22 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
lypinator | 0:bb348c97df44 | 23 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
lypinator | 0:bb348c97df44 | 24 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
lypinator | 0:bb348c97df44 | 25 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
lypinator | 0:bb348c97df44 | 26 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
lypinator | 0:bb348c97df44 | 27 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
lypinator | 0:bb348c97df44 | 28 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
lypinator | 0:bb348c97df44 | 29 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
lypinator | 0:bb348c97df44 | 30 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
lypinator | 0:bb348c97df44 | 31 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
lypinator | 0:bb348c97df44 | 32 | * |
lypinator | 0:bb348c97df44 | 33 | ****************************************************************************** |
lypinator | 0:bb348c97df44 | 34 | */ |
lypinator | 0:bb348c97df44 | 35 | |
lypinator | 0:bb348c97df44 | 36 | /* Define to prevent recursive inclusion -------------------------------------*/ |
lypinator | 0:bb348c97df44 | 37 | #ifndef __STM32F4xx_HAL_NAND_H |
lypinator | 0:bb348c97df44 | 38 | #define __STM32F4xx_HAL_NAND_H |
lypinator | 0:bb348c97df44 | 39 | |
lypinator | 0:bb348c97df44 | 40 | #ifdef __cplusplus |
lypinator | 0:bb348c97df44 | 41 | extern "C" { |
lypinator | 0:bb348c97df44 | 42 | #endif |
lypinator | 0:bb348c97df44 | 43 | |
lypinator | 0:bb348c97df44 | 44 | /* Includes ------------------------------------------------------------------*/ |
lypinator | 0:bb348c97df44 | 45 | #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) |
lypinator | 0:bb348c97df44 | 46 | #include "stm32f4xx_ll_fsmc.h" |
lypinator | 0:bb348c97df44 | 47 | #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx */ |
lypinator | 0:bb348c97df44 | 48 | |
lypinator | 0:bb348c97df44 | 49 | #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\ |
lypinator | 0:bb348c97df44 | 50 | defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx) |
lypinator | 0:bb348c97df44 | 51 | #include "stm32f4xx_ll_fmc.h" |
lypinator | 0:bb348c97df44 | 52 | #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F446xx || STM32F469xx ||\ |
lypinator | 0:bb348c97df44 | 53 | STM32F479xx */ |
lypinator | 0:bb348c97df44 | 54 | |
lypinator | 0:bb348c97df44 | 55 | /** @addtogroup STM32F4xx_HAL_Driver |
lypinator | 0:bb348c97df44 | 56 | * @{ |
lypinator | 0:bb348c97df44 | 57 | */ |
lypinator | 0:bb348c97df44 | 58 | |
lypinator | 0:bb348c97df44 | 59 | /** @addtogroup NAND |
lypinator | 0:bb348c97df44 | 60 | * @{ |
lypinator | 0:bb348c97df44 | 61 | */ |
lypinator | 0:bb348c97df44 | 62 | |
lypinator | 0:bb348c97df44 | 63 | #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) || \ |
lypinator | 0:bb348c97df44 | 64 | defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || \ |
lypinator | 0:bb348c97df44 | 65 | defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx) |
lypinator | 0:bb348c97df44 | 66 | |
lypinator | 0:bb348c97df44 | 67 | /* Exported typedef ----------------------------------------------------------*/ |
lypinator | 0:bb348c97df44 | 68 | /* Exported types ------------------------------------------------------------*/ |
lypinator | 0:bb348c97df44 | 69 | /** @defgroup NAND_Exported_Types NAND Exported Types |
lypinator | 0:bb348c97df44 | 70 | * @{ |
lypinator | 0:bb348c97df44 | 71 | */ |
lypinator | 0:bb348c97df44 | 72 | |
lypinator | 0:bb348c97df44 | 73 | /** |
lypinator | 0:bb348c97df44 | 74 | * @brief HAL NAND State structures definition |
lypinator | 0:bb348c97df44 | 75 | */ |
lypinator | 0:bb348c97df44 | 76 | typedef enum |
lypinator | 0:bb348c97df44 | 77 | { |
lypinator | 0:bb348c97df44 | 78 | HAL_NAND_STATE_RESET = 0x00U, /*!< NAND not yet initialized or disabled */ |
lypinator | 0:bb348c97df44 | 79 | HAL_NAND_STATE_READY = 0x01U, /*!< NAND initialized and ready for use */ |
lypinator | 0:bb348c97df44 | 80 | HAL_NAND_STATE_BUSY = 0x02U, /*!< NAND internal process is ongoing */ |
lypinator | 0:bb348c97df44 | 81 | HAL_NAND_STATE_ERROR = 0x03U /*!< NAND error state */ |
lypinator | 0:bb348c97df44 | 82 | }HAL_NAND_StateTypeDef; |
lypinator | 0:bb348c97df44 | 83 | |
lypinator | 0:bb348c97df44 | 84 | /** |
lypinator | 0:bb348c97df44 | 85 | * @brief NAND Memory electronic signature Structure definition |
lypinator | 0:bb348c97df44 | 86 | */ |
lypinator | 0:bb348c97df44 | 87 | typedef struct |
lypinator | 0:bb348c97df44 | 88 | { |
lypinator | 0:bb348c97df44 | 89 | /*<! NAND memory electronic signature maker and device IDs */ |
lypinator | 0:bb348c97df44 | 90 | |
lypinator | 0:bb348c97df44 | 91 | uint8_t Maker_Id; |
lypinator | 0:bb348c97df44 | 92 | |
lypinator | 0:bb348c97df44 | 93 | uint8_t Device_Id; |
lypinator | 0:bb348c97df44 | 94 | |
lypinator | 0:bb348c97df44 | 95 | uint8_t Third_Id; |
lypinator | 0:bb348c97df44 | 96 | |
lypinator | 0:bb348c97df44 | 97 | uint8_t Fourth_Id; |
lypinator | 0:bb348c97df44 | 98 | }NAND_IDTypeDef; |
lypinator | 0:bb348c97df44 | 99 | |
lypinator | 0:bb348c97df44 | 100 | /** |
lypinator | 0:bb348c97df44 | 101 | * @brief NAND Memory address Structure definition |
lypinator | 0:bb348c97df44 | 102 | */ |
lypinator | 0:bb348c97df44 | 103 | typedef struct |
lypinator | 0:bb348c97df44 | 104 | { |
lypinator | 0:bb348c97df44 | 105 | uint16_t Page; /*!< NAND memory Page address */ |
lypinator | 0:bb348c97df44 | 106 | |
lypinator | 0:bb348c97df44 | 107 | uint16_t Plane; /*!< NAND memory Plane address */ |
lypinator | 0:bb348c97df44 | 108 | |
lypinator | 0:bb348c97df44 | 109 | uint16_t Block; /*!< NAND memory Block address */ |
lypinator | 0:bb348c97df44 | 110 | |
lypinator | 0:bb348c97df44 | 111 | }NAND_AddressTypeDef; |
lypinator | 0:bb348c97df44 | 112 | |
lypinator | 0:bb348c97df44 | 113 | /** |
lypinator | 0:bb348c97df44 | 114 | * @brief NAND Memory info Structure definition |
lypinator | 0:bb348c97df44 | 115 | */ |
lypinator | 0:bb348c97df44 | 116 | typedef struct |
lypinator | 0:bb348c97df44 | 117 | { |
lypinator | 0:bb348c97df44 | 118 | uint32_t PageSize; /*!< NAND memory page (without spare area) size measured in bytes |
lypinator | 0:bb348c97df44 | 119 | for 8 bits adressing or words for 16 bits addressing */ |
lypinator | 0:bb348c97df44 | 120 | |
lypinator | 0:bb348c97df44 | 121 | uint32_t SpareAreaSize; /*!< NAND memory spare area size measured in bytes |
lypinator | 0:bb348c97df44 | 122 | for 8 bits adressing or words for 16 bits addressing */ |
lypinator | 0:bb348c97df44 | 123 | |
lypinator | 0:bb348c97df44 | 124 | uint32_t BlockSize; /*!< NAND memory block size measured in number of pages */ |
lypinator | 0:bb348c97df44 | 125 | |
lypinator | 0:bb348c97df44 | 126 | uint32_t BlockNbr; /*!< NAND memory number of total blocks */ |
lypinator | 0:bb348c97df44 | 127 | |
lypinator | 0:bb348c97df44 | 128 | uint32_t PlaneNbr; /*!< NAND memory number of planes */ |
lypinator | 0:bb348c97df44 | 129 | |
lypinator | 0:bb348c97df44 | 130 | uint32_t PlaneSize; /*!< NAND memory plane size measured in number of blocks */ |
lypinator | 0:bb348c97df44 | 131 | |
lypinator | 0:bb348c97df44 | 132 | FunctionalState ExtraCommandEnable; /*!< NAND extra command needed for Page reading mode. This |
lypinator | 0:bb348c97df44 | 133 | parameter is mandatory for some NAND parts after the read |
lypinator | 0:bb348c97df44 | 134 | command (NAND_CMD_AREA_TRUE1) and before DATA reading sequence. |
lypinator | 0:bb348c97df44 | 135 | Example: Toshiba THTH58BYG3S0HBAI6. |
lypinator | 0:bb348c97df44 | 136 | This parameter could be ENABLE or DISABLE |
lypinator | 0:bb348c97df44 | 137 | Please check the Read Mode sequnece in the NAND device datasheet */ |
lypinator | 0:bb348c97df44 | 138 | }NAND_DeviceConfigTypeDef; |
lypinator | 0:bb348c97df44 | 139 | |
lypinator | 0:bb348c97df44 | 140 | /** |
lypinator | 0:bb348c97df44 | 141 | * @brief NAND handle Structure definition |
lypinator | 0:bb348c97df44 | 142 | */ |
lypinator | 0:bb348c97df44 | 143 | typedef struct |
lypinator | 0:bb348c97df44 | 144 | { |
lypinator | 0:bb348c97df44 | 145 | FMC_NAND_TypeDef *Instance; /*!< Register base address */ |
lypinator | 0:bb348c97df44 | 146 | |
lypinator | 0:bb348c97df44 | 147 | FMC_NAND_InitTypeDef Init; /*!< NAND device control configuration parameters */ |
lypinator | 0:bb348c97df44 | 148 | |
lypinator | 0:bb348c97df44 | 149 | HAL_LockTypeDef Lock; /*!< NAND locking object */ |
lypinator | 0:bb348c97df44 | 150 | |
lypinator | 0:bb348c97df44 | 151 | __IO HAL_NAND_StateTypeDef State; /*!< NAND device access state */ |
lypinator | 0:bb348c97df44 | 152 | |
lypinator | 0:bb348c97df44 | 153 | NAND_DeviceConfigTypeDef Config; /*!< NAND phusical characteristic information structure */ |
lypinator | 0:bb348c97df44 | 154 | |
lypinator | 0:bb348c97df44 | 155 | }NAND_HandleTypeDef; |
lypinator | 0:bb348c97df44 | 156 | /** |
lypinator | 0:bb348c97df44 | 157 | * @} |
lypinator | 0:bb348c97df44 | 158 | */ |
lypinator | 0:bb348c97df44 | 159 | |
lypinator | 0:bb348c97df44 | 160 | /* Exported constants --------------------------------------------------------*/ |
lypinator | 0:bb348c97df44 | 161 | /* Exported macros ------------------------------------------------------------*/ |
lypinator | 0:bb348c97df44 | 162 | /** @defgroup NAND_Exported_Macros NAND Exported Macros |
lypinator | 0:bb348c97df44 | 163 | * @{ |
lypinator | 0:bb348c97df44 | 164 | */ |
lypinator | 0:bb348c97df44 | 165 | |
lypinator | 0:bb348c97df44 | 166 | /** @brief Reset NAND handle state |
lypinator | 0:bb348c97df44 | 167 | * @param __HANDLE__ specifies the NAND handle. |
lypinator | 0:bb348c97df44 | 168 | * @retval None |
lypinator | 0:bb348c97df44 | 169 | */ |
lypinator | 0:bb348c97df44 | 170 | #define __HAL_NAND_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_NAND_STATE_RESET) |
lypinator | 0:bb348c97df44 | 171 | |
lypinator | 0:bb348c97df44 | 172 | /** |
lypinator | 0:bb348c97df44 | 173 | * @} |
lypinator | 0:bb348c97df44 | 174 | */ |
lypinator | 0:bb348c97df44 | 175 | |
lypinator | 0:bb348c97df44 | 176 | /* Exported functions --------------------------------------------------------*/ |
lypinator | 0:bb348c97df44 | 177 | /** @addtogroup NAND_Exported_Functions NAND Exported Functions |
lypinator | 0:bb348c97df44 | 178 | * @{ |
lypinator | 0:bb348c97df44 | 179 | */ |
lypinator | 0:bb348c97df44 | 180 | |
lypinator | 0:bb348c97df44 | 181 | /** @addtogroup NAND_Exported_Functions_Group1 Initialization and de-initialization functions |
lypinator | 0:bb348c97df44 | 182 | * @{ |
lypinator | 0:bb348c97df44 | 183 | */ |
lypinator | 0:bb348c97df44 | 184 | |
lypinator | 0:bb348c97df44 | 185 | /* Initialization/de-initialization functions ********************************/ |
lypinator | 0:bb348c97df44 | 186 | /* Initialization/de-initialization functions ********************************/ |
lypinator | 0:bb348c97df44 | 187 | HAL_StatusTypeDef HAL_NAND_Init(NAND_HandleTypeDef *hnand, FMC_NAND_PCC_TimingTypeDef *ComSpace_Timing, FMC_NAND_PCC_TimingTypeDef *AttSpace_Timing); |
lypinator | 0:bb348c97df44 | 188 | HAL_StatusTypeDef HAL_NAND_DeInit(NAND_HandleTypeDef *hnand); |
lypinator | 0:bb348c97df44 | 189 | |
lypinator | 0:bb348c97df44 | 190 | HAL_StatusTypeDef HAL_NAND_ConfigDevice(NAND_HandleTypeDef *hnand, NAND_DeviceConfigTypeDef *pDeviceConfig); |
lypinator | 0:bb348c97df44 | 191 | |
lypinator | 0:bb348c97df44 | 192 | HAL_StatusTypeDef HAL_NAND_Read_ID(NAND_HandleTypeDef *hnand, NAND_IDTypeDef *pNAND_ID); |
lypinator | 0:bb348c97df44 | 193 | |
lypinator | 0:bb348c97df44 | 194 | void HAL_NAND_MspInit(NAND_HandleTypeDef *hnand); |
lypinator | 0:bb348c97df44 | 195 | void HAL_NAND_MspDeInit(NAND_HandleTypeDef *hnand); |
lypinator | 0:bb348c97df44 | 196 | void HAL_NAND_IRQHandler(NAND_HandleTypeDef *hnand); |
lypinator | 0:bb348c97df44 | 197 | void HAL_NAND_ITCallback(NAND_HandleTypeDef *hnand); |
lypinator | 0:bb348c97df44 | 198 | |
lypinator | 0:bb348c97df44 | 199 | /** |
lypinator | 0:bb348c97df44 | 200 | * @} |
lypinator | 0:bb348c97df44 | 201 | */ |
lypinator | 0:bb348c97df44 | 202 | |
lypinator | 0:bb348c97df44 | 203 | /** @addtogroup NAND_Exported_Functions_Group2 Input and Output functions |
lypinator | 0:bb348c97df44 | 204 | * @{ |
lypinator | 0:bb348c97df44 | 205 | */ |
lypinator | 0:bb348c97df44 | 206 | |
lypinator | 0:bb348c97df44 | 207 | /* IO operation functions ****************************************************/ |
lypinator | 0:bb348c97df44 | 208 | HAL_StatusTypeDef HAL_NAND_Reset(NAND_HandleTypeDef *hnand); |
lypinator | 0:bb348c97df44 | 209 | |
lypinator | 0:bb348c97df44 | 210 | HAL_StatusTypeDef HAL_NAND_Read_Page_8b(NAND_HandleTypeDef *hnand, NAND_AddressTypeDef *pAddress, uint8_t *pBuffer, uint32_t NumPageToRead); |
lypinator | 0:bb348c97df44 | 211 | HAL_StatusTypeDef HAL_NAND_Write_Page_8b(NAND_HandleTypeDef *hnand, NAND_AddressTypeDef *pAddress, uint8_t *pBuffer, uint32_t NumPageToWrite); |
lypinator | 0:bb348c97df44 | 212 | HAL_StatusTypeDef HAL_NAND_Read_SpareArea_8b(NAND_HandleTypeDef *hnand, NAND_AddressTypeDef *pAddress, uint8_t *pBuffer, uint32_t NumSpareAreaToRead); |
lypinator | 0:bb348c97df44 | 213 | HAL_StatusTypeDef HAL_NAND_Write_SpareArea_8b(NAND_HandleTypeDef *hnand, NAND_AddressTypeDef *pAddress, uint8_t *pBuffer, uint32_t NumSpareAreaTowrite); |
lypinator | 0:bb348c97df44 | 214 | |
lypinator | 0:bb348c97df44 | 215 | HAL_StatusTypeDef HAL_NAND_Read_Page_16b(NAND_HandleTypeDef *hnand, NAND_AddressTypeDef *pAddress, uint16_t *pBuffer, uint32_t NumPageToRead); |
lypinator | 0:bb348c97df44 | 216 | HAL_StatusTypeDef HAL_NAND_Write_Page_16b(NAND_HandleTypeDef *hnand, NAND_AddressTypeDef *pAddress, uint16_t *pBuffer, uint32_t NumPageToWrite); |
lypinator | 0:bb348c97df44 | 217 | HAL_StatusTypeDef HAL_NAND_Read_SpareArea_16b(NAND_HandleTypeDef *hnand, NAND_AddressTypeDef *pAddress, uint16_t *pBuffer, uint32_t NumSpareAreaToRead); |
lypinator | 0:bb348c97df44 | 218 | HAL_StatusTypeDef HAL_NAND_Write_SpareArea_16b(NAND_HandleTypeDef *hnand, NAND_AddressTypeDef *pAddress, uint16_t *pBuffer, uint32_t NumSpareAreaTowrite); |
lypinator | 0:bb348c97df44 | 219 | |
lypinator | 0:bb348c97df44 | 220 | HAL_StatusTypeDef HAL_NAND_Erase_Block(NAND_HandleTypeDef *hnand, NAND_AddressTypeDef *pAddress); |
lypinator | 0:bb348c97df44 | 221 | |
lypinator | 0:bb348c97df44 | 222 | uint32_t HAL_NAND_Read_Status(NAND_HandleTypeDef *hnand); |
lypinator | 0:bb348c97df44 | 223 | uint32_t HAL_NAND_Address_Inc(NAND_HandleTypeDef *hnand, NAND_AddressTypeDef *pAddress); |
lypinator | 0:bb348c97df44 | 224 | |
lypinator | 0:bb348c97df44 | 225 | /** |
lypinator | 0:bb348c97df44 | 226 | * @} |
lypinator | 0:bb348c97df44 | 227 | */ |
lypinator | 0:bb348c97df44 | 228 | |
lypinator | 0:bb348c97df44 | 229 | /** @addtogroup NAND_Exported_Functions_Group3 Peripheral Control functions |
lypinator | 0:bb348c97df44 | 230 | * @{ |
lypinator | 0:bb348c97df44 | 231 | */ |
lypinator | 0:bb348c97df44 | 232 | |
lypinator | 0:bb348c97df44 | 233 | /* NAND Control functions ****************************************************/ |
lypinator | 0:bb348c97df44 | 234 | HAL_StatusTypeDef HAL_NAND_ECC_Enable(NAND_HandleTypeDef *hnand); |
lypinator | 0:bb348c97df44 | 235 | HAL_StatusTypeDef HAL_NAND_ECC_Disable(NAND_HandleTypeDef *hnand); |
lypinator | 0:bb348c97df44 | 236 | HAL_StatusTypeDef HAL_NAND_GetECC(NAND_HandleTypeDef *hnand, uint32_t *ECCval, uint32_t Timeout); |
lypinator | 0:bb348c97df44 | 237 | |
lypinator | 0:bb348c97df44 | 238 | /** |
lypinator | 0:bb348c97df44 | 239 | * @} |
lypinator | 0:bb348c97df44 | 240 | */ |
lypinator | 0:bb348c97df44 | 241 | |
lypinator | 0:bb348c97df44 | 242 | /** @addtogroup NAND_Exported_Functions_Group4 Peripheral State functions |
lypinator | 0:bb348c97df44 | 243 | * @{ |
lypinator | 0:bb348c97df44 | 244 | */ |
lypinator | 0:bb348c97df44 | 245 | /* NAND State functions *******************************************************/ |
lypinator | 0:bb348c97df44 | 246 | HAL_NAND_StateTypeDef HAL_NAND_GetState(NAND_HandleTypeDef *hnand); |
lypinator | 0:bb348c97df44 | 247 | /** |
lypinator | 0:bb348c97df44 | 248 | * @} |
lypinator | 0:bb348c97df44 | 249 | */ |
lypinator | 0:bb348c97df44 | 250 | |
lypinator | 0:bb348c97df44 | 251 | /** |
lypinator | 0:bb348c97df44 | 252 | * @} |
lypinator | 0:bb348c97df44 | 253 | */ |
lypinator | 0:bb348c97df44 | 254 | |
lypinator | 0:bb348c97df44 | 255 | /* Private types -------------------------------------------------------------*/ |
lypinator | 0:bb348c97df44 | 256 | /* Private variables ---------------------------------------------------------*/ |
lypinator | 0:bb348c97df44 | 257 | /* Private constants ---------------------------------------------------------*/ |
lypinator | 0:bb348c97df44 | 258 | /** @defgroup NAND_Private_Constants NAND Private Constants |
lypinator | 0:bb348c97df44 | 259 | * @{ |
lypinator | 0:bb348c97df44 | 260 | */ |
lypinator | 0:bb348c97df44 | 261 | #define NAND_DEVICE1 0x70000000U |
lypinator | 0:bb348c97df44 | 262 | #define NAND_DEVICE2 0x80000000U |
lypinator | 0:bb348c97df44 | 263 | #define NAND_WRITE_TIMEOUT 0x01000000U |
lypinator | 0:bb348c97df44 | 264 | |
lypinator | 0:bb348c97df44 | 265 | #define CMD_AREA ((uint32_t)(1U<<16U)) /* A16 = CLE high */ |
lypinator | 0:bb348c97df44 | 266 | #define ADDR_AREA ((uint32_t)(1U<<17U)) /* A17 = ALE high */ |
lypinator | 0:bb348c97df44 | 267 | |
lypinator | 0:bb348c97df44 | 268 | #define NAND_CMD_AREA_A ((uint8_t)0x00) |
lypinator | 0:bb348c97df44 | 269 | #define NAND_CMD_AREA_B ((uint8_t)0x01) |
lypinator | 0:bb348c97df44 | 270 | #define NAND_CMD_AREA_C ((uint8_t)0x50) |
lypinator | 0:bb348c97df44 | 271 | #define NAND_CMD_AREA_TRUE1 ((uint8_t)0x30) |
lypinator | 0:bb348c97df44 | 272 | |
lypinator | 0:bb348c97df44 | 273 | #define NAND_CMD_WRITE0 ((uint8_t)0x80) |
lypinator | 0:bb348c97df44 | 274 | #define NAND_CMD_WRITE_TRUE1 ((uint8_t)0x10) |
lypinator | 0:bb348c97df44 | 275 | #define NAND_CMD_ERASE0 ((uint8_t)0x60) |
lypinator | 0:bb348c97df44 | 276 | #define NAND_CMD_ERASE1 ((uint8_t)0xD0) |
lypinator | 0:bb348c97df44 | 277 | #define NAND_CMD_READID ((uint8_t)0x90) |
lypinator | 0:bb348c97df44 | 278 | #define NAND_CMD_STATUS ((uint8_t)0x70) |
lypinator | 0:bb348c97df44 | 279 | #define NAND_CMD_LOCK_STATUS ((uint8_t)0x7A) |
lypinator | 0:bb348c97df44 | 280 | #define NAND_CMD_RESET ((uint8_t)0xFF) |
lypinator | 0:bb348c97df44 | 281 | |
lypinator | 0:bb348c97df44 | 282 | /* NAND memory status */ |
lypinator | 0:bb348c97df44 | 283 | #define NAND_VALID_ADDRESS 0x00000100U |
lypinator | 0:bb348c97df44 | 284 | #define NAND_INVALID_ADDRESS 0x00000200U |
lypinator | 0:bb348c97df44 | 285 | #define NAND_TIMEOUT_ERROR 0x00000400U |
lypinator | 0:bb348c97df44 | 286 | #define NAND_BUSY 0x00000000U |
lypinator | 0:bb348c97df44 | 287 | #define NAND_ERROR 0x00000001U |
lypinator | 0:bb348c97df44 | 288 | #define NAND_READY 0x00000040U |
lypinator | 0:bb348c97df44 | 289 | /** |
lypinator | 0:bb348c97df44 | 290 | * @} |
lypinator | 0:bb348c97df44 | 291 | */ |
lypinator | 0:bb348c97df44 | 292 | |
lypinator | 0:bb348c97df44 | 293 | /* Private macros ------------------------------------------------------------*/ |
lypinator | 0:bb348c97df44 | 294 | /** @defgroup NAND_Private_Macros NAND Private Macros |
lypinator | 0:bb348c97df44 | 295 | * @{ |
lypinator | 0:bb348c97df44 | 296 | */ |
lypinator | 0:bb348c97df44 | 297 | |
lypinator | 0:bb348c97df44 | 298 | /** |
lypinator | 0:bb348c97df44 | 299 | * @brief NAND memory address computation. |
lypinator | 0:bb348c97df44 | 300 | * @param __ADDRESS__ NAND memory address. |
lypinator | 0:bb348c97df44 | 301 | * @param __HANDLE__ NAND handle. |
lypinator | 0:bb348c97df44 | 302 | * @retval NAND Raw address value |
lypinator | 0:bb348c97df44 | 303 | */ |
lypinator | 0:bb348c97df44 | 304 | #define ARRAY_ADDRESS(__ADDRESS__ , __HANDLE__) ((__ADDRESS__)->Page + \ |
lypinator | 0:bb348c97df44 | 305 | (((__ADDRESS__)->Block + (((__ADDRESS__)->Plane) * ((__HANDLE__)->Config.PlaneSize)))* ((__HANDLE__)->Config.BlockSize))) |
lypinator | 0:bb348c97df44 | 306 | |
lypinator | 0:bb348c97df44 | 307 | /** |
lypinator | 0:bb348c97df44 | 308 | * @brief NAND memory Column address computation. |
lypinator | 0:bb348c97df44 | 309 | * @param __HANDLE__ NAND handle. |
lypinator | 0:bb348c97df44 | 310 | * @retval NAND Raw address value |
lypinator | 0:bb348c97df44 | 311 | */ |
lypinator | 0:bb348c97df44 | 312 | #define COLUMN_ADDRESS( __HANDLE__) ((__HANDLE__)->Config.PageSize) |
lypinator | 0:bb348c97df44 | 313 | |
lypinator | 0:bb348c97df44 | 314 | /** |
lypinator | 0:bb348c97df44 | 315 | * @brief NAND memory address cycling. |
lypinator | 0:bb348c97df44 | 316 | * @param __ADDRESS__ NAND memory address. |
lypinator | 0:bb348c97df44 | 317 | * @retval NAND address cycling value. |
lypinator | 0:bb348c97df44 | 318 | */ |
lypinator | 0:bb348c97df44 | 319 | #define ADDR_1ST_CYCLE(__ADDRESS__) (uint8_t)(__ADDRESS__) /* 1st addressing cycle */ |
lypinator | 0:bb348c97df44 | 320 | #define ADDR_2ND_CYCLE(__ADDRESS__) (uint8_t)((__ADDRESS__) >> 8) /* 2nd addressing cycle */ |
lypinator | 0:bb348c97df44 | 321 | #define ADDR_3RD_CYCLE(__ADDRESS__) (uint8_t)((__ADDRESS__) >> 16) /* 3rd addressing cycle */ |
lypinator | 0:bb348c97df44 | 322 | #define ADDR_4TH_CYCLE(__ADDRESS__) (uint8_t)((__ADDRESS__) >> 24) /* 4th addressing cycle */ |
lypinator | 0:bb348c97df44 | 323 | |
lypinator | 0:bb348c97df44 | 324 | /** |
lypinator | 0:bb348c97df44 | 325 | * @brief NAND memory Columns cycling. |
lypinator | 0:bb348c97df44 | 326 | * @param __ADDRESS__ NAND memory address. |
lypinator | 0:bb348c97df44 | 327 | * @retval NAND Column address cycling value. |
lypinator | 0:bb348c97df44 | 328 | */ |
lypinator | 0:bb348c97df44 | 329 | #define COLUMN_1ST_CYCLE(__ADDRESS__) (uint8_t)(__ADDRESS__) /* 1st Column addressing cycle */ |
lypinator | 0:bb348c97df44 | 330 | #define COLUMN_2ND_CYCLE(__ADDRESS__) (uint8_t)((__ADDRESS__) >> 8) /* 2nd Column addressing cycle */ |
lypinator | 0:bb348c97df44 | 331 | |
lypinator | 0:bb348c97df44 | 332 | /** |
lypinator | 0:bb348c97df44 | 333 | * @} |
lypinator | 0:bb348c97df44 | 334 | */ |
lypinator | 0:bb348c97df44 | 335 | #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx ||\ |
lypinator | 0:bb348c97df44 | 336 | STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx ||\ |
lypinator | 0:bb348c97df44 | 337 | STM32F446xx || STM32F469xx || STM32F479xx */ |
lypinator | 0:bb348c97df44 | 338 | |
lypinator | 0:bb348c97df44 | 339 | /** |
lypinator | 0:bb348c97df44 | 340 | * @} |
lypinator | 0:bb348c97df44 | 341 | */ |
lypinator | 0:bb348c97df44 | 342 | /** |
lypinator | 0:bb348c97df44 | 343 | * @} |
lypinator | 0:bb348c97df44 | 344 | */ |
lypinator | 0:bb348c97df44 | 345 | |
lypinator | 0:bb348c97df44 | 346 | /** |
lypinator | 0:bb348c97df44 | 347 | * @} |
lypinator | 0:bb348c97df44 | 348 | */ |
lypinator | 0:bb348c97df44 | 349 | |
lypinator | 0:bb348c97df44 | 350 | #ifdef __cplusplus |
lypinator | 0:bb348c97df44 | 351 | } |
lypinator | 0:bb348c97df44 | 352 | #endif |
lypinator | 0:bb348c97df44 | 353 | |
lypinator | 0:bb348c97df44 | 354 | #endif /* __STM32F4xx_HAL_NAND_H */ |
lypinator | 0:bb348c97df44 | 355 | |
lypinator | 0:bb348c97df44 | 356 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |