FreeCalypso > hg > freecalypso-sw
annotate loadtools/flash.h @ 876:c9f353b5d70c
rvinterf/asyncshell/rxctl.c: buglet in the implementation of dis/enable commands
author | Space Falcon <falcon@ivan.Harhan.ORG> |
---|---|
date | Sat, 30 May 2015 07:50:05 +0000 |
parents | 23ab8fe81764 |
children |
rev | line source |
---|---|
55
278052b6afda
loadtools: started laying the foundation for flash support
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
1 /* this header file contains definitions for fc-loadtool flash support */ |
278052b6afda
loadtools: started laying the foundation for flash support
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
2 |
278052b6afda
loadtools: started laying the foundation for flash support
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
3 /* |
278052b6afda
loadtools: started laying the foundation for flash support
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
4 * The following structures represent an "abstract" |
278052b6afda
loadtools: started laying the foundation for flash support
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
5 * description of flash devices. |
278052b6afda
loadtools: started laying the foundation for flash support
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
6 * |
278052b6afda
loadtools: started laying the foundation for flash support
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
7 * A "region" is a consecutive group of erase units of the same size. |
278052b6afda
loadtools: started laying the foundation for flash support
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
8 */ |
278052b6afda
loadtools: started laying the foundation for flash support
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
9 |
278052b6afda
loadtools: started laying the foundation for flash support
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
10 struct flash_region_desc { |
278052b6afda
loadtools: started laying the foundation for flash support
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
11 uint32_t sector_size; |
278052b6afda
loadtools: started laying the foundation for flash support
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
12 unsigned nsectors; |
278052b6afda
loadtools: started laying the foundation for flash support
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
13 }; |
278052b6afda
loadtools: started laying the foundation for flash support
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
14 |
400
f027c6fbe37e
fc-loadtool flash: first round of refactoring for CFI
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
203
diff
changeset
|
15 #define CFI_MAX_REGIONS 4 |
f027c6fbe37e
fc-loadtool flash: first round of refactoring for CFI
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
203
diff
changeset
|
16 |
405
a212b4968b29
fc-loadtool flash: another refactoring: geometry vs. command set
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
400
diff
changeset
|
17 /* |
a212b4968b29
fc-loadtool flash: another refactoring: geometry vs. command set
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
400
diff
changeset
|
18 * The info in struct flash_geom can be either |
a212b4968b29
fc-loadtool flash: another refactoring: geometry vs. command set
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
400
diff
changeset
|
19 * gathered from CFI or hard-coded. |
a212b4968b29
fc-loadtool flash: another refactoring: geometry vs. command set
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
400
diff
changeset
|
20 */ |
a212b4968b29
fc-loadtool flash: another refactoring: geometry vs. command set
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
400
diff
changeset
|
21 struct flash_geom { |
400
f027c6fbe37e
fc-loadtool flash: first round of refactoring for CFI
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
203
diff
changeset
|
22 uint32_t total_size; |
f027c6fbe37e
fc-loadtool flash: first round of refactoring for CFI
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
203
diff
changeset
|
23 unsigned nregions; |
f027c6fbe37e
fc-loadtool flash: first round of refactoring for CFI
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
203
diff
changeset
|
24 struct flash_region_desc regions[CFI_MAX_REGIONS]; |
f027c6fbe37e
fc-loadtool flash: first round of refactoring for CFI
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
203
diff
changeset
|
25 unsigned total_sectors; |
f027c6fbe37e
fc-loadtool flash: first round of refactoring for CFI
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
203
diff
changeset
|
26 }; |
f027c6fbe37e
fc-loadtool flash: first round of refactoring for CFI
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
203
diff
changeset
|
27 |
203
99c234bf6a9b
fc-loadtool flash ID check: definitions created
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
55
diff
changeset
|
28 struct flash_idcheck { |
99c234bf6a9b
fc-loadtool flash ID check: definitions created
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
55
diff
changeset
|
29 uint16_t offset; |
99c234bf6a9b
fc-loadtool flash ID check: definitions created
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
55
diff
changeset
|
30 uint16_t expect_val; |
99c234bf6a9b
fc-loadtool flash ID check: definitions created
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
55
diff
changeset
|
31 }; |
99c234bf6a9b
fc-loadtool flash ID check: definitions created
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
55
diff
changeset
|
32 |
55
278052b6afda
loadtools: started laying the foundation for flash support
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
33 struct flash_bank_desc { |
400
f027c6fbe37e
fc-loadtool flash: first round of refactoring for CFI
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
203
diff
changeset
|
34 uint32_t align_size; |
405
a212b4968b29
fc-loadtool flash: another refactoring: geometry vs. command set
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
400
diff
changeset
|
35 struct flash_geom *geom; |
400
f027c6fbe37e
fc-loadtool flash: first round of refactoring for CFI
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
203
diff
changeset
|
36 struct flash_idcheck *idcheck_table; |
f027c6fbe37e
fc-loadtool flash: first round of refactoring for CFI
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
203
diff
changeset
|
37 unsigned idcheck_num; |
55
278052b6afda
loadtools: started laying the foundation for flash support
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
38 }; |
278052b6afda
loadtools: started laying the foundation for flash support
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
39 |
278052b6afda
loadtools: started laying the foundation for flash support
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
40 struct flash_device_desc { |
278052b6afda
loadtools: started laying the foundation for flash support
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
41 char *name; |
278052b6afda
loadtools: started laying the foundation for flash support
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
42 struct flash_bank_desc *bank_desc; |
278052b6afda
loadtools: started laying the foundation for flash support
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
43 unsigned nbanks; |
405
a212b4968b29
fc-loadtool flash: another refactoring: geometry vs. command set
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
400
diff
changeset
|
44 struct flash_cmdset *cmdset; |
55
278052b6afda
loadtools: started laying the foundation for flash support
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
45 }; |
278052b6afda
loadtools: started laying the foundation for flash support
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
46 |
278052b6afda
loadtools: started laying the foundation for flash support
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
47 /* the following structures describe flash banks as accessible to us */ |
278052b6afda
loadtools: started laying the foundation for flash support
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
48 |
278052b6afda
loadtools: started laying the foundation for flash support
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
49 struct sector_info { |
278052b6afda
loadtools: started laying the foundation for flash support
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
50 uint32_t start; |
278052b6afda
loadtools: started laying the foundation for flash support
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
51 uint32_t size; |
278052b6afda
loadtools: started laying the foundation for flash support
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
52 }; |
278052b6afda
loadtools: started laying the foundation for flash support
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
53 |
405
a212b4968b29
fc-loadtool flash: another refactoring: geometry vs. command set
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
400
diff
changeset
|
54 struct flash_cmdset { |
a212b4968b29
fc-loadtool flash: another refactoring: geometry vs. command set
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
400
diff
changeset
|
55 char *cmdset_name; |
a212b4968b29
fc-loadtool flash: another refactoring: geometry vs. command set
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
400
diff
changeset
|
56 int (*reset_cmd)(); |
a212b4968b29
fc-loadtool flash: another refactoring: geometry vs. command set
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
400
diff
changeset
|
57 int (*status_cmd)(); |
a212b4968b29
fc-loadtool flash: another refactoring: geometry vs. command set
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
400
diff
changeset
|
58 int (*unlock_sector)(); |
a212b4968b29
fc-loadtool flash: another refactoring: geometry vs. command set
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
400
diff
changeset
|
59 int (*erase_sector)(); |
a212b4968b29
fc-loadtool flash: another refactoring: geometry vs. command set
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
400
diff
changeset
|
60 int (*prep_for_program)(); |
a212b4968b29
fc-loadtool flash: another refactoring: geometry vs. command set
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
400
diff
changeset
|
61 char *loadagent_setbase_cmd; |
a212b4968b29
fc-loadtool flash: another refactoring: geometry vs. command set
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
400
diff
changeset
|
62 char *loadagent_program_cmd; |
409
23ab8fe81764
Intel flash: unlock command implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
405
diff
changeset
|
63 int needs_unlock; |
405
a212b4968b29
fc-loadtool flash: another refactoring: geometry vs. command set
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
400
diff
changeset
|
64 }; |
a212b4968b29
fc-loadtool flash: another refactoring: geometry vs. command set
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
400
diff
changeset
|
65 |
55
278052b6afda
loadtools: started laying the foundation for flash support
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
66 struct flash_bank_info { |
278052b6afda
loadtools: started laying the foundation for flash support
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
67 uint32_t base_addr; |
278052b6afda
loadtools: started laying the foundation for flash support
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
68 struct flash_bank_desc *bank_desc; |
405
a212b4968b29
fc-loadtool flash: another refactoring: geometry vs. command set
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
400
diff
changeset
|
69 struct flash_geom *geom; |
a212b4968b29
fc-loadtool flash: another refactoring: geometry vs. command set
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
400
diff
changeset
|
70 struct flash_cmdset *ops; |
55
278052b6afda
loadtools: started laying the foundation for flash support
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
71 struct sector_info *sectors; |
203
99c234bf6a9b
fc-loadtool flash ID check: definitions created
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
55
diff
changeset
|
72 int idcheck_done; |
55
278052b6afda
loadtools: started laying the foundation for flash support
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
73 }; |