device register/unregister was Re: RTEMS-SS-20011017 Snapshot Available

Brett Swimley brett.swimley at aedinc.net
Fri Oct 19 14:50:41 UTC 2001


I'll definitely try this out in the near future.

It seems as if a shutdown function pointer would be a useful addition.  This
would actually allow the driver to be closed neatly and any loose ends tied
up.

Brett Swimley

-----Original Message-----
From: cjohns at kiwi.objectivedesign.com.au
[mailto:cjohns at kiwi.objectivedesign.com.au]On Behalf Of Chris Johns
Sent: Thursday, October 18, 2001 7:50 PM
To: joel.sherrill at oarcorp.com
Cc: brett.swimley at aedinc.net; 'RTEMS'
Subject: Re: device register/unregister was Re: RTEMS-SS-20011017
Snapshot Available


Joel Sherrill wrote:
>
> Brett Swimley wrote:
> >
> > >>  + dynamic device driver register and unregister support
> >
> > Joel, can you elaborate on how this works?
>
> Chris Johns submitted this so this is the time to yell ... HELP!! :)
>

I have a task to update the doco about this one. Here is a quick
summuary.

You can have drivers in a table as is now the case, but you can add
entries at run time. Currently you need to add space to the table using
the confdefs.h define:

 #define CONFIGURE_MAXIMUM_DRIVERS   10

This allocates a number of slots. This change changes the size of the
configuration table. It could not be helped.

The API has been extended to have the following functions:

rtems_status_code rtems_io_register_driver(
    rtems_device_major_number   major,
    rtems_driver_address_table *driver_table,
    rtems_device_major_number  *registered_major
);

rtems_status_code rtems_io_unregister_driver(
    rtems_device_major_number major
);

The first function is rtems_io_register_driver. You fill in the standard
driver address table and provide a pointer to it. These functions are
copied into the allocated slot. Not too much different here. The major
number can be selected by you setting the major number or it can be
automatically allocated. If the major number is 0 the register function
will find a free major number slot and allocate it to you. The allocated
major number is returned in the register_major variable. Once allocated
the "rtems_io_initialize" function is called.

The second function unregisters the driver. This just frees the slot. It
does _not_ currently close the driver as no call is currently provided.
Should a shutdown function pointer be added to
rtems_driver_address_table ?

--
 Chris Johns, cjohns at cybertec.com.au




More information about the users mailing list