comparison packages/io/flash/current/src/legacy_dev.c @ 1769:8667859d61ab

* src/flash_legacy.h: Undef HAL_FLASH_CACHES_* macros if the HAL supplied them and they're not needed. * cdl/io_flash.cdl, src/flash.c, src/flash_legacy.h, src/legacy_dev.c: add support for V2 drivers which can take care of the cache and interrupts themselves.
author jlarmour
date Wed, 27 Sep 2006 14:24:46 +0000
parents bfd6d67dba43
children 79275fdb4f20
comparison
equal deleted inserted replaced
1768:ef75ad79dfe3 1769:8667859d61ab
7 //========================================================================== 7 //==========================================================================
8 //####ECOSGPLCOPYRIGHTBEGIN#### 8 //####ECOSGPLCOPYRIGHTBEGIN####
9 // ------------------------------------------- 9 // -------------------------------------------
10 // This file is part of eCos, the Embedded Configurable Operating System. 10 // This file is part of eCos, the Embedded Configurable Operating System.
11 // Copyright (C) 2004 Andrew Lunn 11 // Copyright (C) 2004 Andrew Lunn
12 // Copyright (C) 2004 eCosCentric Limited
12 // 13 //
13 // eCos is free software; you can redistribute it and/or modify it under 14 // eCos is free software; you can redistribute it and/or modify it under
14 // the terms of the GNU General Public License as published by the Free 15 // the terms of the GNU General Public License as published by the Free
15 // Software Foundation; either version 2 or (at your option) any later version. 16 // Software Foundation; either version 2 or (at your option) any later version.
16 // 17 //
139 cyg_flashaddr_t base, 140 cyg_flashaddr_t base,
140 const void* data, size_t len) 141 const void* data, size_t len)
141 { 142 {
142 typedef int code_fun(cyg_flashaddr_t, const void *, int, unsigned long, int); 143 typedef int code_fun(cyg_flashaddr_t, const void *, int, unsigned long, int);
143 code_fun *_flash_program_buf; 144 code_fun *_flash_program_buf;
144 size_t block_mask = ~(block_mask -1); 145 size_t block_mask = ~(block_size -1);
145 int stat; 146 int stat;
146 147
147 _flash_program_buf = (code_fun*) cyg_flash_anonymizer(&flash_program_buf); 148 _flash_program_buf = (code_fun*) cyg_flash_anonymizer(&flash_program_buf);
148 149
149 stat = (*_flash_program_buf)(base, data, len, block_mask, flash_info.buffer_size); 150 stat = (*_flash_program_buf)(base, data, len, block_mask, flash_info.buffer_size);
157 void* data, size_t len) 158 void* data, size_t len)
158 { 159 {
159 typedef int code_fun(const cyg_flashaddr_t, void *, int, unsigned long, int); 160 typedef int code_fun(const cyg_flashaddr_t, void *, int, unsigned long, int);
160 code_fun *_flash_read_buf; 161 code_fun *_flash_read_buf;
161 size_t block_size = dev->block_info[0].block_size; 162 size_t block_size = dev->block_info[0].block_size;
162 size_t block_mask = ~(block_mask -1); 163 size_t block_mask = ~(block_size -1);
163 int stat; 164 int stat;
164 _flash_read_buf = (code_fun*) cyg_flash_anonymizer(&flash_read_buf); 165 _flash_read_buf = (code_fun*) cyg_flash_anonymizer(&flash_read_buf);
165 166
166 stat = (*_flash_read_buf)(base, data, len, block_mask, block_size); 167 stat = (*_flash_read_buf)(base, data, len, block_mask, block_size);
167 return flash_hwr_map_error(stat); 168 return flash_hwr_map_error(stat);
206 void 207 void
207 flash_dev_query(void* data) 208 flash_dev_query(void* data)
208 { 209 {
209 typedef void code_fun(void*); 210 typedef void code_fun(void*);
210 code_fun *_flash_query; 211 code_fun *_flash_query;
211 int d_cache, i_cache; 212 HAL_FLASH_CACHES_STATE(d_cache, i_cache);
212 213
213 _flash_query = (code_fun*) cyg_flash_anonymizer(&flash_query); 214 _flash_query = (code_fun*) cyg_flash_anonymizer(&flash_query);
214 215
215 HAL_FLASH_CACHES_OFF(d_cache, i_cache); 216 HAL_FLASH_CACHES_OFF(d_cache, i_cache);
216 (*_flash_query)(data); 217 (*_flash_query)(data);