Mercurial > ecos
changeset 1237:5acac6d0cccc
* cdl/flash_atlas.cdl: Added requirements for strncmp.
* cdl/flash_atlas.cdl:
* src/flash_lock_block.c (flash_lock_block):
* src/flash_unlock_block.c (flash_unlock_block):
* src/flash_erase_block.c (flash_erase_block):
* src/flash_query.c (flash_query):
* src/flash_program_buf.c (flash_program_buf): Use .2ram sections
for putting flash functions to RAM instead of the old method. Use
generic flash_dev_query
| author | asl |
|---|---|
| date | Tue, 23 Sep 2003 09:50:17 +0000 |
| parents | c3f02caa10bd |
| children | b3c09d540f56 |
| files | packages/devs/flash/mips/atlas/current/ChangeLog packages/devs/flash/mips/atlas/current/cdl/flash_atlas.cdl packages/devs/flash/mips/atlas/current/src/atlas_flash.c packages/devs/flash/mips/atlas/current/src/flash_erase_block.c packages/devs/flash/mips/atlas/current/src/flash_lock_block.c packages/devs/flash/mips/atlas/current/src/flash_program_buf.c packages/devs/flash/mips/atlas/current/src/flash_query.c packages/devs/flash/mips/atlas/current/src/flash_unlock_block.c |
| diffstat | 8 files changed, 41 insertions(+), 76 deletions(-) [+] |
line wrap: on
line diff
--- a/packages/devs/flash/mips/atlas/current/ChangeLog +++ b/packages/devs/flash/mips/atlas/current/ChangeLog @@ -1,3 +1,18 @@ +2003-09-23 Andrew Lunn <andrew.lunn@ascom.ch> + + * cdl/flash_atlas.cdl: Added requirements for strncmp. + +2003-09-16 Jani Monoses <jani@iv.ro> + + * cdl/flash_atlas.cdl: + * src/flash_lock_block.c (flash_lock_block): + * src/flash_unlock_block.c (flash_unlock_block): + * src/flash_erase_block.c (flash_erase_block): + * src/flash_query.c (flash_query): + * src/flash_program_buf.c (flash_program_buf): Use .2ram sections + for putting flash functions to RAM instead of the old method. Use + generic flash_dev_query. + 2001-06-11 Gary Thomas <gthomas@redhat.com> * src/atlas_flash.c: Remove dependency on printf() via user functions.
--- a/packages/devs/flash/mips/atlas/current/cdl/flash_atlas.cdl +++ b/packages/devs/flash/mips/atlas/current/cdl/flash_atlas.cdl @@ -55,55 +55,20 @@ cdl_package CYGPKG_DEVS_FLASH_ATLAS { parent CYGPKG_IO_FLASH active_if CYGPKG_IO_FLASH requires CYGPKG_HAL_MIPS_ATLAS + requires CYGINT_ISO_STRING_STRFUNCS implements CYGHWR_IO_FLASH_DEVICE - implements CYGHWR_IO_FLASH_DEVICE_NOT_IN_RAM implements CYGHWR_IO_FLASH_BLOCK_LOCKING include_dir . include_files ; # none _exported_ whatsoever description "FLASH memory device support for MIPS Atlas" - compile atlas_flash.c + compile atlas_flash.c flash_erase_block.c flash_program_buf.c flash_query.c - make -priority 1 { - flash_erase_block.o: $(REPOSITORY)/$(PACKAGE)/src/flash_erase_block.c - $(CC) -S $(INCLUDE_PATH) $(CFLAGS) -EL -g0 -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 -EL -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) -EL -g0 -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 -EL -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) -EL -g0 -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 -EL -o flash_query.o flash_query.s - $(AR) rcs $(PREFIX)/lib/libtarget.a flash_query.o - } - make -priority 1 { - flash_lock_block.o: $(REPOSITORY)/$(PACKAGE)/src/flash_lock_block.c - $(CC) -S $(INCLUDE_PATH) $(CFLAGS) -EL -g0 -fno-function-sections $(REPOSITORY)/$(PACKAGE)/src/flash_lock_block.c - echo " .globl flash_lock_block_end" >>flash_lock_block.s - echo "flash_lock_block_end:" >>flash_lock_block.s - $(CC) -c -EL -o flash_lock_block.o flash_lock_block.s - $(AR) rcs $(PREFIX)/lib/libtarget.a flash_lock_block.o - } - make -priority 1 { - flash_unlock_block.o: $(REPOSITORY)/$(PACKAGE)/src/flash_unlock_block.c - $(CC) -S $(INCLUDE_PATH) $(CFLAGS) -EL -g0 -fno-function-sections $(REPOSITORY)/$(PACKAGE)/src/flash_unlock_block.c - echo " .globl flash_unlock_block_end" >>flash_unlock_block.s - echo "flash_unlock_block_end:" >>flash_unlock_block.s - $(CC) -c -EL -o flash_unlock_block.o flash_unlock_block.s - $(AR) rcs $(PREFIX)/lib/libtarget.a flash_unlock_block.o + cdl_component CYGPKG_DEVS_FLASH_ATLAS_LOCKING { + display "Flash device implements locking" + active_if 0 < CYGHWR_IO_FLASH_BLOCK_LOCKING + calculated 1 + compile flash_lock_block.c flash_unlock_block.c } } -
--- a/packages/devs/flash/mips/atlas/current/src/atlas_flash.c +++ b/packages/devs/flash/mips/atlas/current/src/atlas_flash.c @@ -52,32 +52,24 @@ #include <pkgconf/hal.h> #include <cyg/hal/hal_arch.h> -#include <cyg/hal/hal_cache.h> +#include <cyg/infra/diag.h> #define _FLASH_PRIVATE_ #include <cyg/io/flash.h> #include "flash.h" +#include <string.h> + #define _si(p) ((p[1]<<8)|p[0]) int flash_hwr_init(void) { struct FLASH_query data, *qp; - 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; + int 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 - HAL_ICACHE_INVALIDATE_ALL(); // is also required to avoid old contents - stat = (*_flash_query)(&data); + flash_dev_query(&data); qp = &data; if (/*(qp->manuf_code == FLASH_Intel_code) && */ @@ -92,7 +84,7 @@ flash_hwr_init(void) return FLASH_ERR_OK; } else { (*flash_info.pf)("Can't identify FLASH, sorry\n"); - diag_dump_buf(data, sizeof(data)); + diag_dump_buf((void*)&data, sizeof(data)); return FLASH_ERR_HWR; } }
--- a/packages/devs/flash/mips/atlas/current/src/flash_erase_block.c +++ b/packages/devs/flash/mips/atlas/current/src/flash_erase_block.c @@ -56,12 +56,10 @@ #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; unsigned long stat;
--- a/packages/devs/flash/mips/atlas/current/src/flash_lock_block.c +++ b/packages/devs/flash/mips/atlas/current/src/flash_lock_block.c @@ -53,13 +53,12 @@ #include "flash.h" #include <cyg/hal/hal_arch.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_lock_block(volatile unsigned long *block) + __attribute__ ((section (".2ram.flash_lock_block"))); +int +flash_lock_block(volatile unsigned long *block) { volatile unsigned long *ROM; unsigned long stat;
--- a/packages/devs/flash/mips/atlas/current/src/flash_program_buf.c +++ b/packages/devs/flash/mips/atlas/current/src/flash_program_buf.c @@ -55,13 +55,12 @@ #include <pkgconf/hal.h> #include <cyg/hal/hal_arch.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) { volatile unsigned long *ROM; unsigned long stat = 0;
--- a/packages/devs/flash/mips/atlas/current/src/flash_query.c +++ b/packages/devs/flash/mips/atlas/current/src/flash_query.c @@ -57,14 +57,12 @@ #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 20*1000*10 // Approx 20ms int +flash_query(unsigned char *data) __attribute__ ((section (".2ram.flash_query"))); +int flash_query(unsigned char *data) { volatile unsigned long *ROM;
--- a/packages/devs/flash/mips/atlas/current/src/flash_unlock_block.c +++ b/packages/devs/flash/mips/atlas/current/src/flash_unlock_block.c @@ -54,10 +54,6 @@ #include <cyg/hal/hal_arch.h> -// -// CAUTION! This code must be copied to RAM before execution. Therefore, -// it must not contain any code which might be position dependent! -// // // The difficulty with this operation is that the hardware does not support @@ -71,6 +67,9 @@ int flash_unlock_block(volatile unsigned long *block, int block_size, int blocks) + __attribute__ ((section (".2ram.flash_unlock_block"))); +int +flash_unlock_block(volatile unsigned long *block, int block_size, int blocks) { volatile unsigned long *ROM, *bp; unsigned long stat;
