This is the mail archive of the ecos-patches@sourceware.org mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Flash_28fXXX buffered writes


I attach a partly completed patch.  I will leave it as an excercise to
the interested reader to fill in the missing buffer sizes.

Summary:
flash_program_buf was getting called with buffer_size as zero.  This
would have resulted in an infinite loop, but the sources had been bodged
to disable buffered writes as a workaround.

* Added buffer_size into flash_dev_info
* Copy buffer_size into flash_info.buffer_size durinig initialisation
* Remove the unconditional disabling of buffered write and replaced it
with a test for zero buffer size (this allows for the case where some
device's details are still unspecified - so this change won't break for
these devices).
Index: flash_28fxxx.inl
===================================================================
--- flash_28fxxx.inl	(revision 3761)
+++ flash_28fxxx.inl	(working copy)
@@ -141,6 +141,7 @@
     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_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 @@
 #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) {
Index: flash_28fxxx_parts.inl
===================================================================
--- flash_28fxxx_parts.inl	(revision 3761)
+++ flash_28fxxx_parts.inl	(working copy)
@@ -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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]