FreeCalypso > hg > freecalypso-sw
annotate loadtools/flashops.c @ 805:f219798c74ea
aci: line_edit.c and line_split.c done
| author | Space Falcon <falcon@ivan.Harhan.ORG> | 
|---|---|
| date | Sun, 05 Apr 2015 05:15:08 +0000 | 
| parents | 81d387690063 | 
| children | 
| rev | line source | 
|---|---|
| 
405
 
a212b4968b29
fc-loadtool flash: another refactoring: geometry vs. command set
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents:  
diff
changeset
 | 
1 /* | 
| 
 
a212b4968b29
fc-loadtool flash: another refactoring: geometry vs. command set
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents:  
diff
changeset
 | 
2 * This module implements those flash operations which are dependent | 
| 
 
a212b4968b29
fc-loadtool flash: another refactoring: geometry vs. command set
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents:  
diff
changeset
 | 
3 * on the AMD vs. Intel command set style. | 
| 
 
a212b4968b29
fc-loadtool flash: another refactoring: geometry vs. command set
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents:  
diff
changeset
 | 
4 */ | 
| 
 
a212b4968b29
fc-loadtool flash: another refactoring: geometry vs. command set
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents:  
diff
changeset
 | 
5 | 
| 
 
a212b4968b29
fc-loadtool flash: another refactoring: geometry vs. command set
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents:  
diff
changeset
 | 
6 #include <sys/types.h> | 
| 
 
a212b4968b29
fc-loadtool flash: another refactoring: geometry vs. command set
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents:  
diff
changeset
 | 
7 #include <stdio.h> | 
| 
 
a212b4968b29
fc-loadtool flash: another refactoring: geometry vs. command set
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents:  
diff
changeset
 | 
8 #include <stdint.h> | 
| 
 
a212b4968b29
fc-loadtool flash: another refactoring: geometry vs. command set
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents:  
diff
changeset
 | 
9 #include <stdlib.h> | 
| 
 
a212b4968b29
fc-loadtool flash: another refactoring: geometry vs. command set
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents:  
diff
changeset
 | 
10 #include <time.h> | 
| 
 
a212b4968b29
fc-loadtool flash: another refactoring: geometry vs. command set
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents:  
diff
changeset
 | 
11 #include "flash.h" | 
| 
 
a212b4968b29
fc-loadtool flash: another refactoring: geometry vs. command set
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents:  
diff
changeset
 | 
12 | 
| 
 
a212b4968b29
fc-loadtool flash: another refactoring: geometry vs. command set
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents:  
diff
changeset
 | 
13 /* common stub functions */ | 
| 
 
a212b4968b29
fc-loadtool flash: another refactoring: geometry vs. command set
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents:  
diff
changeset
 | 
14 | 
| 
 
a212b4968b29
fc-loadtool flash: another refactoring: geometry vs. command set
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents:  
diff
changeset
 | 
15 static | 
| 
 
a212b4968b29
fc-loadtool flash: another refactoring: geometry vs. command set
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents:  
diff
changeset
 | 
16 noop() | 
| 
 
a212b4968b29
fc-loadtool flash: another refactoring: geometry vs. command set
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents:  
diff
changeset
 | 
17 { | 
| 
 
a212b4968b29
fc-loadtool flash: another refactoring: geometry vs. command set
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents:  
diff
changeset
 | 
18 return(0); | 
| 
 
a212b4968b29
fc-loadtool flash: another refactoring: geometry vs. command set
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents:  
diff
changeset
 | 
19 } | 
| 
 
a212b4968b29
fc-loadtool flash: another refactoring: geometry vs. command set
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents:  
diff
changeset
 | 
20 | 
| 
 
a212b4968b29
fc-loadtool flash: another refactoring: geometry vs. command set
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents:  
diff
changeset
 | 
21 static | 
| 
 
a212b4968b29
fc-loadtool flash: another refactoring: geometry vs. command set
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents:  
diff
changeset
 | 
22 invalid() | 
| 
 
a212b4968b29
fc-loadtool flash: another refactoring: geometry vs. command set
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents:  
diff
changeset
 | 
23 { | 
| 
 
a212b4968b29
fc-loadtool flash: another refactoring: geometry vs. command set
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents:  
diff
changeset
 | 
24 fprintf(stderr, | 
| 
 
a212b4968b29
fc-loadtool flash: another refactoring: geometry vs. command set
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents:  
diff
changeset
 | 
25 "This operation is not applicable to the selected flash type\n"); | 
| 
 
a212b4968b29
fc-loadtool flash: another refactoring: geometry vs. command set
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents:  
diff
changeset
 | 
26 return(-1); | 
| 
 
a212b4968b29
fc-loadtool flash: another refactoring: geometry vs. command set
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents:  
diff
changeset
 | 
27 } | 
| 
 
