stm32f411/stm32f411e-disco/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_nand.h
Go to the documentation of this file.
1 
20 /* Define to prevent recursive inclusion -------------------------------------*/
21 #ifndef __STM32F4xx_HAL_NAND_H
22 #define __STM32F4xx_HAL_NAND_H
23 
24 #ifdef __cplusplus
25  extern "C" {
26 #endif
27 
28 /* Includes ------------------------------------------------------------------*/
29 #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx)
30  #include "stm32f4xx_ll_fsmc.h"
31 #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx */
32 
33 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\
34  defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx)
35  #include "stm32f4xx_ll_fmc.h"
36 #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F446xx || STM32F469xx ||\
37  STM32F479xx */
38 
47 #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) || \
48  defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || \
49  defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx)
50 
51 /* Exported typedef ----------------------------------------------------------*/
52 /* Exported types ------------------------------------------------------------*/
60 typedef enum
61 {
62  HAL_NAND_STATE_RESET = 0x00U,
63  HAL_NAND_STATE_READY = 0x01U,
64  HAL_NAND_STATE_BUSY = 0x02U,
65  HAL_NAND_STATE_ERROR = 0x03U
67 
71 typedef struct
72 {
73  /*<! NAND memory electronic signature maker and device IDs */
74 
75  uint8_t Maker_Id;
76 
77  uint8_t Device_Id;
78 
79  uint8_t Third_Id;
80 
81  uint8_t Fourth_Id;
83 
87 typedef struct
88 {
89  uint16_t Page;
91  uint16_t Plane;
93  uint16_t Block;
96 
100 typedef struct
101 {
102  uint32_t PageSize;
105  uint32_t SpareAreaSize;
108  uint32_t BlockSize;
110  uint32_t BlockNbr;
112  uint32_t PlaneNbr;
114  uint32_t PlaneSize;
116  FunctionalState ExtraCommandEnable;
123 
127 #if (USE_HAL_NAND_REGISTER_CALLBACKS == 1)
128 typedef struct __NAND_HandleTypeDef
129 #else
130 typedef struct
131 #endif /* USE_HAL_NAND_REGISTER_CALLBACKS */
132 {
133  FMC_NAND_TypeDef *Instance;
137  HAL_LockTypeDef Lock;
141  NAND_DeviceConfigTypeDef Config;
143 #if (USE_HAL_NAND_REGISTER_CALLBACKS == 1)
144  void (* MspInitCallback) ( struct __NAND_HandleTypeDef * hnand);
145  void (* MspDeInitCallback) ( struct __NAND_HandleTypeDef * hnand);
146  void (* ItCallback) ( struct __NAND_HandleTypeDef * hnand);
147 #endif
149 
150 #if (USE_HAL_NAND_REGISTER_CALLBACKS == 1)
151 
154 typedef enum
155 {
156  HAL_NAND_MSP_INIT_CB_ID = 0x00U,
157  HAL_NAND_MSP_DEINIT_CB_ID = 0x01U,
158  HAL_NAND_IT_CB_ID = 0x02U
159 }HAL_NAND_CallbackIDTypeDef;
160 
164 typedef void (*pNAND_CallbackTypeDef)(NAND_HandleTypeDef *hnand);
165 #endif
166 
171 /* Exported constants --------------------------------------------------------*/
172 /* Exported macros ------------------------------------------------------------*/
181 #if (USE_HAL_NAND_REGISTER_CALLBACKS == 1)
182 #define __HAL_NAND_RESET_HANDLE_STATE(__HANDLE__) do { \
183  (__HANDLE__)->State = HAL_NAND_STATE_RESET; \
184  (__HANDLE__)->MspInitCallback = NULL; \
185  (__HANDLE__)->MspDeInitCallback = NULL; \
186  } while(0)
187 #else
188 #define __HAL_NAND_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_NAND_STATE_RESET)
189 #endif
190 
195 /* Exported functions --------------------------------------------------------*/
204 /* Initialization/de-initialization functions ********************************/
205 /* Initialization/de-initialization functions ********************************/
208 
210 
212 
217 
226 /* IO operation functions ****************************************************/
228 
229 HAL_StatusTypeDef HAL_NAND_Read_Page_8b(NAND_HandleTypeDef *hnand, NAND_AddressTypeDef *pAddress, uint8_t *pBuffer, uint32_t NumPageToRead);
230 HAL_StatusTypeDef HAL_NAND_Write_Page_8b(NAND_HandleTypeDef *hnand, NAND_AddressTypeDef *pAddress, uint8_t *pBuffer, uint32_t NumPageToWrite);
231 HAL_StatusTypeDef HAL_NAND_Read_SpareArea_8b(NAND_HandleTypeDef *hnand, NAND_AddressTypeDef *pAddress, uint8_t *pBuffer, uint32_t NumSpareAreaToRead);
232 HAL_StatusTypeDef HAL_NAND_Write_SpareArea_8b(NAND_HandleTypeDef *hnand, NAND_AddressTypeDef *pAddress, uint8_t *pBuffer, uint32_t NumSpareAreaTowrite);
233 
234 HAL_StatusTypeDef HAL_NAND_Read_Page_16b(NAND_HandleTypeDef *hnand, NAND_AddressTypeDef *pAddress, uint16_t *pBuffer, uint32_t NumPageToRead);
235 HAL_StatusTypeDef HAL_NAND_Write_Page_16b(NAND_HandleTypeDef *hnand, NAND_AddressTypeDef *pAddress, uint16_t *pBuffer, uint32_t NumPageToWrite);
236 HAL_StatusTypeDef HAL_NAND_Read_SpareArea_16b(NAND_HandleTypeDef *hnand, NAND_AddressTypeDef *pAddress, uint16_t *pBuffer, uint32_t NumSpareAreaToRead);
237 HAL_StatusTypeDef HAL_NAND_Write_SpareArea_16b(NAND_HandleTypeDef *hnand, NAND_AddressTypeDef *pAddress, uint16_t *pBuffer, uint32_t NumSpareAreaTowrite);
238 
240 
243 
244 #if (USE_HAL_NAND_REGISTER_CALLBACKS == 1)
245 /* NAND callback registering/unregistering */
246 HAL_StatusTypeDef HAL_NAND_RegisterCallback(NAND_HandleTypeDef *hnand, HAL_NAND_CallbackIDTypeDef CallbackId, pNAND_CallbackTypeDef pCallback);
247 HAL_StatusTypeDef HAL_NAND_UnRegisterCallback(NAND_HandleTypeDef *hnand, HAL_NAND_CallbackIDTypeDef CallbackId);
248 #endif
249 
258 /* NAND Control functions ****************************************************/
261 HAL_StatusTypeDef HAL_NAND_GetECC(NAND_HandleTypeDef *hnand, uint32_t *ECCval, uint32_t Timeout);
262 
270 /* NAND State functions *******************************************************/
280 /* Private types -------------------------------------------------------------*/
281 /* Private variables ---------------------------------------------------------*/
282 /* Private constants ---------------------------------------------------------*/
286 #define NAND_DEVICE1 0x70000000U
287 #define NAND_DEVICE2 0x80000000U
288 #define NAND_WRITE_TIMEOUT 0x01000000U
289 
290 #define CMD_AREA ((uint32_t)(1U<<16U)) /* A16 = CLE high */
291 #define ADDR_AREA ((uint32_t)(1U<<17U)) /* A17 = ALE high */
292 
293 #define NAND_CMD_AREA_A ((uint8_t)0x00)
294 #define NAND_CMD_AREA_B ((uint8_t)0x01)
295 #define NAND_CMD_AREA_C ((uint8_t)0x50)
296 #define NAND_CMD_AREA_TRUE1 ((uint8_t)0x30)
297 
298 #define NAND_CMD_WRITE0 ((uint8_t)0x80)
299 #define NAND_CMD_WRITE_TRUE1 ((uint8_t)0x10)
300 #define NAND_CMD_ERASE0 ((uint8_t)0x60)
301 #define NAND_CMD_ERASE1 ((uint8_t)0xD0)
302 #define NAND_CMD_READID ((uint8_t)0x90)
303 #define NAND_CMD_STATUS ((uint8_t)0x70)
304 #define NAND_CMD_LOCK_STATUS ((uint8_t)0x7A)
305 #define NAND_CMD_RESET ((uint8_t)0xFF)
306 
307 /* NAND memory status */
308 #define NAND_VALID_ADDRESS 0x00000100U
309 #define NAND_INVALID_ADDRESS 0x00000200U
310 #define NAND_TIMEOUT_ERROR 0x00000400U
311 #define NAND_BUSY 0x00000000U
312 #define NAND_ERROR 0x00000001U
313 #define NAND_READY 0x00000040U
314 
318 /* Private macros ------------------------------------------------------------*/
329 #define ARRAY_ADDRESS(__ADDRESS__ , __HANDLE__) ((__ADDRESS__)->Page + \
330  (((__ADDRESS__)->Block + (((__ADDRESS__)->Plane) * ((__HANDLE__)->Config.PlaneSize)))* ((__HANDLE__)->Config.BlockSize)))
331 
337 #define COLUMN_ADDRESS( __HANDLE__) ((__HANDLE__)->Config.PageSize)
338 
344 #define ADDR_1ST_CYCLE(__ADDRESS__) (uint8_t)(__ADDRESS__) /* 1st addressing cycle */
345 #define ADDR_2ND_CYCLE(__ADDRESS__) (uint8_t)((__ADDRESS__) >> 8) /* 2nd addressing cycle */
346 #define ADDR_3RD_CYCLE(__ADDRESS__) (uint8_t)((__ADDRESS__) >> 16) /* 3rd addressing cycle */
347 #define ADDR_4TH_CYCLE(__ADDRESS__) (uint8_t)((__ADDRESS__) >> 24) /* 4th addressing cycle */
348 
354 #define COLUMN_1ST_CYCLE(__ADDRESS__) (uint8_t)(__ADDRESS__) /* 1st Column addressing cycle */
355 #define COLUMN_2ND_CYCLE(__ADDRESS__) (uint8_t)((__ADDRESS__) >> 8) /* 2nd Column addressing cycle */
356 
360 #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx ||\
361  STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx ||\
362  STM32F446xx || STM32F469xx || STM32F479xx */
363 
375 #ifdef __cplusplus
376 }
377 #endif
378 
379 #endif /* __STM32F4xx_HAL_NAND_H */
380 
381 /************************ (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
Init
napi_value Init(napi_env env, napi_value exports)
Definition: porcupine/demo/c/pvrecorder/node/pv_recorder_napi.c:197
HAL_StatusTypeDef
HAL_StatusTypeDef
HAL Status structures definition
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_def.h:40
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)
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)
HAL_NAND_Write_SpareArea_8b
HAL_StatusTypeDef HAL_NAND_Write_SpareArea_8b(NAND_HandleTypeDef *hnand, NAND_AddressTypeDef *pAddress, uint8_t *pBuffer, uint32_t NumSpareAreaTowrite)
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
HAL_NAND_Read_SpareArea_8b
HAL_StatusTypeDef HAL_NAND_Read_SpareArea_8b(NAND_HandleTypeDef *hnand, NAND_AddressTypeDef *pAddress, uint8_t *pBuffer, uint32_t NumSpareAreaToRead)
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)
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
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)
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
HAL_NAND_ConfigDevice
HAL_StatusTypeDef HAL_NAND_ConfigDevice(NAND_HandleTypeDef *hnand, NAND_DeviceConfigTypeDef *pDeviceConfig)
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


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