Not to sure if this is the place to ask, but I'm getting annoyed and confused :)


I am working on a little 'hobby os' / 'test bed' in protected mode.

Everything has been coming along quite nicely, with fdd and ide support, vesa support and few other necessities to keep everything running nicely.

The problem I have is designing the device driver system, for loadable modules.

I plan to have them as part of the kernel space, and loadable at boot time (not too worried about being able to install a new driver without rebooting at the moment). The part that I'm stuck on is 'how to create a driver interface'.

I've had chats with a few other developers, who I have since lost contact with, and seem to have a generalized idea of the design, but I still don't 'really' understand.

The idea of Read/Write/IOCTL functionality seems simple enough, but how does this work for things like IDE block transfers and still work for video drivers, network drivers etc....

If someone has some experience in this area, and wouldn't mind posting a few examples of the interface usage for different devices, it would be hugely appreciated.

In fact, any information in this area would be welcomed with open arms.

Thanks in advance
Posted on 2004-02-17 13:23:30 by Sentient
ioctl is a generic interface - you pass along, say, an ioctl code + buffer + buffersize to the driver, and it's then up to the driver to do with this what it wants. The idea is you have *one* way of calling into drivers, but of course the "API" used to communicate with the drivers will vary a lot. It's also a good idea to build an interface library around the ioctl calls, so you have stuff like "SetDisplayMode" instead of arbitrary-looking ioctl calls scattered all over. Quite like you have the NT native API exports NT, instead of doing the syscall interrupt.

For an idea of what parameters you (could) need for ioctl, check out DeviceIoControl in the win32 API.
Posted on 2004-02-17 13:43:44 by f0dder
Posted on 2004-02-17 16:11:11 by mrgone
Thanks a lot guys.. Even with all the searching I've done i haven't been able to find this information.
Posted on 2004-02-17 17:13:55 by Sentient