changeset 1718:c8515e560548

2004-08-21 Andrew Lunn <andrew.lunn@ascom.ch> * include/flash_strata_v2.inl (flash_unlock_block): * cdl/flash_strata_v2.cdl: CDL to control the maximum number of blocks the driver supports. Some of the newer strata device has more than the default maximum of 128. Problem pointed out by Kevin Zhang.
author asl
date Sat, 21 Aug 2004 08:48:17 +0000
parents faaea4243d52
children c506b95a6346
files packages/devs/flash/intel/stratav2/current/ChangeLog packages/devs/flash/intel/stratav2/current/cdl/flash_strata_v2.cdl packages/devs/flash/intel/stratav2/current/include/flash_strata_v2.inl
diffstat 3 files changed, 22 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/packages/devs/flash/intel/stratav2/current/ChangeLog
+++ b/packages/devs/flash/intel/stratav2/current/ChangeLog
@@ -1,3 +1,10 @@
+2004-08-21  Andrew Lunn  <andrew.lunn@ascom.ch>
+	
+	* include/flash_strata_v2.inl (flash_unlock_block): 
+	* cdl/flash_strata_v2.cdl: CDL to control the maximum number of
+	blocks the driver supports. Some of the newer strata device has more
+	than the default maximum of 128. Problem pointed out by Kevin Zhang.
+
 2004-08-13  Andrew Lunn  <andrew.lunn@ascom.ch>
 
 	* cdl/flash_strata_v2.cdl: Indicate we implement
--- a/packages/devs/flash/intel/stratav2/current/cdl/flash_strata_v2.cdl
+++ b/packages/devs/flash/intel/stratav2/current/cdl/flash_strata_v2.cdl
@@ -65,13 +65,26 @@ cdl_package CYGPKG_DEVS_FLASH_STRATA_V2 
     description   "FLASH memory device support for Intel StrataFlash using
                    the V2 driver API"
 
-    cdl_option  CYGOPT_DEVS_FLASH_STRATA_V2_LOCKING {
+    cdl_component CYGOPT_DEVS_FLASH_STRATA_V2_LOCKING {
 	display       "Flash device implements locking"
 	default_value 1
         implements    CYGHWR_IO_FLASH_BLOCK_LOCKING
         description   "
             This option controls whether the driver will include code
             to allow locking and unlocking of blocks."
+
+        cdl_option CYGNUM_DEVS_FLASH_STRATA_V2_MAX_BLOCKS {
+             display       "Maximum number of blocks the driver supports" 
+             flavor        data
+             default_value 128
+             description   "
+                 The strata devices do not support unlocking an 
+                 individual block. Instead it is necassary to unlock
+                 all the blocks in one operation and then lock all those
+                 blocks that should be blocked. To do this we need an array
+                 containing the current status of the blocks. This controls the 
+                 size of that array."
+        }       
     }
 
     cdl_option  CYGOPT_DEV_FLASH_STATE_V2_DUMP_UNKNOWN {
--- a/packages/devs/flash/intel/stratav2/current/include/flash_strata_v2.inl
+++ b/packages/devs/flash/intel/stratav2/current/include/flash_strata_v2.inl
@@ -434,7 +434,6 @@ strata_program_buf (struct cyg_flash_dev
 // then reset the regions which are known to be locked.
 //
 
-#define MAX_FLASH_BLOCKS 128
 #define FLASH_LOCK_MASK 0x1    // which bit of the read query has the lock bit
 
 static int
@@ -447,7 +446,7 @@ strata_unlock_block(struct cyg_flash_dev
 #ifndef CYGOPT_FLASH_IS_SYNCHRONOUS
     int i;
     volatile flash_t *bp, *bpv, *block;
-    unsigned char is_locked[MAX_FLASH_BLOCKS];
+    unsigned char is_locked[CYGNUM_DEVS_FLASH_STRATA_V2_MAX_BLOCKS];
 #endif
 
     // Get base address and map addresses to virtual addresses