pin 32 (gpio1-0): feb90000.serial (GPIO UNCLAIMED) function uart6 group uart6m1-xfer
pin 33 (gpio1-1): feb90000.serial (GPIO UNCLAIMED) function uart6 group uart6m1-xfer
pin 42 (gpio1-10): feb70000.serial (GPIO UNCLAIMED) function uart4 group uart4m2-xfer
pin 43 (gpio1-11): feb70000.serial (GPIO UNCLAIMED) function uart4 group uart4m2-xfer
/**
*串口发送数据
*@fd:串口描述符
*@data:待发送数据
*@datalen:数据长度
*/
unsigned int total_send = 0 ;
int uart_send(int fd, char *data, int datalen)
{
int len = 0;
len = write(fd, data, datalen);//实际写入的长度
if(len == datalen) {
total_send += len ;
// printf("total_send is %d\n",total_send);
return len;
} else {
tcflush(fd, TCOFLUSH);//TCOFLUSH刷新写入的数据但不传送
return -1;
}
return 0;
}
/**
*串口接收数据
*要求启动后,在pc端发送ascii文件
*/
unsigned int total_length = 0 ;
int uart_recv(int fd, char *data, int datalen, int rate)
{
int len=0, ret = 0;
fd_set fs_read;
struct timeval tv_timeout;