a212b4968b29
fc-loadtool flash: another refactoring: geometry vs. command set
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents:  
diff
changeset
 | 
28 | 
| 
 
a212b4968b29
fc-loadtool flash: another refactoring: geometry vs. command set
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents:  
diff
changeset
 | 
29 /* AMD flash functions */ | 
| 
 
a212b4968b29
fc-loadtool flash: another refactoring: geometry vs. command set
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents:  
diff
changeset
 | 
30 | 
| 
 
a212b4968b29
fc-loadtool flash: another refactoring: geometry vs. command set
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents:  
diff
changeset
 | 
31 amd_reset_cmd(bi) | 
| 
 
a212b4968b29
fc-loadtool flash: another refactoring: geometry vs. command set
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents:  
diff
changeset
 | 
32 struct flash_bank_info *bi; | 
| 
 
a212b4968b29
fc-loadtool flash: another refactoring: geometry vs. command set
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents:  
diff
changeset
 | 
33 { | 
| 
 
a212b4968b29
fc-loadtool flash: another refactoring: geometry vs. command set
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents:  
diff
changeset
 | 
34 if (do_w16(bi->base_addr + 0xAAA, 0xF0)) { | 
| 
 
a212b4968b29
fc-loadtool flash: another refactoring: geometry vs. command set
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents:  
diff
changeset
 | 
35 fprintf(stderr, | 
| 
 
a212b4968b29
fc-loadtool flash: another refactoring: geometry vs. command set
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents:  
diff
changeset
 | 
36 "unexpected response to w16 when resetting flash to read mode!\n"); | 
| 
 
a212b4968b29
fc-loadtool flash: another refactoring: geometry vs. command set
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents:  
diff
changeset
 | 
37 return(-1); | 
| 
 
a212b4968b29
fc-loadtool flash: another refactoring: geometry vs. command set
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents:  
diff
changeset
 | 
38 } | 
| 
 
a212b4968b29
fc-loadtool flash: another refactoring: geometry vs. command set
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents:  
diff
changeset
 | 
39 return(0); | 
| 
 
a212b4968b29
fc-loadtool flash: another refactoring: geometry vs. command set
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents:  
diff
changeset
 | 
40 } | 
| 
 
a212b4968b29
fc-loadtool flash: another refactoring: geometry vs. command set
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents:  
diff
changeset
 | 
41 | 
| 
 
a212b4968b29
fc-loadtool flash: another refactoring: geometry vs. command set
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents:  
diff
changeset
 | 
42 amd_sector_erase(bi, sp) | 
| 
 
a212b4968b29
fc-loadtool flash: another refactoring: geometry vs. command set
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents:  
diff
changeset
 | 
43 struct flash_bank_info *bi; | 
| 
 
a212b4968b29
fc-loadtool flash: another refactoring: geometry vs. command set
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents:  
diff
changeset
 | 
44 struct sector_info *sp; | 
| 
 
a212b4968b29
fc-loadtool flash: another refactoring: geometry vs. command set
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents:  
diff
changeset
 | 
