Advantech RSB-4210 Evaluation Kit User Manual Page 78

  • Download
  • Add to my manuals
  • Print
  • Page
    / 104
  • Table of contents
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 77
RSB-4210 User Manual 70
cfsetospeed(&options, baudrate_map(baudrate));
}
tcsetattr(fd, TCSANOW, &options);
printf("UART %lu, %dbit, %dstop, %s, HW flow %s\n", bau-
drate, 8,
(options.c_cflag & CSTOPB) ? 2 : 1,
(options.c_cflag & PARODD) ? "PARODD" : "PARENB",
(options.c_cflag & CRTSCTS) ? "enabled" : "dis-
abled");
trun = 1;
rrun = 1;
furead = fopen("uart_read.txt","wb");
ret = pthread_create(&p_Uartsend, NULL, Uartsend, NULL);
if(ret < 0)
goto error;
ret = pthread_create(&p_Uartread, NULL, Uartread, NULL);
if(ret < 0) {
ret = pthread_join(p_Uartsend, &thread_res);
goto error;
}
printf("test begin, press 'c' to exit\n");
while(c != 'c'){
c = getchar();
}
trun = 0;
ret = pthread_join(p_Uartsend, &thread_res);
if(ret < 0)
printf("fail to stop Uartsend thread\n");
printf("tcount=%d\n",tcount);
i = 5;
while((tcount > rcount) && i) {
i--;
sleep(1);
}
rrun = 0;
ret = pthread_join(p_Uartread, &thread_res);
if(ret < 0)
printf("fail to stop Uartread thread\n");
printf("rcount=%d\n",rcount);
error:
fclose(furead);
Page view 77
1 2 ... 73 74 75 76 77 78 79 80 81 82 83 ... 103 104

Comments to this Manuals

No comments