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

Function _serial_poll_rx

components/drivers/serial/dev_serial.c:240–263  ·  view source on GitHub ↗

* Serial poll routines */

Source from the content-addressed store, hash-verified

238 * Serial poll routines
239 */
240rt_inline int _serial_poll_rx(struct rt_serial_device *serial, rt_uint8_t *data, int length)
241{
242 int ch;
243 int size;
244
245 RT_ASSERT(serial != RT_NULL);
246 size = length;
247
248 while (length)
249 {
250 ch = serial->ops->getc(serial);
251 if (ch == -1) break;
252
253 *data = ch;
254 data ++; length --;
255
256 if(serial->parent.open_flag & RT_DEVICE_FLAG_STREAM)
257 {
258 if (ch == '\n') break;
259 }
260 }
261
262 return size - length;
263}
264
265rt_inline int _serial_poll_tx(struct rt_serial_device *serial, const rt_uint8_t *data, int length)
266{

Callers 1

rt_serial_readFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected