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

Function uart_msg_getc

bsp/phytium/libraries/drivers/drv_usart_msg.c:150–181  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

148}
149
150static int uart_msg_getc(struct rt_serial_device *serial)
151{
152 int ch;
153 struct drv_usart_msg *uart_msg = RT_NULL;
154 FUartMsg *uart_msg_ptr = RT_NULL;
155 RT_ASSERT(serial != RT_NULL);
156
157 uart_msg = rt_container_of(serial, struct drv_usart_msg, serial);
158 uart_msg_ptr = uart_msg->handle;
159
160
161 if(RT_RINGBUFFER_EMPTY == rt_ringbuffer_status(recv_ringbuffer))
162 {
163 FUartMsgRecvBufferNoBlocking(uart_msg_ptr);
164 }
165
166 if(0 == rt_ringbuffer_getchar(recv_ringbuffer, (rt_uint8_t *)&ch))
167 {
168 return -1;
169 }
170
171 if (ch == 0xffff)
172 {
173 ch = -1;
174 }
175 else
176 {
177 ch &= 0xff;
178 }
179
180 return ch;
181}
182
183static void Ft_Os_Uart_Msg_Callback(void *Args, u32 Event, u32 EventData)
184{

Callers

nothing calls this directly

Calls 3

rt_ringbuffer_getcharFunction · 0.85
rt_ringbuffer_statusFunction · 0.70

Tested by

no test coverage detected