@@ -641,13 +641,13 @@ uint8_t flash_area_erased_val(const struct flash_area *fa)
641641}
642642
643643/****************************************************************************
644- * Name: flash_area_get_sectors
644+ * Name: flash_area_get_sectors_fa
645645 *
646646 * Description:
647647 * Retrieve info about sectors within the area.
648648 *
649649 * Input Parameters:
650- * fa_id - ID of the flash area whose info will be retrieved .
650+ * fa - pointer to flash area object .
651651 * count - On input, represents the capacity of the sectors buffer.
652652 *
653653 * Output Parameters:
@@ -659,15 +659,9 @@ uint8_t flash_area_erased_val(const struct flash_area *fa)
659659 *
660660 ****************************************************************************/
661661
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 )
664664{
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-
671665 for (off = 0 ; off < fa -> fa_size ; off += sector_size )
672666 {
673667 /* 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,
686680 return OK ;
687681}
688682
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+
689715/****************************************************************************
690716 * Name: flash_area_id_from_multi_image_slot
691717 *
0 commit comments