FreeCalypso > hg > freecalypso-tools
comparison loadtools/flash.h @ 0:e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sat, 11 Jun 2016 00:13:35 +0000 |
parents | |
children | 0dd2c87c1b63 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:e7502631a0f9 |
---|---|
1 /* this header file contains definitions for fc-loadtool flash support */ | |
2 | |
3 /* | |
4 * The following structures represent an "abstract" | |
5 * description of flash devices. | |
6 * | |
7 * A "region" is a consecutive group of erase units of the same size. | |
8 */ | |
9 | |
10 struct flash_region_desc { | |
11 uint32_t sector_size; | |
12 unsigned nsectors; | |
13 }; | |
14 | |
15 #define CFI_MAX_REGIONS 4 | |
16 | |
17 /* | |
18 * The info in struct flash_geom can be either | |
19 * gathered from CFI or hard-coded. | |
20 */ | |
21 struct flash_geom { | |
22 uint32_t total_size; | |
23 unsigned nregions; | |
24 struct flash_region_desc regions[CFI_MAX_REGIONS]; | |
25 unsigned total_sectors; | |
26 }; | |
27 | |
28 struct flash_idcheck { | |
29 uint16_t offset; | |
30 uint16_t expect_val; | |
31 }; | |
32 | |
33 struct flash_bank_desc { | |
34 uint32_t align_size; | |
35 struct flash_geom *geom; | |
36 struct flash_idcheck *idcheck_table; | |
37 unsigned idcheck_num; | |
38 }; | |
39 | |
40 struct flash_device_desc { | |
41 char *name; | |
42 struct flash_bank_desc *bank_desc; | |
43 unsigned nbanks; | |
44 struct flash_cmdset *cmdset; | |
45 }; | |
46 | |
47 /* the following structures describe flash banks as accessible to us */ | |
48 | |
49 struct sector_info { | |
50 uint32_t start; | |
51 uint32_t size; | |
52 }; | |
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 int needs_unlock; | |
64 }; | |
65 | |
66 struct flash_bank_info { | |
67 uint32_t base_addr; | |
68 struct flash_bank_desc *bank_desc; | |
69 struct flash_geom *geom; | |
70 struct flash_cmdset *ops; | |
71 struct sector_info *sectors; | |
72 int idcheck_done; | |
73 }; |