Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of mbed-dev by
Diff: hal/flash_api.h
- Revision:
- 170:e3b6fe271b81
- Parent:
- 160:d5399cc887bb
- Child:
- 173:7d866c31b3c5
diff -r 9672193075cf -r e3b6fe271b81 hal/flash_api.h --- a/hal/flash_api.h Thu Jul 06 15:42:05 2017 +0100 +++ b/hal/flash_api.h Wed Jul 19 17:31:21 2017 +0100 @@ -42,14 +42,14 @@ */ /** Initialize the flash peripheral and the flash_t object - * + * * @param obj The flash object * @return 0 for success, -1 for error */ int32_t flash_init(flash_t *obj); /** Uninitialize the flash peripheral and the flash_t object - * + * * @param obj The flash object * @return 0 for success, -1 for error */ @@ -64,9 +64,20 @@ */ int32_t flash_erase_sector(flash_t *obj, uint32_t address); +/** Read data starting at defined address + * + * This function has a WEAK implementation using memcpy for backwards compatibility. + * @param obj The flash object + * @param address Address to begin reading from + * @param data The buffer to read data into + * @param size The number of bytes to read + * @return 0 for success, -1 for error + */ +int32_t flash_read(flash_t *obj, uint32_t address, uint8_t *data, uint32_t size); + /** Program one page starting at defined address - * - * The page should be at page boundary, should not cross multiple sectors. + * + * The page should be at page boundary, should not cross multiple sectors. * This function does not do any check for address alignments or if size is aligned to a page size. * @param obj The flash object * @param address The sector starting address @@ -77,7 +88,7 @@ int32_t flash_program_page(flash_t *obj, uint32_t address, const uint8_t *data, uint32_t size); /** Get sector size - * + * * @param obj The flash object * @param address The sector starting address * @return The size of a sector @@ -85,7 +96,7 @@ uint32_t flash_get_sector_size(const flash_t *obj, uint32_t address); /** Get page size - * + * * @param obj The flash object * @param address The page starting address * @return The size of a page @@ -93,14 +104,14 @@ uint32_t flash_get_page_size(const flash_t *obj); /** Get start address for the flash region - * + * * @param obj The flash object * @return The start address for the flash region */ uint32_t flash_get_start_address(const flash_t *obj); /** Get the flash region size - * + * * @param obj The flash object * @return The flash region size */