20#ifndef STM32H7xx_HAL_NAND_H
21#define STM32H7xx_HAL_NAND_H
115#if (USE_HAL_NAND_REGISTER_CALLBACKS == 1)
116typedef struct __NAND_HandleTypeDef
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);
138#if (USE_HAL_NAND_REGISTER_CALLBACKS == 1)
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;
170#if (USE_HAL_NAND_REGISTER_CALLBACKS == 1)
171#define __HAL_NAND_RESET_HANDLE_STATE(__HANDLE__) do { \
172 (__HANDLE__)->State = HAL_NAND_STATE_RESET; \
173 (__HANDLE__)->MspInitCallback = NULL; \
174 (__HANDLE__)->MspDeInitCallback = NULL; \
177#define __HAL_NAND_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_NAND_STATE_RESET)
219 uint8_t *pBuffer, uint32_t NumPageToRead);
221 const uint8_t *pBuffer, uint32_t NumPageToWrite);
223 uint8_t *pBuffer, uint32_t NumSpareAreaToRead);
225 const uint8_t *pBuffer, uint32_t NumSpareAreaTowrite);
228 uint16_t *pBuffer, uint32_t NumPageToRead);
230 const uint16_t *pBuffer, uint32_t NumPageToWrite);
232 uint16_t *pBuffer, uint32_t NumSpareAreaToRead);
234 const uint16_t *pBuffer, uint32_t NumSpareAreaTowrite);
240#if (USE_HAL_NAND_REGISTER_CALLBACKS == 1)
243 pNAND_CallbackTypeDef pCallback);
285#define NAND_DEVICE 0x80000000UL
286#define NAND_WRITE_TIMEOUT 0x01000000UL
288#define CMD_AREA (1UL<<16U)
289#define ADDR_AREA (1UL<<17U)
291#define NAND_CMD_AREA_A ((uint8_t)0x00)
292#define NAND_CMD_AREA_B ((uint8_t)0x01)
293#define NAND_CMD_AREA_C ((uint8_t)0x50)
294#define NAND_CMD_AREA_TRUE1 ((uint8_t)0x30)
296#define NAND_CMD_WRITE0 ((uint8_t)0x80)
297#define NAND_CMD_WRITE_TRUE1 ((uint8_t)0x10)
298#define NAND_CMD_ERASE0 ((uint8_t)0x60)
299#define NAND_CMD_ERASE1 ((uint8_t)0xD0)
300#define NAND_CMD_READID ((uint8_t)0x90)
301#define NAND_CMD_STATUS ((uint8_t)0x70)
302#define NAND_CMD_LOCK_STATUS ((uint8_t)0x7A)
303#define NAND_CMD_RESET ((uint8_t)0xFF)
306#define NAND_VALID_ADDRESS 0x00000100UL
307#define NAND_INVALID_ADDRESS 0x00000200UL
308#define NAND_TIMEOUT_ERROR 0x00000400UL
309#define NAND_BUSY 0x00000000UL
310#define NAND_ERROR 0x00000001UL
311#define NAND_READY 0x00000040UL
328#define ARRAY_ADDRESS(__ADDRESS__ , __HANDLE__) ((__ADDRESS__)->Page + \
329 (((__ADDRESS__)->Block + \
330 (((__ADDRESS__)->Plane) * \
331 ((__HANDLE__)->Config.PlaneSize))) * \
332 ((__HANDLE__)->Config.BlockSize)))
339#define COLUMN_ADDRESS( __HANDLE__) ((__HANDLE__)->Config.PageSize)
346#define ADDR_1ST_CYCLE(__ADDRESS__) (uint8_t)(__ADDRESS__)
347#define ADDR_2ND_CYCLE(__ADDRESS__) (uint8_t)((__ADDRESS__) >> 8)
348#define ADDR_3RD_CYCLE(__ADDRESS__) (uint8_t)((__ADDRESS__) >> 16)
349#define ADDR_4TH_CYCLE(__ADDRESS__) (uint8_t)((__ADDRESS__) >> 24)
356#define COLUMN_1ST_CYCLE(__ADDRESS__) (uint8_t)((__ADDRESS__) & 0xFFU)
357#define COLUMN_2ND_CYCLE(__ADDRESS__) (uint8_t)((__ADDRESS__) >> 8)
#define __IO
Definition: core_cm4.h:239
HAL_NAND_StateTypeDef
HAL NAND State structures definition.
Definition: stm32h7xx_hal_nand.h:50
@ HAL_NAND_STATE_BUSY
Definition: stm32h7xx_hal_nand.h:53
@ HAL_NAND_STATE_RESET
Definition: stm32h7xx_hal_nand.h:51
@ HAL_NAND_STATE_READY
Definition: stm32h7xx_hal_nand.h:52
@ HAL_NAND_STATE_ERROR
Definition: stm32h7xx_hal_nand.h:54
HAL_StatusTypeDef
HAL Status structures definition.
Definition: stm32h7xx_hal_def.h:47
HAL_LockTypeDef
HAL Lock structures definition.
Definition: stm32h7xx_hal_def.h:58
Header file of FMC HAL module.
FMC NAND Configuration Structure definition.
Definition: stm32h7xx_ll_fmc.h:299
FMC NAND Timing parameters structure definition.
Definition: stm32h7xx_ll_fmc.h:328
NAND Memory address Structure definition.
Definition: stm32h7xx_hal_nand.h:77
uint16_t Plane
Definition: stm32h7xx_hal_nand.h:80
uint16_t Page
Definition: stm32h7xx_hal_nand.h:78
uint16_t Block
Definition: stm32h7xx_hal_nand.h:82
NAND Memory info Structure definition.
Definition: stm32h7xx_hal_nand.h:90
uint32_t BlockNbr
Definition: stm32h7xx_hal_nand.h:99
FunctionalState ExtraCommandEnable
Definition: stm32h7xx_hal_nand.h:105
uint32_t BlockSize
Definition: stm32h7xx_hal_nand.h:97
uint32_t SpareAreaSize
Definition: stm32h7xx_hal_nand.h:94
uint32_t PageSize
Definition: stm32h7xx_hal_nand.h:91
uint32_t PlaneNbr
Definition: stm32h7xx_hal_nand.h:101
uint32_t PlaneSize
Definition: stm32h7xx_hal_nand.h:103
NAND handle Structure definition.
Definition: stm32h7xx_hal_nand.h:120
FMC_NAND_InitTypeDef Init
Definition: stm32h7xx_hal_nand.h:123
FMC_NAND_TypeDef * Instance
Definition: stm32h7xx_hal_nand.h:121
HAL_LockTypeDef Lock
Definition: stm32h7xx_hal_nand.h:125
NAND_DeviceConfigTypeDef Config
Definition: stm32h7xx_hal_nand.h:129
__IO HAL_NAND_StateTypeDef State
Definition: stm32h7xx_hal_nand.h:127
NAND Memory electronic signature Structure definition.
Definition: stm32h7xx_hal_nand.h:61