This is the mail archive of the ecos-patches@sources.redhat.com 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]

V2 flash - sst driver update


This patch updates the SST driver and both platforms that use it.
Initialization now happens statically, eliminating most of the _init()
function, and const usage has been sorted out.

Bart

Index: devs/flash/arm/aim711/current/ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/devs/flash/arm/aim711/current/ChangeLog,v
retrieving revision 1.1.2.1
diff -u -r1.1.2.1 ChangeLog
--- devs/flash/arm/aim711/current/ChangeLog	5 Aug 2004 13:38:15 -0000	1.1.2.1
+++ devs/flash/arm/aim711/current/ChangeLog	22 Nov 2004 20:29:09 -0000
@@ -1,3 +1,8 @@
+2004-11-22  Bart Veer  <bartv@ecoscentric.com>
+
+	* src/arm_aim711_flash.c: use updated CYG_FLASH_DRIVER() macro for
+	completely static initialization.
+
 2004-07-16  Andrew Lunn  <andrew.lunn@ascom.ch>
 
 	* src/arm_aim711_flash.c: Make us of the new sst driver which uses
Index: devs/flash/arm/aim711/current/src/arm_aim711_flash.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/devs/flash/arm/aim711/current/src/arm_aim711_flash.c,v
retrieving revision 1.1.2.1
diff -u -r1.1.2.1 arm_aim711_flash.c
--- devs/flash/arm/aim711/current/src/arm_aim711_flash.c	5 Aug 2004 13:38:16 -0000	1.1.2.1
+++ devs/flash/arm/aim711/current/src/arm_aim711_flash.c	22 Nov 2004 20:29:09 -0000
@@ -71,11 +71,18 @@
 
 #include "cyg/io/flash_sst_39vfxxx.inl"
 
+static const cyg_flash_block_info_t cyg_flash_sst_block_info[1] = {
+    { FLASH_BLOCK_SIZE, FLASH_NUM_REGIONS * CYGNUM_FLASH_SERIES }
+};
 CYG_FLASH_DRIVER(cyg_flash_sst_flashdev,
                  &cyg_sst_funs,
-                 NULL,
-                 CYGNUM_FLASH_BASE,
-                 sizeof(struct cyg_flash_sst_priv));
+                 0,                     // Flags
+                 CYGNUM_FLASH_BASE,     // Start
+                 CYGNUM_FLASH_BASE + (FLASH_BLOCK_SIZE * FLASH_NUM_REGIONS * CYGNUM_FLASH_SERIES) - 1,    // End
+                 1,                     // Number of block infos
+                 cyg_flash_sst_block_info,
+                 NULL                   // priv
+    );
 
 // ------------------------------------------------------------------------
 // EOF arm_aim711_flash.c
Index: devs/flash/arm/e7t/current/ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/devs/flash/arm/e7t/current/ChangeLog,v
retrieving revision 1.2.2.1
diff -u -r1.2.2.1 ChangeLog
--- devs/flash/arm/e7t/current/ChangeLog	5 Aug 2004 13:38:16 -0000	1.2.2.1
+++ devs/flash/arm/e7t/current/ChangeLog	22 Nov 2004 20:29:09 -0000
@@ -1,3 +1,8 @@
+2004-11-22  Bart Veer  <bartv@ecoscentric.com>
+
+	* src/arm_e7t_flash.c: use updated CYG_FLASH_DRIVER() macro for
+	completely static initialization.
+
 2004-08-03  Andrew Lunn  <andrew.lunn@ascom.ch>
 
 	* cdl/flash_e7t.cdl:
Index: devs/flash/arm/e7t/current/src/arm_e7t_flash.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/devs/flash/arm/e7t/current/src/arm_e7t_flash.c,v
retrieving revision 1.2.2.1
diff -u -r1.2.2.1 arm_e7t_flash.c
--- devs/flash/arm/e7t/current/src/arm_e7t_flash.c	5 Aug 2004 13:38:16 -0000	1.2.2.1
+++ devs/flash/arm/e7t/current/src/arm_e7t_flash.c	22 Nov 2004 20:29:09 -0000
@@ -71,11 +71,18 @@
 #ifdef CYGINT_DEVS_FLASH_SST_39VFXXX_REQUIRED
 #include "cyg/io/flash_sst_39vfxxx.inl"
 
+static const cyg_flash_block_info_t cyg_flash_sst_block_info[1] = {
+    { FLASH_BLOCK_SIZE, FLASH_NUM_REGIONS * CYGNUM_FLASH_SERIES }
+};
 CYG_FLASH_DRIVER(cyg_flash_sst_flashdev,
                  &cyg_sst_funs,
-                 NULL,
-                 CYGNUM_FLASH_BASE,
-                 sizeof(struct cyg_flash_sst_priv));
+                 0,                     // Flags
+                 CYGNUM_FLASH_BASE,     // Start
+                 CYGNUM_FLASH_BASE + (FLASH_BLOCK_SIZE * FLASH_NUM_REGIONS * CYGNUM_FLASH_SERIES) - 1,    // End
+                 1,                     // Number of block infos
+                 cyg_flash_sst_block_info,
+                 NULL                   // priv
+    );
 #endif
 
 #ifdef CYGINT_DEVS_FLASH_AMD_AM29XXXXX_REQUIRED
