| 283 | } |
| 284 | |
| 285 | void 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 | |
| 322 | int termios_test(int argc, char **argv) |
| 323 | { |
nothing calls this directly
no test coverage detected