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

Function termios_test_entry

examples/libc/termios_test.c:285–320  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

283}
284
285void termios_test_entry(void *p)
286{
287 int len = 0;
288 int fd = -1;
289 unsigned char *pBuf = RT_NULL;
290 struct termios_test_s *pTerm = (struct termios_test_s *)p;
291
292 if((fd = open_comm(pTerm->dev)) == -1)
293 {
294 rt_kprintf("Check the device name...\n");
295 return;
296 }
297
298 pBuf = (unsigned char *)rt_malloc(BUFFER_SIZE);
299 RT_ASSERT(pBuf != RT_NULL);
300
301 memset(pBuf, 0x00, BUFFER_SIZE);
302
303 config_comm(fd, pTerm->baud_rate, Default_parity, 8, 1);
304
305 flush_comm(fd);
306
307 rt_kprintf("Block recv 10 bytes.\n");
308 /* Block recv 10 bytes */
309 len = recv_comm(fd, pBuf, 10, RT_NULL);
310
311 rt_kprintf("Recv:%s\n", pBuf);
312
313 send_comm(fd, pBuf, len);
314 rt_kprintf("Termios test exit.\n");
315
316 close_comm(fd);
317
318 rt_free(pBuf);
319 pBuf = RT_NULL;
320}
321
322int termios_test(int argc, char **argv)
323{

Callers

nothing calls this directly

Calls 9

open_commFunction · 0.85
rt_kprintfFunction · 0.85
rt_mallocFunction · 0.85
config_commFunction · 0.85
flush_commFunction · 0.85
recv_commFunction · 0.85
send_commFunction · 0.85
close_commFunction · 0.85
rt_freeFunction · 0.85

Tested by

no test coverage detected