[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Problem settin Serial Asynch speed.. AND include/asm/serial.h missing??



I tried to run a simple serial program, that set serial-0 (ttyS0) params (baud, parity, stop, and so on), and comunicates with it.
 
The programs is ok w/ linux i386
 
uClinux Compilation was OK 
 
when started on the dev_board, serial communication fails, and on the debug line I see "serdriver tried setting invalid baudrate, flag cb0"
 
I tried also the serial.c exambple code I found on the list, it didnt work at all.
 
I tried to enable serial support for traditional uart in character device setup in the kernel, but the compilation returned an error while making serial.c, telling that asm/serial.h file was missed. In fact it is not present, nor in the Linux-2.4.3 you supply in your site.
Where's the error?
 
Here's my serial initialization code:
 
========
 

int WC_OpenNode(char *dev, int speed, long tmo) {

struct termios otermio, termio;

int mask = TIOCM_DTR;

inode = onode = 0;

/*

if (tcgetattr(inode, &otermio)) return WC_Rundown("tcgetattr()", errno);

bzero(&termio, sizeof(termio));

switch (speed) {

case 2400: speed = B2400; break;

case 4800: speed = B4800; break;

case 9600: speed = B9600; break;

case 19200: speed = B19200; break;

default: speed = B9600; break;

}

cfsetospeed(&termio, speed);

cfsetispeed(&termio, speed);

switch (TNode) {

case LARA:

termio.c_cflag |= speed|CS8|CSTOPB|CLOCAL|CREAD;

termio.c_iflag = IGNPAR | IGNBRK;

break;

case SYS:

case TTY:

case MAY2:

/* termio.c_cflag = CS8|CLOCAL|CREAD; */

termio.c_cflag = speed|CS8|CREAD|CLOCAL|HUPCL;

termio.c_iflag = IGNPAR | IGNBRK;

break;

case MAYER:

termio.c_cflag |= speed|CS7|PARENB|CLOCAL|CREAD;

termio.c_iflag |= IGNPAR|IGNBRK|INPCK|ISTRIP;

break;

}

termio.c_lflag = 0;

/*

termio.c_cc[VTIME] = tmo/100;

termio.c_cc[VMIN] = 0;

*/

if (tcflush(inode, TCIFLUSH)) return WC_Rundown("tcflush()", errno);

if (tcsetattr(inode, TCSANOW, &termio)) return WC_Rundown("tcsetattr()", errno);

ioctl(inode, TIOCMGET, &mask);

mask |= TIOCM_DTR;

ioctl(inode, TIOCMSET, &mask);

}