@@ -641,13 +641,13 @@ uint8_t flash_area_erased_val(const struct flash_area *fa)
641
641
}
642
642
643
643
/****************************************************************************
644
- * Name: flash_area_get_sectors
644
+ * Name: flash_area_get_sectors_fa
645
645
*
646
646
* Description:
647
647
* Retrieve info about sectors within the area.
648
648
*
649
649
* Input Parameters:
650
- * fa_id - ID of the flash area whose info will be retrieved .
650
+ * fa - pointer to flash area object .
651
651
* count - On input, represents the capacity of the sectors buffer.
652
652
*
653
653
* Output Parameters:
@@ -659,15 +659,9 @@ uint8_t flash_area_erased_val(const struct flash_area *fa)
659
659
*
660
660
****************************************************************************/
661
661
662
- int flash_area_get_sectors ( int fa_id , uint32_t * count ,
663
- struct flash_sector * sectors )
662
+ int flash_area_get_sectors_fa ( const struct flash_area * fa , uint32_t * count ,
663
+ struct flash_sector * sectors )
664
664
{
665
- size_t off ;
666
- uint32_t total_count = 0 ;
667
- struct flash_device_s * dev = lookup_flash_device_by_id (fa_id );
668
- const size_t sector_size = dev -> mtdgeo .erasesize ;
669
- const struct flash_area * fa = fa = dev -> fa_cfg ;
670
-
671
665
for (off = 0 ; off < fa -> fa_size ; off += sector_size )
672
666
{
673
667
/* Note: Offset here is relative to flash area, not device */
@@ -686,6 +680,38 @@ int flash_area_get_sectors(int fa_id, uint32_t *count,
686
680
return OK ;
687
681
}
688
682
683
+
684
+ /****************************************************************************
685
+ * Name: flash_area_get_sectors
686
+ *
687
+ * Description:
688
+ * Retrieve info about sectors within the area.
689
+ *
690
+ * Input Parameters:
691
+ * fa_id - ID of the flash area whose info will be retrieved.
692
+ * count - On input, represents the capacity of the sectors buffer.
693
+ *
694
+ * Output Parameters:
695
+ * count - On output, it shall contain the number of retrieved sectors.
696
+ * sectors - Buffer for sectors data.
697
+ *
698
+ * Returned Value:
699
+ * Zero on success, or negative value in case of error.
700
+ *
701
+ ****************************************************************************/
702
+
703
+ int flash_area_get_sectors (int fa_id , uint32_t * count ,
704
+ struct flash_sector * sectors )
705
+ {
706
+ size_t off ;
707
+ uint32_t total_count = 0 ;
708
+ struct flash_device_s * dev = lookup_flash_device_by_id (fa_id );
709
+ const size_t sector_size = dev -> mtdgeo .erasesize ;
710
+ const struct flash_area * fa = fa = dev -> fa_cfg ;
711
+
712
+ return flash_area_get_sectors_fa (fa , count , sectors );
713
+ }
714
+
689
715
/****************************************************************************
690
716
* Name: flash_area_id_from_multi_image_slot
691
717
*
0 commit comments