RTEMS Logo

RTEMS 4.7.2 On-Line Library


Configuring a System Driver Address Table

PREV UP NEXT Bookshelf RTEMS C User's Guide

22.8: Driver Address Table

The Device Driver Table is used to inform the I/O Manager of the set of entry points for each device driver configured in the system. The table contains one entry for each device driver required by the application. The number of entries is defined in the number_of_device_drivers entry in the Configuration Table. This table is copied to the Device Drive Table during the IO Manager's initialization giving the entries in this table the lower major numbers. The format of each entry in the Device Driver Table is defined in the following C structure:

typedef struct {
  rtems_device_driver_entry initialization_entry;
  rtems_device_driver_entry open_entry;
  rtems_device_driver_entry close_entry;
  rtems_device_driver_entry read_entry;
  rtems_device_driver_entry write_entry;
  rtems_device_driver_entry control_entry;
} rtems_driver_address_table;
initialization_entry
is the address of the entry point called by rtems_io_initialize to initialize a device driver and its associated devices.
open_entry
is the address of the entry point called by rtems_io_open.
close_entry
is the address of the entry point called by rtems_io_close.
read_entry
is the address of the entry point called by rtems_io_read.
write_entry
is the address of the entry point called by rtems_io_write.
control_entry
is the address of the entry point called by rtems_io_control.

Driver entry points configured as NULL will always return a status code of RTEMS_SUCCESSFUL. No user code will be executed in this situation.

A typical declaration for a Device Driver Table might appear as follows:

rtems_driver_address_table Driver_table[2] = {
   { tty_initialize, tty_open,  tty_close,  /* major = 0 */
     tty_read,       tty_write, tty_control
   },
   { lp_initialize, lp_open,    lp_close,   /* major = 1 */
     NULL,          lp_write,   lp_control
   }
};

More information regarding the construction and operation of device drivers is provided in the I/O Manager chapter.


PREV UP NEXT Bookshelf RTEMS C User's Guide

Copyright © 1988-2004 OAR Corporation