Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
cubexHal.pdf
Скачиваний:
110
Добавлен:
10.02.2016
Размер:
16.16 Mб
Скачать

HAL NAND Generic Driver

UM1725

uint32_t ZoneSize

Field Documentation

uint32_t NAND_InfoTypeDef::PageSize

NAND memory page (without spare area) size measured in K. bytes

uint32_t NAND_InfoTypeDef::SpareAreaSize

NAND memory spare area size measured in K. bytes

uint32_t NAND_InfoTypeDef::BlockSize

NAND memory block size number of pages

uint32_t NAND_InfoTypeDef::BlockNbr

NAND memory number of blocks

uint32_t NAND_InfoTypeDef::ZoneSize

NAND memory zone size measured in number of blocks

37.1.4NAND_HandleTypeDef

Data Fields

FMC_NAND_TypeDef * Instance

FMC_NAND_InitTypeDef Init

HAL_LockTypeDef Lock

__IO HAL_NAND_StateTypeDef State

NAND_InfoTypeDef Info

Field Documentation

FMC_NAND_TypeDef* NAND_HandleTypeDef::Instance

Register base address

FMC_NAND_InitTypeDef NAND_HandleTypeDef::Init

NAND device control configuration parameters

HAL_LockTypeDef NAND_HandleTypeDef::Lock

NAND locking object

__IO HAL_NAND_StateTypeDef NAND_HandleTypeDef::State

NAND device access state

NAND_InfoTypeDef NAND_HandleTypeDef::Info

NAND characteristic information structure

37.2NAND Firmware driver API description

37.2.1How to use this driver

This driver is a generic layered driver which contains a set of APIs used to control NAND flash memories. It uses the FMC/FSMC layer functions to interface with NAND devices. This driver is used as follows:

NAND flash memory configuration sequence using the function HAL_NAND_Init() with control and timing parameters for both common and attribute spaces.

476/900

DOCID025834 Rev 2

UM1725

HAL NAND Generic Driver

 

Read NAND flash memory maker and device IDs using the function

 

HAL_NAND_Read_ID(). The read information is stored in the NAND_ID_TypeDef

 

structure declared by the function caller.

 

Access NAND flash memory by read/write operations using the functions

 

HAL_NAND_Read_Page()/HAL_NAND_Read_SpareArea(),

 

HAL_NAND_Write_Page()/HAL_NAND_Write_SpareArea() to read/write

 

page(s)/spare area(s). These functions use specific device information (Block, page

 

size..) predefined by the user in the HAL_NAND_Info_TypeDef structure. The

 

read/write address information is contained by the Nand_Address_Typedef structure

 

passed as parameter.

 

Perform NAND flash Reset chip operation using the function HAL_NAND_Reset().

 

Perform NAND flash erase block operation using the function

 

HAL_NAND_Erase_Block(). The erase block address information is contained in the

 

Nand_Address_Typedef structure passed as parameter.

Read the NAND flash status operation using the function HAL_NAND_Read_Status().

You can also control the NAND device by calling the control APIs

HAL_NAND_ECC_Enable()/ HAL_NAND_ECC_Disable() to respectively enable/disable the ECC code correction feature or the function HAL_NAND_GetECC() to get the ECC correction code.

You can monitor the NAND device HAL state by calling the function HAL_NAND_GetState()

This driver is a set of generic APIs which handle standard NAND flash operations. If a NAND flash device contains different operations and/or implementations, it should be implemented separately.

37.2.2NAND Initialization and de-initialization functions

This section provides functions allowing to initialize/de-initialize the NAND memory

This section contains the following APIs:

HAL_NAND_Init()

HAL_NAND_DeInit()

HAL_NAND_MspInit()

HAL_NAND_MspDeInit()

HAL_NAND_IRQHandler()

HAL_NAND_ITCallback()

37.2.3NAND Input and Output functions

This section provides functions allowing to use and control the NAND memory

This section contains the following APIs:

HAL_NAND_Read_ID()

HAL_NAND_Reset()

HAL_NAND_Read_Page()

HAL_NAND_Write_Page()

HAL_NAND_Read_SpareArea()

