IO operation functions

Data transfers functions. More...

Functions

void hal_exflash_timing_set (exflash_timing_param_t *p_time)
 Configure flash electrical characteristic parameters. More...
 
void hal_exflash_get_info (uint32_t *id, uint32_t *size)
 Get flash id and size. More...
 
uint32_t hal_exflash_config (uint32_t configure, uint32_t value)
 flash parameter configuration More...
 
uint32_t hal_exflash_enable_quad (ll_xqspi_hp_init_t hp_init)
 Enable Quad mode to allow Quad operation. More...
 
uint32_t hal_exflash_write (uint32_t addr, uint8_t *p_data, uint32_t size)
 Write an amount of data with specified instruction and address to flash. More...
 
uint32_t hal_exflash_read (uint32_t addr, uint8_t *p_data, uint32_t size)
 Read an amount of data with specified instruction and address from flash. More...
 
uint32_t hal_exflash_erase (uint32_t erase_type, uint32_t addr, uint32_t size)
 Erase flash region. More...
 
uint32_t hal_exflash_block_protect (uint32_t cmp, uint32_t bp)
 Lock area of flash to be software protected against Write and Erase operation.. More...
 
uint32_t hal_exflash_deepsleep (void)
 the exFlash will go to the Deep Power-Down Mode. More...
 
uint32_t hal_exflash_wakeup (void)
 exFlash will be released from Deep Power-Down Mode. More...
 
uint32_t hal_exflash_sr_erase (uint32_t addr)
 Erase single flash security register. More...
 
uint32_t hal_exflash_sr_program (uint32_t addr, uint8_t *p_data, uint32_t size)
 Write an amount of data into flash security register. More...
 
uint32_t hal_exflash_sr_read (uint32_t addr, uint8_t *p_data, uint32_t size)
 Read an amount of data from flash security register. More...
 
uint32_t hal_exflash_sr_protect (uint32_t lb)
 This function provide the write protect control and status to the Security Registers. More...
 
hal_status_t hal_exflash_read_status_reg (uint16_t *p_reg_status)
 This function reads the status register of a flash. More...
 
hal_status_t hal_exflash_write_status_reg (uint16_t reg_status)
 This function writes the status register of a flash. More...
 
hal_status_t hal_exflash_read_uid (uint8_t *uid)
 This function serves to read UID of flash. More...
 

Detailed Description

