High level interface for interacting with Cypress internal flash memory.
This driver allows data to be read from and written to flash. It also provides the ability to obtain information about the address and characteristics of the flash block(s) contained on the device.
|
| cy_rslt_t | cyhal_flash_init (cyhal_flash_t *obj) |
| |
| void | cyhal_flash_free (cyhal_flash_t *obj) |
| |
| void | cyhal_flash_get_info (const cyhal_flash_t *obj, cyhal_flash_info_t *info) |
| |
| cy_rslt_t | cyhal_flash_read (cyhal_flash_t *obj, uint32_t address, uint8_t *data, size_t size) |
| |
| cy_rslt_t | cyhal_flash_erase (cyhal_flash_t *obj, uint32_t address) |
| |
| cy_rslt_t | cyhal_flash_write (cyhal_flash_t *obj, uint32_t address, const uint32_t *data) |
| |
| cy_rslt_t | cyhal_flash_program (cyhal_flash_t *obj, uint32_t address, const uint32_t *data) |
| |
| cy_rslt_t | cyhal_flash_start_erase (cyhal_flash_t *obj, uint32_t address) |
| |
| cy_rslt_t | cyhal_flash_start_write (cyhal_flash_t *obj, uint32_t address, const uint32_t *data) |
| |
| cy_rslt_t | cyhal_flash_start_program (cyhal_flash_t *obj, uint32_t address, const uint32_t *data) |
| |
| bool | cyhal_flash_is_operation_complete (cyhal_flash_t *obj) |
| |
◆ cyhal_flash_block_info_t
| struct cyhal_flash_block_info_t |
| Data Fields |
|
uint32_t |
start_address |
Start address of the memory. |
|
uint32_t |
size |
Size of the flash memory. |
|
uint32_t |
sector_size |
Sector size of the memory. |
|
uint32_t |
page_size |
Sector size of the memory. |
|
uint8_t |
erase_value |
The flash erase value. |
◆ cyhal_flash_info_t
| struct cyhal_flash_info_t |
| Data Fields |
|
uint8_t |
block_count |
The number of distinct flash blocks. |
|
const cyhal_flash_block_info_t * |
blocks |
Array of the distinct flash blocks. |
◆ CYHAL_FLASH_RSLT_ERR_ADDRESS
◆ cyhal_flash_init()
Initialize the flash_t object for access to flash through the HAL
- Parameters
-
- Returns
- The status of the init request
◆ cyhal_flash_free()
Free resources associated with access to flash through the HAL
- Parameters
-
| [out] | obj | The flash object. |
◆ cyhal_flash_get_info()
Gets key flash characteristics including the start address size, and erase values
- Parameters
-
| [in] | obj | The flash object. |
| [out] | info | The flash configuration info. |
◆ cyhal_flash_read()
Read data starting at defined address
- Parameters
-
| [in] | obj | The flash object. |
| [in] | address | Address to begin reading from. |
| [out] | data | The buffer to read data into. |
| [in] | size | The number of bytes to read. |
- Returns
- The status of the read request.
◆ cyhal_flash_erase()
Erase one page starting at defined address. The address must be at page boundary. This will block until the erase operation is complete.
- See also
- cyhal_flash_get_info() to get the flash charactoristics for legal address values and the total erase size.
- Parameters
-
| [in] | obj | The flash object |
| [in] | address | The page starting address |
- Returns
- The status of the erase request
◆ cyhal_flash_write()
Write one page starting at defined address. The address must be at page boundary. This will block until the write operation is complete. This function erases the page prior to writing the new data.
- See also
- cyhal_flash_get_info() to get the flash charactoristics for legal address values and the total write size. The provided data buffer must be at least as large as the flash page_size.
- Parameters
-
| [in] | obj | The flash object |
| [in] | address | The page starting address |
| [in] | data | The data to write to the flash |
- Returns
- The status of the write request
◆ cyhal_flash_program()
Program one page starting at defined address. The address must be at page boundary. This will block until the write operation is complete. Note: This function does not erase the page prior to writing. The page must be erased first via a separate call to erase.
- See also
- cyhal_flash_get_info() to get the flash charactoristics for legal address values and the total program size. The provided data buffer must be at least as large as the flash page_size.
- Parameters
-
| [in] | obj | The flash object |
| [in] | address | The sector starting address |
| [in] | data | The data buffer to be programmed |
- Returns
- The status of the program request
◆ cyhal_flash_start_erase()
Starts an asynchronous erase of a single page of flash. Returns immediately and reports a successful start or reason for failure.
- See also
- cyhal_flash_get_info() to get the flash charactoristics for legal address values and the total erase size.
- Parameters
-
| [in] | obj | The Flash object being operated on |
| [in] | address | The address to start erasing from |
- Returns
- The status of the start_erase request
◆ cyhal_flash_start_write()
Starts an asynchronous write to a single page of flash. Returns immediately and reports a successful start or reason for failure.
- See also
- cyhal_flash_get_info() to get the flash charactoristics for legal address values and the total write size. The provided data buffer must be at least as large as the flash page_size.
- Parameters
-
| [in] | obj | The Flash object being operated on |
| [in] | address | The address to start writing to |
| [in] | data | The data to write to flash |
- Returns
- The status of the start_write request
◆ cyhal_flash_start_program()
Starts asynchronous programming of a single page of flash. Returns immediately and reports a successful start or reason for failure.
- See also
- cyhal_flash_get_info() to get the flash charactoristics for legal address values and the total program size. The provided data buffer must be at least as large as the flash page_size.
- Parameters
-
| [in] | obj | The Flash object being operated on |
| [in] | address | The address to start programming |
| [in] | data | The data to write to flash |
- Returns
- The status of the start_program request
◆ cyhal_flash_is_operation_complete()
Reports a successful operation result, reason of failure or busy status
- Parameters
-
| [in] | obj | The Flash object being operated on |
- Returns
- Whether the flash operation is complete