# HG changeset patch # User msalter # Date 1029154849 0 # Node ID 845276b93eaa5e1c689d5d1fa4f0c76fb1fc4fc7 # Parent b3a03108f8ff86f300a4397199a9d412f07e9c7c Add support for K-series (synchronous) strataflash parts. diff --git a/packages/devs/flash/intel/strata/current/ChangeLog b/packages/devs/flash/intel/strata/current/ChangeLog --- a/packages/devs/flash/intel/strata/current/ChangeLog +++ b/packages/devs/flash/intel/strata/current/ChangeLog @@ -1,3 +1,8 @@ +2002-08-12 Mark Salter + + * src/flash_unlock_block.c: Add synchronous strataflash support. + * src/strata.h: Add comments regarding synchronous strataflash. + 2002-04-30 Christoph Csebits * src/flash_unlock_block.c: Getting the current block lock diff --git a/packages/devs/flash/intel/strata/current/src/flash_unlock_block.c b/packages/devs/flash/intel/strata/current/src/flash_unlock_block.c --- a/packages/devs/flash/intel/strata/current/src/flash_unlock_block.c +++ b/packages/devs/flash/intel/strata/current/src/flash_unlock_block.c @@ -72,11 +72,15 @@ int flash_unlock_block(volatile flash_t *block, int block_size, int blocks) { - volatile flash_t *ROM, *bp, *bpv; + volatile flash_t *ROM; flash_t stat; int timeout = 5000000; + int cache_on; +#ifndef CYGOPT_FLASH_IS_SYNCHRONOUS + int i; + volatile flash_t *bp, *bpv; unsigned char is_locked[MAX_FLASH_BLOCKS]; - int i, cache_on; +#endif HAL_DCACHE_IS_ENABLED(cache_on); if (cache_on) { @@ -91,6 +95,14 @@ flash_unlock_block(volatile flash_t *blo // Clear any error conditions ROM[0] = FLASH_Clear_Status; +#ifdef CYGOPT_FLASH_IS_SYNCHRONOUS + // Clear lock bit + block[0] = FLASH_Clear_Locks; + block[0] = FLASH_Clear_Locks_Confirm; // Confirmation + while(((stat = ROM[0]) & FLASH_Status_Ready) != FLASH_Status_Ready) { + if (--timeout == 0) break; + } +#else // Get current block lock state. This needs to access each block on // the device so currently locked blocks can be re-locked. bp = ROM; @@ -131,6 +143,7 @@ flash_unlock_block(volatile flash_t *blo } bp += block_size / sizeof(*bp); } +#endif // CYGOPT_FLASH_IS_SYNCHRONOUS // Restore ROM to "normal" mode ROM[0] = FLASH_Reset; diff --git a/packages/devs/flash/intel/strata/current/src/strata.h b/packages/devs/flash/intel/strata/current/src/strata.h --- a/packages/devs/flash/intel/strata/current/src/strata.h +++ b/packages/devs/flash/intel/strata/current/src/strata.h @@ -61,18 +61,20 @@ // It is expected that the above include defined all the properties of the // device we want to drive: the choices this module supports include: // -// Buffered Read Block -// write query locking -// 28FxxxB3 - Bootblock - no no no -// 28FxxxC3 - StrataFlash - no yes yes -// 28FxxxJ3 - Advanced StrataFlash - yes yes yes +// Buffered Read Block +// write query locking +// 28FxxxB3 - Bootblock - no no no +// 28FxxxC3 - StrataFlash - no yes yes +// 28FxxxJ3 - Advanced StrataFlash - yes yes yes +// 28FxxxK3 - Synchronous StrataFlash - yes yes yes // // These options are controlled by defining or not, in that include file, // these symbols (not CDL options, just symbols - though they could be CDL // in future) // CYGOPT_FLASH_IS_BOOTBLOCK - for xxxB3 devices. // CYGOPT_FLASH_IS_NOT_ADVANCED - for xxxC3 devices. -// neither - for xxxJ3 devices. +// CYGOPT_FLASH_IS_SYNCHRONOUS - for xxxK3 devices. +// none of the above - for xxxJ3 devices. // (Advanced seems to be usual these days hence the sense of that opt) // // Other properties are controlled by these symbols: