help needed for modem driver
help needed for modem driver
i'm trying to implement tcp/ip stack.for this first i need to communicate with modem.
can u please give me some code,link or anything else which u think might be helpful in writing modem driver.
can u please give me some code,link or anything else which u think might be helpful in writing modem driver.
Re:help needed for modem driver
You might want to think about how you're going to organise your TCP/IP stack first, because that will be a lot harder than talking to the modem via the serial port. Serial port access can be as simple as a couple of routines.
In fact, you might find it easier to set up a test PC with a network card, and get TCP/IP working over a network first. That will minimise the amount of code you'll need to debug, because it will delay the need to write serial port or PPP code until later. You'll still have a lot of work to do, with Ethernet/ARP/IP/UDP/TCP to do, but it will be less.
In fact, you might find it easier to set up a test PC with a network card, and get TCP/IP working over a network first. That will minimise the amount of code you'll need to debug, because it will delay the need to write serial port or PPP code until later. You'll still have a lot of work to do, with Ethernet/ARP/IP/UDP/TCP to do, but it will be less.
Re:help needed for modem driver
thanks tim.But still i need to communicate with some communication device (modem etc.) to check tcp/ip over a small network of just two PCs.
Can u please help me with those couple of routines to start communication through modem.
Can u please help me with those couple of routines to start communication through modem.
Re:help needed for modem driver
The PC serial port is completely standard, and has remained almost the same since the PC was introduced back in the 1980s. http://www.nondot.org/sabre/os/articles ... onDevices/ should have what you need.
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:help needed for modem driver
of course, this mainly apply to 'external' modems. Do not expect any support for so-called Winmodems, as they are some kind of poor undocumented digital-to-analogous chips controlled by a closed-source driver in a .DLL file ...
Re:help needed for modem driver
i've implemented tcp/ip stack in c using one library function to establish connection with modem.
now i'm trying to work that stack as stand alone .for this
i've to code a modem driver.Can anyone give me code to
dial a number using Hayes AT Commands.I'll build rest of driver using that code as hint
now i'm trying to work that stack as stand alone .for this
i've to code a modem driver.Can anyone give me code to
dial a number using Hayes AT Commands.I'll build rest of driver using that code as hint
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:help needed for modem driver
i think you should get a look at the .:QuickLinkz:., especially the serial port programming section.
Re:help needed for modem driver
Dialling a number is easy.
Tone dialling:
Pulse dialling:
Then:
Then do your PPP, IP and TCP stuff.
Tone dialling:
Code: Select all
serial_write("ATDT");
serial_write(phone_number);
serial_write("\n");
Code: Select all
serial_write("ATDP");
serial_write(phone_number);
serial_write("\n");
Code: Select all
serial_wait_for_text("CONNECT");
serial_read_line(connect_speed);
printf("Connected at %s bps\n", connect_speed);
Re:help needed for modem driver
in the following nothing is printed on screen,although the modem is set in loop back mode.
i ckecked the code for both com1 and com2.the uart chip on my system is 16550A.
please tell me what's causing the problem.
the code that i used to detect UART is as follows
i ckecked the code for both com1 and com2.the uart chip on my system is 16550A.
please tell me what's causing the problem.
Code: Select all
#define PORT1 0x2F8
void main(void)
{
int c;
int ch;
outportb(PORT1 + 1 , 0);
/* PORT 1 - Communication Settings */
outportb(PORT1 + 3 , 0x80);
outportb(PORT1 + 0 , 0x03);
outportb(PORT1 + 1 , 0x00);
outportb(PORT1 + 3 , 0x03);
outportb(PORT1 + 2 , 0xC7);
outportb(PORT1 + 4 , 0x0B);
printf("\nSample Comm's Program. Press ESC to quit \n");
do {
c = inportb(PORT1 + 5);/* Check to see if char has been */
/* received.*/
if (c & 1){
ch = inportb(PORT1); /* If so, then get Char */
printf("%c",ch); /* Print Char to Screen*/
}
if (kbhit()){
ch = getch(); /* If key pressed, get Char */
outportb(PORT1, ch); /* Send Char to Serial Port */
}
} while (ch !=27); /* Quit when ESC (ASC 27) is pressed */
}
Code: Select all
void detect_uart(unsigned base)
{
unsigned char i;
outportb(base+2,0x01);
i=inportb(base+2) & 0xc0;
if(i==0)
printf("\nless than 16550");
if(i==0x80)
printf("\n 16550");
if(i==0xc0)
printf("\n 16550A");
}
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:help needed for modem driver
i'm unsure (never programmed an UART), but it looks weird to me that you can send such a long serie of outport() without having a technique to check that the chip has received and processed the last info.
Many I/O cards have a 'received byte' register in which they cache the last byte you sent until it has been processed by the internal logic, and if you modify that byte (with another outport()) before it has been processed (you're usually informed of this by an IRQ or because the 'status' register of the card tells you the card is no longer BuSY), chances are that the operation performed will not be the one you expected...
Many I/O cards have a 'received byte' register in which they cache the last byte you sent until it has been processed by the internal logic, and if you modify that byte (with another outport()) before it has been processed (you're usually informed of this by an IRQ or because the 'status' register of the card tells you the card is no longer BuSY), chances are that the operation performed will not be the one you expected...
Re:help needed for modem driver
The code that i posted might be for external modem.
Am i correct or not ?
Is there any material available on programming internal modems.
Please tell me if this code works on external modem because i've only internal modem.
Am i correct or not ?
Is there any material available on programming internal modems.
Please tell me if this code works on external modem because i've only internal modem.
Re:help needed for modem driver
There are two types of internal modems:
You'll have more success if you buy yourself a simple external modem and use that.
- Those that install themselves as an extra serial port (they're effectively an external modem without a box). These are rare.
- Winmodems, which rely on a Windows driver to do the work. These are really common.
You'll have more success if you buy yourself a simple external modem and use that.
Re:help needed for modem driver
When you do the stack, write it for you developing OS, not your kernel. Easier to debug. You can just have intermediate I/O routines that use your development OS's I/O. When you put the code in the kernel, use its I/O routines.
Re:help needed for modem driver
very generally speaking, if your modem is 56k you have a high chance of winmodem. If it's onboard (laptop etc) I'm pretty sure it is. If your modem cost less than something like 40 euros new, it is very probably a winmodem.
If not all of these, it is not.
If not all of these, it is not.