General Info | |
Interface: IdeController Files: idecontroller.h Last change: 20/12/2003 Author: Luiz Henrique Shigunov |
Description
Structures |
System Functions | |
0x00 - GetDrive - Get a drive for use 0x01 - LockInterface - Lock an interface for exclusive use 0x02 - PutDrive - Free a drive 0x03 - ReadData - Read data from a drive |
0x04 - SendRequest - Send a request to a drive 0x05 - SetupDrive - Setup a drive 0x06 - UnlockInterface - Unlock an interface 0x07 - WriteData - Write data to a drive |
This page describes the IdeController interface which provides services from an IDE controller.
typedef struct { unsigned char port; unsigned char data; } IdeController_RequestPort; typedef struct { unsigned int version; unsigned int interface; unsigned int drive; unsigned int timeout; int flags; unsigned int numIOs; unsigned char status; unsigned char error; IdeController_RequestPort IOs[1]; } IdeController_Request;
Where version is the structure version (version 1), interface the interface, drive the drive, timeout the amount of seconds to wait before time out the request, flags control the request and can be 0 or the sum of:
status and error will contain the status and error byte in return.
numIOs it is the size o the IO array which contains the IO ports and the data to be write in these ports.
The IO ports present in IO will be write from IO[0] till IO[numIOs-1] in this order.
port must contain one of these values:
typedef struct { unsigned int version; unsigned int interface; unsigned int drive; int flags; } IdeController_Setup;
Where version it is the structure version (version 1), interface the interface, drive the drive and flags must be 0 or the sum of:
These functions are exclusive for system modules.
int IdeController_GetDrive(unsigned int interface, unsigned int drive);
This function gets drive from interface for exclusive use.
drive and interface start at zero.
To free drive use PutDrive.
int IdeController_LockInterface(unsigned int interface);
This function locks interface for exclusive use.
The calling thread will block until it gets exclusive use.
interface starts at zero.
Before an IDE interface can be used on any IdeController function it must be locked for exclusive use using LockInterface.
To unlock use UnlockInterface.
int IdeController_PutDrive(unsigned int interface, unsigned int drive);
This function frees drive from interface.
drive and interface start at zero.
If drive was not got nothing happens and the function returns success.
int IdeController_ReadData(unsigned int interface, void *buf, unsigned int size);
This function reads size bytes from interface and puts them in buf.
interface starts at zero.
int IdeController_SendRequest(IdeController_Request *rq);
This function processes the request rq.
int IdeController_SetupDrive(const IdeController_Setup *set);
This function sets up the drive acording to set.
int IdeController_UnlockInterface(unsigned int interface);
This function unlocks interface.
interface starts at zero.
int IdeController_WriteData(unsigned int interface, const void *buf, unsigned int size);
This function writes size bytes from buf into interface.
interface starts at zero.