HPM SDK
HPMicro Software Development Kit
hpm_serial_nor.h File Reference

Go to the source code of this file.

Enumerations

enum  {
  status_spi_nor_sfdp_not_found = MAKE_STATUS(status_group_spi_nor_flash, 0) , status_spi_nor_ddr_read_dummy_cycle_probe_failed = MAKE_STATUS(status_group_spi_nor_flash, 1) , status_spi_nor_flash_not_found = MAKE_STATUS(status_group_spi_nor_flash, 2) , status_spi_nor_flash_para_err = MAKE_STATUS(status_group_spi_nor_flash, 3) ,
  status_spi_nor_flash_is_busy = MAKE_STATUS(status_group_spi_nor_flash, 4) , status_spi_nor_flash_not_qe_bit_in_sfdp = MAKE_STATUS(status_group_spi_nor_flash, 5)
}
 spi nor API error codes More...
 

Functions

hpm_stat_t hpm_serial_nor_is_busy (hpm_serial_nor_t *flash)
 determine whether the serial nor flash is busy More...
 
hpm_stat_t hpm_serial_nor_write_enable (hpm_serial_nor_t *flash)
 set serial nor flash write enable More...
 
hpm_stat_t hpm_serial_nor_erase_chip (hpm_serial_nor_t *flash)
 erase the serial nor flash chip More...
 
hpm_stat_t hpm_serial_nor_erase_block_blocking (hpm_serial_nor_t *flash, uint32_t block_addr)
 erase the serial nor flash block using blocking transfer More...
 
hpm_stat_t hpm_serial_nor_erase_block_nonblocking (hpm_serial_nor_t *flash, uint32_t block_addr)
 erase the serial nor flash block using nonblocking transfer More...
 
hpm_stat_t hpm_serial_nor_erase_sector_blocking (hpm_serial_nor_t *flash, uint32_t sector_addr)
 erase the serial nor flash sector using blocking transfer More...
 
hpm_stat_t hpm_serial_nor_erase_sector_nonblocking (hpm_serial_nor_t *flash, uint32_t sector_addr)
 erase the serial nor flash sector using nonblocking transfer More...
 
hpm_stat_t hpm_serial_nor_erase_blocking (hpm_serial_nor_t *flash, uint32_t start, uint32_t length)
 erase the serial nor flash specified start address and length using blocking transfer More...
 
hpm_stat_t hpm_serial_nor_program_blocking (hpm_serial_nor_t *flash, uint8_t *buf, uint32_t data_len, uint32_t address)
 program data to the specified serial nor flash address using blocking transfer More...
 
hpm_stat_t hpm_serial_nor_page_program_nonblocking (hpm_serial_nor_t *flash, uint8_t *buf, uint32_t data_len, uint32_t address)
 program data to the page nor flash address using nonblocking transfer More...
 
hpm_stat_t hpm_serial_nor_read (hpm_serial_nor_t *flash, uint8_t *buf, uint16_t data_len, uint32_t address)
 read the data of specified serial nor flash address More...
 
hpm_stat_t hpm_serial_nor_init (hpm_serial_nor_t *flash, hpm_serial_nor_info_t *info)
 the serial nor flash initialization More...
 
hpm_stat_t hpm_serial_nor_get_info (hpm_serial_nor_t *flash, hpm_serial_nor_info_t *info)
 get the serial nor flash information More...
 

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

spi nor API error codes

Enumerator
status_spi_nor_sfdp_not_found 

SFDP table was not found

status_spi_nor_ddr_read_dummy_cycle_probe_failed 

Probing Dummy cyles for DDR read failed

status_spi_nor_flash_not_found 

FLASH was not detected

status_spi_nor_flash_para_err 
status_spi_nor_flash_is_busy 
status_spi_nor_flash_not_qe_bit_in_sfdp 

Function Documentation

◆ hpm_serial_nor_erase_block_blocking()

hpm_stat_t hpm_serial_nor_erase_block_blocking ( hpm_serial_nor_t flash,
uint32_t  block_addr 
)

erase the serial nor flash block using blocking transfer

Note
the erase block address must be block alignment
Parameters
[in]flashthe serial nor context
[in]block_addrthe serial nor flash block address
Returns
hpm_stat_t: status_success if erase block success

◆ hpm_serial_nor_erase_block_nonblocking()

hpm_stat_t hpm_serial_nor_erase_block_nonblocking ( hpm_serial_nor_t flash,
uint32_t  block_addr 
)

erase the serial nor flash block using nonblocking transfer

