How do I use rtems_termios_bufsize?! No doc!

Chris Johns chrisj at rtems.org
Thu Sep 23 20:29:58 CDT 2010


On 23/09/10 7:52 PM, João Rasta wrote:
> Thanks Chris, there are still two things i don't understand:
>
> 1) When transmitting, the behaviour i expect from the rtems software
> buffer is that bytes are read from it one by one and passed to the uart
> hardware buffer and then serialized to the serial line. This software
> buffer is the raw_output buffer and the cooked buffer will not be used
> in this case. Is this correct?

It depends on the termios configuration you use. This link may help:

http://www.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap11.html#tag_11_01_03

The section "Non-Canonical Mode Input Processing" is important for you. 
It is sometimes referred to as 'raw-mode'.

Some drivers can take more than one character at a time. If you have the 
output cooked it will be buffered into the cooked buffer and transferred 
to the output buffer when a LF or flush happens.

>
> 2) I want to transmit a package of 82 bytes, so I set the raw_output
> buffer to 82.

The buffer is a ring buffer so it just loops around for every. I suggest 
you set it to 1024 bytes.

The 82 bytes should work but XOFF/XON or hardware handshaking may be 
stopping the output.

The buffer settings you are playing with are low level. I think your 
issues are in the termios set up.

> However at the other end of the transmission lines i don't
> receive all 82 bytes, it seems some bytes are lost. If i set the
> raw_output buffer bigger, say 256, it starts sending bytes that are not
> on the package. In a transmission, only the message bytes in the
> software buffer should be sent right?

It depends how termios is set up. For example the LF character could be 
expanded to CR/LF. There are other settings that can effect the actual 
byte stream.

Please review the link above plus this may help:

  http://en.wikibooks.org/wiki/Serial_Programming/termios

Chris



More information about the rtems-users mailing list