storage/flash_map: API for get driver belongs to the flash_area.
Introduce API for get driver structure belongs to the flash_area. Some more complex operation on flash areas might want to be done using driver directly. It not make sense to wrap every possible flash related operation by flash_map API. For instance mcuboot will require this patch. Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
This commit is contained in:
parent
2320973fea
commit
3fe98838c9
2 changed files with 14 additions and 0 deletions
|
@ -88,6 +88,15 @@ int flash_area_get_sectors(int fa_id, u32_t *count,
|
||||||
*/
|
*/
|
||||||
int flash_area_has_driver(const struct flash_area *fa);
|
int flash_area_has_driver(const struct flash_area *fa);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get driver for given flash area.
|
||||||
|
*
|
||||||
|
* @param fa Flash area.
|
||||||
|
*
|
||||||
|
* @return device driver.
|
||||||
|
*/
|
||||||
|
struct device *flash_area_get_device(const struct flash_area *fa);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -247,3 +247,8 @@ int flash_area_has_driver(const struct flash_area *fa)
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct device *flash_area_get_device(const struct flash_area *fa)
|
||||||
|
{
|
||||||
|
return device_get_binding(fa->fa_dev_name);
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue