Hello,
I want to write a device driver for hard disk / floppy drive . I already wrote a floppy one. But I am trying to learn how everything works together.
I did give ATA PIO mode and IDE a look. But they do not talk about a set of steps to follow. They already assume we know PCI and DMA and stuff. Which again , I did read. My english is bad , so maybe I missed or could not understand the entire article. Like what is the configuration space and related how do we program them(What are they doing there). What is the ISA.
Can someone give me pointers to writing a device driver (For a hard disk )
Where to start.
I have implemented an OS upto floppy drive controller.
Regards
A doubt/advice on writing a device driver
-
- Member
- Posts: 35
- Joined: Mon Mar 07, 2011 1:41 pm
Re: A doubt/advice on writing a device driver
I suggest to start design the driver interface without actually be so specific to any hardware interface.
For example, "block device" as of unix world, or your own abstract storage device to support your genius idea(eg. distributed, hierarchy, etc)
The device interface would support a set of logical command, again, take unix's design for example:
- open, close
- read X block from offset X
- write X block from offset X
- and the ugly ioctl for all other things.
- identify mechanism
- non-blocking mechanism
These functions will make use of a set of data structures you have to designed.
Then, for each specific hardware you implement the actual piece of code to detect/talk to hardware, and implement the interface functions.
And for the PCI things, read the wiki, then read it again, then re-read it again until you got the idea - this works for me.
For example, "block device" as of unix world, or your own abstract storage device to support your genius idea(eg. distributed, hierarchy, etc)
The device interface would support a set of logical command, again, take unix's design for example:
- open, close
- read X block from offset X
- write X block from offset X
- and the ugly ioctl for all other things.
- identify mechanism
- non-blocking mechanism
These functions will make use of a set of data structures you have to designed.
Then, for each specific hardware you implement the actual piece of code to detect/talk to hardware, and implement the interface functions.
And for the PCI things, read the wiki, then read it again, then re-read it again until you got the idea - this works for me.