Data transfers functions.

  ==============================================================================
                      ##### IO operation functions #####
 ===============================================================================
 [..]
    This subsection provides a set of functions allowing to manage the exFlash
    data transfers.

    [..] The exFlash supports XIP and QSPI mode:

    (#) There are only one modes of transfer:
       (++) Blocking mode: The communication is performed in polling mode.
            The HAL status of all data processing is returned by the same function
            after finishing transfer.

Function Documentation

◆ hal_exflash_block_protect()

uint32_t hal_exflash_block_protect ( uint32_t  cmp,
uint32_t  bp 
)

Lock area of flash to be software protected against Write and Erase operation..

Parameters
[in]cmpIt is used in conjunction the BPs bits to provide more flexibility for the array protection.
[in]bpSpecifies the value to be written to the selected bit. This parameter can be one of the EXFLASH_PROTECTED_AREA_SIZE values:
Return values
HAL_OKOperation is OK.
HAL_ERRORParameter error or operation not supported.
HAL_BUSYDriver is busy.
HAL_TIMEOUTTimeout occurred.

◆ hal_exflash_config()

uint32_t hal_exflash_config ( uint32_t  configure,
uint32_t  value 
)

flash parameter configuration

Parameters
[in]configureflash parameter configuration item
[in]valueflash parameter configuration value
Return values
HAL_OKOperation is OK.
HAL_ERRORParameter error or operation not supported.
HAL_BUSYDriver is busy.
HAL_TIMEOUTTimeout occurred.

◆ hal_exflash_deepsleep()

uint32_t hal_exflash_deepsleep ( void  )

the exFlash will go to the Deep Power-Down Mode.

Note
This function is used only in Mirror Mode.
Return values
HAL_OKOperation is OK.
HAL_ERRORParameter error or operation not supported.
HAL_BUSYDriver is busy.
HAL_TIMEOUTTimeout occurred.

◆ hal_exflash_enable_quad()

uint32_t hal_exflash_enable_quad ( ll_xqspi_hp_init_t  hp_init)

Enable Quad mode to allow Quad operation.

Note
This function is used only in Mirror Mode.
Return values
HAL_OKOperation is OK.
HAL_ERRORParameter error or operation not supported.
HAL_BUSYDriver is busy.
HAL_TIMEOUTTimeout occurred.

◆ hal_exflash_erase()

uint32_t hal_exflash_erase ( uint32_t  erase_type,
uint32_t  addr,
uint32_t  size 
)

Erase flash region.

Note
All sectors that have address in range of [addr, addr+len] will be erased. If addr is not sector aligned, preceding data on the sector that addr belongs to will also be erased. If (addr + size) is not sector aligned, the whole sector will also be erased. If erase_type is EXFLASH_ERASE_CHIP , all data in flash will be erased ignored addr and size.
Parameters
[in]erase_typeErase flash with page/sector/chip.
[in]addrAddress to erased data in flash, start at EXFLASH_START_ADDR.
[in]sizeSize of erased bytes.
Return values
HAL_OKOperation is OK.
HAL_ERRORParameter error or operation not supported.
HAL_BUSYDriver is busy.
HAL_TIMEOUTTimeout occurred.

◆ hal_exflash_get_info()

void hal_exflash_get_info ( uint32_t *  id,
uint32_t *  size 
)

Get flash id and size.

Parameters
[out]idPointer to flash id
[out]sizePointer to flash size
Return values
HAL_OKOperation is OK.
HAL_ERRORParameter error or operation not supported.
HAL_BUSYDriver is busy.
HAL_TIMEOUTTimeout occurred.

◆ hal_exflash_read()

uint32_t hal_exflash_read ( uint32_t  addr,
uint8_t *  p_data,
uint32_t  size 
)

Read an amount of data with specified instruction and address from flash.

Note
This function is used only in non-encrypted Indirect Read Mode.
Parameters
[in]addrAddress to read data in flash, start at EXFLASH_START_ADDR.
[out]p_dataPointer to data buffer
[in]sizeSize of buffer bytes
Return values
HAL_OKOperation is OK.
HAL_ERRORParameter error or operation not supported.
HAL_BUSYDriver is busy.
HAL_TIMEOUTTimeout occurred.

◆ hal_exflash_read_status_reg()

hal_status_t hal_exflash_read_status_reg ( uint16_t *  p_reg_status)

This function reads the status register of a flash.

Note
The status register is a 16-bit register that provides information about the flash operation status.
Parameters
[in]p_reg_statusPointer of status register.
Return values
HAL_OKOperation is OK.
HAL_ERRORParameter error or operation not supported.
HAL_BUSYDriver is busy.
HAL_TIMEOUTTimeout occurred.

◆ hal_exflash_read_uid()

hal_status_t hal_exflash_read_uid ( uint8_t *  uid)

This function serves to read UID of flash.

Parameters
[out]uidstore 16 Byte flash UID
Return values
HAL_OKOperation is OK.
HAL_ERRORParameter error or operation not supported.
HAL_BUSYDriver is busy.
HAL_TIMEOUTTimeout occurred.

◆ hal_exflash_sr_erase()

uint32_t hal_exflash_sr_erase ( uint32_t  addr)

Erase single flash security register.

Note
This function erase only single security register. If initial_mode is XIP, it will swich to QSPI mode to execute command and switch to XIP mode finally.
Parameters
[in]addrSecurity Registers address of flash
Return values
HAL_OKOperation is OK.
HAL_ERRORParameter error or operation not supported.
HAL_BUSYDriver is busy.
HAL_TIMEOUTTimeout occurred.

◆ hal_exflash_sr_program()

uint32_t hal_exflash_sr_program ( uint32_t  addr,
uint8_t *  p_data,
uint32_t  size 
)

Write an amount of data into flash security register.

Note
This function is used only in non-encrypted Indirect Write Mode. If initial_mode is XIP, it will swich to QSPI mode to execute command and switch to XIP mode finally.
Parameters
[in]addrSecurity Registers address of flash
[out]p_dataPointer to data buffer
[in]sizeSize of data buffer bytes, and need be smaller than single security register
Return values
HAL_OKOperation is OK.
HAL_ERRORParameter error or operation not supported.
HAL_BUSYDriver is busy.
HAL_TIMEOUTTimeout occurred.

◆ hal_exflash_sr_protect()

uint32_t hal_exflash_sr_protect ( uint32_t  lb)

This function provide the write protect control and status to the Security Registers.

Note
The LB3-BL1bits of flash status register are One Time Programmable, once its set to 1, the Security Registers will become read-only permanently.
Parameters
[in]lbLocked security registers. This parameter can be a combination of the following values:
Return values
HAL_OKOperation is OK.
HAL_ERRORParameter error or operation not supported.
HAL_BUSYDriver is busy.
HAL_TIMEOUTTimeout occurred.

◆ hal_exflash_sr_read()

uint32_t hal_exflash_sr_read ( uint32_t  addr,
uint8_t *  p_data,
uint32_t  size 
)

Read an amount of data from flash security register.

Note
This function is used only in non-encrypted Indirect Read Mode. If initial_mode is XIP, it will swich to QSPI mode to execute command and switch to XIP mode finally.
Parameters
[in]addrSecurity Registers address of flash
[out]p_dataPointer to data buffer
[in]sizeSize of data buffer bytes, and need be smaller than single security register
Return values
HAL_OKOperation is OK.
HAL_ERRORParameter error or operation not supported.
HAL_BUSYDriver is busy.
HAL_TIMEOUTTimeout occurred.

◆ hal_exflash_timing_set()

void hal_exflash_timing_set ( exflash_timing_param_t p_time)

Configure flash electrical characteristic parameters.

Parameters
[in]p_timeflash timing characteristics
Return values
HAL_OKOperation is OK.
HAL_ERRORParameter error or operation not supported.
HAL_BUSYDriver is busy.
HAL_TIMEOUTTimeout occurred.

◆ hal_exflash_wakeup()

uint32_t hal_exflash_wakeup ( void  )

exFlash will be released from Deep Power-Down Mode.

Note
This function is used only in Mirror Mode.
Return values
HAL_OKOperation is OK.
HAL_ERRORParameter error or operation not supported.
HAL_BUSYDriver is busy.
HAL_TIMEOUTTimeout occurred.

◆ hal_exflash_write()

uint32_t hal_exflash_write ( uint32_t  addr,
uint8_t *  p_data,
uint32_t  size 
)

Write an amount of data with specified instruction and address to flash.

Note
This function is used only in Indirect Write Mode. In secure mode, address alignment requires 4 bytes.
Parameters
[in]addrAddress to write data in flash, start at EXFLASH_START_ADDR.
[in]p_dataPointer to data buffer
[in]sizeSize of buffer bytes
Return values
HAL_OKOperation is OK.
HAL_ERRORParameter error or operation not supported.
HAL_BUSYDriver is busy.
HAL_TIMEOUTTimeout occurred.

◆ hal_exflash_write_status_reg()

hal_status_t hal_exflash_write_status_reg ( uint16_t  reg_status)

This function writes the status register of a flash.

Note
The status register is a 16-bit register that provides information about the flash operation status.
Parameters
reg_statusAn integer value representing the content to be written to the flash status register.
Return values
HAL_OKOperation is OK.
HAL_ERRORParameter error or operation not supported.
HAL_BUSYDriver is busy.
HAL_TIMEOUTTimeout occurred.