mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2026-09-21 02:44:35 +08:00
bsps/zynq-uart: fix parity configuration handling
Fix parity handling in zynq_uart_set_attributes() by clearing existing parity bits before setting a new mode instead of always ORing PAR_NONE, which caused incorrect or ignored parity; also fix inverted PARODD logic and add ZYNQ_UART_MODE_PAR_MASK to manage the parity field correctly. Fixes #5554
This commit is contained in:
committed by
Kinsey Moore
parent
2c39475802
commit
b41f83249a
@@ -193,16 +193,13 @@ static bool zynq_uart_set_attributes(
|
||||
*/
|
||||
mode |= ZYNQ_UART_MODE_CHMODE(ZYNQ_UART_MODE_CHMODE_NORMAL);
|
||||
|
||||
/*
|
||||
* Parity
|
||||
*/
|
||||
mode |= ZYNQ_UART_MODE_PAR(ZYNQ_UART_MODE_PAR_NONE);
|
||||
if (term->c_cflag & PARENB) {
|
||||
if (!(term->c_cflag & PARODD)) {
|
||||
mode |= ZYNQ_UART_MODE_PAR(ZYNQ_UART_MODE_PAR_ODD);
|
||||
} else {
|
||||
mode |= ZYNQ_UART_MODE_PAR(ZYNQ_UART_MODE_PAR_EVEN);
|
||||
}
|
||||
/* Apply correct parity */
|
||||
if (!(term->c_cflag & PARENB)) {
|
||||
mode |= ZYNQ_UART_MODE_PAR(ZYNQ_UART_MODE_PAR_NONE);
|
||||
} else if (term->c_cflag & PARODD) {
|
||||
mode |= ZYNQ_UART_MODE_PAR(ZYNQ_UART_MODE_PAR_ODD);
|
||||
} else {
|
||||
mode |= ZYNQ_UART_MODE_PAR(ZYNQ_UART_MODE_PAR_EVEN);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user