| 19 | static struct rt_serial_device sam_serial; |
| 20 | |
| 21 | static void serial_rxcallback(const struct usart_async_descriptor *const io_descr) |
| 22 | { |
| 23 | (void)io_descr; |
| 24 | |
| 25 | /* enter interrupt */ |
| 26 | rt_interrupt_enter(); |
| 27 | |
| 28 | #ifdef RT_USING_SERIAL_V2 |
| 29 | struct rt_serial_rx_fifo *rx_fifo; |
| 30 | uint8_t data; |
| 31 | |
| 32 | rx_fifo = (struct rt_serial_rx_fifo *)sam_serial.serial_rx; |
| 33 | RT_ASSERT(rx_fifo != RT_NULL); |
| 34 | |
| 35 | do { |
| 36 | ringbuffer_get((struct ringbuffer *const)&io_descr->rx, &data); |
| 37 | rt_ringbuffer_putchar_force(&rx_fifo->rb, data); |
| 38 | } while (0); // maybe not only one byte |
| 39 | |
| 40 | #endif |
| 41 | |
| 42 | /* Notify Serial driver to process RX data */ |
| 43 | rt_hw_serial_isr(&sam_serial, RT_SERIAL_EVENT_RX_IND); // or RT_SERIAL_EVENT_RX_DMADONE |
| 44 | |
| 45 | /* leave interrupt */ |
| 46 | rt_interrupt_leave(); |
| 47 | } |
| 48 | |
| 49 | static void serial_txcallback(const struct usart_async_descriptor *const io_descr) |
| 50 | { |
nothing calls this directly
no test coverage detected