File tree 2 files changed +14
-9
lines changed
include/flash_map_backend 2 files changed +14
-9
lines changed Original file line number Diff line number Diff line change @@ -107,12 +107,13 @@ static inline uint8_t flash_area_get_device_id(const struct flash_area *fa)
107
107
}
108
108
109
109
/****************************************************************************
110
- * Name: flash_area_sector_from_off
110
+ * Name: flash_area_get_sector
111
111
*
112
112
* Description:
113
113
* Retrieve the flash sector a given offset belongs to.
114
114
*
115
115
* Input Parameters:
116
+ * fap - flash area structure
116
117
* off - address offset.
117
118
* sector - flash sector
118
119
*
@@ -121,7 +122,8 @@ static inline uint8_t flash_area_get_device_id(const struct flash_area *fa)
121
122
*
122
123
****************************************************************************/
123
124
124
- int flash_area_sector_from_off (off_t off , struct flash_sector * fs );
125
+ int flash_area_get_sector (const struct flash_area * fap , off_t off ,
126
+ struct flash_sector * fs );
125
127
126
128
/****************************************************************************
127
129
* Name: flash_area_get_off
Original file line number Diff line number Diff line change @@ -812,12 +812,13 @@ int flash_area_id_from_image_offset(uint32_t offset)
812
812
}
813
813
814
814
/****************************************************************************
815
- * Name: flash_area_sector_from_off
815
+ * Name: flash_area_get_sector
816
816
*
817
817
* Description:
818
818
* Retrieve the flash sector a given offset belongs to.
819
819
*
820
820
* Input Parameters:
821
+ * fap - flash area structure
821
822
* off - address offset.
822
823
* sector - flash sector
823
824
*
@@ -826,15 +827,17 @@ int flash_area_id_from_image_offset(uint32_t offset)
826
827
*
827
828
****************************************************************************/
828
829
829
- int flash_area_sector_from_off (off_t off , struct flash_sector * fs )
830
+ int flash_area_get_sector (const struct flash_area * fap , off_t off ,
831
+ struct flash_sector * fs )
830
832
{
831
- struct flash_device_s * dev = lookup_flash_device_by_offset (off );
833
+ off_t offset = fap -> fa_off + off ;
834
+ struct flash_device_s * dev = lookup_flash_device_by_offset (offset );
832
835
if (dev == NULL )
833
- {
834
- return - errno ;
835
- }
836
+ {
837
+ return - errno ;
838
+ }
836
839
837
- fs -> fs_off = (off / dev -> mtdgeo .erasesize ) * dev -> mtdgeo .erasesize ;
840
+ fs -> fs_off = (offset / dev -> mtdgeo .erasesize ) * dev -> mtdgeo .erasesize ;
838
841
fs -> fs_size = dev -> mtdgeo .erasesize ;
839
842
840
843
return 0 ;
You can’t perform that action at this time.
0 commit comments