Mercurial > flash_v2
changeset 1371:e4d78a7a628d
Remove support for non-RAM drivers (depricated)
| author | gthomas |
|---|---|
| date | Thu, 20 Nov 2003 14:48:46 +0000 |
| parents | b83338d7c212 |
| children | 121121d3d18f |
| files | packages/io/flash/current/ChangeLog packages/io/flash/current/cdl/io_flash.cdl packages/io/flash/current/src/flash.c |
| diffstat | 3 files changed, 22 insertions(+), 98 deletions(-) [+] |
line wrap: on
line diff
--- a/packages/io/flash/current/ChangeLog +++ b/packages/io/flash/current/ChangeLog @@ -1,3 +1,10 @@ +2003-11-20 Jani Monoses <jani@iv.ro> + + * cdl/io_flash.cdl: + * src/flash.c: Remove handling of CYGHWR_IO_FLASH_DEVICE_NOT_IN_RAM + now that all flash drivers use ELF sections to specify which parts + go in RAM. + 2003-10-08 Roland Cassebohm <roland.cassebohm@visionsystems.de> * src/flash.c: Fix parse error if CYGSEM_IO_FLASH_READ_INDIRECT
--- a/packages/io/flash/current/cdl/io_flash.cdl +++ b/packages/io/flash/current/cdl/io_flash.cdl @@ -92,10 +92,10 @@ cdl_package CYGPKG_IO_FLASH { display "Hardware FLASH device drivers are not in RAM" flavor booldata description " - This option makes the IO driver copy the device - driver functions to RAM before calling them. Newer - drivers should make sure that the functions are + Use of this interface is deprecated. + Drivers should make sure that the functions are linked to RAM by putting them in .2ram sections." + requires !CYGHWR_IO_FLASH_DEVICE_NOT_IN_RAM } cdl_interface CYGHWR_IO_FLASH_BLOCK_LOCKING {
--- a/packages/io/flash/current/src/flash.c +++ b/packages/io/flash/current/src/flash.c @@ -68,7 +68,6 @@ #undef RAM_FLASH_DEV_DEBUG #if !defined(CYG_HAL_STARTUP_RAM) && defined(RAM_FLASH_DEV_DEBUG) # warning "Can only enable the flash debugging when configured for RAM startup" -# undef CYGHWR_IO_FLASH_DEVICE_NOT_IN_RAM #endif struct flash_info flash_info; @@ -90,7 +89,6 @@ flash_init(void *work_space, int work_sp return FLASH_ERR_OK; } -#ifndef CYGHWR_IO_FLASH_DEVICE_NOT_IN_RAM // Use this function to make function pointers anonymous - forcing the // compiler to use jumps instead of branches when calling driver // services. @@ -98,7 +96,6 @@ static void* __anonymizer(void* p) { return p; } -#endif // FIXME: Want to change all drivers to use this function. But it may // make sense to wait till device structure pointer arguments get @@ -110,22 +107,8 @@ flash_dev_query(void* data) code_fun *_flash_query; int d_cache, i_cache; -#ifdef CYGHWR_IO_FLASH_DEVICE_NOT_IN_RAM - { - extern char flash_query[], flash_query_end[]; - CYG_ADDRESS code_len; - - // Query the device driver - copy 'query' code to RAM for execution - code_len = (CYG_ADDRESS)&flash_query_end - (CYG_ADDRESS)&flash_query; - _flash_query = (code_fun *)flash_info.work_space; - memcpy(_flash_query, &flash_query, code_len); - } -#else - { - externC code_fun flash_query; - _flash_query = (code_fun*) __anonymizer(&flash_query); - } -#endif + externC code_fun flash_query; + _flash_query = (code_fun*) __anonymizer(&flash_query); HAL_FLASH_CACHES_OFF(d_cache, i_cache); (*_flash_query)(data); @@ -186,22 +169,8 @@ flash_erase(void *addr, int len, void ** return FLASH_ERR_PROTECT; #endif -#ifdef CYGHWR_IO_FLASH_DEVICE_NOT_IN_RAM - { - extern char flash_erase_block[], flash_erase_block_end[]; - CYG_ADDRESS code_len; - - // Copy 'erase' code to RAM for execution - code_len = (CYG_ADDRESS)&flash_erase_block_end - (CYG_ADDRESS)&flash_erase_block; - _flash_erase_block = (code_fun *)flash_info.work_space; - memcpy(_flash_erase_block, &flash_erase_block, code_len); - } -#else - { - externC code_fun flash_erase_block; - _flash_erase_block = (code_fun*) __anonymizer(&flash_erase_block); - } -#endif + externC code_fun flash_erase_block; + _flash_erase_block = (code_fun*) __anonymizer(&flash_erase_block); block = (unsigned short *)((CYG_ADDRESS)addr & flash_info.block_mask); end_addr = (unsigned short *)((CYG_ADDRESS)addr+len); @@ -287,21 +256,8 @@ flash_program(void *_addr, void *_data, return FLASH_ERR_PROTECT; #endif -#ifdef CYGHWR_IO_FLASH_DEVICE_NOT_IN_RAM - { - CYG_ADDRESS code_len; - extern char flash_program_buf[], flash_program_buf_end[]; - // Copy 'program' code to RAM for execution - code_len = (CYG_ADDRESS)&flash_program_buf_end - (CYG_ADDRESS)&flash_program_buf; - _flash_program_buf = (code_fun *)flash_info.work_space; - memcpy(_flash_program_buf, &flash_program_buf, code_len); - } -#else - { - externC code_fun flash_program_buf; - _flash_program_buf = (code_fun*) __anonymizer(&flash_program_buf); - } -#endif + externC code_fun flash_program_buf; + _flash_program_buf = (code_fun*) __anonymizer(&flash_program_buf); #ifdef CYGSEM_IO_FLASH_CHATTER (*flash_info.pf)("... Program from %p-%p at %p: ", (void*)data, @@ -374,21 +330,8 @@ flash_read(void *_addr, void *_data, int return FLASH_ERR_PROTECT; #endif -#ifdef CYGHWR_IO_FLASH_DEVICE_NOT_IN_RAM - { - CYG_ADDRESS code_len; - extern char flash_read_buf[], flash_read_buf_end[]; - // Copy 'read' code to RAM for execution - code_len = (CYG_ADDRESS)&flash_read_buf_end - (CYG_ADDRESS)&flash_read_buf; - _flash_read_buf = (code_fun *)flash_info.work_space; - memcpy(_flash_read_buf, &flash_read_buf, code_len); - } -#else - { - externC code_fun flash_read_buf; - _flash_read_buf = (code_fun*) __anonymizer(&flash_read_buf); - } -#endif + externC code_fun flash_read_buf; + _flash_read_buf = (code_fun*) __anonymizer(&flash_read_buf); #ifdef CYGSEM_IO_FLASH_CHATTER (*flash_info.pf)("... Read from %p-%p at %p: ", (void*)data, @@ -467,21 +410,8 @@ flash_lock(void *addr, int len, void **e return FLASH_ERR_PROTECT; #endif -#ifdef CYGHWR_IO_FLASH_DEVICE_NOT_IN_RAM - { - extern char flash_lock_block[], flash_lock_block_end[]; - CYG_ADDRESS code_len; - // Copy 'lock' code to RAM for execution - code_len = (CYG_ADDRESS)&flash_lock_block_end - (CYG_ADDRESS)&flash_lock_block; - _flash_lock_block = (code_fun *)flash_info.work_space; - memcpy(_flash_lock_block, &flash_lock_block, code_len); - } -#else - { - externC code_fun flash_lock_block; - _flash_lock_block = (code_fun*) __anonymizer(&flash_lock_block); - } -#endif + externC code_fun flash_lock_block; + _flash_lock_block = (code_fun*) __anonymizer(&flash_lock_block); block = (unsigned short *)((CYG_ADDRESS)addr & flash_info.block_mask); end_addr = (unsigned short *)((CYG_ADDRESS)addr+len); @@ -545,21 +475,8 @@ flash_unlock(void *addr, int len, void * return FLASH_ERR_PROTECT; #endif -#ifdef CYGHWR_IO_FLASH_DEVICE_NOT_IN_RAM - { - extern char flash_unlock_block[], flash_unlock_block_end[]; - CYG_ADDRESS code_len; - // Copy 'lock' code to RAM for execution - code_len = (CYG_ADDRESS)&flash_unlock_block_end - (CYG_ADDRESS)&flash_unlock_block; - _flash_unlock_block = (code_fun *)flash_info.work_space; - memcpy(_flash_unlock_block, &flash_unlock_block, code_len); - } -#else - { - externC code_fun flash_unlock_block; - _flash_unlock_block = (code_fun*) __anonymizer(&flash_unlock_block); - } -#endif + externC code_fun flash_unlock_block; + _flash_unlock_block = (code_fun*) __anonymizer(&flash_unlock_block); block = (unsigned short *)((CYG_ADDRESS)addr & flash_info.block_mask); end_addr = (unsigned short *)((CYG_ADDRESS)addr+len);
