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]

Re: [flash_v2] sst driver fix


>>>>> "Andrew" == Andrew Lunn <andrew@lunn.ch> writes:

    Andrew> This patch fixes a compilation error of the sst driver
    Andrew> when locking is enabled.

I think there is a better way to handle this. The patch below adds
some new dummy init/query/lock/unlock functions to the generic flash
code (originally in the am29xxxxx v2 driver). The various v2 flash
drivers are then modified to use these generic nop functions when
appropriate, as opposed to having each driver provide its own. It
eliminates some unnecessary code duplication.

I have also exported the anonymizer from the generic flash code, since
several drivers may want to share that.

Bart

Index: io/flash/current/ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/io/flash/current/ChangeLog,v
retrieving revision 1.38.2.22
diff -u -r1.38.2.22 ChangeLog
--- io/flash/current/ChangeLog	28 Nov 2004 19:10:11 -0000	1.38.2.22
+++ io/flash/current/ChangeLog	29 Nov 2004 00:19:15 -0000
@@ -1,3 +1,10 @@
+2004-11-29  Bart Veer  <bartv@ecoscentric.com>
+
+	* include/flash_priv.h, src/flash.c, src/legacy_dev.c: provide
+	dummy init/query/lock/unlock functions for use by device drivers
+	which do not support/need this functionality. Export the
+	anonymizer function.
+
 2004-11-28  Bart Veer  <bartv@ecoscentric.com>
 
 	* src/flash.c (flash_sort_and_check): previous patch would have
Index: io/flash/current/include/flash_priv.h
===================================================================
RCS file: /cvs/ecos/ecos/packages/io/flash/current/include/Attic/flash_priv.h,v
retrieving revision 1.1.2.6
diff -u -r1.1.2.6 flash_priv.h
--- io/flash/current/include/flash_priv.h	22 Nov 2004 20:06:37 -0000	1.1.2.6
+++ io/flash/current/include/flash_priv.h	29 Nov 2004 00:19:20 -0000
@@ -84,6 +84,17 @@
 #endif    
 };
 
+// Dummy functions for some of the above operations, if a device does
+// not support e.g. locking.
+externC int     cyg_flash_devfn_init_nop(struct cyg_flash_dev*);
+externC size_t  cyg_flash_devfn_query_nop(struct cyg_flash_dev*, void*, const size_t);
+externC int     cyg_flash_devfn_lock_nop(struct cyg_flash_dev*, const cyg_flashaddr_t);
+externC int     cyg_flash_devfn_unlock_nop(struct cyg_flash_dev*, const cyg_flashaddr_t);
+
+// Facilitate function calls between flash-resident code and .2ram
+// functions.
+externC void*   cyg_flash_anonymizer(void*);
+
 // Structure each device places in the HAL table
 struct cyg_flash_dev {
   const struct cyg_flash_dev_funs *funs;            // Function pointers
Index: io/flash/current/src/flash.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/io/flash/current/src/flash.c,v
retrieving revision 1.26.2.15
diff -u -r1.26.2.15 flash.c
--- io/flash/current/src/flash.c	28 Nov 2004 19:10:03 -0000	1.26.2.15
+++ io/flash/current/src/flash.c	29 Nov 2004 00:19:20 -0000
@@ -862,4 +862,59 @@
     }
 }
 