HAL_NAND_Write_SpareArea()

HAL_NAND_Erase_Block()

HAL_NAND_Read_Status()

HAL_NAND_Address_Inc()

DOCID025834 Rev 2

477/900

HAL NAND Generic Driver

UM1725

37.2.4NAND Control functions

This subsection provides a set of functions allowing to control dynamically the NAND interface.

This section contains the following APIs:

HAL_NAND_ECC_Enable()

HAL_NAND_ECC_Disable()

HAL_NAND_GetECC()

37.2.5NAND State functions

This subsection permits to get in run-time the status of the NAND controller and the data flow.

This section contains the following APIs:

HAL_NAND_GetState()

HAL_NAND_Read_Status()

37.2.6HAL_NAND_Init

Function Name

HAL_StatusTypeDef HAL_NAND_Init (NAND_HandleTypeDef *

 

hnand, FMC_NAND_PCC_TimingTypeDef *

 

ComSpace_Timing, FMC_NAND_PCC_TimingTypeDef *

 

AttSpace_Timing)

Function Description

Perform NAND memory Initialization sequence.

Parameters

 

hnand: pointer to a NAND_HandleTypeDef structure that

 

 

contains the configuration information for NAND module.

 

ComSpace_Timing: pointer to Common space timing

 

 

structure

 

AttSpace_Timing: pointer to Attribute space timing structure

Return values

 

HAL status

37.2.7HAL_NAND_DeInit

Function Name

HAL_StatusTypeDef HAL_NAND_DeInit

 

(NAND_HandleTypeDef * hnand)

Function Description

Perform NAND memory De-Initialization sequence.

Parameters

 

hnand: pointer to a NAND_HandleTypeDef structure that

 

 

contains the configuration information for NAND module.

Return values

 

HAL status

37.2.8HAL_NAND_MspInit

Function Name

void HAL_NAND_MspInit (NAND_HandleTypeDef * hnand)

Function Description

NAND MSP Init.

Parameters

 

hnand: pointer to a NAND_HandleTypeDef structure that

 

 

contains the configuration information for NAND module.

Return values

 

None

478/900

DOCID025834 Rev 2

UM1725

HAL NAND Generic Driver

37.2.9HAL_NAND_MspDeInit

Function Name

void HAL_NAND_MspDeInit (NAND_HandleTypeDef * hnand)

Function Description

NAND MSP DeInit.

Parameters

 

hnand: pointer to a NAND_HandleTypeDef structure that

 

 

contains the configuration information for NAND module.

Return values

 

None

37.2.10HAL_NAND_IRQHandler

Function Name

void HAL_NAND_IRQHandler (NAND_HandleTypeDef * hnand)

Function Description

This function handles NAND device interrupt request.

Parameters

 

hnand: pointer to a NAND_HandleTypeDef structure that

 

 

contains the configuration information for NAND module.

Return values

 

HAL status

37.2.11HAL_NAND_ITCallback

Function Name

void HAL_NAND_ITCallback (NAND_HandleTypeDef * hnand)

Function Description

NAND interrupt feature callback.

Parameters

 

hnand: pointer to a NAND_HandleTypeDef structure that

 

 

contains the configuration information for NAND module.

Return values

 

None

37.2.12HAL_NAND_Read_ID

Function Name

HAL_StatusTypeDef HAL_NAND_Read_ID

 

(NAND_HandleTypeDef * hnand, NAND_IDTypeDef *

 

pNAND_ID)

Function Description

Read the NAND memory electronic signature.

Parameters

 

hnand: pointer to a NAND_HandleTypeDef structure that

 

 

contains the configuration information for NAND module.

 

pNAND_ID: NAND ID structure

Return values

 

HAL status

37.2.13HAL_NAND_Reset

Function Name

HAL_StatusTypeDef HAL_NAND_Reset

 

(NAND_HandleTypeDef * hnand)

Function Description

NAND memory reset.

Parameters

 

hnand: pointer to a NAND_HandleTypeDef structure that

 

 

contains the configuration information for NAND module.

Return values

 

HAL status

37.2.14HAL_NAND_Read_Page

DOCID025834 Rev 2

479/900

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]