This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Dear all,
We has an Appro DM365 IPNC, the software is Montavista pro 5.0& LSP 2.1. DM365 has two UART port, and we found in sprs566a.pdf that the UART0 is used for console, so we'd like to use UART1 for communication. In Linux /dev/tts directory, there are two devices, we thought that /dev/tts/0 was linked to UART0 and /dev/tts/1 was linked to UART1. So according to sprs566a.pdf , we wrote the following code to test the UART driver:
-------------------------------------------------------------------------------------------------------
fd1 = open("/dev/tts/1",O_RDWR);
printf("fd1 value is %d\n", fd1);
perror("open /dev/tts/1");
return_value 1= ioctl(fd1, TIOCGSERIAL, &serial1_info);
return_value 2= ioctl(fd1, TIOCSSERIAL, &serial1_info);
printf("ioctl set return value is %d\n", return_value);
perror("ioctl(fd1, TIOCSSERIAL, &serial1_info)");
close(fd1);
----------------------------------------------------------------------------------------------------------------
We successfully open the /dev/tts/1 device(fd1 value is 3) and get the attribute by using "TIOCGSERIAL" IOCTL, we got:
serial1_info.type is 0X00000000
serial1_info.line is 0X00000001
serial1_info.port is 0X00000000
serial1_info.irq is 0X00000000
serial1_info.flags is 0X00000000
serial1_info.xmit_fifo_size is 0X00000000
serial1_info.custom_divisor is 0X00000000
serial1_info.baud_base is 0X00000000
serial1_info.close_delay is 0X0032
serial1_info.io_type is 0X00
serial1_info.reserved_char[0] is 0X00
serial1_info.hub6 is 0X00000000
serial1_info.closing_wait is 0X0BB8
serial1_info.closing_wait2 is 0X0000
serial1_info.iomem_base is 0X00000000
serial1_info.iomem_reg_shift is 0X0000
serial1_info.port_high is 0X00000000
serial1_info.iomap_base is 0X00000000
==========================================>/dev/tts/1
but the sad news is that we can set the attribute of tha t device by using "TIOCSSERIAL" IOCTL. When we used that IOCTL, the system seemed bankrupt:
Internal error: Oops: 817 [#2]
Modules linked in:
CPU: 0
PC is at serial_out+0x98/0xa0
LR is at serial8250_startup+0xd4/0x644
pc : [<c020af08>] lr : [<c020d7a4>] Not tainted
sp : c70abce8 ip : c044d7c8 fp : c70abcf4
r10: bedd9c98 r9 : 00000000 r8 : 00000001
r7 : c06a0344 r6 : c044d7c8 r5 : c044d7c8 r4 : 00000000
r3 : 00000001 r2 : 00000000 r1 : 00000008 r0 : 00000001
Flags: Nzcv IRQs on FIQs on Mode SVC_32 Segment user
Control: 5317F
Table: 85C58000 DAC: 00000015
Process helloworld (pid: 753, stack limit = 0xc70aa258)
Stack: (0xc70abce8 to 0xc70ac000)
bce0: c70abd1c c70abcf8 c020d7a4 c020ae80 00000000 bedd9c98
bd00: 00000000 c00367a0 c044d7c8 c06a0344 c70abd44 c70abd20 c0208940 c020d6e0
bd20: c044d7c8 00000000 00000000 10000040 c06a0344 bedd9c98 c70abe4c c70abd48
bd40: c020a16c c02088c4 2323f6b9 c70aa000 c70abda4 0000541f c05ed1c0 c70f1000
bd60: 00000000 00000000 00000000 000001f4 00000000 00007530 00000001 00000000
bd80: c70aa000 c03b6030 c03b6030 00000000 00000020 c70abe38 c70abdb4 c70abda8
bda0: c004a1e0 c70aa000 c06c1360 00000015 c70abdd4 c70abdc0 c0061ce0 c00610fc
bdc0: c5f7601c c06c1360 c70abe14 c70abdd8 00000004 00000001 00000001 00000029
bde0: 10000040 00000010 00000000 0019bfcc 00020032 00000000 00000bb8 01c20400
..........
So could you pls give us some suggestion on how to use the UART driver IOCTL and how to set the attribute of UART1?
Thanks!
Bryan,
moved your post to the linux forum for the correct audience to help you.
regards,
miguel