Mercurial > flash_v2
changeset 1370:b83338d7c212
* cdl/flash_edb7xxx.cdl:
* src/edb7xxx_flash.c.c:
* src/flash_query.c:
* src/flash_erase_block.c:
* src/flash_program_buf.c: Place flash functions in RAM sections
and no longer implement CYGHWR_IO_FLASH_DEVICE_NOT_IN_RAM. Use
generic flash_dev_query().
| author | asl |
|---|---|
| date | Thu, 20 Nov 2003 12:33:37 +0000 |
| parents | c92d7972c02c |
| children | e4d78a7a628d |
| files | packages/devs/flash/arm/edb7xxx/current/ChangeLog packages/devs/flash/arm/edb7xxx/current/cdl/flash_edb7xxx.cdl packages/devs/flash/arm/edb7xxx/current/src/edb7xxx_flash.c packages/devs/flash/arm/edb7xxx/current/src/flash_erase_block.c packages/devs/flash/arm/edb7xxx/current/src/flash_program_buf.c packages/devs/flash/arm/edb7xxx/current/src/flash_query.c |
| diffstat | 6 files changed, 20 insertions(+), 88 deletions(-) [+] |
line wrap: on
line diff
--- a/packages/devs/flash/arm/edb7xxx/current/ChangeLog +++ b/packages/devs/flash/arm/edb7xxx/current/ChangeLog @@ -1,3 +1,13 @@ +2003-11-20 Jani Monoses <jani@iv.ro> + + * cdl/flash_edb7xxx.cdl: + * src/edb7xxx_flash.c.c: + * src/flash_query.c: + * src/flash_erase_block.c: + * src/flash_program_buf.c: Place flash functions in RAM sections + and no longer implement CYGHWR_IO_FLASH_DEVICE_NOT_IN_RAM. Use + generic flash_dev_query(). + 2001-10-14 Gary Thomas <gthomas@redhat.com> * cdl/flash_edb7xxx.cdl: Missed change in include file location
--- a/packages/devs/flash/arm/edb7xxx/current/cdl/flash_edb7xxx.cdl +++ b/packages/devs/flash/arm/edb7xxx/current/cdl/flash_edb7xxx.cdl @@ -67,34 +67,9 @@ cdl_package CYGPKG_DEVS_FLASH_EDB7XXX { calculated 1 no_define implements CYGHWR_IO_FLASH_DEVICE - implements CYGHWR_IO_FLASH_DEVICE_NOT_IN_RAM - - compile edb7xxx_flash.c - make -priority 1 { - flash_erase_block.o: $(REPOSITORY)/$(PACKAGE)/src/flash_erase_block.c - $(CC) -S $(INCLUDE_PATH) $(CFLAGS) -g0 -mcpu=strongarm -fno-function-sections $(REPOSITORY)/$(PACKAGE)/src/flash_erase_block.c - echo " .globl flash_erase_block_end" >>flash_erase_block.s - echo "flash_erase_block_end:" >>flash_erase_block.s - $(CC) -c -o flash_erase_block.o flash_erase_block.s - $(AR) rcs $(PREFIX)/lib/libtarget.a flash_erase_block.o - } - make -priority 1 { - flash_program_buf.o: $(REPOSITORY)/$(PACKAGE)/src/flash_program_buf.c - $(CC) -S $(INCLUDE_PATH) $(CFLAGS) -g0 -mcpu=strongarm -fno-function-sections $(REPOSITORY)/$(PACKAGE)/src/flash_program_buf.c - echo " .globl flash_program_buf_end" >>flash_program_buf.s - echo "flash_program_buf_end:" >>flash_program_buf.s - $(CC) -c -o flash_program_buf.o flash_program_buf.s - $(AR) rcs $(PREFIX)/lib/libtarget.a flash_program_buf.o - } - make -priority 1 { - flash_query.o: $(REPOSITORY)/$(PACKAGE)/src/flash_query.c - $(CC) -S $(INCLUDE_PATH) $(CFLAGS) -g0 -mcpu=strongarm -fno-function-sections $(REPOSITORY)/$(PACKAGE)/src/flash_query.c - echo " .globl flash_query_end" >>flash_query.s - echo "flash_query_end:" >>flash_query.s - $(CC) -c -o flash_query.o flash_query.s - $(AR) rcs $(PREFIX)/lib/libtarget.a flash_query.o - } + compile edb7xxx_flash.c flash_query.c flash_program_buf.c flash_erase_block.c + } cdl_component CYGPKG_DEVS_FLASH_STRATA_EDB7XXX { display "Cirrus Logic EDB7xxx StrataFLASH memory support"
--- a/packages/devs/flash/arm/edb7xxx/current/src/edb7xxx_flash.c +++ b/packages/devs/flash/arm/edb7xxx/current/src/edb7xxx_flash.c @@ -52,7 +52,6 @@ #include <pkgconf/hal.h> #include <cyg/hal/hal_arch.h> -#include <cyg/hal/hal_cache.h> #define _FLASH_PRIVATE_ #include <cyg/io/flash.h> @@ -65,16 +64,7 @@ int flash_hwr_init(void) { unsigned short data[4]; - extern char flash_query, flash_query_end; - typedef int code_fun(unsigned char *); - code_fun *_flash_query; - int code_len, stat, num_regions, region_size; - - // Copy 'program' code to RAM for execution - code_len = (unsigned long)&flash_query_end - (unsigned long)&flash_query; - _flash_query = (code_fun *)flash_info.work_space; - memcpy(_flash_query, &flash_query, code_len); - HAL_DCACHE_SYNC(); // Should guarantee this code will run + int num_regions, region_size; #if 0 { @@ -105,9 +95,8 @@ flash_hwr_init(void) } #endif - stat = (*_flash_query)(data); + flash_dev_query(data); #if 0 - (*flash_info.pf)("stat = %x\n", stat); dump_buf(data, sizeof(data)); #endif
--- a/packages/devs/flash/arm/edb7xxx/current/src/flash_erase_block.c +++ b/packages/devs/flash/arm/edb7xxx/current/src/flash_erase_block.c @@ -54,27 +54,17 @@ #include <pkgconf/hal.h> #include <cyg/hal/hal_arch.h> -#include <cyg/hal/hal_cache.h> -// -// CAUTION! This code must be copied to RAM before execution. Therefore, -// it must not contain any code which might be position dependent! -// +int flash_erase_block(volatile unsigned long * block) + __attribute__ ((section (".2ram.flash_erase_block"))); int flash_erase_block(volatile unsigned long *block) { volatile unsigned long *ROM, *sb; unsigned long stat; int timeout = 50000; - int cache_on; int len, block_size; - HAL_DCACHE_IS_ENABLED(cache_on); - if (cache_on) { - HAL_DCACHE_SYNC(); - HAL_DCACHE_DISABLE(); - } - ROM = (volatile unsigned long *)((unsigned long)block & 0xFF800000); // Clear any error conditions @@ -114,9 +104,5 @@ int flash_erase_block(volatile unsigned if (len == 0) stat = 0; } - if (cache_on) { - HAL_DCACHE_ENABLE(); - } - return stat; }
--- a/packages/devs/flash/arm/edb7xxx/current/src/flash_program_buf.c +++ b/packages/devs/flash/arm/edb7xxx/current/src/flash_program_buf.c @@ -54,12 +54,9 @@ #include <pkgconf/hal.h> #include <cyg/hal/hal_arch.h> -#include <cyg/hal/hal_cache.h> -// -// CAUTION! This code must be copied to RAM before execution. Therefore, -// it must not contain any code which might be position dependent! -// +int flash_program_buf(volatile unsigned long* addr, unsigned long* data, int len) + __attribute__ ((section (".2ram.flash_program_buf"))); int flash_program_buf(volatile unsigned long *addr, unsigned long *data, int len) @@ -67,13 +64,6 @@ flash_program_buf(volatile unsigned long volatile unsigned long *ROM; unsigned long stat = 0; int timeout = 50000; - int cache_on; - - HAL_DCACHE_IS_ENABLED(cache_on); - if (cache_on) { - HAL_DCACHE_SYNC(); - HAL_DCACHE_DISABLE(); - } ROM = (volatile unsigned long *)((unsigned long)addr & 0xFF800000); @@ -104,9 +94,5 @@ flash_program_buf(volatile unsigned long bad: ROM[0] = FLASH_Reset; - if (cache_on) { - HAL_DCACHE_ENABLE(); - } - return stat; }
--- a/packages/devs/flash/arm/edb7xxx/current/src/flash_query.c +++ b/packages/devs/flash/arm/edb7xxx/current/src/flash_query.c @@ -54,28 +54,18 @@ #include <pkgconf/hal.h> #include <cyg/hal/hal_arch.h> -#include <cyg/hal/hal_cache.h> #include CYGHWR_MEMORY_LAYOUT_H -// -// CAUTION! This code must be copied to RAM before execution. Therefore, -// it must not contain any code which might be position dependent! -// #define CNT 2000*1000*10 // At least 20ms +int flash_query(unsigned short* data) __attribute__ ((section (".2ram.flash_query"))); + int flash_query(unsigned short *data) { volatile unsigned long *ROM; int cnt; - int cache_on; - - HAL_DCACHE_IS_ENABLED(cache_on); - if (cache_on) { - HAL_DCACHE_SYNC(); - HAL_DCACHE_DISABLE(); - } ROM = (volatile unsigned long *)0xE0000000; @@ -86,9 +76,5 @@ flash_query(unsigned short *data) ROM[0] = FLASH_Reset; - if (cache_on) { - HAL_DCACHE_ENABLE(); - } - return 0; }
