[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Setting up Device Driver
- Date: Sat, 2 Oct 1999 11:12:06 +1000
- From: davidh at student.unsw.edu.au (David Hocking)
- Subject: Setting up Device Driver
Hi,
I'm currently writing a device driver for the MC68EZ328 to interface with the Siemens 81c91 Standalone Full-CAN controller. I'm new to writing device drivers and new to Rtems so it's been a steep learning curve.
So far i've written rtems_device_driver functions:
can_init(major, minor, *arg);
can_read(major, minor, *arg);
can_write(major, minor, *arg);
However, i'm unsure where and how to set up the Device Driver Table. (Also the Configuration Table)
In the file console.h for example the entry appears:
#define CONSOLE_DRIVER_TABLE_ENTRY \
{ console_initialize, console_open, console_close, \
console_read, console_write, console_control }
In the user documentation an example of a typical declaration for a Device Driver Table appears:
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
}
};
I'm not sure where this declaration would occur and why this is the Driver table [2].
How are the major numbers defined ? It seems it is just the order that they appear above.
So how do you explain the CONSOLE_DRIVER_TABLE_ENTRY ?
I understand the the device driver functions correspond to the rtems_io_etc directives via the table. How then does the user know the correct major number for the device?
Thanks,
Dave.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rtems.rtems.org/pipermail/rtems-users/attachments/19991002/f30f4d51/attachment.html