45 { | 
| 
 
a212b4968b29
fc-loadtool flash: another refactoring: geometry vs. command set
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents:  
diff
changeset
 | 
46 int stat; | 
| 
 
a212b4968b29
fc-loadtool flash: another refactoring: geometry vs. command set
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents:  
diff
changeset
 | 
47 uint16_t flstat; | 
| 
 
a212b4968b29
fc-loadtool flash: another refactoring: geometry vs. command set
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents:  
diff
changeset
 | 
48 time_t start_time, curtime; | 
| 
 
a212b4968b29
fc-loadtool flash: another refactoring: geometry vs. command set
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents:  
diff
changeset
 | 
49 | 
| 
 
a212b4968b29
fc-loadtool flash: another refactoring: geometry vs. command set
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents:  
diff
changeset
 | 
50 stat = do_w16(bi->base_addr + sp->start + 0xAAA, 0xAA); | 
| 
 
a212b4968b29
fc-loadtool flash: another refactoring: geometry vs. command set
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents:  
diff
changeset
 | 
51 if (stat) { | 
| 
 
a212b4968b29
fc-loadtool flash: another refactoring: geometry vs. command set
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents:  
diff
changeset
 | 
52 bad_w16: fprintf(stderr, | 
| 
 
a212b4968b29
fc-loadtool flash: another refactoring: geometry vs. command set
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents:  
diff
changeset
 | 
53 "unexpected response to w16 in erase cmd sequence - aborting\n"); | 
| 
 
a212b4968b29
fc-loadtool flash: another refactoring: geometry vs. command set
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents:  
diff
changeset
 | 
54 return(-1); | 
| 
 
a212b4968b29
fc-loadtool flash: another refactoring: geometry vs. command set
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents:  
diff
changeset
 | 
55 } | 
| 
 
a212b4968b29
fc-loadtool flash: another refactoring: geometry vs. command set
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents:  
diff
changeset
 | 
56 stat = do_w16(bi->base_addr + sp->start + 0x554, 0x55); | 
| 
 
a212b4968b29
fc-loadtool flash: another refactoring: geometry vs. command set
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents:  
diff
changeset
 | 
57 if (stat) | 
| 
 
a212b4968b29
fc-loadtool flash: another refactoring: geometry vs. command set
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents:  
diff
changeset
 | 
58 goto bad_w16; | 
| 
 
a212b4968b29
fc-loadtool flash: another refactoring: geometry vs. command set
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents:  
diff
changeset
 | 
59 stat = do_w16(bi->base_addr + sp->start + 0xAAA, 0x80); | 
| 
 
a212b4968b29
fc-loadtool flash: another refactoring: geometry vs. command set
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents:  
diff
changeset
 | 
60 if (stat) | 
| 
 
a212b4968b29
fc-loadtool flash: another refactoring: geometry vs. command set
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents:  
diff
changeset
 | 
61 goto bad_w16; | 
| 
 
a212b4968b29
fc-loadtool flash: another refactoring: geometry vs. command set
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents:  
diff
changeset
 | 
62 stat = do_w16(bi->base_addr + sp->start + 0xAAA, 0xAA); | 
| 
 
a212b4968b29
fc-loadtool flash: another refactoring: geometry vs. command set
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents:  
diff
changeset
 | 
63 if (stat) | 
| 
 
a212b4968b29
fc-loadtool flash: another refactoring: geometry vs. command set
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents:  
diff
changeset
 | 
64 goto bad_w16; | 
| 
 
a212b4968b29
fc-loadtool flash: another refactoring: geometry vs. command set
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents:  
diff
changeset
 | 
65 stat = do_w16(bi->base_addr + sp->start + 0x554, 0x55); | 
| 
 
a212b4968b29
fc-loadtool flash: another refactoring: geometry vs. command set
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents:  
diff
changeset
 | 
66 if (stat) | 
| 
 
a212b4968b29
fc-loadtool flash: another refactoring: geometry vs. command set
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents:  
diff
changeset
 | 
67 goto bad_w16; | 
| 
 
a212b4968b29
fc-loadtool flash: another refactoring: geometry vs. command set
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents:  
diff
changeset
 | 
68 stat = do_w16(bi->base_addr + sp->start + 0xAAA, 0x30); | 
| 
 
a212b4968b29
fc-loadtool flash: another refactoring: geometry vs. command set
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents:  
diff
changeset
 | 
69 if (stat) | 
| 
 
a212b4968b29
fc-loadtool flash: another refactoring: geometry vs. command set
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents:  
diff
changeset
 | 
70 goto bad_w16; | 
| 
 
a212b4968b29
fc-loadtool flash: another refactoring: geometry vs. command set
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents:  
diff
changeset
 | 
71 start_time = time(0); | 
| 
 
a212b4968b29
fc-loadtool flash: another refactoring: geometry vs. command set
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents:  
diff
changeset
 | 
72 for (;;) { | 
| 
 
a212b4968b29
fc-loadtool flash: another refactoring: geometry vs. command set
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents:  
diff
changeset
 | 
73 stat = do_r16(bi->base_addr + sp->start, &flstat); | 
| 
 
a212b4968b29
fc-loadtool flash: another refactoring: geometry vs. command set
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents:  
diff
changeset
 | 
74 if (stat) | 
| 
 
a212b4968b29
fc-loadtool flash: another refactoring: geometry vs. command set
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents:  
diff
changeset
 | 
75 return(stat); /* error msg already printed */ | 
| 
 
a212b4968b29
fc-loadtool flash: another refactoring: geometry vs. command set
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents:  
diff
changeset
 | 
76 if (flstat == 0xFFFF) | 
| 
 
a212b4968b29
fc-loadtool flash: another refactoring: geometry vs. command set
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents:  
diff
changeset
 | 
77 return(0); | 
| 
 
a212b4968b29
fc-loadtool flash: another refactoring: geometry vs. command set
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents:  
diff
changeset
 | 
78 curtime = time(0); | 
| 
 
a212b4968b29
fc-loadtool flash: another refactoring: geometry vs. command set
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents:  
diff
changeset
 | 
79 if (curtime >= start_time + 20) { | 
| 
 
a212b4968b29
fc-loadtool flash: another refactoring: geometry vs. command set
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents:  
diff
changeset
 | 
80 fprintf(stderr, "erase timeout, aborting\n"); | 
| 
 
a212b4968b29
fc-loadtool flash: another refactoring: geometry vs. command set
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents:  
diff
changeset
 | 
81 return(-1); | 
| 
 
a212b4968b29
fc-loadtool flash: another refactoring: geometry vs. command set
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents:  
diff
changeset
 | 
82 } | 
| 
 
a212b4968b29
fc-loadtool flash: another refactoring: geometry vs. command set
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents:  
diff
changeset
 | 
83 } | 
| 
 
a212b4968b29
fc-loadtool flash: another refactoring: geometry vs. command set
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents:  
diff
changeset
 | 
84 } | 
| 
 