+// Dummy routines to put into the device function tables, to handle
+// unsupported/unnecessary functionality. For example not all devices
+// support block locking.
+//
+// A dummy initialization routine, for platforms where everything is
+// done statically and there is no need to check device ids or
+// anything similar.
+int
+cyg_flash_devfn_init_nop(struct cyg_flash_dev* dev)
+{
+    CYG_UNUSED_PARAM(struct cyg_flash_dev*, dev);
+    return CYG_FLASH_ERR_OK;
+}
+
+// A dummy query routine. The implementation of this is specific to
+// each device driver, so some device drivers may choose to do
+// nothing.
+size_t
+cyg_flash_devfn_query_nop(struct cyg_flash_dev* dev, void* data, size_t len)
+{
+    CYG_UNUSED_PARAM(struct cyg_flash_dev*, dev);
+    CYG_UNUSED_PARAM(void*, data);
+    CYG_UNUSED_PARAM(size_t, len);
+    return 0;
+}
+
+// Dummy lock/unlock routines
+int
+cyg_flash_devfn_lock_nop(struct cyg_flash_dev* dev, const cyg_flashaddr_t addr)
+{
+    CYG_UNUSED_PARAM(struct cyg_flash_dev*, dev);
+    CYG_UNUSED_PARAM(const cyg_flashaddr_t, addr);
+    return CYG_FLASH_ERR_DRV_WRONG_PART;
+}
+
+int
+cyg_flash_devfn_unlock_nop(struct cyg_flash_dev* dev, const cyg_flashaddr_t addr)
+{
+    CYG_UNUSED_PARAM(struct cyg_flash_dev*, dev);
+    CYG_UNUSED_PARAM(const cyg_flashaddr_t, addr);
+    return CYG_FLASH_ERR_DRV_WRONG_PART;
+}
+
+// On some architectures there are problems calling the .2ram
+// functions from the main ones. Specifically the compiler may issue a
+// short call, even though the flash and ram are too far apart. The
+// solution is to indirect via a function pointer, but the simplistic
+// approach is vulnerable to compiler optimization. Hence the function
+// pointer is passed through an anonymizer.
+void*
+cyg_flash_anonymizer(void* fn)
+{
+    return fn;
+}
+
 // EOF io/flash/..../flash.c
Index: io/flash/current/src/legacy_dev.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/io/flash/current/src/Attic/legacy_dev.c,v
retrieving revision 1.1.2.9
diff -u -r1.1.2.9 legacy_dev.c
--- io/flash/current/src/legacy_dev.c	22 Nov 2004 21:27:43 -0000	1.1.2.9
+++ io/flash/current/src/legacy_dev.c	29 Nov 2004 00:19:24 -0000
@@ -102,14 +102,6 @@
   return err;
 }
 
-// Use this function to make function pointers anonymous - forcing the
-// compiler to use jumps instead of branches when calling driver
-// services.
-static void* __anonymizer(void* p)
-{
-  return p;
-}
-
 static size_t 
 legacy_flash_query (struct cyg_flash_dev *dev, 
                     void * data, 
@@ -118,7 +110,7 @@
   typedef void code_fun(void*);
   code_fun *_flash_query;
   
-  _flash_query = (code_fun*) __anonymizer(&flash_query);
+  _flash_query = (code_fun*) cyg_flash_anonymizer(&flash_query);
   
   (*_flash_query)(data);
   
@@ -133,7 +125,7 @@
   code_fun *_flash_erase_block;
   size_t block_size = dev->block_info[0].block_size;
   
-  _flash_erase_block = (code_fun*) __anonymizer(&flash_erase_block);
+  _flash_erase_block = (code_fun*) cyg_flash_anonymizer(&flash_erase_block);
 
   return (*_flash_erase_block)(block_base, block_size);
 }
@@ -148,7 +140,7 @@
   size_t block_size = dev->block_info[0].block_size;
   size_t block_mask = ~(block_mask -1);
 
-  _flash_program_buf = (code_fun*) __anonymizer(&flash_program_buf);
+  _flash_program_buf = (code_fun*) cyg_flash_anonymizer(&flash_program_buf);
 
   return (*_flash_program_buf)(base, data, len, block_mask ,block_size);
 }
@@ -164,7 +156,7 @@
   size_t block_size = dev->block_info[0].block_size;
   size_t block_mask = ~(block_mask -1);
 
-  _flash_read_buf = (code_fun*) __anonymizer(&flash_read_buf);
+  _flash_read_buf = (code_fun*) cyg_flash_anonymizer(&flash_read_buf);
   
   return (*_flash_read_buf)(base, data, len, block_mask, block_size);
 }
