Newer
Older
ubixos / src / sys / deviceman / device.h
@reddawg reddawg on 11 May 2002 1 KB Floppy Support
/*
   "device.h"

   created by: grayspace aka J. Leveille
   for: UbixOS Project
   date: May 11, 2002

   purpose: master header file for all things device related
*/

#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 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_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 */