a212b4968b29
fc-loadtool flash: another refactoring: geometry vs. command set
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents:  
diff
changeset
 | 
85 | 
| 
 
a212b4968b29
fc-loadtool flash: another refactoring: geometry vs. command set
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents:  
diff
changeset
 | 
86 struct flash_cmdset flash_cmdset_amd = { | 
| 
 
a212b4968b29
fc-loadtool flash: another refactoring: geometry vs. command set
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents:  
diff
changeset
 | 
87 .cmdset_name = "AMD", | 
| 
 
a212b4968b29
fc-loadtool flash: another refactoring: geometry vs. command set
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents:  
diff
changeset
 | 
88 .reset_cmd = amd_reset_cmd, | 
| 
 
a212b4968b29
fc-loadtool flash: another refactoring: geometry vs. command set
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents:  
diff
changeset
 | 
89 .status_cmd = invalid, | 
| 
 
a212b4968b29
fc-loadtool flash: another refactoring: geometry vs. command set
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents:  
diff
changeset
 | 
90 .unlock_sector = invalid, | 
| 
 
a212b4968b29
fc-loadtool flash: another refactoring: geometry vs. command set
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents:  
diff
changeset
 | 
91 .erase_sector = amd_sector_erase, | 
| 
 
a212b4968b29
fc-loadtool flash: another refactoring: geometry vs. command set
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents:  
diff
changeset
 | 
92 .prep_for_program = noop, | 
| 
 
a212b4968b29
fc-loadtool flash: another refactoring: geometry vs. command set
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents:  
diff
changeset
 | 
93 .loadagent_setbase_cmd = "AMFB", | 
| 
 
a212b4968b29
fc-loadtool flash: another refactoring: geometry vs. command set
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents:  
diff
changeset
 | 
94 .loadagent_program_cmd = "AMFW", | 
| 
409
 
23ab8fe81764
Intel flash: unlock command implemented
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
408 
diff
changeset
 | 
95 .needs_unlock = 0, | 
| 
405
 
a212b4968b29
fc-loadtool flash: another refactoring: geometry vs. command set
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents:  
diff
changeset
 | 
96 }; | 
| 
407
 
f2cc551e597f
fc-loadtool flash: beginning of Intel command set support
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
405 
diff
changeset
 | 
97 | 
| 
 
f2cc551e597f
fc-loadtool flash: beginning of Intel command set support
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
405 
diff
changeset
 | 
98 /* Intel flash functions */ | 
| 
 
f2cc551e597f
fc-loadtool flash: beginning of Intel command set support
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
405 
diff
changeset
 | 
99 | 
| 
 
f2cc551e597f
fc-loadtool flash: beginning of Intel command set support
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
405 
diff
changeset
 | 
100 intel_reset_cmd(bi) | 
| 
 
f2cc551e597f
fc-loadtool flash: beginning of Intel command set support
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
405 
diff
changeset
 | 
101 struct flash_bank_info *bi; | 
| 
 
f2cc551e597f
fc-loadtool flash: beginning of Intel command set support
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
405 
diff
changeset
 | 
