File tree Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -172,6 +172,24 @@ u8_t flash_area_align(const struct flash_area *fa);
172172int flash_area_get_sectors (int fa_id , u32_t * count ,
173173 struct flash_sector * sectors );
174174
175+ /**
176+ * Flash map iteration callback
177+ *
178+ * @param fa flash area
179+ * @param user_data User supplied data
180+ *
181+ */
182+ typedef void (* flash_area_cb_t )(const struct flash_area * fa ,
183+ void * user_data );
184+
185+ /**
186+ * Iterate over flash map
187+ *
188+ * @param user_cb User callback
189+ * @param user_data User supplied data
190+ */
191+ void flash_area_foreach (flash_area_cb_t user_cb , void * user_data );
192+
175193/**
176194 * Check whether given flash area has supporting flash driver
177195 * in the system.
Original file line number Diff line number Diff line change @@ -41,6 +41,13 @@ static struct flash_area const *get_flash_area_from_id(int idx)
4141 return NULL ;
4242}
4343
44+ void flash_area_foreach (flash_area_cb_t user_cb , void * user_data )
45+ {
46+ for (int i = 0 ; i < flash_map_entries ; i ++ ) {
47+ user_cb (& flash_map [i ], user_data );
48+ }
49+ }
50+
4451int flash_area_open (u8_t id , const struct flash_area * * fap )
4552{
4653 const struct flash_area * area ;
You can’t perform that action at this time.
0 commit comments