This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: Problem in cyg_io_compare?
- From: davidw at dedasys dot com (David N. Welton)
- To: "Gary D. Thomas" <gary dot thomas at mind dot be>
- Cc: eCos Discussion <ecos-discuss at sources dot redhat dot com>
- Date: 04 Aug 2003 15:21:30 +0200
- Subject: Re: [ECOS] Problem in cyg_io_compare?
- References: <871xwapzos.fsf@dedasys.com> <1059398484.10050.5.camel@hermes><87ptjr82xm.fsf@dedasys.com> <1059654077.10050.3224.camel@hermes><87adau97mk.fsf@dedasys.com> <1059656539.10050.3306.camel@hermes>
"Gary D. Thomas" <gary.thomas@mind.be> writes:
> > 2) Document the existing behavior - "it's a feature, not a bug".
> > I would be willing to contribute a documentation patch as well
> > once I am sure I understand the underlying thought behind these
> > functions. I didn't find this either in the on-line
> > documentation, or in my copy of Anthony Massa's book.
> > Restating: it works as it does in order that the *name passed to
> > the lookup function can be added to a 'base name' known to the
> > driver to create a full name?
> Yes, that's the intention, perhaps not very well documented or
> articulated (I wrote that code oh so long ago...)
How about something along these lines:
<funcsynopsis>
<funcprototype>
<funcdef>Cyg_ErrNo <function>(*lookup)</function></funcdef>
<paramdef>struct <parameter>cyg_devtab_entry</parameter> **tab</paramdef>
<paramdef>struct <parameter>cyg_devtab_entry</parameter> *sub_tab</paramdef>
<paramdef>const char <parameter>name</parameter> *name</paramdef>
</funcprototype>
</funcsynopsis>
<para>
The lookup function is called from <function>cyg_io_lookup</function>
if the name of the device in question (as declared in the
corresponding <structname>DEVTAB_ENTRY</structname>) matches the name
passed to <function>cyg_io_lookup</function>.
</para>
<para>
The <parameter>**tab</parameter> parameter holds a pointer to the
memory location of the devtab entry. This indirection allows the
device driver author to create a new devtab entry in the lookup
function, in order to provide for pluggable devices, and devices
where multiple instances are possible.
</para>
<para>
The <parameter>*sub_tab</parameter> parameter is a
<type>cyg_io_handle_t</type> that references a second device that
the current driver depends on. It has already been looked up by
the time it is passed to the <function>lookup</function> function.
</para>
<para>
The <parameter>*name</parameter> parameter holds a pointer to the
part of a string passed to <function>cyg_io_lookup</function> that
differs from the "base name" of a device. For instance, a device
might have the base name "/dev/fd". If a lookup is performed on
"/dev/fd/1", then the <function>lookup</function> function will be
called with "/1" in its <parameter>name</parameter> argument.
</para>
Of course, it needs some tweaking, as I'm not %100 sure on how **tab
might be used, but adding that would be an improvement, especially WRT
to the name parameter and it's "confusing" behavior.
--
David N. Welton
Consulting: http://www.dedasys.com/
Personal: http://www.dedasys.com/davidw/
Free Software: http://www.dedasys.com/freesoftware/
Apache Tcl: http://tcl.apache.org/
--
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss