stm32f7xx_hal_nand.h
Go to the documentation of this file.
1 
20 /* Define to prevent recursive inclusion -------------------------------------*/
21 #ifndef __STM32F7xx_HAL_NAND_H
22 #define __STM32F7xx_HAL_NAND_H
23 
24 #ifdef __cplusplus
25  extern "C" {
26 #endif
27 
28 /* Includes ------------------------------------------------------------------*/
29 #include "stm32f7xx_ll_fmc.h"
30 
39 /* Exported typedef ----------------------------------------------------------*/
40 /* Exported types ------------------------------------------------------------*/
48 typedef enum
49 {
55 
59 typedef struct
60 {
61  /*<! NAND memory electronic signature maker and device IDs */
62 
63  uint8_t Maker_Id;
64 
65  uint8_t Device_Id;
66 
67  uint8_t Third_Id;
68 
69  uint8_t Fourth_Id;
71 
75 typedef struct
76 {
77  uint16_t Page;
79  uint16_t Plane;
81  uint16_t Block;
84 
88 typedef struct
89 {
90  uint32_t PageSize;
93  uint32_t SpareAreaSize;
96  uint32_t BlockSize;
98  uint32_t BlockNbr;
100  uint32_t PlaneNbr;
102  uint32_t PlaneSize;
111 
115 #if (USE_HAL_NAND_REGISTER_CALLBACKS == 1)
116 typedef struct __NAND_HandleTypeDef
117 #else
118 typedef struct
119 #endif /* USE_HAL_NAND_REGISTER_CALLBACKS */
120 {
131 #if (USE_HAL_NAND_REGISTER_CALLBACKS == 1)
132  void (* MspInitCallback) ( struct __NAND_HandleTypeDef * hnand);
133  void (* MspDeInitCallback) ( struct __NAND_HandleTypeDef * hnand);
134  void (* ItCallback) ( struct __NAND_HandleTypeDef * hnand);
135 #endif
137 
138 #if (USE_HAL_NAND_REGISTER_CALLBACKS == 1)
139 
142 typedef enum
143 {
144  HAL_NAND_MSP_INIT_CB_ID = 0x00U,
145  HAL_NAND_MSP_DEINIT_CB_ID = 0x01U,
146  HAL_NAND_IT_CB_ID = 0x02U
147 }HAL_NAND_CallbackIDTypeDef;
148 
152 typedef void (*pNAND_CallbackTypeDef)(NAND_HandleTypeDef *hnand);
153 #endif
154 
159 /* Exported constants --------------------------------------------------------*/
160 /* Exported macro ------------------------------------------------------------*/
169 #if (USE_HAL_NAND_REGISTER_CALLBACKS == 1)
170 #define __HAL_NAND_RESET_HANDLE_STATE(__HANDLE__) do { \
171  (__HANDLE__)->State = HAL_NAND_STATE_RESET; \
172  (__HANDLE__)->MspInitCallback = NULL; \
173  (__HANDLE__)->MspDeInitCallback = NULL; \
174  } while(0)
175 #else
176 #define __HAL_NAND_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_NAND_STATE_RESET)
177 #endif
178 
183 /* Exported functions --------------------------------------------------------*/
192 /* Initialization/de-initialization functions ********************************/
195 
197 
199 
204 
213 /* IO operation functions ****************************************************/
214 
216 
217 HAL_StatusTypeDef HAL_NAND_Read_Page_8b(NAND_HandleTypeDef *hnand, NAND_AddressTypeDef *pAddress, uint8_t *pBuffer, uint32_t NumPageToRead);
218 HAL_StatusTypeDef HAL_NAND_Write_Page_8b(NAND_HandleTypeDef *hnand, NAND_AddressTypeDef *pAddress, uint8_t *pBuffer, uint32_t NumPageToWrite);
219 HAL_StatusTypeDef HAL_NAND_Read_SpareArea_8b(NAND_HandleTypeDef *hnand, NAND_AddressTypeDef *pAddress, uint8_t *pBuffer, uint32_t NumSpareAreaToRead);
220 HAL_StatusTypeDef HAL_NAND_Write_SpareArea_8b(NAND_HandleTypeDef *hnand, NAND_AddressTypeDef *pAddress, uint8_t *pBuffer, uint32_t NumSpareAreaTowrite);
221 
222 HAL_StatusTypeDef HAL_NAND_Read_Page_16b(NAND_HandleTypeDef *hnand, NAND_AddressTypeDef *pAddress, uint16_t *pBuffer, uint32_t NumPageToRead);
223 HAL_StatusTypeDef HAL_NAND_Write_Page_16b(NAND_HandleTypeDef *hnand, NAND_AddressTypeDef *pAddress, uint16_t *pBuffer, uint32_t NumPageToWrite);
224 HAL_StatusTypeDef HAL_NAND_Read_SpareArea_16b(NAND_HandleTypeDef *hnand, NAND_AddressTypeDef *pAddress, uint16_t *pBuffer, uint32_t NumSpareAreaToRead);
225 HAL_StatusTypeDef HAL_NAND_Write_SpareArea_16b(NAND_HandleTypeDef *hnand, NAND_AddressTypeDef *pAddress, uint16_t *pBuffer, uint32_t NumSpareAreaTowrite);
226 
228 
230 
231 #if (USE_HAL_NAND_REGISTER_CALLBACKS == 1)
232 /* NAND callback registering/unregistering */
233 HAL_StatusTypeDef HAL_NAND_RegisterCallback(NAND_HandleTypeDef *hnand, HAL_NAND_CallbackIDTypeDef CallbackId, pNAND_CallbackTypeDef pCallback);
234 HAL_StatusTypeDef HAL_NAND_UnRegisterCallback(NAND_HandleTypeDef *hnand, HAL_NAND_CallbackIDTypeDef CallbackId);
235 #endif
236 
245 /* NAND Control functions ****************************************************/
248 HAL_StatusTypeDef HAL_NAND_GetECC(NAND_HandleTypeDef *hnand, uint32_t *ECCval, uint32_t Timeout);
249 
257 /* NAND State functions *******************************************************/
267 /* Private types -------------------------------------------------------------*/
268 /* Private variables ---------------------------------------------------------*/
269 /* Private constants ---------------------------------------------------------*/
273 #define NAND_DEVICE ((uint32_t)0x80000000U)
274 #define NAND_WRITE_TIMEOUT ((uint32_t)0x01000000U)
275 
276 #define CMD_AREA ((uint32_t)(1<<16)) /* A16 = CLE high */
277 #define ADDR_AREA ((uint32_t)(1<<17)) /* A17 = ALE high */
278 
279 #define NAND_CMD_AREA_A ((uint8_t)0x00U)
280 #define NAND_CMD_AREA_B ((uint8_t)0x01U)
281 #define NAND_CMD_AREA_C ((uint8_t)0x50U)
282 #define NAND_CMD_AREA_TRUE1 ((uint8_t)0x30U)
283 
284 #define NAND_CMD_WRITE0 ((uint8_t)0x80U)
285 #define NAND_CMD_WRITE_TRUE1 ((uint8_t)0x10U)
286 #define NAND_CMD_ERASE0 ((uint8_t)0x60U)
287 #define NAND_CMD_ERASE1 ((uint8_t)0xD0U)
288 #define NAND_CMD_READID ((uint8_t)0x90U)
289 #define NAND_CMD_STATUS ((uint8_t)0x70U)
290 #define NAND_CMD_LOCK_STATUS ((uint8_t)0x7AU)
291 #define NAND_CMD_RESET ((uint8_t)0xFFU)
292 
293 /* NAND memory status */
294 #define NAND_VALID_ADDRESS ((uint32_t)0x00000100U)
295 #define NAND_INVALID_ADDRESS ((uint32_t)0x00000200U)
296 #define NAND_TIMEOUT_ERROR ((uint32_t)0x00000400U)
297 #define NAND_BUSY ((uint32_t)0x00000000U)
298 #define NAND_ERROR ((uint32_t)0x00000001U)
299 #define NAND_READY ((uint32_t)0x00000040U)
300 
304 /* Private macros ------------------------------------------------------------*/
315 #define ARRAY_ADDRESS(__ADDRESS__ , __HANDLE__) ((__ADDRESS__)->Page + \
316  (((__ADDRESS__)->Block + (((__ADDRESS__)->Plane) * ((__HANDLE__)->Config.PlaneSize)))* ((__HANDLE__)->Config.BlockSize)))
317 
318 #define COLUMN_ADDRESS( __HANDLE__) ((__HANDLE__)->Config.PageSize)
319 
325 #define ADDR_1ST_CYCLE(__ADDRESS__) (uint8_t)(__ADDRESS__) /* 1st addressing cycle */
326 #define ADDR_2ND_CYCLE(__ADDRESS__) (uint8_t)((__ADDRESS__) >> 8) /* 2nd addressing cycle */
327 #define ADDR_3RD_CYCLE(__ADDRESS__) (uint8_t)((__ADDRESS__) >> 16) /* 3rd addressing cycle */
328 #define ADDR_4TH_CYCLE(__ADDRESS__) (uint8_t)((__ADDRESS__) >> 24) /* 4th addressing cycle */
329 
335 #define COLUMN_1ST_CYCLE(__ADDRESS__) (uint8_t)(__ADDRESS__) /* 1st Column addressing cycle */
336 #define COLUMN_2ND_CYCLE(__ADDRESS__) (uint8_t)((__ADDRESS__) >> 8) /* 2nd Column addressing cycle */
337 
353 #ifdef __cplusplus
354 }
355 #endif
356 
357 #endif /* __STM32F7xx_HAL_NAND_H */
358 
359 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
HAL_NAND_ECC_Disable
HAL_StatusTypeDef HAL_NAND_ECC_Disable(NAND_HandleTypeDef *hnand)
NAND_DeviceConfigTypeDef
NAND Memory info Structure definition.
Definition: stm32f7xx_hal_nand.h:88
HAL_NAND_MspInit
void HAL_NAND_MspInit(NAND_HandleTypeDef *hnand)
__IO
#define __IO
Definition: imxrt1050/imxrt1050-evkb/CMSIS/core_cm7.h:237
HAL_StatusTypeDef
HAL_StatusTypeDef
HAL Status structures definition
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_def.h:40
NAND_IDTypeDef::Third_Id
uint8_t Third_Id
Definition: stm32f7xx_hal_nand.h:67
NAND_HandleTypeDef::State
__IO HAL_NAND_StateTypeDef State
Definition: stm32f7xx_hal_nand.h:127
NAND_IDTypeDef::Fourth_Id
uint8_t Fourth_Id
Definition: stm32f7xx_hal_nand.h:69
NAND_IDTypeDef
NAND Memory electronic signature Structure definition.
Definition: stm32f7xx_hal_nand.h:59
HAL_NAND_Read_Page_16b
HAL_StatusTypeDef HAL_NAND_Read_Page_16b(NAND_HandleTypeDef *hnand, NAND_AddressTypeDef *pAddress, uint16_t *pBuffer, uint32_t NumPageToRead)
HAL_NAND_Reset
HAL_StatusTypeDef HAL_NAND_Reset(NAND_HandleTypeDef *hnand)
NAND_AddressTypeDef
NAND Memory address Structure definition.
Definition: stm32f7xx_hal_nand.h:75
HAL_LockTypeDef
HAL_LockTypeDef
HAL Lock structures definition
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_def.h:51
HAL_NAND_Write_Page_8b
HAL_StatusTypeDef HAL_NAND_Write_Page_8b(NAND_HandleTypeDef *hnand, NAND_AddressTypeDef *pAddress, uint8_t *pBuffer, uint32_t NumPageToWrite)
HAL_NAND_Address_Inc
uint32_t HAL_NAND_Address_Inc(NAND_HandleTypeDef *hnand, NAND_AddressTypeDef *pAddress)
HAL_NAND_DeInit
HAL_StatusTypeDef HAL_NAND_DeInit(NAND_HandleTypeDef *hnand)
NAND_IDTypeDef::Device_Id
uint8_t Device_Id
Definition: stm32f7xx_hal_nand.h:65
NAND_DeviceConfigTypeDef::PageSize
uint32_t PageSize
Definition: stm32f7xx_hal_nand.h:90
NAND_HandleTypeDef::Config
NAND_DeviceConfigTypeDef Config
Definition: stm32f7xx_hal_nand.h:129
HAL_NAND_Read_Page_8b
HAL_StatusTypeDef HAL_NAND_Read_Page_8b(NAND_HandleTypeDef *hnand, NAND_AddressTypeDef *pAddress, uint8_t *pBuffer, uint32_t NumPageToRead)
HAL_NAND_GetState
HAL_NAND_StateTypeDef HAL_NAND_GetState(NAND_HandleTypeDef *hnand)
NAND_IDTypeDef::Maker_Id
uint8_t Maker_Id
Definition: stm32f7xx_hal_nand.h:63
HAL_NAND_Write_SpareArea_8b
HAL_StatusTypeDef HAL_NAND_Write_SpareArea_8b(NAND_HandleTypeDef *hnand, NAND_AddressTypeDef *pAddress, uint8_t *pBuffer, uint32_t NumSpareAreaTowrite)
NAND_DeviceConfigTypeDef::PlaneSize
uint32_t PlaneSize
Definition: stm32f7xx_hal_nand.h:102
HAL_NAND_STATE_READY
@ HAL_NAND_STATE_READY
Definition: stm32f7xx_hal_nand.h:51
HAL_NAND_Init
HAL_StatusTypeDef HAL_NAND_Init(NAND_HandleTypeDef *hnand, FMC_NAND_PCC_TimingTypeDef *ComSpace_Timing, FMC_NAND_PCC_TimingTypeDef *AttSpace_Timing)
HAL_NAND_StateTypeDef
HAL_NAND_StateTypeDef
HAL NAND State structures definition.
Definition: stm32f7xx_hal_nand.h:48
HAL_NAND_ECC_Enable
HAL_StatusTypeDef HAL_NAND_ECC_Enable(NAND_HandleTypeDef *hnand)
FMC_NAND_TypeDef
#define FMC_NAND_TypeDef
Definition: stm32f7xx_ll_fmc.h:385
HAL_NAND_STATE_ERROR
@ HAL_NAND_STATE_ERROR
Definition: stm32f7xx_hal_nand.h:53
NAND_AddressTypeDef::Plane
uint16_t Plane
Definition: stm32f7xx_hal_nand.h:79
HAL_NAND_Read_SpareArea_8b
HAL_StatusTypeDef HAL_NAND_Read_SpareArea_8b(NAND_HandleTypeDef *hnand, NAND_AddressTypeDef *pAddress, uint8_t *pBuffer, uint32_t NumSpareAreaToRead)
NAND_AddressTypeDef::Page
uint16_t Page
Definition: stm32f7xx_hal_nand.h:77
FMC_NAND_PCC_TimingTypeDef
FMC NAND Timing parameters structure definition.
Definition: stm32f7xx_ll_fmc.h:532
HAL_NAND_GetECC
HAL_StatusTypeDef HAL_NAND_GetECC(NAND_HandleTypeDef *hnand, uint32_t *ECCval, uint32_t Timeout)
NAND_DeviceConfigTypeDef::BlockSize
uint32_t BlockSize
Definition: stm32f7xx_hal_nand.h:96
HAL_NAND_Read_SpareArea_16b
HAL_StatusTypeDef HAL_NAND_Read_SpareArea_16b(NAND_HandleTypeDef *hnand, NAND_AddressTypeDef *pAddress, uint16_t *pBuffer, uint32_t NumSpareAreaToRead)
HAL_NAND_Read_ID
HAL_StatusTypeDef HAL_NAND_Read_ID(NAND_HandleTypeDef *hnand, NAND_IDTypeDef *pNAND_ID)
HAL_NAND_Write_SpareArea_16b
HAL_StatusTypeDef HAL_NAND_Write_SpareArea_16b(NAND_HandleTypeDef *hnand, NAND_AddressTypeDef *pAddress, uint16_t *pBuffer, uint32_t NumSpareAreaTowrite)
NAND_HandleTypeDef
NAND handle Structure definition.
Definition: stm32f7xx_hal_nand.h:118
NAND_HandleTypeDef::Instance
FMC_NAND_TypeDef * Instance
Definition: stm32f7xx_hal_nand.h:121
NAND_DeviceConfigTypeDef::PlaneNbr
uint32_t PlaneNbr
Definition: stm32f7xx_hal_nand.h:100
HAL_NAND_IRQHandler
void HAL_NAND_IRQHandler(NAND_HandleTypeDef *hnand)
HAL_NAND_Write_Page_16b
HAL_StatusTypeDef HAL_NAND_Write_Page_16b(NAND_HandleTypeDef *hnand, NAND_AddressTypeDef *pAddress, uint16_t *pBuffer, uint32_t NumPageToWrite)
stm32f7xx_ll_fmc.h
Header file of FMC HAL module.
HAL_NAND_STATE_BUSY
@ HAL_NAND_STATE_BUSY
Definition: stm32f7xx_hal_nand.h:52
HAL_NAND_ITCallback
void HAL_NAND_ITCallback(NAND_HandleTypeDef *hnand)
HAL_NAND_Read_Status
uint32_t HAL_NAND_Read_Status(NAND_HandleTypeDef *hnand)
HAL_NAND_Erase_Block
HAL_StatusTypeDef HAL_NAND_Erase_Block(NAND_HandleTypeDef *hnand, NAND_AddressTypeDef *pAddress)
FMC_NAND_InitTypeDef
FMC NAND Configuration Structure definition
Definition: stm32f7xx_ll_fmc.h:503
NAND_DeviceConfigTypeDef::ExtraCommandEnable
FunctionalState ExtraCommandEnable
Definition: stm32f7xx_hal_nand.h:104
HAL_NAND_ConfigDevice
HAL_StatusTypeDef HAL_NAND_ConfigDevice(NAND_HandleTypeDef *hnand, NAND_DeviceConfigTypeDef *pDeviceConfig)
NAND_AddressTypeDef::Block
uint16_t Block
Definition: stm32f7xx_hal_nand.h:81
NAND_HandleTypeDef::Init
FMC_NAND_InitTypeDef Init
Definition: stm32f7xx_hal_nand.h:123
NAND_DeviceConfigTypeDef::SpareAreaSize
uint32_t SpareAreaSize
Definition: stm32f7xx_hal_nand.h:93
HAL_NAND_STATE_RESET
@ HAL_NAND_STATE_RESET
Definition: stm32f7xx_hal_nand.h:50
HAL_NAND_MspDeInit
void HAL_NAND_MspDeInit(NAND_HandleTypeDef *hnand)
FunctionalState
FunctionalState
Definition: stm32f407/stm32f407g-disc1/Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f4xx.h:191
NAND_DeviceConfigTypeDef::BlockNbr
uint32_t BlockNbr
Definition: stm32f7xx_hal_nand.h:98
NAND_HandleTypeDef::Lock
HAL_LockTypeDef Lock
Definition: stm32f7xx_hal_nand.h:125


picovoice_driver
Author(s):
autogenerated on Fri Apr 1 2022 02:14:53