Mercurial > flash_v2
comparison packages/io/flash/current/src/flash.c @ 163:0d2b193a635f
Merge from eCos master repository on 2001-06-22-17:38:39-BST
| author | jlarmour |
|---|---|
| date | Fri, 22 Jun 2001 18:18:44 +0000 |
| parents | 2395031e7a66 |
| children | 38892b97b685 |
comparison
equal
deleted
inserted
replaced
| 162:2395031e7a66 | 163:0d2b193a635f |
|---|---|
| 66 flash_init(void *work_space, int work_space_size, _printf *pf) | 66 flash_init(void *work_space, int work_space_size, _printf *pf) |
| 67 { | 67 { |
| 68 int err; | 68 int err; |
| 69 | 69 |
| 70 if (flash_info.init) return FLASH_ERR_OK; | 70 if (flash_info.init) return FLASH_ERR_OK; |
| 71 flash_info.pf = pf; // Do this before calling into the driver | |
| 71 flash_info.work_space = work_space; | 72 flash_info.work_space = work_space; |
| 72 flash_info.work_space_size = work_space_size; | 73 flash_info.work_space_size = work_space_size; |
| 73 if ((err = flash_hwr_init()) != FLASH_ERR_OK) { | 74 if ((err = flash_hwr_init()) != FLASH_ERR_OK) { |
| 74 return err; | 75 return err; |
| 75 } | 76 } |
| 76 flash_info.block_mask = ~(flash_info.block_size-1); | 77 flash_info.block_mask = ~(flash_info.block_size-1); |
| 77 flash_info.init = 1; | 78 flash_info.init = 1; |
| 78 flash_info.pf = pf; | |
| 79 return FLASH_ERR_OK; | 79 return FLASH_ERR_OK; |
| 80 } | 80 } |
| 81 | 81 |
| 82 #ifndef CYGHWR_IO_FLASH_DEVICE_NOT_IN_RAM | 82 #ifndef CYGHWR_IO_FLASH_DEVICE_NOT_IN_RAM |
| 83 // Use this function to make function pointers anonymous - forcing the | 83 // Use this function to make function pointers anonymous - forcing the |
| 253 | 253 |
| 254 stat = (*_flash_program_buf)(addr, data, size, | 254 stat = (*_flash_program_buf)(addr, data, size, |
| 255 flash_info.block_mask, flash_info.buffer_size); | 255 flash_info.block_mask, flash_info.buffer_size); |
| 256 stat = flash_hwr_map_error(stat); | 256 stat = flash_hwr_map_error(stat); |
| 257 #ifdef CYGSEM_IO_FLASH_VERIFY_PROGRAM | 257 #ifdef CYGSEM_IO_FLASH_VERIFY_PROGRAM |
| 258 if (memcmp(addr, data, size) != 0) { | 258 if (0 == stat) // Claims to be OK |
| 259 stat = 0x0BAD; | 259 if (memcmp(addr, data, size) != 0) { |
| 260 (*flash_info.pf)("V"); | 260 stat = 0x0BAD; |
| 261 } | 261 (*flash_info.pf)("V"); |
| 262 } | |
| 262 #endif | 263 #endif |
| 263 if (stat) { | 264 if (stat) { |
| 264 *err_addr = (void *)addr; | 265 *err_addr = (void *)addr; |
| 265 break; | 266 break; |
| 266 } | 267 } |