@@ -183,7 +175,7 @@
   typedef int code_fun(cyg_flashaddr_t);
   code_fun *_flash_lock_block;
   
-  _flash_lock_block = (code_fun*) __anonymizer(&flash_lock_block);
+  _flash_lock_block = (code_fun*) cyg_flash_anonymizer(&flash_lock_block);
 
   return (*_flash_lock_block)(block_base);
 }
@@ -197,7 +189,7 @@
   size_t block_size = dev->block_info[0].block_size;
   cyg_uint32 blocks = dev->block_info[0].blocks;
   
-  _flash_unlock_block = (code_fun*) __anonymizer(&flash_unlock_block);
+  _flash_unlock_block = (code_fun*) cyg_flash_anonymizer(&flash_unlock_block);
   
   return (*_flash_unlock_block)(block_base, block_size, blocks);
 }
@@ -217,7 +209,7 @@
     code_fun *_flash_query;
     int d_cache, i_cache;
 
-    _flash_query = (code_fun*) __anonymizer(&flash_query);
+    _flash_query = (code_fun*) cyg_flash_anonymizer(&flash_query);
 
     HAL_FLASH_CACHES_OFF(d_cache, i_cache);
     (*_flash_query)(data);
Index: devs/flash/amd/am29xxxxxv2/current/ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/devs/flash/amd/am29xxxxxv2/current/Attic/ChangeLog,v
retrieving revision 1.1.2.5
diff -u -r1.1.2.5 ChangeLog
--- devs/flash/amd/am29xxxxxv2/current/ChangeLog	22 Nov 2004 20:11:22 -0000	1.1.2.5
+++ devs/flash/amd/am29xxxxxv2/current/ChangeLog	29 Nov 2004 00:19:24 -0000
@@ -1,3 +1,10 @@
+2004-11-29  Bart Veer  <bartv@ecoscentric.com>
+
+	* include/am29xxxxx_dev.h, src/am29xxxxx.c, src/am29xxxxx_aux.c:
+	The dummy init/query/lock/unlock functions have been moved to the
+	generic flash package. That also now exports an anonymizer
+	function.
+
 2004-11-22  Bart Veer  <bartv@ecoscentric.com>
 
 	* include/am29xxxxx_dev.h, src/am29xxxxx.c, src/am29xxxxx_aux.c,
Index: devs/flash/amd/am29xxxxxv2/current/include/am29xxxxx_dev.h
===================================================================
RCS file: /cvs/ecos/ecos/packages/devs/flash/amd/am29xxxxxv2/current/include/Attic/am29xxxxx_dev.h,v
retrieving revision 1.1.2.3
diff -u -r1.1.2.3 am29xxxxx_dev.h
--- devs/flash/amd/am29xxxxxv2/current/include/am29xxxxx_dev.h	22 Nov 2004 20:11:21 -0000	1.1.2.3
+++ devs/flash/amd/am29xxxxxv2/current/include/am29xxxxx_dev.h	29 Nov 2004 00:19:24 -0000
@@ -52,11 +52,7 @@
 #include <cyg/io/flash.h>
 #include <cyg/io/flash_priv.h>
 
-externC int     cyg_am29xxxxx_init_nop(struct cyg_flash_dev*);
-externC size_t  cyg_am29xxxxx_query_nop(struct cyg_flash_dev*, void*, const size_t);
 externC int     cyg_am29xxxxx_hwr_map_error_nop(struct cyg_flash_dev*, int);
-externC int     cyg_am29xxxxx_lock_nop(struct cyg_flash_dev*, const cyg_flashaddr_t);
-externC int     cyg_am29xxxxx_unlock_nop(struct cyg_flash_dev*, const cyg_flashaddr_t);
 
 externC int cyg_am29xxxxx_read_devid_8(     struct cyg_flash_dev*);
 externC int cyg_am29xxxxx_read_devid_16(    struct cyg_flash_dev*);
