MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / serial_rxcallback

Function serial_rxcallback

bsp/microchip/common/board/serial.c:21–47  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

19static struct rt_serial_device sam_serial;
20
21static 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
49static void serial_txcallback(const struct usart_async_descriptor *const io_descr)
50{

Callers

nothing calls this directly

Calls 5

rt_interrupt_enterFunction · 0.50
ringbuffer_getFunction · 0.50
rt_hw_serial_isrFunction · 0.50
rt_interrupt_leaveFunction · 0.50

Tested by

no test coverage detected