102 { | 
| 
 
f2cc551e597f
fc-loadtool flash: beginning of Intel command set support
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
405 
diff
changeset
 | 
103 if (do_w16(bi->base_addr, 0xFF)) { | 
| 
 
f2cc551e597f
fc-loadtool flash: beginning of Intel command set support
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
405 
diff
changeset
 | 
104 fprintf(stderr, | 
| 
 
f2cc551e597f
fc-loadtool flash: beginning of Intel command set support
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
405 
diff
changeset
 | 
105 "unexpected response to w16 when resetting flash to read mode!\n"); | 
| 
 
f2cc551e597f
fc-loadtool flash: beginning of Intel command set support
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
405 
diff
changeset
 | 
106 return(-1); | 
| 
 
f2cc551e597f
fc-loadtool flash: beginning of Intel command set support
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
405 
diff
changeset
 | 
107 } | 
| 
 
f2cc551e597f
fc-loadtool flash: beginning of Intel command set support
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
405 
diff
changeset
 | 
108 return(0); | 
| 
 
f2cc551e597f
fc-loadtool flash: beginning of Intel command set support
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
405 
diff
changeset
 | 
109 } | 
| 
 
f2cc551e597f
fc-loadtool flash: beginning of Intel command set support
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
405 
diff
changeset
 | 
110 | 
| 
408
 
431023033c86
Intel flash: flash status command implemented
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
407 
diff
changeset
 | 
111 intel_status_cmd(bi) | 
| 
 
431023033c86
Intel flash: flash status command implemented
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
407 
diff
changeset
 | 
112 struct flash_bank_info *bi; | 
| 
 
431023033c86
Intel flash: flash status command implemented
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
407 
diff
changeset
 | 
113 { | 
| 
 
431023033c86
Intel flash: flash status command implemented
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
407 
diff
changeset
 | 
114 int stat; | 
| 
 
431023033c86
Intel flash: flash status command implemented
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
407 
diff
changeset
 | 
115 uint16_t sr; | 
| 
 
431023033c86
Intel flash: flash status command implemented
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
407 
diff
changeset
 | 
116 | 
| 
 
431023033c86
Intel flash: flash status command implemented
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
407 
diff
changeset
 | 
117 /* issue Read SR command */ | 
| 
 
431023033c86
Intel flash: flash status command implemented
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
407 
diff
changeset
 | 
118 stat = do_w16(bi->base_addr, 0x70); | 
| 
 
431023033c86
Intel flash: flash status command implemented
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
407 
diff
changeset
 | 
119 if (stat) { | 
| 
 
431023033c86
Intel flash: flash status command implemented
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
407 
diff
changeset
 | 
120 fprintf(stderr, | 
| 
 
431023033c86
Intel flash: flash status command implemented
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
407 
diff
changeset
 | 
121 "unexpected response to w16 for Read SR command\n"); | 
| 
 
431023033c86
Intel flash: flash status command implemented
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
407 
diff
changeset
 | 
122 return(-1); | 
| 
 
431023033c86
Intel flash: flash status command implemented
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
407 
diff
changeset
 | 
123 } | 
| 
 
431023033c86
Intel flash: flash status command implemented
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
407 
diff
changeset
 | 
124 stat = do_r16(bi->base_addr, &sr); | 
| 
 
431023033c86
Intel flash: flash status command implemented
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
407 
diff
changeset
 | 
125 if (stat) | 
| 
 
431023033c86
Intel flash: flash status command implemented
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
407 
diff
changeset
 | 
126 return(stat); /* error msg already printed */ | 
| 
 
431023033c86
Intel flash: flash status command implemented
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
407 
diff
changeset
 | 
127 sr &= 0xFF; | 
| 
 
431023033c86
Intel flash: flash status command implemented
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
407 
diff
changeset
 | 
128 printf("Status Register: %02X\n", sr); | 
| 
 
431023033c86
Intel flash: flash status command implemented
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
407 
diff
changeset
 | 
129 return(0); | 
| 
 
431023033c86
Intel flash: flash status command implemented
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
407 
diff
changeset
 | 
130 } | 
| 
 
431023033c86
Intel flash: flash status command implemented
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
407 
diff
changeset
 | 
131 | 
| 
407
 
f2cc551e597f
fc-loadtool flash: beginning of Intel command set support
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
405 
diff
changeset
 | 
132 intel_sector_unlock(bi, sp) | 
| 
 
f2cc551e597f
fc-loadtool flash: beginning of Intel command set support
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
405 
diff
changeset
 | 
133 struct flash_bank_info *bi; | 
| 
 
f2cc551e597f
fc-loadtool flash: beginning of Intel command set support
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
405 
diff
changeset
 | 
134 struct sector_info *sp; | 
| 
 
