changeset 2545:3e357a0a0869

* include/flash_28fxxx.inl: * include/flash_28fxxx_parts.inl: Support write buffering. Add an entry to the parts table indicating the size of the buffer and copy it into the device table during initialization.
author asl
date Thu, 04 Sep 2008 06:00:09 +0000
parents ec29669c67e2
children 28ecf71a7103
files packages/devs/flash/intel/28fxxx/current/ChangeLog packages/devs/flash/intel/28fxxx/current/include/flash_28fxxx.inl packages/devs/flash/intel/28fxxx/current/include/flash_28fxxx_parts.inl
diffstat 3 files changed, 17 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/packages/devs/flash/intel/28fxxx/current/ChangeLog
+++ b/packages/devs/flash/intel/28fxxx/current/ChangeLog
@@ -1,3 +1,10 @@
+2008-09-04  Dave Lawrence <dlawrence@ad-holdings.co.uk>
+
+	* include/flash_28fxxx.inl: 
+	* include/flash_28fxxx_parts.inl: Support write buffering. Add an
+	entry to the parts table indicating the size of the buffer and
+	copy it into the device table during initialization. 
+
 2006-12-14  Yoshinori Sato <ysato@users.sourceforge.jp>
 
 	* cdl/flash_intel_28fxxx.cdl, include/flash_28fxxx_parts.inl: Add
--- a/packages/devs/flash/intel/28fxxx/current/include/flash_28fxxx.inl
+++ b/packages/devs/flash/intel/28fxxx/current/include/flash_28fxxx.inl
@@ -141,6 +141,7 @@ typedef struct flash_dev_info {
     cyg_uint32   device_size;
     cyg_bool     locking;               // supports locking
     cyg_bool     buffered_w;            // supports buffered writes
+    cyg_uint32   buffer_size;
     cyg_bool     bootblock;
     cyg_uint32   bootblocks[12];         // 0 is bootblock offset, 1-11 sub-sector sizes (or 0)
     cyg_bool     banked;
@@ -198,6 +199,7 @@ flash_hwr_init(void)
     flash_info.blocks = flash_dev_info->block_count * CYGNUM_FLASH_SERIES;
     flash_info.start = (void *)CYGNUM_FLASH_BASE;
     flash_info.end = (void *)(CYGNUM_FLASH_BASE+ (flash_dev_info->device_size * CYGNUM_FLASH_SERIES));
+    flash_info.buffer_size = flash_dev_info->buffer_size;
 
     return FLASH_ERR_OK;
 }
@@ -367,8 +369,10 @@ flash_program_buf(void* addr, void* data
 #ifdef CYGHWR_DEVS_FLASH_INTEL_BUFFERED_WRITES
     // FIXME: This code has not been adjusted to handle bootblock
     // parts yet.
-    // FIXME: This code does not appear to work anymore
-    if (0 && flash_dev_info->buffered_w) {
+    // If the buffer size has not been initialised, buffered write will
+    // be skipped.
+
+     if (flash_dev_info->buffered_w && buffer_size) {
         int i, wc;
         // Write any big chunks first
         while (len >= buffer_size) {
--- a/packages/devs/flash/intel/28fxxx/current/include/flash_28fxxx_parts.inl
+++ b/packages/devs/flash/intel/28fxxx/current/include/flash_28fxxx_parts.inl
@@ -217,6 +217,7 @@
         base_mask  : ~(0x1000000 * CYGNUM_FLASH_INTERLEAVE - 1),
         locking    : true,
         buffered_w : true,
+//        buffer_size: TODO!!!
         bootblock  : false,
         banked     : false
     },
@@ -231,6 +232,7 @@
         base_mask  : ~(0x1000000 * CYGNUM_FLASH_INTERLEAVE - 1),
         locking    : true,
         buffered_w : true,
+//        buffer_size: TODO!!!
         bootblock  : false,
         banked     : false
     },
@@ -245,6 +247,7 @@
         base_mask  : ~(0x1000000 * CYGNUM_FLASH_INTERLEAVE - 1),
         locking    : true,
         buffered_w : true,
+        buffer_size: 32,
         bootblock  : false,
         banked     : false
     },
@@ -258,6 +261,7 @@
         device_size: 0x200000 * CYGNUM_FLASH_INTERLEAVE,
         base_mask  : ~(0x200000 * CYGNUM_FLASH_INTERLEAVE - 1),
         buffered_w : true,
+//        buffer_size: TODO
         locking    : false,
         bootblock  : false,
         banked     : false