Page 1 of 1

[edit]NIC driver

Posted: Sun May 11, 2008 9:24 am
by packet50071
I want to add internet support to my OS :D

But i have no clue of what so ever about where to start . I googled but no luck. any pointing to right direction would be great.

Posted: Sun May 11, 2008 9:37 am
by 01000101
have you written a NIC driver? if not, that would deffinately be the first place to start as writing a TCP/IP stack doesn't provide much functionality without a network card.

but, assuming you have. You need to create structures of the various protocols (TCP/IP, ARP, RARP, ICMP, IGMP, etc...) and then parse the structure after the packet has been copied onto the appropriate structure.

If you have some decent assembly knowledge, I believe Dex just relased his TCP/IP stack which you could look at to get you more familiar with the stack. Also, if you google for TCP/IP Stacks I'm sure you will find pre-built structures with explanations to guide you along.

Posted: Sun May 11, 2008 9:53 am
by packet50071
thanks for the reply :)

I don't have NIC driver . thats what I am looking for

Posted: Sun May 11, 2008 10:56 am
by Dex
So what NIC card do you have on your sys ?, put the name of it in Google along with date sheet and see what it comes up with.

Posted: Sun May 11, 2008 11:31 am
by lukem95
There are some entries on the Wiki for common cards (ne2k and a realtek one iirc).

I'd suggest buying one of those (or using qemu/bochs to emulate one) and write your first driver for that.

Posted: Sun May 11, 2008 11:35 am
by packet50071
I have this VIA Rhine II fast ehternet adapter

I thought there are some standard basic features that are common in all cards. Am i wrong ?

Posted: Sun May 11, 2008 1:12 pm
by Dex
packet50071 wrote:I have this VIA Rhine II fast ehternet adapter

I thought there are some standard basic features that are common in all cards. Am i wrong ?
Yes, you need to write a driver for your card, Some times you can not find a data sheet.
So you look for Linux or BSD drivers eg:
http://www.gelato.unsw.edu.au/lxr/sourc ... ia-rhine.c
In it you will find "References"
This leads to
http://people.freebsd.org/~wpaul/VIA/VT86C100A03.pdf
and
http://people.freebsd.org/~wpaul/VIA/VT6102_021.PDF
Thats how you get info for your driver.

Posted: Sun May 11, 2008 6:15 pm
by 01000101
packet50071 wrote: I thought there are some standard basic features that are common in all cards. Am i wrong ?
There are "standards" but unfortunately finding a card that actually obeys the standards is hit or miss. Ne2K is one type of standard.