Index: devs/flash/sst/39vfxxx/current/ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/devs/flash/sst/39vfxxx/current/ChangeLog,v
retrieving revision 1.1.2.4
diff -u -r1.1.2.4 ChangeLog
--- devs/flash/sst/39vfxxx/current/ChangeLog	22 Nov 2004 12:06:07 -0000	1.1.2.4
+++ devs/flash/sst/39vfxxx/current/ChangeLog	22 Nov 2004 20:29:19 -0000
@@ -1,5 +1,7 @@
 2004-11-22  Bart Veer  <bartv@ecoscentric.com>
-
+	
+	* include/flash_sst_39vfxxx.inl: assume static initialization and
+	adjust const's in various parameters
 	* include/flash_sst_39vfxxx.inl: rename cyg_block_info to
 	cyg_flash_block_info
 
Index: devs/flash/sst/39vfxxx/current/include/flash_sst_39vfxxx.inl
===================================================================
RCS file: /cvs/ecos/ecos/packages/devs/flash/sst/39vfxxx/current/include/flash_sst_39vfxxx.inl,v
retrieving revision 1.1.2.4
diff -u -r1.1.2.4 flash_sst_39vfxxx.inl
--- devs/flash/sst/39vfxxx/current/include/flash_sst_39vfxxx.inl	22 Nov 2004 12:06:07 -0000	1.1.2.4
+++ devs/flash/sst/39vfxxx/current/include/flash_sst_39vfxxx.inl	22 Nov 2004 20:29:21 -0000
@@ -134,20 +134,14 @@
 #include <cyg/io/flash_dev.h>
 
 //----------------------------------------------------------------------------
-// Private structure used by the device
-struct cyg_flash_sst_priv 
-{
-  cyg_flash_block_info_t block_info[1];
-};
-//----------------------------------------------------------------------------
 // Functions that put the flash device into non-read mode must reside
 // in RAM.
-static size_t sst_query(struct cyg_flash_dev *dev, void* data, const size_t len)
+static size_t sst_query(struct cyg_flash_dev *dev, void* data, size_t len)
   __attribute__ ((section (".2ram.flash_query")));
 static int sst_erase_block(struct cyg_flash_dev *dev, cyg_flashaddr_t block_base)
   __attribute__ ((section (".2ram.flash_erase_block")));
 static int sst_program(struct cyg_flash_dev *dev, cyg_flashaddr_t base, 
-            const void* data, const size_t length)
+            const void* data, size_t length)
   __attribute__ ((section (".2ram.flash_program_buf")));
 
 
@@ -156,7 +150,6 @@
 static int
 sst_init(struct cyg_flash_dev *dev)
 {
-  struct cyg_flash_sst_priv *priv = dev->priv;
   flash_data_t id[2];
 
   dev->funs->flash_query(dev,id,sizeof(id));
@@ -166,14 +159,6 @@
   if (id[0] != CYGNUM_FLASH_ID_MANUFACTURER
       || id[1] != CYGNUM_FLASH_ID_DEVICE)
     return CYG_FLASH_ERR_DRV_WRONG_PART;
-  
-  // Hard wired for now
-  dev->end = dev->start + 
-    (FLASH_NUM_REGIONS * FLASH_BLOCK_SIZE * CYGNUM_FLASH_SERIES) -1;
-  dev->num_block_infos = 1;
-  priv->block_info[0].blocks = FLASH_NUM_REGIONS * CYGNUM_FLASH_SERIES;
-  priv->block_info[0].block_size = FLASH_BLOCK_SIZE;
-  dev->block_info = priv->block_info;
   return CYG_FLASH_ERR_OK;
 }
 
@@ -194,7 +179,7 @@
 // will be of the same type.
 
 static size_t
-sst_query(struct cyg_flash_dev *dev, void* data, const size_t len)
+sst_query(struct cyg_flash_dev *dev, void* data, size_t len)
 {
     volatile flash_data_t *ROM;
     flash_data_t* id = (flash_data_t*) data;
@@ -283,7 +268,7 @@
 // Program Buffer
 static int
 sst_program(struct cyg_flash_dev *dev, cyg_flashaddr_t base, 
-            const void* data, const size_t length)
+            const void* data, size_t length)
 {
     volatile flash_data_t* ROM;
     volatile flash_data_t* addr_ptr = (volatile flash_data_t*) base;
@@ -341,14 +326,28 @@
     return res;
 }
 
-static CYG_FLASH_FUNS(cyg_sst_funs,
-               sst_init,
-               sst_query,
-               sst_erase_block,
-               sst_program,
-               NULL,              // read
-               sst_hwr_map_error,
-               NULL,              // block_lock
-               NULL);             // block_unlock
+#ifdef CYGHWR_IO_FLASH_BLOCK_LOCKING
+static int 
+sst_block_lock(struct cyg_flash_dev   *dev, const  cyg_flashaddr_t  block_base)
+{
+    return CYG_DATAFLASH_ERR_INVALID;
+}
+
+static int 
+sst_block_unlock(struct cyg_flash_dev  *dev, const cyg_flashaddr_t  block_base)
+{
+    return CYG_DATAFLASH_ERR_INVALID;
+}
+#endif
+
+static const CYG_FLASH_FUNS(cyg_sst_funs,
+	               sst_init,
+	               sst_query,
+	               sst_erase_block,
+	               sst_program,
+	               NULL,              // read
+	               sst_hwr_map_error,
+	               sst_block_lock,
+	               sst_block_unlock);
 
 #endif // CYGONCE_DEVS_FLASH_SST_39VFXXX_INL


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