f2cc551e597f
fc-loadtool flash: beginning of Intel command set support
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
405 
diff
changeset
 | 
135 { | 
| 
 
f2cc551e597f
fc-loadtool flash: beginning of Intel command set support
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
405 
diff
changeset
 | 
136 int stat; | 
| 
 
f2cc551e597f
fc-loadtool flash: beginning of Intel command set support
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
405 
diff
changeset
 | 
137 | 
| 
 
f2cc551e597f
fc-loadtool flash: beginning of Intel command set support
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
405 
diff
changeset
 | 
138 stat = do_w16(bi->base_addr + sp->start, 0x60); | 
| 
 
f2cc551e597f
fc-loadtool flash: beginning of Intel command set support
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
405 
diff
changeset
 | 
139 if (stat) { | 
| 
 
f2cc551e597f
fc-loadtool flash: beginning of Intel command set support
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
405 
diff
changeset
 | 
140 bad_w16: fprintf(stderr, | 
| 
 
f2cc551e597f
fc-loadtool flash: beginning of Intel command set support
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
405 
diff
changeset
 | 
141 "unexpected response to w16 in block unlock cmd sequence - aborting\n"); | 
| 
 
f2cc551e597f
fc-loadtool flash: beginning of Intel command set support
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
405 
diff
changeset
 | 
142 return(-1); | 
| 
 
f2cc551e597f
fc-loadtool flash: beginning of Intel command set support
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
405 
diff
changeset
 | 
143 } | 
| 
 
f2cc551e597f
fc-loadtool flash: beginning of Intel command set support
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
405 
diff
changeset
 | 
144 stat = do_w16(bi->base_addr + sp->start, 0xD0); | 
| 
 
f2cc551e597f
fc-loadtool flash: beginning of Intel command set support
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
405 
diff
changeset
 | 
145 if (stat) | 
| 
 
f2cc551e597f
fc-loadtool flash: beginning of Intel command set support
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
405 
diff
changeset
 | 
146 goto bad_w16; | 
| 
 
f2cc551e597f
fc-loadtool flash: beginning of Intel command set support
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
405 
diff
changeset
 | 
147 return(0); | 
| 
 
f2cc551e597f
fc-loadtool flash: beginning of Intel command set support
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
405 
diff
changeset
 | 
148 } | 
| 
 
f2cc551e597f
fc-loadtool flash: beginning of Intel command set support
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
405 
diff
changeset
 | 
149 | 
| 
 
f2cc551e597f
fc-loadtool flash: beginning of Intel command set support
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
405 
diff
changeset
 | 
150 intel_sector_erase(bi, sp) | 
| 
 
f2cc551e597f
fc-loadtool flash: beginning of Intel command set support
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
405 
diff
changeset
 | 
151 struct flash_bank_info *bi; | 
| 
 
f2cc551e597f
fc-loadtool flash: beginning of Intel command set support
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
405 
diff
changeset
 | 
152 struct sector_info *sp; | 
| 
 
f2cc551e597f
fc-loadtool flash: beginning of Intel command set support
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
405 
diff
changeset
 | 
