]> git.gag.com Git - debian/gnuradio/commitdiff
send a char to the serial port, but don't wait if the queue is full
authormatt <matt@221aa14e-8319-0410-a670-987f0aec2ac5>
Fri, 5 Dec 2008 00:03:29 +0000 (00:03 +0000)
committermatt <matt@221aa14e-8319-0410-a670-987f0aec2ac5>
Fri, 5 Dec 2008 00:03:29 +0000 (00:03 +0000)
git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@10102 221aa14e-8319-0410-a670-987f0aec2ac5

usrp2/firmware/lib/hal_uart.c
usrp2/firmware/lib/hal_uart.h

index f1d46fe8493fa8e68693733879ea3055669e7e35..75b12b43271f59df233962f9fc324ce1ec21d8ba 100644 (file)
@@ -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)
 {
index 41e78894b09079c3daef732dd6b15147fe371112..2ddfa6259e31242da15a6353eb0b6d755709aac5 100644 (file)
@@ -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
  */