Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
I finished dealing with my PCI configure space and read all the information I needed.
Now that I have read the IO BAR's for my network cards, I am having trouble reading from that space in memory. There for some reason is little help out there for what to do about STARTING driver development, and the few answers that are out there just point to the linux source.
How do I read from the IO address area?
say my base address is 0x6601, would I read it like this:
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
If port(register) = BAR+5eh of rtl8139D returns revision on reads then you are right.
If you want revision from PCI configuration space then it has offset 8h and no BARs involved.
yea, that is what I wanted, the non-config_space way.
I'm having a hard time getting reads from IO space provided by device BARs. Is there a sure way to see if the BAR's being read are correct?
dont know, but you can print this hex # on the screen, last bit has to be 1 and you need to clear(=0) last byte before doing 'out' & 'in'
Most likely address has to be 16bit number not more.
You can try other offset other than 5eh, and see if reading status for instance makes sense.
Another thought: see which address(BAR) linux or windows have. Not sure how to to that. In Win you go to Device Manager -> Properties of netw adapter -> Resources Tab.
As far as I know WinXP doesn't change any addresses.
I'm not familiar with this card but maybe you need to check Command word of PCI conf space and ensure that BustMastering, IO and maybe other bits are set.
Last edited by exkor on Wed Aug 08, 2007 8:49 pm, edited 1 time in total.
I just thought of this, but, someone should write a step-by-step tutorial on how to write network device drivers, or something similar.
I've gone to places like osdever.net, and even with their large tutorial/document sections, they hardly even touch on device driver writing, and usually when someone does, they refer to linux module coding...
01000101 wrote:I've gone to places like osdever.net, and even with their large tutorial/document sections, they hardly even touch on device driver writing, and usually when someone does, they refer to linux module coding...
That's because drivers are never the same on different operating systems. Each OS handles drivers differently.
If you do want to look at a very basic NE2k/rtl8139d driver, try here or here (both are the same, with some basic differences).