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

Re: cyg_io_lookup () and handles


>>>>> "Trenton" == Trenton D Adams <tadams@extremeeng.com> writes:

    Trenton> Ok, this is fine. But does this mean I'm going to have to
    Trenton> go looking through the sources just to find what handles
    Trenton> I can use? After all, isn't a handle just an unsigned
    Trenton> integer identifier? Or is it just the "/dev/ser1" kind of
    Trenton> thing? In which case I could call mine
    Trenton> "/dev/mySuperWirelessDeviceThingy"! LOL

If you are really worried, how about just running something like the
following (untested):

#include <devtab.h>

int
main(int argc, char** argv)
{
    cyg_devtab_entry_t *dev;
    for (dev = &(__DEVTAB__[0]); dev != &__DEVTAB_END__; dev++) {
        printf("Device %s\n", dev->name);
    }
}

The real point is to remember the typical kind of target system that
eCos is intended for. There will only be a small number of devices in
the system and you should have a pretty good idea what they are.
Admittedly the documentation could be more explicit about this sort of
thing, e.g. the documentation for a given target might have a section
listing all of the devices that will be present plus details of
relevant configuration options etc.

Now in theory we could add complexity to the build system to check
that all devtab entries are unique, or add code bloat by doing a
run-time check, but in practice there are many more important things
to work on.

Bart

    Trenton> -----Original Message-----
    Trenton> From: jlarmour@cambridge.redhat.com
    Trenton> [mailto:jlarmour@cambridge.redhat.com] On Behalf Of Jonathan Larmour
    Trenton> Sent: Wednesday, June 13, 2001 12:24 PM
    Trenton> To: Trenton D. Adams
    Trenton> Cc: 'eCos'
    Trenton> Subject: Re: [ECOS] cyg_io_lookup () and handles


    Trenton> "Trenton D. Adams" wrote:
    >> 
    >> I think this is a simple easy to answer question.
    >> When creating drivers, does the driver developer select their own 
    >> handle for their device?  If so, how does one pick a handle that 
    >> doesn't conflict with any of the system device handles?

    Jifl> The developer is in control of the code they are using so
    Jifl> it's up to them to only have unique names in their sources
    Jifl> :-). Just name new ones unambiguously, preferably based
    Jifl> around what is distinctive about their driver.

    Jifl> There's no standard as such because the only way to make names truly
    Jifl> unique is to have a central registration authority, and that's just too
    Jifl> much overhead for something small like this :-).


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