Index: devs/flash/amd/am29xxxxxv2/current/src/am29xxxxx.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/devs/flash/amd/am29xxxxxv2/current/src/Attic/am29xxxxx.c,v
retrieving revision 1.1.2.2
diff -u -r1.1.2.2 am29xxxxx.c
--- devs/flash/amd/am29xxxxxv2/current/src/am29xxxxx.c	22 Nov 2004 20:11:21 -0000	1.1.2.2
+++ devs/flash/amd/am29xxxxxv2/current/src/am29xxxxx.c	29 Nov 2004 00:19:24 -0000
@@ -195,26 +195,6 @@
 // ----------------------------------------------------------------------------
 // Generic code.
 
-// A dummy initialization routine, for platforms where everything is
-// done statically and there is no need to check device ids or anything similar.
-int
-cyg_am29xxxxx_init_nop(struct cyg_flash_dev* dev)
-{
-    CYG_UNUSED_PARAM(struct cyg_flash_dev*, dev);
-    return CYG_FLASH_ERR_OK;
-}
-
-// A dummy query routine. The implementation of this is specific to
-// each device driver, and I choose to do as little as possible.
-size_t
-cyg_am29xxxxx_query_nop(struct cyg_flash_dev* dev, void* data, size_t len)
-{
-    CYG_UNUSED_PARAM(struct cyg_flash_dev*, dev);
-    CYG_UNUSED_PARAM(void*, data);
-    CYG_UNUSED_PARAM(size_t, len);
-    return 0;
-}
-
 // A dummy hwr_map_error routine.
 int
 cyg_am29xxxxx_hwr_map_error_nop(struct cyg_flash_dev* dev, int err)
@@ -223,36 +203,6 @@
     return err;
 }
 
-// Dummy lock/unlock routines
-int
-cyg_am29xxxxx_lock_nop(struct cyg_flash_dev* dev, const cyg_flashaddr_t addr)
-{
-    CYG_UNUSED_PARAM(struct cyg_flash_dev*, dev);
-    CYG_UNUSED_PARAM(cyg_flashaddr_t, addr);
-    return CYG_FLASH_ERR_DRV_WRONG_PART;
-}
-
-int
-cyg_am29xxxxx_unlock_nop(struct cyg_flash_dev* dev, const cyg_flashaddr_t addr)
-{
-    CYG_UNUSED_PARAM(struct cyg_flash_dev*, dev);
-    CYG_UNUSED_PARAM(cyg_flashaddr_t, addr);
-    return CYG_FLASH_ERR_DRV_WRONG_PART;
-}
-
-// On some architectures there are problems calling the .2ram
-// functions from the main ones. Specifically the compiler may issue a
-// short call, even though the flash and ram are too far apart. The
-// solution is to indirect via a function pointer, but the simplistic
-// approach is vulnerable to compiler optimization. Hence the function
-// pointer is passed through an anonymizer. Even this may fail in
-// future if the compiler starts doing global optimization.
-static void*
-am29_anonymizer(void* fn)
-{
-    return fn;
-}
-
 // Get info about the current block, i.e. base and size.
 static void
 am29_get_block_info(struct cyg_flash_dev* dev, const cyg_flashaddr_t addr, cyg_flashaddr_t* block_start, size_t* block_size)
Index: devs/flash/amd/am29xxxxxv2/current/src/am29xxxxx_aux.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/devs/flash/amd/am29xxxxxv2/current/src/Attic/am29xxxxx_aux.c,v
retrieving revision 1.1.2.2
diff -u -r1.1.2.2 am29xxxxx_aux.c
--- devs/flash/amd/am29xxxxxv2/current/src/am29xxxxx_aux.c	22 Nov 2004 20:11:20 -0000	1.1.2.2
+++ devs/flash/amd/am29xxxxxv2/current/src/am29xxxxx_aux.c	29 Nov 2004 00:19:29 -0000
@@ -343,7 +343,7 @@
     CYG_CHECK_DATA_PTR(dev, "valid flash device pointer required");
     
     addr     = AM29_P2V(dev->start);
