Bona Fide OS Developer
View unanswered posts | View active topics It is currently Sat Jun 23, 2018 4:26 pm



Post new topic Reply to topic  [ 31 posts ]  Go to page 1, 2, 3, 4  Next
 How does one get hardware data for writing drivers? 
Author Message
Post How does one get hardware data for writing drivers?
Hi all,

How does one get enough data to write a hardware driver?

If I want to write a network card driver, is it enough to just know the make and model of the main processor on the card? (Will its datasheet tell me everything I need to know?)

I've looked a little bit at some of the linux network drivers. I don't see how the writers understood the hardware so well.

How do they understand the card-specific (couldn't two cards with the same chip differ in other ways) differences? [Trial and error?]


Thu Sep 17, 2009 7:55 pm

Joined: Fri Sep 04, 2009 2:25 pm
Posts: 3
Post Re: How does one get hardware data for writing drivers?
Depends on the device. Usually there is a microcontroller/interrupt controller/integrated circuit on the printed circuit board somewhere. This chip usually has many functions, the processor, Uart, interrupt controls, ADC/DAC... and once you discover what kind you have on your hardware then you may begin to start down the right track, if your building from scratch... for instance. A simple but neat project using programmable interrupt controller.

Typically though because of the printed circuit board design and manufacturer patents we use the provided communications port. i.e. serial, usb, pci, agp, p-ata, s-ata etc. There is a wealth of knowledge on all of the communications standards out there, but remember hardware devices have to be able to recieve interrupt requests, and recieve/transmit data to the motherboard's processor, so they usually have integrated circuit boards themselves with these simple functions. You should be able to discover what you need from the programmers manuals on your manufacturers site. Intel, or AMD. :)


Wed Sep 23, 2009 11:44 pm
Profile

Joined: Sat Jul 25, 2009 9:15 am
Posts: 257
Post Re: How does one get hardware data for writing drivers?
I think what Gadha was getting at is that programming via the provided serial, usb, pci, etc port is not that straight forward and it differs between devices that do the same thing... The problem is that OEMs do not readily publish the "how to program" their devices anymore... I've heard from driver developers of the linux community that its because OEMs fear legal intanglement with patent issues... That OEMs want people to program their stuff but they rather not deal with legal issues... and when they do provide information they cage it in with a NDA.

Back in the 1990s when my parents bought the printer and the modem their manuals had programming info, I remember I used to log onto the Packard Bell BBS and it had schematics and other technical stuff for people to download. That is not the case anymore...

I think that linux driver developers are as good as they are its because they are great reverse engineers and or they've have had the appropiate connections...


Fri Sep 25, 2009 8:00 am
Profile
Site Admin

Joined: Fri Jul 24, 2009 10:02 pm
Posts: 247
Location: Las Vegas, NV, US
Post Re: How does one get hardware data for writing drivers?
Many linux drivers were contributed by commercial entities that had NDA access to API data on specific hardware. Others have reverse engineered many components such as DVD CSS encoding and NTFS write access.

To answer your question, dude of X, the best way to program a piece of hardware is to try to find what chipset it is using and then search for the documents for that. Many ethernet cards, 56k modems, graphics cards etc use a foundation chipset that you can read the documentation on.

I've never found schematics to be of much help. It could be because I'm not familiar with them though. I'd love to do some low level PIC programming like the DIY MP# player that was linked to, but time does not allow much for this sort of hobby right now.


Fri Oct 02, 2009 8:33 pm
Profile
Post Re: How does one get hardware data for writing drivers?
First check if its supported in the bios
if it is just use the bios interface
otherwise use the In and Out instructions and hope the manufacurer gives the specs
.


Tue Oct 06, 2009 4:21 pm

Joined: Sat Jan 16, 2010 7:53 pm
Posts: 18
Location: Melbourne, Australia
Post Re: How does one get hardware data for writing drivers?
If all else fails, just use the Linux driver code as your reference :)


Sat Jan 16, 2010 7:54 pm
Profile WWW
Post Re: How does one get hardware data for writing drivers?
The Intel ICH4-ICH10 datasheets are or were available on Intel's web site. They cover most devices, including networking.

