Add flush_buffer to uart
authorMiroslav Ondra <ondra@faster.cz>
Wed, 22 Jan 2020 21:02:32 +0000 (22:02 +0100)
committerMiroslav Ondra <ondra@faster.cz>
Wed, 22 Jan 2020 21:02:32 +0000 (22:02 +0100)
modules/unipi/src/unipi_spi.c
modules/unipi/src/unipi_spi.h
modules/unipi/src/unipi_uart.c

index 6fa32e317937c0cd0f8ffb98ad144187269e0d17..851c7dda720a06615ce37aa5b69257be8f2cc518 100644 (file)
@@ -1117,6 +1117,27 @@ void neuronspi_spi_set_irqs(struct spi_device* spi_dev, u16 to)
        unipi_spi_trace(KERN_INFO "UNIPISPI: SPI IRQ Set, CS%d, to:0x%x\n", spi_dev->chip_select, to);
 }
 
+void neuronspi_uart_flush_proc(struct kthread_work *ws)
+{
+       struct neuronspi_port *n_port = ((container_of((ws), struct neuronspi_port, flush_work)));
+       struct spi_device *spi = neuronspi_s_dev[n_spi->neuron_index];
+    struct neuronspi_op_buffer recv_buf;
+       unsigned long flags;
+
+    unipi_spi_read_str(spi,  n_port);
+    if (n_port->rx_in_progress) {
+               s32 frequency = NEURONSPI_DEFAULT_FREQ;
+               if (n_spi) {
+                       frequency = n_spi->ideal_frequency;
+               }
+               neuronspi_spi_send_const_op(spi, &UNIPISPI_IDLE_MESSAGE, &recv_buf, 0, frequency, 25);
+       }
+
+       spin_lock_irqsave(&n_port->port.lock, flags);
+    n_port->accept_rx = 1;
+    spin_lock_irqrestore(&n_port->port.lock, flags);
+
+}
 
 void neuronspi_irq_proc(struct kthread_work *ws)
 {
index 8dcae85b1e996ea5d039305c8498ad734ef05981..1de5252916d6aa5ac6eddca08d90ead100af12de 100644 (file)
@@ -128,7 +128,7 @@ int unipi_spi_write_str(struct spi_device* spi, struct neuronspi_port* port, int
 int unipi_spi_get_tx_fifo(struct spi_device* spi, struct neuronspi_port* port);
 
 void neuronspi_enable_uart_interrupt(struct neuronspi_port* n_port);
-
+void neuronspi_uart_flush_proc(struct kthread_work *ws);
 
 /***********************
  * Function structures *
index 78375863b71e49234f43d3d795b1a44469ff08c7..02fa7e6cf2c163243c6c23a0d4bbdc589e2a4c1b 100644 (file)
@@ -154,27 +154,6 @@ void neuronspi_uart_set_ldisc(struct uart_port *port, struct ktermios *kterm)
 }
 
 
-void neuronspi_uart_flush_proc(struct kthread_work *ws)
-{
-       struct neuronspi_port *n_port = ((container_of((ws), struct neuronspi_port, flush_work)));
-       struct spi_device *spi = neuronspi_s_dev[n_spi->neuron_index];
-    struct neuronspi_op_buffer recv_buf;
-       unsigned long flags;
-
-    unipi_spi_read_str(spi,  n_port);
-    if (n_port->rx_in_progress) {
-               s32 frequency = NEURONSPI_DEFAULT_FREQ;
-               if (n_spi) {
-                       frequency = n_spi->ideal_frequency;
-               }
-               neuronspi_spi_send_const_op(spi, &UNIPISPI_IDLE_MESSAGE, &recv_buf, 0, frequency, 25);
-       }
-
-       spin_lock_irqsave(&port->port.lock, flags);
-    n_port->accept_rx = 1;
-    spin_lock_irqrestore(&port->port.lock, flags);
-
-}
 
 
 void neuronspi_uart_flush_buffer(struct uart_port* port)