FreeCalypso > hg > freecalypso-sw
comparison loadtools/flashops.c @ 408:431023033c86
Intel flash: flash status command implemented
author | Michael Spacefalcon <msokolov@ivan.Harhan.ORG> |
---|---|
date | Tue, 17 Jun 2014 01:52:46 +0000 |
parents | f2cc551e597f |
children | 23ab8fe81764 |
comparison
equal
deleted
inserted
replaced
407:f2cc551e597f | 408:431023033c86 |
---|---|
102 if (do_w16(bi->base_addr, 0xFF)) { | 102 if (do_w16(bi->base_addr, 0xFF)) { |
103 fprintf(stderr, | 103 fprintf(stderr, |
104 "unexpected response to w16 when resetting flash to read mode!\n"); | 104 "unexpected response to w16 when resetting flash to read mode!\n"); |
105 return(-1); | 105 return(-1); |
106 } | 106 } |
107 return(0); | |
108 } | |
109 | |
110 intel_status_cmd(bi) | |
111 struct flash_bank_info *bi; | |
112 { | |
113 int stat; | |
114 uint16_t sr; | |
115 | |
116 /* issue Read SR command */ | |
117 stat = do_w16(bi->base_addr, 0x70); | |
118 if (stat) { | |
119 fprintf(stderr, | |
120 "unexpected response to w16 for Read SR command\n"); | |
121 return(-1); | |
122 } | |
123 stat = do_r16(bi->base_addr, &sr); | |
124 if (stat) | |
125 return(stat); /* error msg already printed */ | |
126 sr &= 0xFF; | |
127 printf("Status Register: %02X\n", sr); | |
107 return(0); | 128 return(0); |
108 } | 129 } |
109 | 130 |
110 intel_sector_unlock(bi, sp) | 131 intel_sector_unlock(bi, sp) |
111 struct flash_bank_info *bi; | 132 struct flash_bank_info *bi; |
172 } | 193 } |
173 | 194 |
174 struct flash_cmdset flash_cmdset_intel = { | 195 struct flash_cmdset flash_cmdset_intel = { |
175 .cmdset_name = "Intel", | 196 .cmdset_name = "Intel", |
176 .reset_cmd = intel_reset_cmd, | 197 .reset_cmd = intel_reset_cmd, |
177 .status_cmd = invalid, | 198 .status_cmd = intel_status_cmd, |
178 .unlock_sector = intel_sector_unlock, | 199 .unlock_sector = intel_sector_unlock, |
179 .erase_sector = intel_sector_erase, | 200 .erase_sector = intel_sector_erase, |
180 .loadagent_setbase_cmd = "INFB", | 201 .loadagent_setbase_cmd = "INFB", |
181 .loadagent_program_cmd = "INFW", | 202 .loadagent_program_cmd = "INFW", |
182 }; | 203 }; |