http://www.intel.com/assets/PDF/datasheet/319973.pdf

Basically, there's an I/O chip along-side the CPU in PC's which covers most devices. The problem is there are many different ICH chips and I think AMD or other companies make some too. The ICH chips do not cover graphics.


Tue Jan 19, 2010 11:48 pm

Joined: Tue Jan 19, 2010 11:51 pm
Posts: 66
Post Re: How does one get hardware data for writing drivers?
Linux is NOT your friend. I've worked on my OS for 6 years, full time. In the first couple years, I thought I could find whatever I wanted from Linux. Then, I got serious about making money and didn't want to be encumbered by GPL. It's impossible to remove the stench of GPL, so the zealots would claim --they're vicious, claiming your life's work. I learned to use the floppy from them and later removed it. I got the ATA reg usage and commands from them and later found actual good documentation.

Use documentation, not Linux, is my advice, unless you want to be hounded by Linux nuts. I hear most companies won't allow any GPL code on their machines. Better yet, use LoseThos for what you need -- no GPL code. It'll get you started.

How's this for an example...

return heinous exuberance for shade conjectures bodies diluted
conversation envenomed prosper unfailingly actions degraded
eager seduced Madness mould changed seduced molten reconciled
despisedst offences patiently Power secrecies greater
enlightens serenity hopes domain footsteps distracting
liability scoffed marry lethargy selling drank perceive
uncertain founded finish wept crookedness substantial

That's from a ouija board, essentually. Now, I own your soul because you read it! How do you like that? Lots of crazy people think they own you if they post copyrighted code on the net and you stumble upon it and accidentally read it. I know law can't be that messed-up and most people greatly insult the legal system by thinking rediculous claims are valid. They're punks who are not lawyers.


Besides, Linux code is a smoking heap of crap -- #ifdef's everywhere, stuff buried beneath layer upon layer of needless indirection. Screw them! Keep your nasty code.


Last edited by Terry A. Davis on Wed Jan 20, 2010 1:09 pm, edited 1 time in total.



Wed Jan 20, 2010 3:27 am
Profile

Joined: Thu Jan 07, 2010 4:46 am
Posts: 5
Post Re: How does one get hardware data for writing drivers?
Linux IS your friend. When you like to use GPL as I do. ;)

I actually copied the vsnprintf code for my kernel from Linux, because it's working well (though I "improved" it a bit) and I'm using GPL for every kernel I write anyway.

I cannot understand your frustration. If you're copying code from Linux (or using it as a reference), then you're forced to use GPL. That's it. And that's the way they want it to be. I like that, because I don't like the idea that I write code and someone might use that code in a closed-source project, I give code to him so I want to get code back (if I like his coding style ;)).

You want to use open-sourced code in a closed-sourced project? Then don't be angry if the open-source boys want your project to be open-sourced, too. 8-)


PS: Of course if you're not using GPL and also don't plan to do so, DON'T simply copy code from Linux - it's free but still it's copyrighted (or, better: copylefted). :geek:


Wed Jan 20, 2010 10:52 am
Profile

Joined: Tue Jan 19, 2010 11:51 pm
Posts: 66
Post Re: How does one get hardware data for writing drivers?
Why do corporations avoid GPL? Are you a friggin commie? You wish programmers not to make money or something?

I removed floppy support. Originally, I got ATA register numbers and commands--no intellectual property owned by linux -- they got it from a standard. I subsequently found the standard. I have no GPL issues, thank God.

You're a brainwashed commie.

How does one become uninfected if you're suggesting I got some disease from GPL? Is there no cure for the GPL? I'll see them in court! Is my lifes work owned by Linus Torvalds? You're a moron! Basically, you're saying anyone who comes near Linux has sold their soul for all eternity to Linus.


Last edited by Terry A. Davis on Wed Jan 20, 2010 12:23 pm, edited 1 time in total.



Wed Jan 20, 2010 12:10 pm
Profile
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 31 posts ]  Go to page 1, 2, 3, 4  Next


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by Vjacheslav Trushkin and tweaked by the BF Team.