flash_map: add function to iterate over areas
A new foreach iterator to go over all flash areas in a flash map. Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit is contained in:
parent
27c97911b7
commit
1e5d02fcd2
2 changed files with 25 additions and 0 deletions
|
@ -41,6 +41,13 @@ static struct flash_area const *get_flash_area_from_id(int idx)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
void flash_area_foreach(flash_area_cb_t user_cb, void *user_data)
|
||||
{
|
||||
for (int i = 0; i < flash_map_entries; i++) {
|
||||
user_cb(&flash_map[i], user_data);
|
||||
}
|
||||
}
|
||||
|
||||
int flash_area_open(u8_t id, const struct flash_area **fap)
|
||||
{
|
||||
const struct flash_area *area;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue