Thursday, August 19, 2004
First Step: Drivers
The nitty-gritty: I'm going to write a short assembly language program that I can fit in a floppy boot sector and which will scan the PCI bus and print out a list of all devices found. Then I will look those devices up in a PCI vendor/device database, and try to find existing drivers/documentation that I can use to create my own drivers.
So far, I think that the basic hardware-independant functions that need to be supported for building device drivers is: IRQ mapping, I/O port access, memory-mapped I/O access, and maybe DMA but that might work best as a separate device. In writing my Java device drivers, I will use the following methods that I assume are supported natively:
class Device {
void addInterruptListener(InterruptListener l);
void removeInterruptListener(InterruptListener l);
IORange getPortRange(long base, int len);
IORange getMemoryRange(long base, int len);
}
interface InterruptListener {
void interruptOccurred();
}
class IORange {
int readByte(int offset);
int readShort(int offset);
int readInt(int offset);
void writeByte(int offset, int data);
void writeShort(int offset, int data);
void writeInt(int offset, int data);
}
