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/Makefile b/Makefile
index 11eb07b..7d6e668 100644
--- a/Makefile
+++ b/Makefile
@@ -400,8 +400,10 @@
###############################################################################
# Library code.
-LIB_OBJS = libflashprog.o layout.o flashprog.o udelay.o parallel.o programmer.o programmer_table.o \
- helpers.o helpers_fileio.o ich_descriptors.o fmap.o platform/endian_$(ENDIAN).o platform/memaccess.o
+LIB_OBJS = libflashprog.o libflashprog/chips.o layout.o flashprog.o udelay.o \
+ parallel.o programmer.o programmer_table.o \
+ helpers.o helpers_fileio.o ich_descriptors.o fmap.o \
+ platform/endian_$(ENDIAN).o platform/memaccess.o
###############################################################################