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

HAL NOR Generic Driver

UM1725

Data Fields

 

FMC_NORSRAM_TypeDef * Instance

FMC_NORSRAM_EXTENDED_TypeDef * Extended

FMC_NORSRAM_InitTypeDef Init

HAL_LockTypeDef Lock

__IO HAL_NOR_StateTypeDef State

Field Documentation

FMC_NORSRAM_TypeDef* NOR_HandleTypeDef::Instance

Register base address

FMC_NORSRAM_EXTENDED_TypeDef* NOR_HandleTypeDef::Extended

Extended mode register base address

FMC_NORSRAM_InitTypeDef NOR_HandleTypeDef::Init

NOR device control configuration parameters

HAL_LockTypeDef NOR_HandleTypeDef::Lock

NOR locking object

__IO HAL_NOR_StateTypeDef NOR_HandleTypeDef::State

NOR device access state

38.2NOR Firmware driver API description

38.2.1How to use this driver

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

NOR flash memory configuration sequence using the function HAL_NOR_Init() with control and timing parameters for both normal and extended mode.

Read NOR flash memory manufacturer code and device IDs using the function HAL_NOR_Read_ID(). The read information is stored in the NOR_ID_TypeDef structure declared by the function caller.

Access NOR flash memory by read/write data unit operations using the functions HAL_NOR_Read(), HAL_NOR_Program().

Perform NOR flash erase block/chip operations using the functions

HAL_NOR_Erase_Block() and HAL_NOR_Erase_Chip().

Read the NOR flash CFI (common flash interface) IDs using the function

HAL_NOR_Read_CFI(). The read information is stored in the NOR_CFI_TypeDef structure declared by the function caller.

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

HAL_NOR_WriteOperation_Enable()/ HAL_NOR_WriteOperation_Disable() to respectively enable/disable the NOR write operation

You can monitor the NOR device HAL state by calling the function HAL_NOR_GetState()

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

486/900

DOCID025834 Rev 2

UM1725

HAL NOR Generic Driver

NOR HAL driver macros list

Below the list of most used macros in NOR HAL driver.

NOR_WRITE : NOR memory write data to specified address

38.2.2NOR Initialization and de_initialization functions

This section provides functions allowing to initialize/de-initialize the NOR memory This section contains the following APIs:

HAL_NOR_Init()

HAL_NOR_DeInit()

HAL_NOR_MspInit()

HAL_NOR_MspDeInit()

HAL_NOR_MspWait()

38.2.3NOR Input and Output functions

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

This section contains the following APIs:

HAL_NOR_Read_ID()

HAL_NOR_ReturnToReadMode()

HAL_NOR_Read()

HAL_NOR_Program()

HAL_NOR_ReadBuffer()

HAL_NOR_ProgramBuffer()

HAL_NOR_Erase_Block()

HAL_NOR_Erase_Chip()

HAL_NOR_Read_CFI()

38.2.4NOR Control functions

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

This section contains the following APIs:

HAL_NOR_WriteOperation_Enable()

HAL_NOR_WriteOperation_Disable()

38.2.5NOR State functions

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

This section contains the following APIs:

HAL_NOR_GetState()

HAL_NOR_GetStatus()

38.2.6HAL_NOR_Init

Function Name

HAL_StatusTypeDef HAL_NOR_Init (NOR_HandleTypeDef *

 

hnor, FMC_NORSRAM_TimingTypeDef * Timing,

 

 

FMC_NORSRAM_TimingTypeDef * ExtTiming)

 

Function Description

Perform the NOR memory Initialization sequence.

 

 

DOCID025834 Rev 2

487/900

HAL NOR Generic Driver

 

UM1725

Parameters

 

hnor: pointer to the NOR handle

 

Timing: pointer to NOR control timing structure

 

ExtTiming: pointer to NOR extended mode timing structure

Return values

 

HAL status

38.2.7HAL_NOR_DeInit

Function Name

HAL_StatusTypeDef HAL_NOR_DeInit (NOR_HandleTypeDef *

 

hnor)

Function Description

Perform NOR memory De-Initialization sequence.

Parameters

 

hnor: pointer to a NOR_HandleTypeDef structure that

 

 

contains the configuration information for NOR module.

Return values

 

HAL status

38.2.8HAL_NOR_MspInit

Function Name

void HAL_NOR_MspInit (NOR_HandleTypeDef * hnor)

Function Description

NOR MSP Init.

Parameters

 

hnor: pointer to a NOR_HandleTypeDef structure that

 

 

contains the configuration information for NOR module.

Return values

 

None

38.2.9HAL_NOR_MspDeInit

Function Name

void HAL_NOR_MspDeInit (NOR_HandleTypeDef * hnor)

Function Description

NOR MSP DeInit.

Parameters

 

hnor: pointer to a NOR_HandleTypeDef structure that

 

 

contains the configuration information for NOR module.

Return values

 

None

38.2.10HAL_NOR_MspWait

Function Name

void HAL_NOR_MspWait (NOR_HandleTypeDef * hnor,

 

uint32_t Timeout)

Function Description

NOR BSP Wait for Ready/Busy signal.

Parameters

 

hnor: pointer to a NOR_HandleTypeDef structure that

 

 

contains the configuration information for NOR module.

 

Timeout: Maximum timeout value

Return values

 

None

38.2.11HAL_NOR_Read_ID

Function Name

HAL_StatusTypeDef HAL_NOR_Read_ID

 

(NOR_HandleTypeDef * hnor, NOR_IDTypeDef * pNOR_ID)

Function Description

Read NOR flash IDs.

Parameters

hnor: pointer to the NOR handle

488/900

DOCID025834 Rev 2

UM1725

 

HAL NOR Generic Driver

 

 

pNOR_ID: : pointer to NOR ID structure

Return values

 

HAL status

38.2.12HAL_NOR_ReturnToReadMode

Function Name

HAL_StatusTypeDef HAL_NOR_ReturnToReadMode

 

(NOR_HandleTypeDef * hnor)

Function Description

Returns the NOR memory to Read mode.

Parameters

 

hnor: pointer to the NOR handle

Return values

 

HAL status

38.2.13HAL_NOR_Read

Function Name

HAL_StatusTypeDef HAL_NOR_Read (NOR_HandleTypeDef *

 

hnor, uint32_t * pAddress, uint16_t * pData)

Function Description

Read data from NOR memory.

Parameters

 

hnor: pointer to the NOR handle

 

pAddress: pointer to Device address

 

pData: : pointer to read data

Return values

 

HAL status

38.2.14HAL_NOR_Program

Function Name

HAL_StatusTypeDef HAL_NOR_Program

 

(NOR_HandleTypeDef * hnor, uint32_t * pAddress, uint16_t *

 

pData)

Function Description

Program data to NOR memory.

Parameters

 

hnor: pointer to the NOR handle

 

 

pAddress: Device address

 

pData: : pointer to the data to write

Return values

 

HAL status

38.2.15HAL_NOR_ReadBuffer

Function Name

HAL_StatusTypeDef HAL_NOR_ReadBuffer

 

(NOR_HandleTypeDef * hnor, uint32_t uwAddress, uint16_t *

 

pData, uint32_t uwBufferSize)

Function Description

Reads a half-word buffer from the NOR memory.

Parameters

 

hnor: pointer to the NOR handle

 

uwAddress: NOR memory internal address to read from.

 

pData: pointer to the buffer that receives the data read from

 

 

the NOR memory.

 

uwBufferSize: : number of Half word to read.

Return values

 

HAL status

38.2.16HAL_NOR_ProgramBuffer

DOCID025834 Rev 2

489/900

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