changeset 1753:a15c7003d1da

Update following changes to the flash device driver interface
author bartv
date Mon, 22 Nov 2004 20:11:20 +0000
parents 61fbcc1cb232
children 6a1e54eaaac8
files packages/devs/flash/amd/am29xxxxxv2/current/ChangeLog packages/devs/flash/amd/am29xxxxxv2/current/doc/am29xxxxx.sgml packages/devs/flash/amd/am29xxxxxv2/current/include/am29xxxxx_dev.h packages/devs/flash/amd/am29xxxxxv2/current/src/am29xxxxx.c packages/devs/flash/amd/am29xxxxxv2/current/src/am29xxxxx_aux.c
diffstat 5 files changed, 35 insertions(+), 31 deletions(-) [+]
line wrap: on
line diff
--- a/packages/devs/flash/amd/am29xxxxxv2/current/ChangeLog
+++ b/packages/devs/flash/amd/am29xxxxxv2/current/ChangeLog
@@ -1,5 +1,8 @@
 2004-11-22  Bart Veer  <bartv@ecoscentric.com>
 
+	* include/am29xxxxx_dev.h, src/am29xxxxx.c, src/am29xxxxx_aux.c,
+	doc/am29xxxxx.sgml: implement changes to the interface between the
+	generic flash code and the device drivers.
 	* include/am29xxxxx_dev.h: rename cyg_block_info to
 	cyg_flash_block_info
 
--- a/packages/devs/flash/amd/am29xxxxxv2/current/doc/am29xxxxx.sgml
+++ b/packages/devs/flash/amd/am29xxxxxv2/current/doc/am29xxxxx.sgml
@@ -126,14 +126,14 @@ the one supported by the platform HAL an
       <funcprototype>
         <funcdef>int <function>cyg_am29xxxxx_erase_XX</function></funcdef>
         <paramdef>struct cyg_flash_dev* <parameter>device</parameter></paramdef>
-        <paramdef>const cyg_flashaddr_t <parameter>addr</parameter></paramdef>
+        <paramdef>cyg_flashaddr_t <parameter>addr</parameter></paramdef>
       </funcprototype>
       <funcprototype>
         <funcdef>int <function>cyg_am29xxxxx_program_XX</function></funcdef>
         <paramdef>struct cyg_flash_dev* <parameter>device</parameter></paramdef>
-        <paramdef>const cyg_flashaddr_t <parameter>addr</parameter></paramdef>
+        <paramdef>cyg_flashaddr_t <parameter>addr</parameter></paramdef>
         <paramdef>const void* <parameter>data</parameter></paramdef>
-        <paramdef>const size_t <parameter>len</parameter></paramdef>
+        <paramdef>size_t <parameter>len</parameter></paramdef>
       </funcprototype>
       <funcprototype>
         <funcdef>int <function>cyg_am29xxxxx_query_nop</function></funcdef>
@@ -303,7 +303,7 @@ static const CYG_FLASH_FUNS(hal_alaia_fl
     &amp;cyg_am29xxxxx_query_nop,
     &amp;cyg_am29xxxxx_erase_16,
     &amp;cyg_am29xxxxx_program_16,
-    (int (*)(struct cyg_flash_dev*, const cyg_flashaddr_t, void*, const size_t))0,
+    (int (*)(struct cyg_flash_dev*, const cyg_flashaddr_t, void*, size_t))0,
     &amp;cyg_am29xxxxx_hwr_map_error_nop,
     &amp;cyg_am29xxxxx_lock_nop,
     &amp;cyg_am29xxxxx_unlock_nop);
@@ -318,14 +318,15 @@ static const cyg_am29xxxxx_dev hal_alaia
     }
 };
 
-struct cyg_flash_dev hal_alaia_flash CYG_HAL_TABLE_ENTRY(cyg_flashdev) = {
-    .funs               = &amp;hal_alaia_flash_amd_funs,
-    .start              = 0xFFE00000,
-    .end                = 0xFFFFFFFF,
-    .num_block_infos    = 4,
-    .block_info         = hal_alaia_flash_priv.block_info,
-    .priv               = &amp;hal_alaia_flash_priv
-};
+CYG_FLASH_DRIVER(hal_alaia_flash,
+                 &amp;hal_alaia_flash_amd_funs,
+                 0,
+                 0xFFE00000,
+                 0xFFFFFFFF,
+                 4,
+                 hal_alaia_flash_priv.block_info,
+                 &amp;hal_alaia_flash_priv
+);
 #endif
     </programlisting>
     <para>
@@ -459,7 +460,7 @@ platform-specific erase function would l
       </para>
       <programlisting width=72>
 static int
