Hardware Reference
In-Depth Information
The serial port developer, wishing to communicate with a serial device or AVR
class microcontroller, will be very interested in raw mode. Using raw mode, the data you
transmit is sent unmodified to its destination. Likewise, the data received is received as it
was originally transmitted. Cooked mode, which is the norm, is a very different beast.
The original purpose of serial lines for Unix was the handling of user interaction
using terminal I/O (this is still true for the serial port console). Many terminal processing
functions were considered common enough among applications to centralize them in
the kernel. This saved the application from having to deal with these physical aspects and
lead to consistency in their handling. This terminal handling is affectionately known as
cooked mode .
The main areas of cooked mode processing are as follows:
Input processing : The type of kernel processing performed on
serial input data (like backspace processing)
Output processing : The type of kernel processing performed
on serial output data (like converting a sent line feed into a
carriage return and line-feed pair)
Local processing : Involving input and output, processing
features such as echo
Control processing : Other serial controls
We can get a sense of how raw mode differs from cooked mode by looking at what
cfmakeraw(3) changes. Looking at
term.c_iflag &= ~ (IGNBRK | BRKINT | PARMRK | ISTRIP
| INLCR | IGNCR | ICRNL | IXON);
we see that the following input processing features are disabled:
Flag
Description
Setting
IGNBRK
Ignore break
Disabled
BRKINT
Break reads as 0x00
Disabled
PARMRK
Don't prefix with \377 (byte reads 0)
Disabled
ISTRIP
Strip off eighth bit
Disabled
INLCR
Translate NL to CR
Disabled
IGNCR
Ignore CR
Disabled
ICRNL
Translate CR to NL
Disabled
IXON
Enable output XON/XOFF
Disabled
 
Search WWH ::




Custom Search