Configure the serial interface.
- Returns
- *this
- Exceptions
-
Definition at line 22 of file sttybuf.cpp.
References __D_ASSERT, discard(), m_baud, m_devnode, csdbg::streambuf::m_handle, csdbg::util::memset(), translate_baud(), and unlikely.
Referenced by open(), and set_baud().
26 return const_cast<sttybuf&
> (*this);
32 conf.c_cflag = real_baud | CS8 | CRTSCTS | CREAD | CLOCAL;
33 conf.c_iflag = IGNPAR;
38 retval = tcsetattr(
m_handle, TCSANOW, &conf);
40 while (
unlikely(retval < 0 && errno == EINTR) );
44 "failed to configure serial interface '%s' (errno %d - %s)",
sttybuf(const i8 *, u32=9600)
Object constructor.
static u32 translate_baud(u32)
Translate a number to a baud rate as defined in termios.h.
static void * memset(void *, u8, u32)
Fill a memory block with a constant byte.
i32 m_handle
Stream handle (descriptor)
virtual sttybuf & discard() const
Discard the data cached in the serial interface (in-kernel) buffers.
i8 * m_devnode
Device node file (devfs)
unsigned int u32
32-bit unsigned integer
int i32
32-bit signed integer
#define unlikely(expr)
Offer a hint (negative) to the pipeline branch predictor.
#define __D_ASSERT(x)
Assertion macro.