I want to enable the software loop back in the MCR of UART4 instance through my (user space )application code.
I am using omap4460 panda board.
I was able to control the baudrate ,using termios but not this as this is different when i looked into omap-serial.c for version(3.4)
How will I do it using ioctl?or any other way.How do I test it.
I tried this way.
#define DEVICE "/dev/ttyO3"
int main()
{
int fd;
int write_fd1;
int read_fd;
int status = 0;
char buf[2];
struct termios options;
fd = open(DEVICE,O_RDWR | O_NONBLOCK);
if(fd < 0)
{
printf("unable to open the device\n");
return -1;
}
else
printf("device opened %d \n",fd);
tcgetattr(fd,&options);
cfsetospeed(&options,B300);
cfsetispeed(&options,B300);
tcsetattr(fd,TCSANOW,&options);
tcgetattr(fd,&options);
if((cfgetospeed(&options) != B300) || (cfgetispeed(&options)!= B300));
{
printf("Baud rate not set");
}
ioctl(fd,TIOCMGET,&status);
status |= 0x0010;
ioctl(fd,TIOCMSET,&status);
/* read from file and write to device */
while(1)
{
write_fd1 = write(fd,"a",2) ;
read_fd = read(fd,buf,sizeof(buf)) ;
printf("write_fd %d \n",write_fd1);
printf("read_fd %d \n",read_fd);
}
close(fd);
return 0;
}
Please share any reference code.