comparison 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
comparison
equal deleted inserted replaced
404:7daea2476062 405:a212b4968b29
12 unsigned nsectors; 12 unsigned nsectors;
13 }; 13 };
14 14
15 #define CFI_MAX_REGIONS 4 15 #define CFI_MAX_REGIONS 4
16 16
17 /* The info in struct cfi_info can be either gathered from CFI or hard-coded. */ 17 /*
18 struct cfi_info { 18 * The info in struct flash_geom can be either
19 uint16_t cmdset_style; 19 * gathered from CFI or hard-coded.
20 */
21 struct flash_geom {
20 uint32_t total_size; 22 uint32_t total_size;
21 unsigned nregions; 23 unsigned nregions;
22 struct flash_region_desc regions[CFI_MAX_REGIONS]; 24 struct flash_region_desc regions[CFI_MAX_REGIONS];
23 unsigned total_sectors; 25 unsigned total_sectors;
24 }; 26 };
28 uint16_t expect_val; 30 uint16_t expect_val;
29 }; 31 };
30 32
31 struct flash_bank_desc { 33 struct flash_bank_desc {
32 uint32_t align_size; 34 uint32_t align_size;
33 struct cfi_info *hard_cfi; 35 struct flash_geom *geom;
34 struct flash_idcheck *idcheck_table; 36 struct flash_idcheck *idcheck_table;
35 unsigned idcheck_num; 37 unsigned idcheck_num;
36 }; 38 };
37 39
38 struct flash_device_desc { 40 struct flash_device_desc {
39 char *name; 41 char *name;
40 struct flash_bank_desc *bank_desc; 42 struct flash_bank_desc *bank_desc;
41 unsigned nbanks; 43 unsigned nbanks;
44 struct flash_cmdset *cmdset;
42 }; 45 };
43 46
44 /* the following structures describe flash banks as accessible to us */ 47 /* the following structures describe flash banks as accessible to us */
45 48
46 struct sector_info { 49 struct sector_info {
47 uint32_t start; 50 uint32_t start;
48 uint32_t size; 51 uint32_t size;
49 }; 52 };
50 53
54 struct flash_cmdset {
55 char *cmdset_name;
56 int (*reset_cmd)();
57 int (*status_cmd)();
58 int (*unlock_sector)();
59 int (*erase_sector)();
60 int (*prep_for_program)();
61 char *loadagent_setbase_cmd;
62 char *loadagent_program_cmd;
63 };
64
51 struct flash_bank_info { 65 struct flash_bank_info {
52 uint32_t base_addr; 66 uint32_t base_addr;
53 struct flash_bank_desc *bank_desc; 67 struct flash_bank_desc *bank_desc;
54 struct cfi_info *cfi; 68 struct flash_geom *geom;
69 struct flash_cmdset *ops;
55 struct sector_info *sectors; 70 struct sector_info *sectors;
56 int idcheck_done; 71 int idcheck_done;
57 }; 72 };