-    query_fn = (int (*)(volatile AM29_TYPE*)) am29_anonymizer( & AM29_FNNAME(am29_hw_query) );
+    query_fn = (int (*)(volatile AM29_TYPE*)) cyg_flash_anonymizer( & AM29_FNNAME(am29_hw_query) );
     devid    = (*query_fn)(addr);
     return devid;
 }
@@ -380,7 +380,7 @@
     am29_dev    = (cyg_am29xxxxx_dev*) dev->priv;    // Remove const, only place where this is needed.
     addr        = AM29_P2V(dev->start);
     cfi_fn      = (int (*)(struct cyg_flash_dev*, cyg_am29xxxxx_dev*, volatile AM29_TYPE*))
-        am29_anonymizer( & AM29_FNNAME(am29_hw_cfi));
+        cyg_flash_anonymizer( & AM29_FNNAME(am29_hw_cfi));
 
     result      = (*cfi_fn)(dev, am29_dev, addr);
 
@@ -414,7 +414,7 @@
     CYG_ASSERT(addr == block_start, "erase address should be the start of a flash block");
     
     block       = AM29_P2V(addr);
-    erase_fn    = (void (*)(volatile AM29_TYPE*)) am29_anonymizer( & AM29_FNNAME(am29_hw_erase) );
+    erase_fn    = (void (*)(volatile AM29_TYPE*)) cyg_flash_anonymizer( & AM29_FNNAME(am29_hw_erase) );
     (*erase_fn)(block);
 
     // The erase may have failed for a number of reasons, e.g. because
@@ -467,7 +467,7 @@
     data        = (const cyg_uint8*) src;
 
     program_fn  = (void (*)(volatile AM29_TYPE*, volatile AM29_TYPE*, const cyg_uint8*, cyg_uint32))
-        am29_anonymizer( & AM29_FNNAME(am29_hw_program) );
+        cyg_flash_anonymizer( & AM29_FNNAME(am29_hw_program) );
     (*program_fn)(block, addr, (const cyg_uint8*)src, len / sizeof(AM29_TYPE));
     
     // Too many things can go wrong when manipulating the h/w, so
Index: devs/flash/atmel/dataflash/current/ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/devs/flash/atmel/dataflash/current/Attic/ChangeLog,v
retrieving revision 1.1.2.7
diff -u -r1.1.2.7 ChangeLog
--- devs/flash/atmel/dataflash/current/ChangeLog	22 Nov 2004 21:05:43 -0000	1.1.2.7
+++ devs/flash/atmel/dataflash/current/ChangeLog	29 Nov 2004 00:19:31 -0000
@@ -1,3 +1,8 @@
+2004-11-29  Bart Veer  <bartv@ecoscentric.com>
+
+	* src/devs_flash_atmel_dataflash_flash_dev_funs.c: use the dummy
+	query/lock/unlock functions provided by the generic flash code
+
 2004-11-22  Bart Veer  <bartv@ecoscentric.com>
 
 	* include/dataflash.h, src/devs_flash_atmel_dataflash.c,
Index: devs/flash/atmel/dataflash/current/src/devs_flash_atmel_dataflash_flash_dev_funs.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/devs/flash/atmel/dataflash/current/src/Attic/devs_flash_atmel_dataflash_flash_dev_funs.c,v
retrieving revision 1.1.2.4
diff -u -r1.1.2.4 devs_flash_atmel_dataflash_flash_dev_funs.c
--- devs/flash/atmel/dataflash/current/src/devs_flash_atmel_dataflash_flash_dev_funs.c	22 Nov 2004 21:05:43 -0000	1.1.2.4
+++ devs/flash/atmel/dataflash/current/src/devs_flash_atmel_dataflash_flash_dev_funs.c	29 Nov 2004 00:19:32 -0000
@@ -115,12 +115,6 @@
     return CYG_DATAFLASH_ERR_OK;
 }
 
