Hi,
Prabu wrote:I think first I want to write a driver for rs-232 (serial port controller).
I don't know what this driver is going to do?
Serial ports are a good way to start - well documented, etc. Start by writing code to detect them, then add more code so that other software can initialize them (set baud rate, number of bits, etc). After that write code to send a byte and receive a byte. Then (to test if it's all working right) write yourself a simple dumb terminal and connect 2 computers together (so what's typed in one is displayed on the other), or alternatively you could do a serial mouse driver.
Prabu wrote:Let me tell what I know about these three. And then I raise my doubt's
rs232,
- a programmable controller for serial port in mother board.
modem,
- used to connect with the internet.
ethernet card.
- used to connect a computer with the LAN.
Close, but not quite. RS232 is one of the many electrical standards used to transfer data over a serial cable - it goes into what voltages are interpretted as 1 and 0, synchonizing (start and stop bits), timing, what each pin on the connectors are used for, etc. You don't really have to worry about any of that (the serial controller chip handles it all for you).
The term "modem" is short for "MODulator/DEModulator". Because normal phone lines aren't designed to handle DC voltages (like ones and zeros) the modem converts the digital signals into audio tones that are suitable for normal phone lines. This is called modulating the signal (the demodulating part is the reverse). This is just an example though - the same technique is used (at higher frequencies) for a lot of things. A normal phone line type modem does this for data being sent/received, but it also has additional control sequences for dialing phone numbers, hanging up, etc.
An ethernet card is a bit different (AFAIK it uses multiple modulator/demulators at different frequencies to handle much more data at once). An ethernet card doesn't deal with normal phone lines (it's used to connect local computers together) so it doesn't need all the phone dialing & hanging up stuff. Because it can handle much more data it doesn't send/receive data one byte at a time (like the serial/modem) - instead it sends and receives complete packets of data which saves a fair bit of overhead. Also most ethernet networks connect multiple computers together (rather than just 2 like serial), so there's additional things at the start of a packet to determine who is meant to receive the packet.
Prabu wrote:My doubts:
1. Can both modem and ethernet card can present in the same system.
2. cpu --> rs232 --> modem(or)ethernet-card is this the way of connection.
3. Should I write a single driver for both rs232, modem and ethernet card or separately.
I've got a server next to me that's got 3 ethernet cards and 2 serial ports that I can plug modems into (just about all computers have one or 2 serial ports). Back 10 years ago internet service providers used banks of modems for people to dial into (e.g. 24 modems on a single computer). Often this computer was connected to other computers via ethernet (e.g. a router which was connected to an ISDN modem). There's no fixed limit to the number of serial ports and ethernet cards you can have in your computer (other than the number of PCI and/or ISA slots you've got).
Serial ports and ethernet cards are completely seperate, connections could look like:
CPU <-> bus <-> serial port <-> bus <-> CPU
CPU <-> bus <-> serial port <-> mouse
CPU <-> bus <-> serial port <-> modem <-> phone line <-> modem <-> serial port <-> bus <-> CPU
CPU <-> bus <-> ethernet card <-> ethernet card <-> bus <-> CPU
CPU <-> bus <-> ethernet card <-> hub/switch (with many computers attached)
I'd write one driver for all common serial port controllers (there's some minor variations, mostly with FIFO buffers). Ethernet cards aren't standardized, so you'd need around 20 different drivers if you want to support most of them. For modems figure out how they work first (I'd use a seperate driver, but I'm like that - it depends on what you want your OS to do).
Once you've got drivers working you'd need to look into common protocols - IP, TCP, UDP, PPP, etc. For e.g. a modem connected to the internet usually uses PPP, but there's IP on top of the PPP, and TCP & UDP on top of the IP. Then there's higher level protocols like FTP, HTTP, Telnet, NNTP, SMTP, POP3, etc than run on top of TCP and UDP.
Cheers,
Brendan