From: matt Date: Fri, 5 Dec 2008 00:03:29 +0000 (+0000) Subject: send a char to the serial port, but don't wait if the queue is full X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=4ef65a60c4cf79a11a097cac312d86803fbbd202;p=debian%2Fgnuradio send a char to the serial port, but don't wait if the queue is full git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@10102 221aa14e-8319-0410-a670-987f0aec2ac5 --- diff --git a/usrp2/firmware/lib/hal_uart.c b/usrp2/firmware/lib/hal_uart.c index f1d46fe8..75b12b43 100644 --- a/usrp2/firmware/lib/hal_uart.c +++ b/usrp2/firmware/lib/hal_uart.c @@ -57,6 +57,16 @@ hal_uart_putc(int ch) u->txchar = ch; } +void +hal_uart_putc_nowait(int ch) +{ + if (ch == '\n') // FIXME for now map \n -> \r\n + hal_uart_putc('\r'); + + if(u->txlevel) // If fifo has space + u->txchar = ch; +} + int hal_uart_getc(void) { diff --git a/usrp2/firmware/lib/hal_uart.h b/usrp2/firmware/lib/hal_uart.h index 41e78894..2ddfa625 100644 --- a/usrp2/firmware/lib/hal_uart.h +++ b/usrp2/firmware/lib/hal_uart.h @@ -54,6 +54,11 @@ void hal_uart_get_config(hal_uart_config_t *c); */ void hal_uart_putc(int ch); +/*! + * \brief Enqueue \p ch for output over serial port, silent fail if queue is full + */ +void hal_uart_putc_nowait(int ch); + /* * \brief Blocking read of next char from serial port */