diff loadtools/flash.h @ 405:a212b4968b29

fc-loadtool flash: another refactoring: geometry vs. command set
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Tue, 17 Jun 2014 00:33:05 +0000
parents f027c6fbe37e
children 23ab8fe81764
line wrap: on
line diff
--- a/loadtools/flash.h	Mon Jun 16 01:15:17 2014 +0000
+++ b/loadtools/flash.h	Tue Jun 17 00:33:05 2014 +0000
@@ -14,9 +14,11 @@
 
 #define	CFI_MAX_REGIONS		4
 
-/* The info in struct cfi_info can be either gathered from CFI or hard-coded. */
-struct cfi_info {
-	uint16_t			cmdset_style;
+/*
+ * The info in struct flash_geom can be either
+ * gathered from CFI or hard-coded.
+ */
+struct flash_geom {
 	uint32_t			total_size;
 	unsigned			nregions;
 	struct flash_region_desc	regions[CFI_MAX_REGIONS];
@@ -30,7 +32,7 @@
 
 struct flash_bank_desc {
 	uint32_t		align_size;
-	struct cfi_info		*hard_cfi;
+	struct flash_geom	*geom;
 	struct flash_idcheck	*idcheck_table;
 	unsigned		idcheck_num;
 };
@@ -39,6 +41,7 @@
 	char			*name;
 	struct flash_bank_desc	*bank_desc;
 	unsigned		nbanks;
+	struct flash_cmdset	*cmdset;
 };
 
 /* the following structures describe flash banks as accessible to us */
@@ -48,10 +51,22 @@
 	uint32_t	size;
 };
 
+struct flash_cmdset {
+	char	*cmdset_name;
+	int	(*reset_cmd)();
+	int	(*status_cmd)();
+	int	(*unlock_sector)();
+	int	(*erase_sector)();
+	int	(*prep_for_program)();
+	char	*loadagent_setbase_cmd;
+	char	*loadagent_program_cmd;
+};
+
 struct flash_bank_info {
 	uint32_t		base_addr;
 	struct flash_bank_desc	*bank_desc;
-	struct cfi_info		*cfi;
+	struct flash_geom	*geom;
+	struct flash_cmdset	*ops;
 	struct sector_info	*sectors;
 	int			idcheck_done;
 };