Mercurial > flash_v2
diff packages/io/flash/current/src/flash.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 | 96ec7e534d98 |
| children |
line wrap: on
line diff
--- a/packages/io/flash/current/src/flash.c +++ b/packages/io/flash/current/src/flash.c @@ -9,7 +9,7 @@ // ------------------------------------------- // This file is part of eCos, the Embedded Configurable Operating System. // Copyright (C) 2004 Andrew Lunn -// Copyright (C) 2004 eCosCentric Ltd. +// Copyright (C) 2004, 2005, 2006 eCosCentric Ltd. // Copyright (C) 2003 Gary Thomas // Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. // @@ -162,8 +162,8 @@ static bool flash_sort_and_check(void) } } - // If there are no devices, abort. This could happen because none - // of the devices initialised. + // If there are no valid devices, abort. This might happen if + // all drivers failed to initialize. if (flash_head == NULL) { return false; } @@ -293,7 +293,7 @@ cyg_flash_verify_addr(const cyg_flashadd cyg_flash_get_info(cyg_uint32 Nth, cyg_flash_info_t * info) { struct cyg_flash_dev * dev; - + if (!init) return CYG_FLASH_ERR_NOT_INIT; #if (1 == CYGHWR_IO_FLASH_DEVICE) @@ -439,7 +439,7 @@ cyg_flash_erase(cyg_flashaddr_t flash_ba struct cyg_flash_dev * dev; size_t erase_count; int stat = CYG_FLASH_ERR_OK; - int d_cache, i_cache; + HAL_FLASH_CACHES_STATE(d_cache, i_cache); dev = find_dev(flash_base, &stat); if (!dev) return stat; @@ -529,7 +529,7 @@ cyg_flash_program(cyg_flashaddr_t flash_ const unsigned char * ram = ram_base; size_t write_count, offset; int stat = CYG_FLASH_ERR_OK; - int d_cache, i_cache; + HAL_FLASH_CACHES_STATE(d_cache, i_cache); dev = find_dev(flash_base, &stat); if (!dev) return stat; @@ -643,9 +643,9 @@ cyg_flash_read(const cyg_flashaddr_t fla // We have to indirect through the device driver. // The first read may be in the middle of a block. Do the necessary // adjustment here rather than inside the loop. - int d_cache, i_cache; size_t offset; cyg_flashaddr_t block = flash_block_begin(flash_base, dev); + HAL_FLASH_CACHES_STATE(d_cache, i_cache); if (addr == block) { offset = 0; } else { @@ -701,7 +701,7 @@ cyg_flash_lock(const cyg_flashaddr_t fla struct cyg_flash_dev * dev; size_t lock_count; int stat = CYG_FLASH_ERR_OK; - int d_cache, i_cache; + HAL_FLASH_CACHES_STATE(d_cache, i_cache); dev = find_dev(flash_base, &stat); if (!dev) return stat; @@ -764,7 +764,7 @@ cyg_flash_unlock(const cyg_flashaddr_t f struct cyg_flash_dev * dev; size_t unlock_count; int stat = CYG_FLASH_ERR_OK; - int d_cache, i_cache; + HAL_FLASH_CACHES_STATE(d_cache, i_cache); dev = find_dev(flash_base, &stat); if (!dev) return stat;
