InPlay API
SPI Flash driver

HAL_SPI_FLASH. More...

Functions

int hal_spi_flash_sector_erase (uint32_t addr, uint32_t sector_nb)
 Erase SPI Flash sector. More...
 
int hal_spi_flash_prog_page (uint32_t addr, uint8_t *data, uint32_t data_len)
 Programme SPI Flash page. More...
 
int hal_spi_flash_verify (uint32_t addr, uint8_t *data, uint32_t size)
 Verify SPI Flash data. More...
 
int hal_spi_flash_read (uint32_t addr, uint8_t *data, uint32_t size)
 Flash read function. More...
 
int hal_spi_flash_read_page (uint32_t addr, uint8_t *data, uint32_t size)
 Flash read function. More...
 

Detailed Description

HAL_SPI_FLASH.

Function Documentation

◆ hal_spi_flash_prog_page()

int hal_spi_flash_prog_page ( uint32_t  addr,
uint8_t *  data,
uint32_t  data_len 
)

Programme SPI Flash page.

Note
Now one page is 256 bytes. prog_size should be smaller then 256. This function only programme one page. If user want to write more page, call this function with new page address.
Parameters
[in]addrFlash programme address (Starting from 0x0).
[in]dataProgramme data buffer.
[in]data_lenFlash Programme size. This size shoudle be be smaller than sector size (4K).
Returns
See also
enum flash_error for return code.

◆ hal_spi_flash_read()

int hal_spi_flash_read ( uint32_t  addr,
uint8_t *  data,
uint32_t  size 
)

Flash read function.

Note
Read data from addr. Read data in XIP mode.
Parameters
[in]addrFlash read address (starting from 0x0).
[in]dataData buffer.
[in]sizeData size.
Returns
See also
enum flash_error for return code.

◆ hal_spi_flash_read_page()

int hal_spi_flash_read_page ( uint32_t  addr,
uint8_t *  data,
uint32_t  size 
)

Flash read function.

Note
Read data from addr. Read data in non-XIP mode.
Parameters
[in]addrFlash read address (starting from 0x0).
[in]dataData buffer.
[in]sizeData size. Max size is 256 bytes.
Returns
See also
enum flash_error for return code.

◆ hal_spi_flash_sector_erase()

int hal_spi_flash_sector_erase ( uint32_t  addr,
uint32_t  sector_nb 
)

Erase SPI Flash sector.

Note
Now one sector is 4K bytes. erase_addr should be 4K bytes aligned. This function only erase 4K bytes. If user want to erase more sector, call this function with new sector address.
Parameters
[in]addrFlash erase address (Starting from 0x0)
[in]sector_nbsector number to erase.
Returns
See also
enum flash_error for return code.

◆ hal_spi_flash_verify()

int hal_spi_flash_verify ( uint32_t  addr,
uint8_t *  data,
uint32_t  size 
)

Verify SPI Flash data.

Note
Read data from addr, and compare data in data buffer. Only work in XIP mode.
Parameters
[in]addrFlash read address (starting from 0x0).
[in]dataData buffer.
[in]sizeData size.
Returns
See also
enum flash_error for return code.