20#ifndef STM32H7xx_HAL_NAND_H
21#define STM32H7xx_HAL_NAND_H
116#if (USE_HAL_NAND_REGISTER_CALLBACKS == 1)
117typedef struct __NAND_HandleTypeDef
132#if (USE_HAL_NAND_REGISTER_CALLBACKS == 1)
133 void (* MspInitCallback)(
struct __NAND_HandleTypeDef *hnand);
134 void (* MspDeInitCallback)(
struct __NAND_HandleTypeDef *hnand);
135 void (* ItCallback)(
struct __NAND_HandleTypeDef *hnand);
139#if (USE_HAL_NAND_REGISTER_CALLBACKS == 1)
145 HAL_NAND_MSP_INIT_CB_ID = 0x00U,
146 HAL_NAND_MSP_DEINIT_CB_ID = 0x01U,
147 HAL_NAND_IT_CB_ID = 0x02U
148} HAL_NAND_CallbackIDTypeDef;
171#if (USE_HAL_NAND_REGISTER_CALLBACKS == 1)
172#define __HAL_NAND_RESET_HANDLE_STATE(__HANDLE__) do { \
173 (__HANDLE__)->State = HAL_NAND_STATE_RESET; \
174 (__HANDLE__)->MspInitCallback = NULL; \
175 (__HANDLE__)->MspDeInitCallback = NULL; \
178#define __HAL_NAND_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_NAND_STATE_RESET)
220 uint32_t NumPageToRead);
222 uint32_t NumPageToWrite);
224 uint8_t *pBuffer, uint32_t NumSpareAreaToRead);
226 uint8_t *pBuffer, uint32_t NumSpareAreaTowrite);
229 uint32_t NumPageToRead);
231 uint32_t NumPageToWrite);
233 uint16_t *pBuffer, uint32_t NumSpareAreaToRead);
235 uint16_t *pBuffer, uint32_t NumSpareAreaTowrite);
241#if (USE_HAL_NAND_REGISTER_CALLBACKS == 1)
244 pNAND_CallbackTypeDef pCallback);
286#define NAND_DEVICE 0x80000000UL
287#define NAND_WRITE_TIMEOUT 0x01000000UL
289#define CMD_AREA (1UL<<16U)
290#define ADDR_AREA (1UL<<17U)
292#define NAND_CMD_AREA_A ((uint8_t)0x00)
293#define NAND_CMD_AREA_B ((uint8_t)0x01)
294#define NAND_CMD_AREA_C ((uint8_t)0x50)
295#define NAND_CMD_AREA_TRUE1 ((uint8_t)0x30)
297#define NAND_CMD_WRITE0 ((uint8_t)0x80)
298#define NAND_CMD_WRITE_TRUE1 ((uint8_t)0x10)
299#define NAND_CMD_ERASE0 ((uint8_t)0x60)
300#define NAND_CMD_ERASE1 ((uint8_t)0xD0)
301#define NAND_CMD_READID ((uint8_t)0x90)
302#define NAND_CMD_STATUS ((uint8_t)0x70)
303#define NAND_CMD_LOCK_STATUS ((uint8_t)0x7A)
304#define NAND_CMD_RESET ((uint8_t)0xFF)
307#define NAND_VALID_ADDRESS 0x00000100UL
308#define NAND_INVALID_ADDRESS 0x00000200UL
309#define NAND_TIMEOUT_ERROR 0x00000400UL
310#define NAND_BUSY 0x00000000UL
311#define NAND_ERROR 0x00000001UL
312#define NAND_READY 0x00000040UL
329#define ARRAY_ADDRESS(__ADDRESS__ , __HANDLE__) ((__ADDRESS__)->Page + \
330 (((__ADDRESS__)->Block + \
331 (((__ADDRESS__)->Plane) * \
332 ((__HANDLE__)->Config.PlaneSize))) * \
333 ((__HANDLE__)->Config.BlockSize)))
340#define COLUMN_ADDRESS( __HANDLE__) ((__HANDLE__)->Config.PageSize)
347#define ADDR_1ST_CYCLE(__ADDRESS__) (uint8_t)(__ADDRESS__)
348#define ADDR_2ND_CYCLE(__ADDRESS__) (uint8_t)((__ADDRESS__) >> 8)
349#define ADDR_3RD_CYCLE(__ADDRESS__) (uint8_t)((__ADDRESS__) >> 16)
350#define ADDR_4TH_CYCLE(__ADDRESS__) (uint8_t)((__ADDRESS__) >> 24)
357#define COLUMN_1ST_CYCLE(__ADDRESS__) (uint8_t)((__ADDRESS__) & 0xFFU)
358#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:121
FMC_NAND_InitTypeDef Init
Definition: stm32h7xx_hal_nand.h:124
FMC_NAND_TypeDef * Instance
Definition: stm32h7xx_hal_nand.h:122
HAL_LockTypeDef Lock
Definition: stm32h7xx_hal_nand.h:126
NAND_DeviceConfigTypeDef Config
Definition: stm32h7xx_hal_nand.h:130
__IO HAL_NAND_StateTypeDef State
Definition: stm32h7xx_hal_nand.h:128
NAND Memory electronic signature Structure definition.
Definition: stm32h7xx_hal_nand.h:61