Serial communications sometimes use a condition called BREAK [1]. I
need to interface to 3rd party equipment that uses this feature.

In Unix-like OSes a BREAK can be sent by calling termios function
tcsendbreak() or ioctl TCSBRK.

NuttX has an extern declaration for tcsendbreak() and a #define for
TCSBRK. However, there is no implementation for these in the serial
driver (no such function, no handling for this IOCTL).

I am wondering how to implement this in the serial driver. I know that
the basic change is:

(1) In libs/libc/termios/, add new file lib_tcsendbreak.c which calls
ioctl TCSBRK.

(2) In drivers/serial/serial.c uart_ioctl(), add a case for TCSBRK
which calls the upper half driver, e.g., new function
uart_tcsendbreak().

(3) In uart_tcsendbreak(), do some magic.

That magic is the question:

What if there is pending transmit data? Then BREAK should happen after
transmit done but before any new transmit data.

What if filep->f_oflags & O_NONBLOCK? Then how does the driver
schedule BREAK to happen after transmit done but before new transmit
data?

Any ideas would be appreciated.

References:
[1] https://stackoverflow.com/questions/1279478/rs-232-break-signal#1279671

Cheers,
Nathan

Reply via email to