changeset 1336:4abdcd2f65a9

* src/flash_unlock_block.c (flash_unlock_block): test lock bit explicitly - newer flash parts use the reserved bits in the returned data.
author jlarmour
date Wed, 29 Oct 2003 17:21:11 +0000
parents 564441705fa6
children 1ded88da2dd4
files packages/devs/flash/intel/strata/current/ChangeLog packages/devs/flash/intel/strata/current/src/flash_unlock_block.c
diffstat 2 files changed, 9 insertions(+), 2 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,9 @@
+2003-10-29  Jonathan Larmour  <jifl@eCosCentric.com>
+
+	* src/flash_unlock_block.c (flash_unlock_block): test lock bit
+	explicitly - newer flash parts use the reserved bits in the
+	returned data.
+
 2003-09-11  Jani Monoses <jani@iv.ro>
 
 	* src/flash_erase_block.c (flash_erase_block): 
--- a/packages/devs/flash/intel/strata/current/src/flash_unlock_block.c
+++ b/packages/devs/flash/intel/strata/current/src/flash_unlock_block.c
@@ -62,6 +62,7 @@
 //
 
 #define MAX_FLASH_BLOCKS 128
+#define FLASH_LOCK_MASK 0x1    // which bit of the read query has the lock bit
 
 int
 flash_unlock_block(volatile flash_t *block, int block_size, int blocks)
@@ -103,9 +104,9 @@ flash_unlock_block(volatile flash_t *blo
             is_locked[i] = 0;
         } else {
 #if 8 == CYGNUM_FLASH_WIDTH
-            is_locked[i] = bpv[4];
+            is_locked[i] = bpv[4] & FLASH_LOCK_MASK;
 #else
-            is_locked[i] = bpv[2];
+            is_locked[i] = bpv[2] & FLASH_LOCK_MASK;
 # endif
         }
         bp += block_size / sizeof(*bp);