Chapter 47. Hardware Driver Interface

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.

DevTab Entry

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>>
                  );

Arguments

module_name

The "C" label for this devtab entry

device_name

The "C" string for the device. E.g. /dev/serial0.

cyg_io_disk_devio

The table of I/O functions. This set is defined in the hardware independent disk driver and should be used exactly as shown here.

module_init

The module initialization function.

module_lookup

The device lookup function. This function typically sets up the device for actual use, turning on interrupts, configuring the controller, etc.

disk_channel

This table (defined below) contains the interface between the interface module and the disk driver proper.

2017-02-09
Documentation license for this page: eCosPro License