|
|
您好!tronlong提供的最新的linux3.3内核已经对uart0和uart1做了rs485功能的支持,uart2默认为启动串口。如何想使能uart0和uart1 rs485的功能,只需在menuconfig将485使能。
* `3 j# P) {+ S3 M- x *** DaVinci Core Type *** | |$ B8 e0 ~) }4 f L6 C3 R( C& W% H
| | [ ] DaVinci 644x based system | |% s. F4 I2 X$ L- c+ l
| | [ ] DaVinci 355 based system | |
, |. d$ H" n# Z8 e7 c0 ]) @ | | [ ] DaVinci 646x based system | |$ b O* p3 n' I# i8 C5 y
| | [ ] DA830/OMAP-L137/AM17x based system | |
* X5 _" W) v6 _) e1 Z | | [*] DA850/OMAP-L138/AM18x based system | |
; ~. _7 N( d, f0 y& y | | [ ] Enable UART1 flow control | |( D8 _. P9 ^4 j8 E0 N. c' ]
| | [ ] Enable UART0 RS485 funcation | |4 a- m+ m/ L4 M% @
| | [*] Enable UART1 RS485 funcation / ~; s% Z5 y) _8 Z; Z
. ~8 ?( K {6 J! u3 R* Q. h想了解详细的功能实现,也可以查看8250.c文件里面的;$ _2 u- U% \' p8 Q; s2 u
void serial8250_tx_chars(struct uart_8250_port *up)
/ p6 T0 ?! u( I. N5 y9 x6 o return;
( y D0 B: {1 |& w% D4 g }2 P- G! Z, t- w2 M
/ O/ S$ i* m/ H$ B' V
+#if 1
: J3 _4 L$ s! f" d6 S+ /* The funcation with RS485 flow control */
: ]6 ^9 ]) K+ Z1 Q f+ if (up->port.private_data) {+ H+ y8 l5 U4 t2 ?
+ struct serial8250_flow_ctrl *flow_ctrl_p;
0 Q( L& N0 j }! d5 G+ flow_ctrl_p = up->port.private_data;2 L* g3 J7 A Z- y
+
+ Z" E& S2 V5 H& H5 W) c+ if (flow_ctrl_p->gpio) {& L, Y: C0 v0 p& t. I \ z+ v
+ gpio_set_value(flow_ctrl_p->gpio, 1);
5 j a7 w; z6 y% ], |+ b0 |2 [+ ndelay(50); /* Propagation delay >= 50ns */
( n" K4 i7 L2 ~4 i z* W+ }+ H8 B% {8 N; w4 y+ {4 L% n# Y
+ }
$ u, V6 o7 [' V9 |7 V" L$ ?3 U+#endif4 q# T9 k0 d1 U; J, R. f! G
希望对您有帮助。0 o7 X7 C ?5 b1 Q7 D7 ^2 o
|
|