-static size_t 
-df_flash_query(struct cyg_flash_dev *dev, void *data, size_t len)
-{
-    return len;
-}
-
 static int 
 df_flash_erase_block(struct cyg_flash_dev   *dev, 
                      cyg_flashaddr_t  base)
@@ -216,33 +210,17 @@
     }
 }
 
-#ifdef CYGHWR_IO_FLASH_BLOCK_LOCKING
-static int 
-df_flash_block_lock(struct cyg_flash_dev   *dev, 
-                    const  cyg_flashaddr_t  block_base)
-{
-    return CYG_DATAFLASH_ERR_INVALID;
-}
-
-static int 
-df_flash_block_unlock(struct cyg_flash_dev  *dev, 
-                      const cyg_flashaddr_t  block_base)
-{
-    return CYG_DATAFLASH_ERR_INVALID;
-}
-#endif
-
 // -------------------------------------------------------------------------- 
 
 CYG_FLASH_FUNS(cyg_dataflash_flash_dev_funs,
                df_flash_init,
-               df_flash_query,
+               cyg_flash_devfn_query_nop,
                df_flash_erase_block,
                df_flash_program,
                df_flash_read,
                df_flash_hwr_map_error,
-               df_flash_block_lock,
-               df_flash_block_unlock
+               cyg_flash_devfn_lock_nop,
+               cyg_flash_devfn_unlock_nop
 );
 
 //----------------------------------------------------------------------------
Index: devs/flash/intel/stratav2/current/ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/devs/flash/intel/stratav2/current/Attic/ChangeLog,v
retrieving revision 1.1.2.8
diff -u -r1.1.2.8 ChangeLog
--- devs/flash/intel/stratav2/current/ChangeLog	28 Nov 2004 22:25:38 -0000	1.1.2.8
+++ devs/flash/intel/stratav2/current/ChangeLog	29 Nov 2004 00:19:37 -0000
@@ -1,3 +1,8 @@
+2004-11-29  Bart Veer  <bartv@ecoscentric.com>
+
+	* include/flash_strata_v2.inl: use the dummy lock/unlock functions
+	provided by the generic flash code.
+
 2004-11-25  Andrew Lunn  <andrew.lunn@ascom.ch>
 
 	* include/flash_strata_v2.inl: Correct the usage of const
Index: devs/flash/intel/stratav2/current/include/flash_strata_v2.inl
===================================================================
RCS file: /cvs/ecos/ecos/packages/devs/flash/intel/stratav2/current/include/Attic/flash_strata_v2.inl,v
retrieving revision 1.1.2.7
diff -u -r1.1.2.7 flash_strata_v2.inl
--- devs/flash/intel/stratav2/current/include/flash_strata_v2.inl	28 Nov 2004 22:25:37 -0000	1.1.2.7
+++ devs/flash/intel/stratav2/current/include/flash_strata_v2.inl	29 Nov 2004 00:19:37 -0000
@@ -576,8 +576,8 @@
                 strata_program_buf,
                 NULL,
                 strata_hwr_map_error,
-                NULL,
-                NULL);
+                cyg_flash_devfn_lock_nop,
+                cyg_flash_devfn_unlock_nop);
 #endif
 #endif //CYGONCE_DEVS_FLASH_STRATA_V2_INL
 // EOF strata.c
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.5
diff -u -r1.1.2.5 ChangeLog
--- devs/flash/sst/39vfxxx/current/ChangeLog	22 Nov 2004 20:40:56 -0000	1.1.2.5
+++ devs/flash/sst/39vfxxx/current/ChangeLog	29 Nov 2004 00:19:41 -0000
@@ -1,3 +1,8 @@
+2004-11-29  Bart Veer  <bartv@ecoscentric.com>
+
+	* include/flash_sst_39vfxxx.inl: use the dummy lock/unlock
+	functions provided by the generic flash code.
+
 2004-11-22  Bart Veer  <bartv@ecoscentric.com>
 	
 	* include/flash_sst_39vfxxx.inl: assume static initialization and
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.5
diff -u -r1.1.2.5 flash_sst_39vfxxx.inl
--- devs/flash/sst/39vfxxx/current/include/flash_sst_39vfxxx.inl	22 Nov 2004 20:40:54 -0000	1.1.2.5
+++ devs/flash/sst/39vfxxx/current/include/flash_sst_39vfxxx.inl	29 Nov 2004 00:19:42 -0000
@@ -326,20 +326,6 @@
     return res;
 }
 
