Functions | |
int32_t | flash_init (flash_t *obj) |
Initialize the flash peripheral and the flash_t object. More... | |
int32_t | flash_free (flash_t *obj) |
Uninitialize the flash peripheral and the flash_t object. More... | |
int32_t | flash_erase_sector (flash_t *obj, uint32_t address) |
Erase one sector starting at defined address. More... | |
int32_t | flash_read (flash_t *obj, uint32_t address, uint8_t *data, uint32_t size) |
Read data starting at defined address. More... | |
int32_t | flash_program_page (flash_t *obj, uint32_t address, const uint8_t *data, uint32_t size) |
Program pages starting at defined address. More... | |
uint32_t | flash_get_sector_size (const flash_t *obj, uint32_t address) |
Get sector size. More... | |
uint32_t | flash_get_page_size (const flash_t *obj) |
Get page size. More... | |
uint32_t | flash_get_start_address (const flash_t *obj) |
Get start address for the flash region. More... | |
uint32_t | flash_get_size (const flash_t *obj) |
Get the flash region size. More... | |
uint8_t | flash_get_erase_value (const flash_t *obj) |
Get the flash erase value. More... | |
int32_t flash_erase_sector | ( | flash_t * | obj, |
uint32_t | address | ||
) |
Erase one sector starting at defined address.
The address should be at sector boundary. This function does not do any check for address alignments
obj | The flash object |
address | The sector starting address |
int32_t flash_free | ( | flash_t * | obj | ) |
Uninitialize the flash peripheral and the flash_t object.
obj | The flash object |
uint8_t flash_get_erase_value | ( | const flash_t * | obj | ) |
Get the flash erase value.
obj | The flash object |
uint32_t flash_get_page_size | ( | const flash_t * | obj | ) |
Get page size.
The page size defines the writable page size
obj | The flash object |
uint32_t flash_get_sector_size | ( | const flash_t * | obj, |
uint32_t | address | ||
) |
Get sector size.
obj | The flash object |
address | The sector starting address |
uint32_t flash_get_size | ( | const flash_t * | obj | ) |
Get the flash region size.
obj | The flash object |
uint32_t flash_get_start_address | ( | const flash_t * | obj | ) |
Get start address for the flash region.
obj | The flash object |
int32_t flash_init | ( | flash_t * | obj | ) |
Initialize the flash peripheral and the flash_t object.
obj | The flash object |
int32_t flash_program_page | ( | flash_t * | obj, |
uint32_t | address, | ||
const uint8_t * | data, | ||
uint32_t | size | ||
) |
Program pages starting at defined address.
The pages should not cross multiple sectors. This function does not do any check for address alignments or if size is aligned to a page size.
obj | The flash object |
address | The sector starting address |
data | The data buffer to be programmed |
size | The number of bytes to program |
int32_t flash_read | ( | flash_t * | obj, |
uint32_t | address, | ||
uint8_t * | data, | ||
uint32_t | size | ||
) |
Read data starting at defined address.
This function has a WEAK implementation using memcpy for backwards compatibility.
obj | The flash object |
address | Address to begin reading from |
data | The buffer to read data into |
size | The number of bytes to read |