--- /f/ecos/packages/io/common/current/include/devtab.h Fri Nov 24 15:49:04 2000 +++ /f/io/common/current/include/devtab.h Tue Jan 22 11:27:10 2002 @@ -143,6 +143,7 @@ typedef struct cyg_devtab_entry { Cyg_ErrNo (*lookup)(struct cyg_devtab_entry **tab, struct cyg_devtab_entry *sub_tab, const char *name); + void (*shutdown)(cyg_io_handle_t handle); /* shutdown device is possbile */ void *priv; unsigned long status; } CYG_HAL_TABLE_TYPE cyg_devtab_entry_t; @@ -160,10 +161,24 @@ cyg_devtab_entry_t _l CYG_HAL_TABLE_ENTR _handlers, \ _init, \ _lookup, \ + NULL, \ _priv, \ CYG_DEVTAB_STATUS_CHAR \ }; +#define CHAR_DEVTAB_ENTRY_WITH_SHUTDOWN(_l,_name,_dep_name,_handlers,_init,_lookup,_shutdown,_priv) \ +cyg_devtab_entry_t _l CYG_HAL_TABLE_ENTRY(devtab) = { \ + _name, \ + _dep_name, \ + _handlers, \ + _init, \ + _lookup, \ + _shutdown, \ + _priv, \ + CYG_DEVTAB_STATUS_CHAR \ +}; + + #define BLOCK_DEVTAB_ENTRY(_l,_name,_dep_name,_handlers,_init,_lookup,_priv) \ cyg_devtab_entry_t _l CYG_HAL_TABLE_ENTRY(devtab) = { \ _name, \ @@ -171,13 +186,30 @@ cyg_devtab_entry_t _l CYG_HAL_TABLE_ENTR _handlers, \ _init, \ _lookup, \ + NULL, \ _priv, \ CYG_DEVTAB_STATUS_BLOCK \ }; +#define BLOCK_DEVTAB_ENTRY_WITH_SHUTDOWN(_l,_name,_dep_name,_handlers,_init,_lookup,_shutdown,_priv) \ +cyg_devtab_entry_t _l CYG_HAL_TABLE_ENTRY(devtab) = { \ + _name, \ + _dep_name, \ + _handlers, \ + _init, \ + _lookup, \ + _shutdown, \ + _priv, \ + CYG_DEVTAB_STATUS_BLOCK \ +}; + + #define DEVTAB_ENTRY(_l,_name,_dep_name,_handlers,_init,_lookup,_priv) \ CHAR_DEVTAB_ENTRY(_l,_name,_dep_name,_handlers,_init,_lookup,_priv) +#define DEVTAB_ENTRY_WITH_SHUTDOWN(_l,_name,_dep_name,_handlers,_init,_lookup,_shutdown,_priv) \ + CHAR_DEVTAB_ENTRY(_l,_name,_dep_name,_handlers,_init,_lookup,_shutdown,_priv) + #define DEVTAB_ENTRY_NO_INIT(_l,_name,_dep_name,_handlers,_init,_lookup,_priv) \ cyg_devtab_entry_t _l = { \ @@ -186,6 +218,7 @@ cyg_devtab_entry_t _l = { _handlers, \ _init, \ _lookup, \ + NULL, \ _priv, \ CYG_DEVTAB_STATUS_CHAR \ }; --- /f/ecos/packages/io/common/current/include/io.h Sat Aug 26 01:33:26 2000 +++ /f/io/common/current/include/io.h Tue Jan 22 11:35:12 2002 @@ -66,6 +66,8 @@ typedef void *cyg_io_handle_t; // Lookup a device and return it's handle Cyg_ErrNo cyg_io_lookup(const char *name, cyg_io_handle_t *handle); +// shutdown a device +Cyg_ErrNo cyg_io_shutdown(cyg_io_handle_t handle); // Write data to a device Cyg_ErrNo cyg_io_write(cyg_io_handle_t handle, const void *buf, --- /f/ecos/packages/io/common/current/src/iosys.c Fri Nov 24 15:49:04 2000 +++ /f/io/common/current/src/iosys.c Tue Jan 22 11:40:48 2002 @@ -146,6 +146,20 @@ cyg_io_lookup(const char *name, cyg_io_h } // +// 'shutdown' a device +// + +Cyg_ErrNo cyg_io_shutdown(cyg_io_handle_t handle) +{ + cyg_devtab_entry_t *t = (cyg_devtab_entry_t *)handle; + // Validate request + if (!t->handlers->shutdown) { + return -EDEVNOSUPP; + } + return t->handlers->write(handle); +} + +// // 'write' data to a device. //