I am using /dev/ttyAM1(COM2) connected to radio modem with baud rate
9600 bps for serial communication asynchronously .Now I configured
/dev/tts/2 (for COM 2 through 5)with baud rate 115200 bps on TS SER4
board for transferring files also done through the same serial
communication mechanism.
Both the modules (i.e. serial comm through ttyAM1 & through tts/2)are
working fine independently,but when I integrated both these modules in
my project,then after successful initialization of both the COM ports,
I am not receiving data on /dev/ttyAM1(COM2)port.
As can be seen from the following code snippets,two different signal
handlers are invoked to read data on the respective COM ports.
I am eagerly awaiting for any solution to my problem.
///////////////////////////////////////////////////////////////////
/*Initialization routine for communication through /dev/ttyAM1 on TS7250*/
//////////////////////////////////////////////////////////////////
void InitializeCOM(void)
{
/* Definition of signal action */
struct sigaction saio;
/* open the device to be non-blocking (read will return immediatly) */
fd1 = open("/dev/ttyAM1", O_RDWR | O_NOCTTY | O_NONBLOCK );
/* Fail check for open device */
assert(fd1 != -1);
/* resetting memory saioi structure */
memset(&saio, 0, sizeof(saio));
/* Install the signal handler before making the device asynchronous */
saio.sa_handler = signal_handler_IO;
/* Flag settings */
saio.sa_flags = 0;
saio.sa_restorer = NULL;
sigaction(SIGIO, &saio, NULL);
/* ALLOW the process to receive SIGIO */
fcntl(fd1, F_SETOWN, getpid());
/* Make fd1 async */
fcntl(fd1, F_SETFL, FASYNC);
/* save current port settings */
tcgetattr(fd1, &oldtio);
bzero(&newtio, sizeof(newtio));
/* set new port settings for non-canonical input processing */
newtio.c_cflag = BAUDRATE | CS8 | CLOCAL | CREAD ;
newtio.c_iflag = IGNPAR | ICRNL;
newtio.c_oflag = 0;
newtio.c_lflag = 0;
newtio.c_cc[VMIN] = 1;
newtio.c_cc[VTIME] = 0;
tcflush(fd1, TCIFLUSH);
tcsetattr(fd1, TCSANOW, &newtio);
}
///////////////////////////////////////////////////////////////////
/*Initialization routine for communication through /dev/tts/2 on TS SER4*/
///////////////////////////////////////////////////////////////////
void InitializeMULCOM(void)
{
/* Definition of signal action */
struct sigaction saio;
/* open the device to be non-blocking (read will return immediately) */
fd2 = open("/dev/tts/2", O_RDWR | O_NOCTTY | O_NONBLOCK );
/* Fail check for open device */
assert(fd2 != -1);
/* resetting memory saioi structure */
memset(&saio, 0, sizeof(saio));
/* Install the signal handler before making the device asynchronous */
saio.sa_handler = signal_handler_IO1;
/* Flag settings */
saio.sa_flags = 0;
saio.sa_restorer = NULL;
sigaction(SIGIO, &saio, NULL);
/* ALLOW the process to receive SIGIO */
fcntl(fd2, F_SETOWN, getpid());
/* Make fd2 async */
fcntl(fd2, F_SETFL, FASYNC);
/* save current port settings */
tcgetattr(fd2, &muloldtio);
bzero(&mulnewtio, sizeof(mulnewtio));
/* set new port settings for non-canonical input processing */
mulnewtio.c_cflag = MULBAUDRATE | CS8 | CLOCAL | CREAD ;
mulnewtio.c_iflag = IGNPAR | ICRNL;
mulnewtio.c_oflag = 0;
mulnewtio.c_lflag = 0;
mulnewtio.c_cc[VMIN] = 1;
mulnewtio.c_cc[VTIME] = 0;
tcflush(fd2, TCIFLUSH);
tcsetattr(fd2, TCSANOW, &mulnewtio);
}
------------------------------------
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/ts-7000/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/ts-7000/join
(Yahoo! ID required)
<*> To change settings via email:
<*> To unsubscribe from this group, send an email to:
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|