# HG changeset patch # User gthomas # Date 1070289227 0 # Node ID 5e52f3febc7d1d1b710aa259f3932e7c4cf0093a # Parent 41bc3b72d3eb4499c9c5d7d14044a36602f1d3f0 Specify flash block device names at runtime - from David Woodhouse diff --git a/packages/io/common/current/ChangeLog b/packages/io/common/current/ChangeLog --- a/packages/io/common/current/ChangeLog +++ b/packages/io/common/current/ChangeLog @@ -1,3 +1,7 @@ +2003-11-27 David Woodhouse + + * include/config_keys.h: Add CYG_IO_SET_CONFIG_FLASH_FIS_NAME + 2003-11-06 Billy * doc/io.sgml: In the TTY section swap "\n\r" to "\r\n" to match diff --git a/packages/io/common/current/include/config_keys.h b/packages/io/common/current/include/config_keys.h --- 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. diff --git a/packages/io/flash/current/ChangeLog b/packages/io/flash/current/ChangeLog --- a/packages/io/flash/current/ChangeLog +++ b/packages/io/flash/current/ChangeLog @@ -1,3 +1,8 @@ +2003-11-27 David Woodhouse + + * src/flashiodev.c: Enable set_config() and implement + CYG_IO_SET_CONFIG_FLASH_FIS_NAME. + 2003-11-25 Andrew Lunn * src/flash.c: gcc 3.x vs gcc 2.x problems. diff --git a/packages/io/flash/current/src/flashiodev.c b/packages/io/flash/current/src/flashiodev.c --- 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 );