mode &= 0xfffffff0;
mode |= ATMEL_US_USMODE_RS485; // in drivers/serial/atmel_serial.h
}
将上面的代码插在UART_PUT_MR(port, mode)之前即可
下面是从外国的一个论坛上找到的:关于uart配置成rs485模式的
to change each USART in RS-485 mode, add this line in linux/drivers/serial/atmel_serial.c , in function atmel_set_termios ,
just before the instruction "UART_PUT_MR(port, mode) ;" that configures the USART mode.
mode |= ATMEL_US_USMODE_RS485; //Take effect for all USART that you configure
or if you want filter for a specific USART, i used the dedicated IRQ number :
if (port->irq == AT91SAM9260_ID_US2) // USART2 is a rs485
{
mode |= ATMEL_US_USMODE_RS485;
}
I don't know if it's the best solution but it works very well.
本文来自电脑杂谈,转载请注明本文网址:
https://www.pc-fly.com/a/dianqi/article-44919-2.html
我们家千玺配的棒棒的