mirror of https://github.com/ARMmbed/mbed-os.git
NXP: Update serial driver's parity handling
This is a fix for issue 6305. This fix set the default parity value to NONE. Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>pull/8010/head
parent
06106297a4
commit
16ff8e7369
|
@ -266,7 +266,7 @@ void serial_format(serial_t *obj, int data_bits, SerialParity parity, int stop_b
|
||||||
(parity == ParityForced1) || (parity == ParityForced0));
|
(parity == ParityForced1) || (parity == ParityForced0));
|
||||||
data_bits -= 5;
|
data_bits -= 5;
|
||||||
|
|
||||||
int parity_enable, parity_select;
|
int parity_enable = 0, parity_select = 0;
|
||||||
switch (parity) {
|
switch (parity) {
|
||||||
case ParityNone: parity_enable = 0; parity_select = 0; break;
|
case ParityNone: parity_enable = 0; parity_select = 0; break;
|
||||||
case ParityOdd : parity_enable = 1; parity_select = 0; break;
|
case ParityOdd : parity_enable = 1; parity_select = 0; break;
|
||||||
|
@ -274,7 +274,7 @@ void serial_format(serial_t *obj, int data_bits, SerialParity parity, int stop_b
|
||||||
case ParityForced1: parity_enable = 1; parity_select = 2; break;
|
case ParityForced1: parity_enable = 1; parity_select = 2; break;
|
||||||
case ParityForced0: parity_enable = 1; parity_select = 3; break;
|
case ParityForced0: parity_enable = 1; parity_select = 3; break;
|
||||||
default:
|
default:
|
||||||
return;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
obj->uart->LCR = data_bits << 0
|
obj->uart->LCR = data_bits << 0
|
||||||
|
|
|
@ -193,7 +193,7 @@ void serial_format(serial_t *obj, int data_bits, SerialParity parity, int stop_b
|
||||||
stop_bits -= 1;
|
stop_bits -= 1;
|
||||||
data_bits -= 5;
|
data_bits -= 5;
|
||||||
|
|
||||||
int parity_enable, parity_select;
|
int parity_enable = 0, parity_select = 0;
|
||||||
switch (parity) {
|
switch (parity) {
|
||||||
case ParityNone: parity_enable = 0; parity_select = 0; break;
|
case ParityNone: parity_enable = 0; parity_select = 0; break;
|
||||||
case ParityOdd : parity_enable = 1; parity_select = 0; break;
|
case ParityOdd : parity_enable = 1; parity_select = 0; break;
|
||||||
|
@ -201,7 +201,6 @@ void serial_format(serial_t *obj, int data_bits, SerialParity parity, int stop_b
|
||||||
case ParityForced1: parity_enable = 1; parity_select = 2; break;
|
case ParityForced1: parity_enable = 1; parity_select = 2; break;
|
||||||
case ParityForced0: parity_enable = 1; parity_select = 3; break;
|
case ParityForced0: parity_enable = 1; parity_select = 3; break;
|
||||||
default:
|
default:
|
||||||
parity_enable = 0, parity_select = 0;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -196,7 +196,7 @@ void serial_format(serial_t *obj, int data_bits, SerialParity parity, int stop_b
|
||||||
stop_bits -= 1;
|
stop_bits -= 1;
|
||||||
data_bits -= 5;
|
data_bits -= 5;
|
||||||
|
|
||||||
int parity_enable, parity_select;
|
int parity_enable = 0, parity_select = 0;
|
||||||
switch (parity) {
|
switch (parity) {
|
||||||
case ParityNone: parity_enable = 0; parity_select = 0; break;
|
case ParityNone: parity_enable = 0; parity_select = 0; break;
|
||||||
case ParityOdd : parity_enable = 1; parity_select = 0; break;
|
case ParityOdd : parity_enable = 1; parity_select = 0; break;
|
||||||
|
|
|
@ -203,7 +203,7 @@ void serial_format(serial_t *obj, int data_bits, SerialParity parity, int stop_b
|
||||||
stop_bits -= 1;
|
stop_bits -= 1;
|
||||||
data_bits -= 7;
|
data_bits -= 7;
|
||||||
|
|
||||||
int paritysel;
|
int paritysel = 0;
|
||||||
switch (parity) {
|
switch (parity) {
|
||||||
case ParityNone: paritysel = 0; break;
|
case ParityNone: paritysel = 0; break;
|
||||||
case ParityEven: paritysel = 2; break;
|
case ParityEven: paritysel = 2; break;
|
||||||
|
|
|
@ -256,7 +256,7 @@ void serial_format(serial_t *obj, int data_bits, SerialParity parity, int stop_b
|
||||||
stop_bits -= 1;
|
stop_bits -= 1;
|
||||||
data_bits -= 5;
|
data_bits -= 5;
|
||||||
|
|
||||||
int parity_enable, parity_select;
|
int parity_enable = 0, parity_select = 0;
|
||||||
switch (parity) {
|
switch (parity) {
|
||||||
case ParityNone: parity_enable = 0; parity_select = 0; break;
|
case ParityNone: parity_enable = 0; parity_select = 0; break;
|
||||||
case ParityOdd : parity_enable = 1; parity_select = 0; break;
|
case ParityOdd : parity_enable = 1; parity_select = 0; break;
|
||||||
|
@ -264,7 +264,6 @@ void serial_format(serial_t *obj, int data_bits, SerialParity parity, int stop_b
|
||||||
case ParityForced1: parity_enable = 1; parity_select = 2; break;
|
case ParityForced1: parity_enable = 1; parity_select = 2; break;
|
||||||
case ParityForced0: parity_enable = 1; parity_select = 3; break;
|
case ParityForced0: parity_enable = 1; parity_select = 3; break;
|
||||||
default:
|
default:
|
||||||
parity_enable = 0, parity_select = 0;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -219,7 +219,7 @@ void serial_format(serial_t *obj, int data_bits, SerialParity parity, int stop_b
|
||||||
stop_bits -= 1;
|
stop_bits -= 1;
|
||||||
data_bits -= 5;
|
data_bits -= 5;
|
||||||
|
|
||||||
int parity_enable, parity_select;
|
int parity_enable = 0, parity_select = 0;
|
||||||
switch (parity) {
|
switch (parity) {
|
||||||
case ParityNone: parity_enable = 0; parity_select = 0; break;
|
case ParityNone: parity_enable = 0; parity_select = 0; break;
|
||||||
case ParityOdd : parity_enable = 1; parity_select = 0; break;
|
case ParityOdd : parity_enable = 1; parity_select = 0; break;
|
||||||
|
|
|
@ -206,7 +206,7 @@ void serial_format(serial_t *obj, int data_bits, SerialParity parity, int stop_b
|
||||||
stop_bits -= 1;
|
stop_bits -= 1;
|
||||||
data_bits -= 5;
|
data_bits -= 5;
|
||||||
|
|
||||||
int parity_enable, parity_select;
|
int parity_enable = 0, parity_select = 0;
|
||||||
switch (parity) {
|
switch (parity) {
|
||||||
case ParityNone: parity_enable = 0; parity_select = 0; break;
|
case ParityNone: parity_enable = 0; parity_select = 0; break;
|
||||||
case ParityOdd : parity_enable = 1; parity_select = 0; break;
|
case ParityOdd : parity_enable = 1; parity_select = 0; break;
|
||||||
|
|
|
@ -264,7 +264,7 @@ void serial_format(serial_t *obj, int data_bits, SerialParity parity, int stop_b
|
||||||
}
|
}
|
||||||
data_bits -= 5;
|
data_bits -= 5;
|
||||||
|
|
||||||
int parity_enable, parity_select;
|
int parity_enable = 0, parity_select = 0;
|
||||||
switch (parity) {
|
switch (parity) {
|
||||||
case ParityNone: parity_enable = 0; parity_select = 0; break;
|
case ParityNone: parity_enable = 0; parity_select = 0; break;
|
||||||
case ParityOdd : parity_enable = 1; parity_select = 0; break;
|
case ParityOdd : parity_enable = 1; parity_select = 0; break;
|
||||||
|
@ -272,8 +272,7 @@ void serial_format(serial_t *obj, int data_bits, SerialParity parity, int stop_b
|
||||||
case ParityForced1: parity_enable = 1; parity_select = 2; break;
|
case ParityForced1: parity_enable = 1; parity_select = 2; break;
|
||||||
case ParityForced0: parity_enable = 1; parity_select = 3; break;
|
case ParityForced0: parity_enable = 1; parity_select = 3; break;
|
||||||
default:
|
default:
|
||||||
error("Invalid serial parity setting");
|
break;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
obj->uart->LCR = data_bits << 0
|
obj->uart->LCR = data_bits << 0
|
||||||
|
|
|
@ -188,7 +188,7 @@ void serial_format(serial_t *obj, int data_bits, SerialParity parity, int stop_b
|
||||||
stop_bits -= 1;
|
stop_bits -= 1;
|
||||||
data_bits -= 7;
|
data_bits -= 7;
|
||||||
|
|
||||||
int paritysel;
|
int paritysel = 0;
|
||||||
switch (parity) {
|
switch (parity) {
|
||||||
case ParityNone: paritysel = 0; break;
|
case ParityNone: paritysel = 0; break;
|
||||||
case ParityEven: paritysel = 2; break;
|
case ParityEven: paritysel = 2; break;
|
||||||
|
|
Loading…
Reference in New Issue