Hi all,

This is the situation: I've got 1 thread reading and another writing
writing over a serial port (16550). It's configured without Flow Control
(TX/RX/GND lines, that's all there is). I'm receving packets at 9600
bauds every 40ms, and get them all, no probs. But sending is more
problematic. I'd like to send packets continuosly, in a while(true)
loop. But if I don't pause and wait for the packet to be fully
transmitted from the buffer, it obviously overruns the buffer and I send
rubbish. I can slow things down with SW waits, and it kind of works, but
it is not the solution I am after. The question is probably quite clear
by now: is there a way I can grab some sort of indication the TX buffer
is empty and ready to send again? 

(I've got the same stuuf running on various machines and kernels over
RH5.2)

Thanks in adavance.

Jaime


...
... code snippet of port configuration
...

m_fd = open( m_ChanStr, O_RDWR | O_NONBLOCK | O_NOCTTY | O_SYNC); 
  
// save current port settings for restoration on application exit 
tcgetattr(m_fd,&oldtio); 
                
// clear struct for new port settings 
memset(&newtio, 0, sizeof(newtio)); 
newtio.c_cflag = BAUDRATE | CS8 | CREAD  | HUPCL; // | CRTSCTS | CLOCAL
newtio.c_iflag = IGNPAR;
newtio.c_oflag = 0;
newtio.c_lflag = 0;
newtio.c_cc[VTIME] = 0;     // inter-character timer unused 
newtio.c_cc[VMIN]  = 1;     // blocking read until 1 character arrives 
          
if (tcflush(m_fd,TCIFLUSH))
{
        cout << "<CCommChan::Open> error on tcflush()\n";
        Close();
 }
if (tcsetattr(m_fd,TCSANOW,&newtio))
{
        cout << "<CCommChan::Open> error on tcsetattr()\n";
        Close();
}       

...
...


-
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to [EMAIL PROTECTED]

Reply via email to