changeset 1723:10c1990120d3

* src/flash_unlock_block.c (flash_unlock_block): * cdl/flash_strata.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:37:47 +0000
parents d0cd03f9e00f
children 549e69d9a7d0
files packages/devs/flash/intel/strata/current/ChangeLog packages/devs/flash/intel/strata/current/cdl/flash_strata.cdl packages/devs/flash/intel/strata/current/src/flash_unlock_block.c
diffstat 3 files changed, 21 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/packages/devs/flash/intel/strata/current/ChangeLog
+++ b/packages/devs/flash/intel/strata/current/ChangeLog
@@ -1,3 +1,10 @@
+2004-08-21  Andrew Lunn  <andrew.lunn@ascom.ch>
+
+	* src/flash_unlock_block.c (flash_unlock_block): 
+	* cdl/flash_strata.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.
+
 2005-01-26  Scott Wilkinson <scott@alliantnetworks.com>
 	* src/strata.h:
 	* src/strata.c:
--- a/packages/devs/flash/intel/strata/current/cdl/flash_strata.cdl
+++ b/packages/devs/flash/intel/strata/current/cdl/flash_strata.cdl
@@ -69,12 +69,24 @@ cdl_package CYGPKG_DEVS_FLASH_STRATA {
         puts $::cdl_header "#include CYGDAT_DEVS_FLASH_STRATA_CFG";
     }
 
-
     cdl_component  CYGPKG_DEVS_FLASH_STRATA_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
+
+        cdl_option CYGNUM_DEVS_FLASH_STRATA_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."
+        }
     }
 }
 
--- a/packages/devs/flash/intel/strata/current/src/flash_unlock_block.c
+++ b/packages/devs/flash/intel/strata/current/src/flash_unlock_block.c
@@ -61,7 +61,6 @@
 // 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
 
 int
@@ -76,7 +75,7 @@ flash_unlock_block(volatile flash_t *blo
 #ifndef CYGOPT_FLASH_IS_SYNCHRONOUS
     int i;
     volatile flash_t *bp, *bpv;
-    unsigned char is_locked[MAX_FLASH_BLOCKS];
+    unsigned char is_locked[CYGNUM_DEVS_FLASH_STRATA_MAX_BLOCKS];
 #endif
 
     // Get base address and map addresses to virtual addresses