RTEMS sound device driver

Joel Sherrill joel.sherrill at OARcorp.com
Fri Feb 8 00:15:43 UTC 2002


"Aaron J. Grier" wrote:
> 
> On Fri, Feb 08, 2002 at 12:02:33AM +0100, Pattara Kiatisevi wrote:
> 
> > But how exactly is this "registering" process? I took a look at the
> > existing driver code as suggested and draft the steps as follow.
> 
> rtems_io_register_name binds a name in filesystem space to the device
> driver.

Right it installs the name (/dev/dsp) you use later with open,

And rtems_io_register_driver() is a late-model service that can
dynamically
register a driver. :)

> > -I create a file contained device driver's code: sound-driver.c
> >       -Which should contain initialize(), open(), close(), read(),
> > write(), and control(). Arguments of these functions = like in console.c?
> 
> yes.
> 
> >       -In the initialize() I would have sth. like:
> >
> >       rtems_io_register_name( "/dev/dsp", major, 0 );
> >
> > -In my application file, I do open(), ioctl(), write(), close() to
> > /dev/dsp as usual.
> 
> you understand correctly.
> 
> > -And then how can I tell RTEMS to call this sound device driver when there
> > is access to /dev/dsp?
> 
> after registering the device with rtems_io_register_name, you can
> perform standard operations like open(), close(), lseek(), dup(), etc.
> on your file.  RTEMS handles the "mid level" between these calls and
> your device driver calls.
> 
> > Something to do with #def CONFIGURE_HAS_OWN_DEVICE_DRIVER_TABLE and I
> > have to create my own Device_drivers? (Hmm, but how and where? :) )
> 
> look at c/src/lib/include/console.h.  you define a table entry, and the
> extern declarations for your driver entry points, then somewhere in your
> confdefs.h:
> 
> #define CONFIGURE_HAS_OWN_DEVICE_DRIVER_TABLE
> 
> #include <console.h>
> 
> rtems_driver_address_table Device_drivers[] = {
>         CONSOLE_DRIVER_TABLE_ENTRY,
>         { NULL, NULL, NULL, NULL, NULL, NULL }
> };
> 
> getting everything glued in to autoconf/automake so that they will be
> compiled and linked into your BSP is a whole other story.  :)  let us
> know if you need help with that.

He can do all this in user/application space without tinkering with
the BSP makefiles.

> --
>   Aaron J. Grier  |   Frye Electronics, Tigard, OR   |  aaron at frye.com
>      "In a few thousand years people will be scratching their heads
>        wondering how on earth the first computer was invented and
>           bootstrapped without a prior computer to do it with."
>                     --  Chris Malcolm, on comp.arch

-- 
Joel Sherrill, Ph.D.             Director of Research & Development
joel at OARcorp.com                 On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
   Support Available             (256) 722-9985



More information about the users mailing list