fixed parameter to FLASH_Disable()
authorlothar <lothar>
Wed, 8 Jul 2009 10:48:39 +0000 (10:48 +0000)
committerlothar <lothar>
Wed, 8 Jul 2009 10:48:39 +0000 (10:48 +0000)
packages/io/flash/v2_0/src/flash.c

index f952713..59725c5 100644 (file)
@@ -233,7 +233,8 @@ flash_erase(void *addr, int len, void **err_addr)
         flash_info.pf(".");
 #endif
     }
-    FLASH_Disable((void *)((CYG_ADDRESS)addr & flash_info.block_mask), end_addr);
+    FLASH_Disable((void *)((CYG_ADDRESS)addr & flash_info.block_mask),
+                                 end_addr);
     HAL_FLASH_CACHES_ON(d_cache, i_cache);
 #ifdef CYGSEM_IO_FLASH_CHATTER
     flash_info.pf("\n");
@@ -304,10 +305,10 @@ flash_program(void *_addr, void *_data, int len, void **err_addr)
         flash_info.pf(".");
 #endif
         len -= size;
-        addr += size/sizeof(*addr);
-        data += size/sizeof(*data);
+        addr += size / sizeof(*addr);
+        data += size / sizeof(*data);
     }
-    FLASH_Disable(_addr, addr);
+    FLASH_Disable(_addr, addr + len);
     HAL_FLASH_CACHES_ON(d_cache, i_cache);
 #ifdef CYGSEM_IO_FLASH_CHATTER
     flash_info.pf("\n");
@@ -378,7 +379,7 @@ flash_read(void *_addr, void *_data, int len, void **err_addr)
         addr += size / sizeof(*addr);
         data += size / sizeof(*data);
     }
-    FLASH_Disable(_addr, addr);
+    FLASH_Disable(_addr, addr + len);
     HAL_FLASH_CACHES_ON(d_cache, i_cache);
 #ifdef CYGSEM_IO_FLASH_CHATTER_VERBOSE
     flash_info.pf("\n");