Note
the erase block address must be block alignment, it'not wait flash busy status.
Parameters
[in]flashthe serial nor context
[in]block_addrthe serial nor flash block address
Returns
hpm_stat_t: status_success if erase block success

◆ hpm_serial_nor_erase_blocking()

hpm_stat_t hpm_serial_nor_erase_blocking ( hpm_serial_nor_t flash,
uint32_t  start,
uint32_t  length 
)

erase the serial nor flash specified start address and length using blocking transfer

Note
the erase sector address must be sector alignment
Parameters
[in]flashthe serial nor context
[in]sector_addrthe serial nor flash sector address
Returns
hpm_stat_t: status_success if erase success

◆ hpm_serial_nor_erase_chip()

hpm_stat_t hpm_serial_nor_erase_chip ( hpm_serial_nor_t flash)

erase the serial nor flash chip

Parameters
[in]flashthe serial nor context
Returns
hpm_stat_t: status_success if erase chip success

◆ hpm_serial_nor_erase_sector_blocking()

hpm_stat_t hpm_serial_nor_erase_sector_blocking ( hpm_serial_nor_t flash,
uint32_t  sector_addr 
)

erase the serial nor flash sector using blocking transfer

Note
the erase sector address must be sector alignment
Parameters
[in]flashthe serial nor context
[in]sector_addrthe serial nor flash sector address
Returns
hpm_stat_t: status_success if erase sector success

◆ hpm_serial_nor_erase_sector_nonblocking()

hpm_stat_t hpm_serial_nor_erase_sector_nonblocking ( hpm_serial_nor_t flash,
uint32_t  sector_addr 
)

erase the serial nor flash sector using nonblocking transfer

Note
the erase sector address must be sector alignment, it'not wait flash busy status.
Parameters
[in]flashthe serial nor context
[in]sector_addrthe serial nor flash sector address
Returns
hpm_stat_t: status_success if erase sector success

◆ hpm_serial_nor_get_info()

hpm_stat_t hpm_serial_nor_get_info ( hpm_serial_nor_t flash,
hpm_serial_nor_info_t info 
)

get the serial nor flash information

Parameters
[in]flashthe serial nor context
[out]infoserial_nor_flash_info_t
Returns
hpm_stat_t: status_success if get information success

◆ hpm_serial_nor_init()

hpm_stat_t hpm_serial_nor_init ( hpm_serial_nor_t flash,
hpm_serial_nor_info_t info 
)

the serial nor flash initialization

Parameters
[in]flashthe serial nor context
[out]infoserial_nor_flash_info_t
Returns
hpm_stat_t: status_success if initialization success

◆ hpm_serial_nor_is_busy()

hpm_stat_t hpm_serial_nor_is_busy ( hpm_serial_nor_t flash)

determine whether the serial nor flash is busy

Parameters
[in]flashthe serial nor context
Returns
hpm_stat_t: status_spi_nor_flash_is_busy if the serial nor flash is busy

◆ hpm_serial_nor_page_program_nonblocking()

hpm_stat_t hpm_serial_nor_page_program_nonblocking ( hpm_serial_nor_t flash,
uint8_t *  buf,
uint32_t  data_len,
uint32_t  address 
)

program data to the page nor flash address using nonblocking transfer

Parameters
[in]flashthe serial nor context
[in]bufthe data source pointer
[in]data_lenthe data length
[in]addressthe serial nor flash programming address
Returns
hpm_stat_t: status_success if program success

◆ hpm_serial_nor_program_blocking()

hpm_stat_t hpm_serial_nor_program_blocking ( hpm_serial_nor_t flash,
uint8_t *  buf,
uint32_t  data_len,
uint32_t  address 
)

program data to the specified serial nor flash address using blocking transfer

Parameters
[in]flashthe serial nor context
[in]bufthe data source pointer
[in]data_lenthe data length
[in]addressthe serial nor flash programming address
Returns
hpm_stat_t: status_success if program success

◆ hpm_serial_nor_read()

hpm_stat_t hpm_serial_nor_read ( hpm_serial_nor_t flash,
uint8_t *  buf,
uint16_t  data_len,
uint32_t  address 
)

read the data of specified serial nor flash address

Parameters
[in]flashthe serial nor context
[in]bufthe data source pointer
[in]data_lenthe data length
[in]addressthe serial nor flash reading address
Returns
hpm_stat_t: status_success if read success

◆ hpm_serial_nor_write_enable()

hpm_stat_t hpm_serial_nor_write_enable ( hpm_serial_nor_t flash)

set serial nor flash write enable

Parameters
[in]channelserial nor flash channel
Returns
hpm_stat_t: status_success if write enable success