153 { | 
| 
 
f2cc551e597f
fc-loadtool flash: beginning of Intel command set support
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
405 
diff
changeset
 | 
154 int stat; | 
| 
 
f2cc551e597f
fc-loadtool flash: beginning of Intel command set support
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
405 
diff
changeset
 | 
155 uint16_t flstat; | 
| 
 
f2cc551e597f
fc-loadtool flash: beginning of Intel command set support
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
405 
diff
changeset
 | 
156 time_t start_time, curtime; | 
| 
 
f2cc551e597f
fc-loadtool flash: beginning of Intel command set support
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
405 
diff
changeset
 | 
157 | 
| 
 
f2cc551e597f
fc-loadtool flash: beginning of Intel command set support
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
405 
diff
changeset
 | 
158 stat = intel_sector_unlock(bi, sp); | 
| 
 
f2cc551e597f
fc-loadtool flash: beginning of Intel command set support
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
405 
diff
changeset
 | 
159 if (stat) | 
| 
 
f2cc551e597f
fc-loadtool flash: beginning of Intel command set support
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
405 
diff
changeset
 | 
160 return(stat); /* error msg already printed */ | 
| 
 
f2cc551e597f
fc-loadtool flash: beginning of Intel command set support
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
405 
diff
changeset
 | 
161 /* clear SR */ | 
| 
 
f2cc551e597f
fc-loadtool flash: beginning of Intel command set support
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
405 
diff
changeset
 | 
162 stat = do_w16(bi->base_addr + sp->start, 0x50); | 
| 
 
f2cc551e597f
fc-loadtool flash: beginning of Intel command set support
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
405 
diff
changeset
 | 
163 if (stat) { | 
| 
 
f2cc551e597f
fc-loadtool flash: beginning of Intel command set support
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
405 
diff
changeset
 | 
164 bad_w16: fprintf(stderr, | 
| 
 
f2cc551e597f
fc-loadtool flash: beginning of Intel command set support
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
405 
diff
changeset
 | 
165 "unexpected response to w16 in erase cmd sequence - aborting\n"); | 
| 
 
f2cc551e597f
fc-loadtool flash: beginning of Intel command set support
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
405 
diff
changeset
 | 
166 return(-1); | 
| 
 
f2cc551e597f
fc-loadtool flash: beginning of Intel command set support
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
405 
diff
changeset
 | 
167 } | 
| 
 
f2cc551e597f
fc-loadtool flash: beginning of Intel command set support
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
405 
diff
changeset
 | 
168 /* send the actual block erase command */ | 
| 
 
f2cc551e597f
fc-loadtool flash: beginning of Intel command set support
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
405 
diff
changeset
 | 
169 stat = do_w16(bi->base_addr + sp->start, 0x20); | 
| 
 
f2cc551e597f
fc-loadtool flash: beginning of Intel command set support
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
405 
diff
changeset
 | 
170 if (stat) | 
| 
 
f2cc551e597f
fc-loadtool flash: beginning of Intel command set support
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
405 
diff
changeset
 | 
171 goto bad_w16; | 
| 
 
f2cc551e597f
fc-loadtool flash: beginning of Intel command set support
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
405 
diff
changeset
 | 
172 stat = do_w16(bi->base_addr + sp->start, 0xD0); | 
| 
 
f2cc551e597f
fc-loadtool flash: beginning of Intel command set support
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
405 
diff
changeset
 | 
173 if (stat) | 
| 
 
f2cc551e597f
fc-loadtool flash: beginning of Intel command set support
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
405 
diff
changeset
 | 
174 goto bad_w16; | 
| 
 
f2cc551e597f
fc-loadtool flash: beginning of Intel command set support
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
405 
diff
changeset
 | 
175 /* wait for completion */ | 
| 
 
f2cc551e597f
fc-loadtool flash: beginning of Intel command set support
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
405 
diff
changeset
 | 
176 start_time = time(0); | 
| 
 
f2cc551e597f
fc-loadtool flash: beginning of Intel command set support
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
405 
diff
changeset
 | 
177 for (;;) { | 
| 
 
f2cc551e597f
fc-loadtool flash: beginning of Intel command set support
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
405 
diff
changeset
 | 
178 stat = do_r16(bi->base_addr + sp->start, &flstat); | 
| 
 
f2cc551e597f
fc-loadtool flash: beginning of Intel command set support
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
405 
diff
changeset
 | 
179 if (stat) | 
| 
 
f2cc551e597f
fc-loadtool flash: beginning of Intel command set support
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
405 
diff
changeset
 | 
180 return(stat); /* error msg already printed */ | 
| 
 
f2cc551e597f
fc-loadtool flash: beginning of Intel command set support
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
405 
diff
changeset
 | 
181 if (flstat & 0x80) | 
| 
 
f2cc551e597f
fc-loadtool flash: beginning of Intel command set support
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
405 
diff
changeset
 | 
182 break; | 
| 
 
f2cc551e597f
fc-loadtool flash: beginning of Intel command set support
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
405 
diff
changeset
 | 
183 curtime = time(0); | 
| 
 
f2cc551e597f
fc-loadtool flash: beginning of Intel command set support
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
405 
diff
changeset
 | 
184 if (curtime >= start_time + 20) { | 
| 
 
f2cc551e597f
fc-loadtool flash: beginning of Intel command set support
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
405 
diff
changeset
 | 
185 fprintf(stderr, "erase timeout, aborting\n"); | 
| 
 
f2cc551e597f
fc-loadtool flash: beginning of Intel command set support
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
405 
diff
changeset
 | 
186 return(-1); | 
| 
 
f2cc551e597f
fc-loadtool flash: beginning of Intel command set support
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
405 
diff
changeset
 | 
187 } | 
| 
 
f2cc551e597f
fc-loadtool flash: beginning of Intel command set support
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
405 
diff
changeset
 | 
188 } | 
| 
 
f2cc551e597f
fc-loadtool flash: beginning of Intel command set support
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
405 
diff
changeset
 | 
189 if (flstat & 0x20) { | 
| 
 
f2cc551e597f
fc-loadtool flash: beginning of Intel command set support
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
405 
diff
changeset
 | 
190 fprintf(stderr, "block erase failed!\n"); | 
| 
 
f2cc551e597f
fc-loadtool flash: beginning of Intel command set support
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
405 
diff
changeset
 | 
191 return(-1); | 
| 
 
f2cc551e597f
fc-loadtool flash: beginning of Intel command set support
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
405 
diff
changeset
 | 
192 } else | 
| 
 
f2cc551e597f
fc-loadtool flash: beginning of Intel command set support
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
405 
diff
changeset
 | 
193 return(0); | 
| 
 
f2cc551e597f
fc-loadtool flash: beginning of Intel command set support
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
405 
diff
changeset
 | 
194 } | 
| 
 
