VxWorks Reference Manual : Libraries
ideDrv - IDE disk device driver
ideDrv( ) - initialize the IDE driver
ideDevCreate( ) - create a device for a IDE disk
ideRawio( ) - provide raw I/O access
This is the driver for the IDE used on the PC 386/486.
Most of the routines in this driver are accessible only through the I/O system. However, two routines must be called directly: ideDrv( ) to initialize the driver, and ideDevCreate( ) to create devices.
Before the driver can be used, it must be initialized by calling ideDrv( ). This routine should be called exactly once, before any reads, writes, or calls to ideDevCreate( ). Normally, it is called from usrRoot( ) in usrConfig.c.
The routine ideRawio( ) provides physical I/O access. Its first argument is a drive number, 0 or 1; the second argument is a pointer to an IDE_RAW structure.
Format is not supported, because IDE disks are already formatted, and bad sectors are mapped.
ideDrv, VxWorks Programmer's Guide: I/O System
ideDrv( ) - initialize the IDE driver
STATUS ideDrv ( int vector, /* interrupt vector */ int level, /* interrupt level */ BOOL manualConfig /* 1 = initialize drive parameters */ )
This routine initializes the IDE driver, sets up interrupt vectors, and performs hardware initialization of the IDE chip.
This routine should be called exactly once, before any reads, writes, or calls to ideDevCreate( ). Normally, it is called by usrRoot( ) in usrConfig.c.
The ideDrv( ) call requires a configuration type, manualConfig. If this argument is 1, the driver will initialize drive parameters; if the argument is 0, the driver will not initialize drive parameters.
The drive parameters are the number of sectors per track, the number of heads, and the number of cylinders. They are stored in the structure table ideTypes[] in sysLib.c. The table has two entries: the first is for drive 0; the second is for drive 1. The table has two other members which are used by the driver: the number of bytes per sector and the precompensation cylinder. These two members should be set properly. Definitions of the structure members are:
int cylinders; /* number of cylinders */ int heads; /* number of heads */ int sectorsTrack; /* number of sectors per track */ int bytesSector; /* number of bytes per sector */ int precomp; /* precompensation cylinder */
OK, or ERROR if initialization fails.
ideDrv, ideDevCreate( )
ideDevCreate( ) - create a device for a IDE disk
BLK_DEV *ideDevCreate ( int drive, /* drive number for hard drive (0 or 1) */ int nBlocks, /* device size in blocks (0 = whole disk) */ int blkOffset /* offset from start of device */ )
This routine creates a device for a specified IDE disk.
drive is a drive number for the hard drive: it must be 0 or 1.
The nBlocks parameter specifies the size of the device, in blocks. If nBlocks is zero, the whole disk is used.
The blkOffset parameter specifies an offset, in blocks, from the start of the device to be used when writing or reading the hard disk. This offset is added to the block numbers passed by the file system during disk accesses. (VxWorks file systems always use block numbers beginning at zero for the start of a device.)
A pointer to a block device structure (BLK_DEV), or NULL if memory cannot be allocated for the device structure.
ideDrv, dosFsMkfs( ), dosFsDevInit( ), rt11FsDevInit( ), rt11FsMkfs( ), rawFsDevInit( )
ideRawio( ) - provide raw I/O access
STATUS ideRawio ( int drive, /* drive number for hard drive (0 or 1) */ IDE_RAW * pIdeRaw /* pointer to IDE_RAW structure */ )
This routine is called when the raw I/O access is necessary.
drive is a drive number for the hard drive: it must be 0 or 1.
The pIdeRaw is a pointer to the structure IDE_RAW which is defined in ideDrv.h
OK or ERROR.