libflashprog: Start a new API for chip enumeration
For now, allow to query all chips, their vendor, name and size.
There's a tricky optimization coming up: We don't want to allocate
additional memory when enumerating the chip database. But, we also
want to use the same API interface to access information about de-
tected chips, which requires dynamic memory. So we have to handle
these distinct cases explicitly. Where `struct flashprog_chips *`
is used, we set it to the special value `FLASHCHIPS_DB` to denote
the flash database. For `struct flashprog_chip *` pointers, we add
chip_from_db(), which tells us whether the given pointer is within
the database range.
Change-Id: I7ecc12e1b74ca11f2be1b3472d6e470da44bfef1
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.sourcearcade.org/c/flashprog/+/481
diff --git a/libflashprog.map b/libflashprog.map
index a0dd125..c13f7e4 100644
--- a/libflashprog.map
+++ b/libflashprog.map
@@ -1,5 +1,13 @@
LIBFLASHPROG_1.0 {
global:
+ flashprog_chip_first;
+ flashprog_chip_name;
+ flashprog_chip_next;
+ flashprog_chip_size;
+ flashprog_chip_vendor;
+ flashprog_chips_all;
+ flashprog_chips_count;
+ flashprog_chips_release;
flashprog_flag_get;
flashprog_flag_set;
flashprog_flash_erase;