f2cc551e597f
fc-loadtool flash: beginning of Intel command set support
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
405 
diff
changeset
 | 
195 | 
| 
410
 
81d387690063
Intel flash: clear SR before programming
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
409 
diff
changeset
 | 
196 intel_clear_sr(bi) | 
| 
 
81d387690063
Intel flash: clear SR before programming
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
409 
diff
changeset
 | 
197 struct flash_bank_info *bi; | 
| 
 
81d387690063
Intel flash: clear SR before programming
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
409 
diff
changeset
 | 
198 { | 
| 
 
81d387690063
Intel flash: clear SR before programming
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
409 
diff
changeset
 | 
199 printf("Clearing Intel flash SR\n"); | 
| 
 
81d387690063
Intel flash: clear SR before programming
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
409 
diff
changeset
 | 
200 if (do_w16(bi->base_addr, 0x50)) { | 
| 
 
81d387690063
Intel flash: clear SR before programming
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
409 
diff
changeset
 | 
201 fprintf(stderr, | 
| 
 
81d387690063
Intel flash: clear SR before programming
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
409 
diff
changeset
 | 
202 "unexpected response to w16 for Clear SR command\n"); | 
| 
 
81d387690063
Intel flash: clear SR before programming
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
409 
diff
changeset
 | 
203 return(-1); | 
| 
 
81d387690063
Intel flash: clear SR before programming
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
409 
diff
changeset
 | 
204 } | 
| 
 
81d387690063
Intel flash: clear SR before programming
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
409 
diff
changeset
 | 
205 return(0); | 
| 
 
81d387690063
Intel flash: clear SR before programming
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
409 
diff
changeset
 | 
206 } | 
| 
 
81d387690063
Intel flash: clear SR before programming
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
409 
diff
changeset
 | 
207 | 
| 
407
 
f2cc551e597f
fc-loadtool flash: beginning of Intel command set support
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
405 
diff
changeset
 | 
208 struct flash_cmdset flash_cmdset_intel = { | 
| 
 
f2cc551e597f
fc-loadtool flash: beginning of Intel command set support
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
405 
diff
changeset
 | 
209 .cmdset_name = "Intel", | 
| 
 
f2cc551e597f
fc-loadtool flash: beginning of Intel command set support
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
405 
diff
changeset
 | 
210 .reset_cmd = intel_reset_cmd, | 
| 
408
 
431023033c86
Intel flash: flash status command implemented
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
407 
diff
changeset
 | 
211 .status_cmd = intel_status_cmd, | 
| 
407
 
f2cc551e597f
fc-loadtool flash: beginning of Intel command set support
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
405 
diff
changeset
 | 
212 .unlock_sector = intel_sector_unlock, | 
| 
 
f2cc551e597f
fc-loadtool flash: beginning of Intel command set support
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
405 
diff
changeset
 | 
213 .erase_sector = intel_sector_erase, | 
| 
410
 
81d387690063
Intel flash: clear SR before programming
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
409 
diff
changeset
 | 
214 .prep_for_program = intel_clear_sr, | 
| 
407
 
f2cc551e597f
fc-loadtool flash: beginning of Intel command set support
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
405 
diff
changeset
 | 
215 .loadagent_setbase_cmd = "INFB", | 
| 
 
f2cc551e597f
fc-loadtool flash: beginning of Intel command set support
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
405 
diff
changeset
 | 
216 .loadagent_program_cmd = "INFW", | 
| 
409
 
23ab8fe81764
Intel flash: unlock command implemented
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
408 
diff
changeset
 | 
217 .needs_unlock = 1, | 
| 
407
 
f2cc551e597f
fc-loadtool flash: beginning of Intel command set support
 
Michael Spacefalcon <msokolov@ivan.Harhan.ORG> 
parents: 
405 
diff
changeset
 | 
218 }; | 