-#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,
@@ -347,7 +333,7 @@
 	               sst_program,
 	               NULL,              // read
 	               sst_hwr_map_error,
-	               sst_block_lock,
-	               sst_block_unlock);
+	               cyg_flash_devfn_lock_nop,
+	               cyg_flash_devfn_unlock_nop);
 
 #endif // CYGONCE_DEVS_FLASH_SST_39VFXXX_INL
Index: devs/flash/synthv2/current/ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/devs/flash/synthv2/current/Attic/ChangeLog,v
retrieving revision 1.1.2.7
diff -u -r1.1.2.7 ChangeLog
--- devs/flash/synthv2/current/ChangeLog	22 Nov 2004 20:54:04 -0000	1.1.2.7
+++ devs/flash/synthv2/current/ChangeLog	29 Nov 2004 00:19:42 -0000
@@ -1,3 +1,8 @@
+2004-11-29  Bart Veer  <bartv@ecoscentric.com>
+
+	* src/synth.c: use the dummy lock/unlock functions provided by the
+	generic flash package.
+
 2004-11-22  Bart Veer  <bartv@ecoscentric.com>
 
 	* include/synth.h, src/synth.c, tests/flash3.c: merge the config
Index: devs/flash/synthv2/current/src/synth.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/devs/flash/synthv2/current/src/Attic/synth.c,v
retrieving revision 1.1.2.4
diff -u -r1.1.2.4 synth.c
--- devs/flash/synthv2/current/src/synth.c	22 Nov 2004 20:54:04 -0000	1.1.2.4
+++ devs/flash/synthv2/current/src/synth.c	29 Nov 2004 00:19:43 -0000
@@ -256,27 +256,6 @@
     return sizeof(QUERY);
 }
 
-// Just in case there is another flash driver which does implement locking
-#ifdef CYGHWR_IO_FLASH_BLOCK_LOCKING
-static int
-synth_flash_lock(struct cyg_flash_dev* dev,
-                 const cyg_flashaddr_t addr)
-{
-    CYG_UNUSED_PARAM(struct cyg_flash_dev*, dev);
-    CYG_UNUSED_PARAM(const cyg_flashaddr_t, addr);
-    return CYG_FLASH_ERR_INVALID;
-}
-
-static int
-synth_flash_unlock(struct cyg_flash_dev* dev,
-                   const cyg_flashaddr_t addr)
-{
-    CYG_UNUSED_PARAM(struct cyg_flash_dev*, dev);
-    CYG_UNUSED_PARAM(const cyg_flashaddr_t, addr);
-    return CYG_FLASH_ERR_INVALID;
-}
-#endif
-
 const CYG_FLASH_FUNS(cyg_flash_synth_funs,
                      synth_flash_init,
                      synth_flash_query,
@@ -284,8 +263,8 @@
                      synth_flash_program,
                      NULL,                 // read
                      synth_flash_hwr_map_error,
-                     synth_flash_lock,
-                     synth_flash_unlock);
+                     cyg_flash_devfn_lock_nop,
+                     cyg_flash_devfn_unlock_nop);
 
 static struct cyg_flash_synth_priv synth_flash_priv = {
     .block_size         = CYGNUM_FLASH_SYNTH_V2_BLOCKSIZE,


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