This is the mail archive of the ecos-discuss@sourceware.cygnus.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]

IO driver open mode / close function



There was some discussion a few months back regarding modifying the IO
layer in eCos so that drivers would know the open mode (for stdio fopen)
as well as adding a close function. 

http://sourceware.cygnus.com/ml/ecos-discuss/1999-11/msg00082.html

I am in support of adding this capability to eCos.  So as not to break
the existing code base, I suggest adding two new functions to the
cyg_devio_table [cyg_devio_table_t] structure.

    Cyg_ErrNo (*open)(cyg_io_handle_t *handle, const char *name, int
mode);
    Cyg_ErrNo (*close)(cyg_io_handle_t *handle);

The "char *name" in the open function is the same as passed down to the
cyg_io_lookup function.  This would probably require parsing again (to
remove the device name portion [matched portion] from the "file name"
portion).

In addition, add the corresponding user callable functions to iosys.c. 
Also add calls to these from the fopen and fclose function (if non NULL
plugged functions).

I believe if the DEVIO_TABLE macro where modified to default the open
and close function pointers to NULL then there would be no impact to
existing code.  New code/devices would use a new macro called
DEVIO_TABLE_VER1 which have arguments for the open and close function
pointers.

If this work, or something similar, has not been done and everyone is in
agreement, I have no problem implementing these changes and passing them
on to the eCos maintainers

-dave-
-- 
*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
 Dave Vogel                             dave@lightsurf.com
 LightSurf Technologies, Inc.            www.lightsurf.com
*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*

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