comparison packages/io/flash/current/src/legacy_dev.c @ 1765:bfd6d67dba43

V2 flash. Miscellaneous fixes to the legacy API and legacy device driver support
author bartv
date Tue, 22 Feb 2005 23:21:12 +0000
parents 96ec7e534d98
children 8667859d61ab
comparison
equal deleted inserted replaced
1764:96ec7e534d98 1765:bfd6d67dba43
87 legacy_flash_init (struct cyg_flash_dev *dev) 87 legacy_flash_init (struct cyg_flash_dev *dev)
88 { 88 {
89 int err; 89 int err;
90 static cyg_flash_block_info_t block_info[1]; 90 static cyg_flash_block_info_t block_info[1];
91 91
92 flash_info.pf = dev->pf;
93
92 err=flash_hwr_init(); 94 err=flash_hwr_init();
93 95
94 if (!err) { 96 if (!err) {
95 dev->start = (cyg_flashaddr_t)flash_info.start; 97 dev->start = (cyg_flashaddr_t)flash_info.start;
96 dev->end = dev->start + flash_info.block_size * flash_info.blocks - 1; 98 dev->end = dev->start + flash_info.block_size * flash_info.blocks - 1;
137 cyg_flashaddr_t base, 139 cyg_flashaddr_t base,
138 const void* data, size_t len) 140 const void* data, size_t len)
139 { 141 {
140 typedef int code_fun(cyg_flashaddr_t, const void *, int, unsigned long, int); 142 typedef int code_fun(cyg_flashaddr_t, const void *, int, unsigned long, int);
141 code_fun *_flash_program_buf; 143 code_fun *_flash_program_buf;
142 size_t block_size = dev->block_info[0].block_size;
143 size_t block_mask = ~(block_mask -1); 144 size_t block_mask = ~(block_mask -1);
144 int stat; 145 int stat;
145 146
146 _flash_program_buf = (code_fun*) cyg_flash_anonymizer(&flash_program_buf); 147 _flash_program_buf = (code_fun*) cyg_flash_anonymizer(&flash_program_buf);
147 148
148 stat = (*_flash_program_buf)(base, data, len, block_mask ,block_size); 149 stat = (*_flash_program_buf)(base, data, len, block_mask, flash_info.buffer_size);
149 return flash_hwr_map_error(stat); 150 return flash_hwr_map_error(stat);
150 } 151 }
151 152
152 #ifdef CYGSEM_IO_FLASH_READ_INDIRECT 153 #ifdef CYGSEM_IO_FLASH_READ_INDIRECT
153 static int 154 static int