espressif: Add flash_area_get_sector
Commits adds implementation of flash_area_get_sector that is supposed to replace flash_area_sector_from_off. The flash_area_get_sector gets additional parameter of flash_area type, while flash_area_sector_from_off uses hardcoded flash_area. Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
This commit is contained in:
parent
b1d4e00186
commit
bd0d94ce4b
|
@ -80,6 +80,10 @@ int flash_area_get_sectors(int fa_id, uint32_t *count,
|
|||
//! Retrieve the flash sector a given offset belongs to.
|
||||
int flash_area_sector_from_off(uint32_t off, struct flash_sector *sector);
|
||||
|
||||
//! Retrieve the flash sector a given offset belongs to.
|
||||
int flash_area_get_sector(const struct flash_area *area, uint32_t off,
|
||||
struct flash_sector *sector);
|
||||
|
||||
//! Returns the `fa_id` for slot, where slot is 0 (primary) or 1 (secondary).
|
||||
//!
|
||||
//! `image_index` (0 or 1) is the index of the image. Image index is
|
||||
|
|
|
@ -372,6 +372,15 @@ int flash_area_sector_from_off(uint32_t off, struct flash_sector *sector)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int flash_area_get_sector(const struct flash_area *fa, uint32_t off,
|
||||
struct flash_sector *sector)
|
||||
{
|
||||
sector->fs_off = (off / FLASH_SECTOR_SIZE) * FLASH_SECTOR_SIZE;
|
||||
sector->fs_size = FLASH_SECTOR_SIZE;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int flash_area_id_from_multi_image_slot(int image_index, int slot)
|
||||
{
|
||||
BOOT_LOG_DBG("%s", __func__);
|
||||
|
|
Loading…
Reference in New Issue