While the DISK I/O package provides the top level, hardware independent, part of each disk driver, the actual hardware interface is handled by a hardware dependent interface module. To add support for a new disk device, the user should be able to use the existing hardware independent portion and just add their own interface driver which handles the details of the actual device. The user should have no need to change the hardware independent portion.
The interfaces used by the disk driver and disk implementation modules are contained in the file <cyg/io/disk.h>.
Note: In the sections below we use the notation <<xx>> to mean a module specific value, referred to as “xx” below.
The interface module contains the devtab entry (or entries if a single module supports more than one interface). This entry should have the form:
BLOCK_DEVTAB_ENTRY(<<module_name>>, <<device_name>>, 0, &cyg_io_disk_devio, <<module_init>>, <<module_lookup>>, &<<disk_channel>> );
The "C" label for this devtab entry
The "C" string for the device. E.g. /dev/serial0.
The table of I/O functions. This set is defined in the hardware independent disk driver and should be used exactly as shown here.
The module initialization function.
The device lookup function. This function typically sets up the device for actual use, turning on interrupts, configuring the controller, etc.
This table (defined below) contains the interface between the interface module and the disk driver proper.