-alaia_flash_erase(struct cyg_flash_dev* dev, const cyg_flashaddr_t addr)
+alaia_flash_erase(struct cyg_flash_dev* dev, cyg_flashaddr_t addr)
 {
     int result;
     &hellip;  // Set up the hardware for an erase
--- a/packages/devs/flash/amd/am29xxxxxv2/current/include/am29xxxxx_dev.h
+++ b/packages/devs/flash/amd/am29xxxxxv2/current/include/am29xxxxx_dev.h
@@ -82,21 +82,21 @@ externC int cyg_am29xxxxx_init_cfi_8888(
 externC int cyg_am29xxxxx_init_cfi_1616(  struct cyg_flash_dev*);
 externC int cyg_am29xxxxx_init_cfi_16as8( struct cyg_flash_dev*);
 
-externC int cyg_am29xxxxx_erase_8(     struct cyg_flash_dev*, const cyg_flashaddr_t);
-externC int cyg_am29xxxxx_erase_16(    struct cyg_flash_dev*, const cyg_flashaddr_t);
-externC int cyg_am29xxxxx_erase_32(    struct cyg_flash_dev*, const cyg_flashaddr_t);
-externC int cyg_am29xxxxx_erase_88(    struct cyg_flash_dev*, const cyg_flashaddr_t);
-externC int cyg_am29xxxxx_erase_8888(  struct cyg_flash_dev*, const cyg_flashaddr_t);
-externC int cyg_am29xxxxx_erase_1616(  struct cyg_flash_dev*, const cyg_flashaddr_t);
-externC int cyg_am29xxxxx_erase_16as8( struct cyg_flash_dev*, const cyg_flashaddr_t);
+externC int cyg_am29xxxxx_erase_8(     struct cyg_flash_dev*, cyg_flashaddr_t);
+externC int cyg_am29xxxxx_erase_16(    struct cyg_flash_dev*, cyg_flashaddr_t);
+externC int cyg_am29xxxxx_erase_32(    struct cyg_flash_dev*, cyg_flashaddr_t);
+externC int cyg_am29xxxxx_erase_88(    struct cyg_flash_dev*, cyg_flashaddr_t);
+externC int cyg_am29xxxxx_erase_8888(  struct cyg_flash_dev*, cyg_flashaddr_t);
+externC int cyg_am29xxxxx_erase_1616(  struct cyg_flash_dev*, cyg_flashaddr_t);
+externC int cyg_am29xxxxx_erase_16as8( struct cyg_flash_dev*, cyg_flashaddr_t);
 
-externC int cyg_am29xxxxx_program_8(     struct cyg_flash_dev*, const cyg_flashaddr_t, const void*, const size_t);
-externC int cyg_am29xxxxx_program_16(    struct cyg_flash_dev*, const cyg_flashaddr_t, const void*, const size_t);
-externC int cyg_am29xxxxx_program_32(    struct cyg_flash_dev*, const cyg_flashaddr_t, const void*, const size_t);
-externC int cyg_am29xxxxx_program_88(    struct cyg_flash_dev*, const cyg_flashaddr_t, const void*, const size_t);
-externC int cyg_am29xxxxx_program_8888(  struct cyg_flash_dev*, const cyg_flashaddr_t, const void*, const size_t);
-externC int cyg_am29xxxxx_program_1616(  struct cyg_flash_dev*, const cyg_flashaddr_t, const void*, const size_t);
-externC int cyg_am29xxxxx_program_16as8( struct cyg_flash_dev*, const cyg_flashaddr_t, const void*, const size_t);
+externC int cyg_am29xxxxx_program_8(     struct cyg_flash_dev*, cyg_flashaddr_t, const void*, size_t);
+externC int cyg_am29xxxxx_program_16(    struct cyg_flash_dev*, cyg_flashaddr_t, const void*, size_t);
+externC int cyg_am29xxxxx_program_32(    struct cyg_flash_dev*, cyg_flashaddr_t, const void*, size_t);
+externC int cyg_am29xxxxx_program_88(    struct cyg_flash_dev*, cyg_flashaddr_t, const void*, size_t);
+externC int cyg_am29xxxxx_program_8888(  struct cyg_flash_dev*, cyg_flashaddr_t, const void*, size_t);
+externC int cyg_am29xxxxx_program_1616(  struct cyg_flash_dev*, cyg_flashaddr_t, const void*, size_t);
+externC int cyg_am29xxxxx_program_16as8( struct cyg_flash_dev*, cyg_flashaddr_t, const void*, size_t);
 
 // FIXME: add program_buffered() support as per e.g. the AM29LV128
 // FIXME: add software lock/unlock support as per e.g. the AM29BDS640
--- a/packages/devs/flash/amd/am29xxxxxv2/current/src/am29xxxxx.c
+++ b/packages/devs/flash/amd/am29xxxxxv2/current/src/am29xxxxx.c
@@ -207,7 +207,7 @@ cyg_am29xxxxx_init_nop(struct cyg_flash_
 // 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, const size_t len)
+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);
--- a/packages/devs/flash/amd/am29xxxxxv2/current/src/am29xxxxx_aux.c
+++ b/packages/devs/flash/amd/am29xxxxxv2/current/src/am29xxxxx_aux.c
@@ -377,7 +377,7 @@ AM29_FNNAME(cyg_am29xxxxx_init_cfi)(stru
     int                 result;
     
     CYG_CHECK_DATA_PTR(dev, "valid flash device pointer required");
-    am29_dev    = (cyg_am29xxxxx_dev*) dev->priv;
+    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));
@@ -399,7 +399,7 @@ AM29_FNNAME(cyg_am29xxxxx_init_cfi)(stru
 // Erase a single block. The calling code will have supplied a pointer
 // aligned to a block boundary.
 int
-AM29_FNNAME(cyg_am29xxxxx_erase)(struct cyg_flash_dev* dev, const cyg_flashaddr_t addr)
+AM29_FNNAME(cyg_am29xxxxx_erase)(struct cyg_flash_dev* dev, cyg_flashaddr_t addr)
 {
     void                (*erase_fn)(volatile AM29_TYPE*);
     volatile AM29_TYPE* block;
@@ -435,7 +435,7 @@ AM29_FNNAME(cyg_am29xxxxx_erase)(struct 
 // Write some data to the flash. The destination must be aligned
 // appropriately for the bus width (not the device width).
 int
-AM29_FNNAME(cyg_am29xxxxx_program)(struct cyg_flash_dev* dev, const cyg_flashaddr_t dest, const void* src, const size_t len)
+AM29_FNNAME(cyg_am29xxxxx_program)(struct cyg_flash_dev* dev, cyg_flashaddr_t dest, const void* src, size_t len)
 {
     void                (*program_fn)(volatile AM29_TYPE*, volatile AM29_TYPE*, const cyg_uint8*, cyg_uint32);
     volatile AM29_TYPE* block;