/* "device.h" created by: grayspace aka J. Leveille for: UbixOS Project date: May 11, 2002 purpose: master header file for all things device related $Id: device.h,v 1.1.1.1 2003/01/12 00:20:19 reddawg Exp $ */ #ifndef _DEVICE_H #define _DEVICE_H // maximum length of a device's name #define MAX_DEVICE_NAMELEN (16) // maximum number of bus devices allowed #define MAX_BUS_DEVICES (16) /* device types (for now, only bus devices allowed) */ #define DEVICE_TYPE_UNKNOWN (0) #define DEVICE_TYPE_BUS_ISA (1) #define DEVICE_TYPE_BUS_PCI (2) /* device classes */ #define DEVICE_CLASS_GENERIC (0) #define DEVICE_CLASS_SOUND_DAC (1) #define DEVICE_CLASS_VIDEO (2) #define DEVICE_CLASS_NIC (3) #define DEVICE_CLASS_DISK_CTLR (4) #define DEVICE_CLASS_DISK (5) /* string names for devices classes (for use in device list configuration files) */ #define DEVICE_CLASS_GENERIC_IDSTR "GENERIC" #define DEVICE_CLASS_SOUND_DAC_IDSTR "SOUND_DAC" #define DEVICE_CLASS_VIDEO_IDSTR "VIDEO" #define DEVICE_CLASS_NIC_IDSTR "NIC" #define DEVICE_CLASS_DISK_CTLR_IDSTR "DISK_CTLR" #define DEVICE_CLASS_DISK_IDSTR "DISK" /* string names for devices classes (for display to the user) */ #define DEVICE_CLASS_GENERIC_NAME "Generic Device" #define DEVICE_CLASS_SOUND_DAC_NAME "Sound (Digital-Ananlog Output)" #define DEVICE_CLASS_VIDEO_NAME "Video Card" #define DEVICE_CLASS_NIC_NAME "Network Card" #define DEVICE_CLASS_DISK_CTLR_NAME "Disk Controller" #define DEVICE_CLASS_DISK_NAME "Disk Device" /* device ISR or pseudo ISR */ typedef int (* DEVICE_ISR)( void * p ); /* device IO routine */ typedef int (* DEVICE_IO_RTN)( void * p ); /* device control routine */ typedef int (* DEVICE_CTRL_RTN)( void * p ); /* ISA bus device structure */ typedef struct tagDEVICE_ISA { /* bus resources assigned to device */ BUS_RESOURCES br; /* ISRs for device */ DEVICE_ISR * apfn_isr[BI_MAX_IRQS]; /* device IO routine (kernel/driver use only) */ DEVICE_IO_RTN pfn_io; /* device control routine (kernel/driver use only) */ DEVICE_CTRL_RTN pfn_ctrl; } DEVICE_BUS_ISA; /* PCI bus device structure */ /* TODO */ typedef struct tagDEVICE_BUS_PCI { int dummy; } DEVICE_BUS_PCI; /* bus device structure */ typedef union tagDEVICE_BUS { DEVICE_BUS_ISA isa; DEVICE_BUS_PCI pci; } DEVICE_BUS; /* device structure */ typedef struct tagDEVICE { /* type of device */ BYTEg type; /* pointer to actual device specific structure */ void * p; } DEVICE; /* global kernel structure for device information */ typedef struct tagDEVICES { /* bus devices */ DEVICE a_isa[MAX_BUS_DEVICES]; } DEVICES; #endif /* _DEVICE_H */