comparison packages/io/flash/current/src/flash.c @ 151:25e238959bae

Merge from eCos master repository on 2001-02-12-23:44:24-GMT
author jlarmour
date Tue, 13 Feb 2001 01:23:16 +0000
parents 6b5f480c6929
children e2d866e32dac
comparison
equal deleted inserted replaced
150:f0e3fb000de8 151:25e238959bae
88 extern char flash_query[], flash_query_end[]; 88 extern char flash_query[], flash_query_end[];
89 typedef void code_fun(void*); 89 typedef void code_fun(void*);
90 int code_len; 90 int code_len;
91 code_fun *_flash_query; 91 code_fun *_flash_query;
92 int d_cache, i_cache; 92 int d_cache, i_cache;
93 void* flash_id;
94 93
95 // Query the device driver - copy 'query' code to RAM for execution 94 // Query the device driver - copy 'query' code to RAM for execution
96 code_len = (unsigned long)&flash_query_end - (unsigned long)&flash_query; 95 code_len = (unsigned long)&flash_query_end - (unsigned long)&flash_query;
97 _flash_query = (code_fun *)flash_info.work_space; 96 _flash_query = (code_fun *)flash_info.work_space;
98 memcpy(_flash_query, &flash_query, code_len); 97 memcpy(_flash_query, &flash_query, code_len);
145 { 144 {
146 unsigned short *block, *end_addr; 145 unsigned short *block, *end_addr;
147 int stat = 0; 146 int stat = 0;
148 extern char flash_erase_block[], flash_erase_block_end[]; 147 extern char flash_erase_block[], flash_erase_block_end[];
149 int code_len; 148 int code_len;
150 typedef int code_fun(unsigned short *); 149 typedef int code_fun(unsigned short *, unsigned int);
151 code_fun *_flash_erase_block; 150 code_fun *_flash_erase_block;
152 int d_cache, i_cache; 151 int d_cache, i_cache;
153 152
154 if (!flash_info.init) { 153 if (!flash_info.init) {
155 return FLASH_ERR_NOT_INIT; 154 return FLASH_ERR_NOT_INIT;
168 167
169 while (block < end_addr) { 168 while (block < end_addr) {
170 #ifdef RAM_FLASH_DEV_DEBUG 169 #ifdef RAM_FLASH_DEV_DEBUG
171 _flash_erase_block = &flash_erase_block; 170 _flash_erase_block = &flash_erase_block;
172 #endif 171 #endif
173 stat = (*_flash_erase_block)(block); 172 // Supply the blocksize for a gross check for erase success
173 stat = (*_flash_erase_block)(block, flash_info.block_size);
174 stat = flash_hwr_map_error(stat); 174 stat = flash_hwr_map_error(stat);
175 if (stat) { 175 if (stat) {
176 *err_addr = (void *)block; 176 *err_addr = (void *)block;
177 break; 177 break;
178 } 178 }
349 return "Data verify failed after operation"; 349 return "Data verify failed after operation";
350 default: 350 default:
351 return "Unknown error"; 351 return "Unknown error";
352 } 352 }
353 } 353 }
354
355 // EOF io/flash/..../flash.c