changeset 1411:5e52f3febc7d

Specify flash block device names at runtime - from David Woodhouse
author gthomas
date Mon, 01 Dec 2003 14:33:47 +0000
parents 41bc3b72d3eb
children 7423c71e5c19
files packages/io/common/current/ChangeLog packages/io/common/current/include/config_keys.h packages/io/flash/current/ChangeLog packages/io/flash/current/src/flashiodev.c
diffstat 4 files changed, 30 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/packages/io/common/current/ChangeLog
+++ b/packages/io/common/current/ChangeLog
@@ -1,3 +1,7 @@
+2003-11-27  David Woodhouse  <dwmw2@infradead.org>
+
+	* include/config_keys.h: Add CYG_IO_SET_CONFIG_FLASH_FIS_NAME
+
 2003-11-06   Billy <billy@babababa.net>
 
 	* doc/io.sgml: In the TTY section swap "\n\r" to "\r\n" to match
--- a/packages/io/common/current/include/config_keys.h
+++ b/packages/io/common/current/include/config_keys.h
@@ -121,6 +121,8 @@
 #define CYG_IO_GET_CONFIG_FLASH_DEVSIZE          0x605
 #define CYG_IO_GET_CONFIG_FLASH_BLOCKSIZE        0x606
 
+#define CYG_IO_SET_CONFIG_FLASH_FIS_NAME         0x680
+
 // ======== 0x1000 Generic ===================================================
 // Get/Set configuration 'key' values that can apply to more than one
 // class of device.
--- a/packages/io/flash/current/ChangeLog
+++ b/packages/io/flash/current/ChangeLog
@@ -1,3 +1,8 @@
+2003-11-27  David Woodhouse  <dwmw2@infradead.org>
+
+	* src/flashiodev.c: Enable set_config() and implement
+	CYG_IO_SET_CONFIG_FLASH_FIS_NAME.
+	
 2003-11-25  Andrew Lunn  <andrew.lunn@ascom.ch>
 
 	* src/flash.c: gcc 3.x vs gcc 2.x problems. 
--- a/packages/io/flash/current/src/flashiodev.c
+++ b/packages/io/flash/current/src/flashiodev.c
@@ -238,7 +238,6 @@ flashiodev_get_config( cyg_io_handle_t h
     }
 } // flashiodev_get_config()
 
-#if 0
 static Cyg_ErrNo
 flashiodev_set_config( cyg_io_handle_t handle,
                        cyg_uint32 key,
@@ -249,11 +248,28 @@ flashiodev_set_config( cyg_io_handle_t h
 	struct flashiodev_priv_t *dev = (struct flashiodev_priv_t *)tab->priv;
 
     switch (key) {
+#ifdef CYGNUM_IO_FLASH_BLOCK_CFG_FIS_1
+    case CYG_IO_SET_CONFIG_FLASH_FIS_NAME:
+    {
+        CYG_ADDRESS     flash_base;
+	unsigned long   size;
+
+	if(!CYGACC_CALL_IF_FLASH_FIS_OP(CYGNUM_CALL_IF_FLASH_FIS_GET_FLASH_BASE, 
+                                        (char *)buf, &flash_base))
+	    return -ENOENT;
+	if(!CYGACC_CALL_IF_FLASH_FIS_OP(CYGNUM_CALL_IF_FLASH_FIS_GET_SIZE, 
+					(char *)buf, &size))
+	    return -ENOENT;
+			
+	dev->start = (char *)flash_base;
+	dev->end = (char *)flash_base + size;
+	return ENOERR;
+    }
+#endif
     default:
         return -EINVAL;
     }
 } // flashiodev_set_config()
-#endif
 
 // get_config/set_config should be added later to provide the other flash
 // operations possible, like erase etc.
@@ -263,7 +279,7 @@ BLOCK_DEVIO_TABLE( cyg_io_flashdev1_ops,
                    &flashiodev_bread,
                    0, // no select
                    &flashiodev_get_config,
-                   0 // &flashiodev_set_config
+                   &flashiodev_set_config
     );