Skip to content

NXP: Update serial driver's parity handling #8010

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 17, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions targets/TARGET_NXP/TARGET_LPC11U6X/serial_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -266,15 +266,15 @@ void serial_format(serial_t *obj, int data_bits, SerialParity parity, int stop_b
(parity == ParityForced1) || (parity == ParityForced0));
data_bits -= 5;

int parity_enable, parity_select;
int parity_enable = 0, parity_select = 0;
switch (parity) {
case ParityNone: parity_enable = 0; parity_select = 0; break;
case ParityOdd : parity_enable = 1; parity_select = 0; break;
case ParityEven: parity_enable = 1; parity_select = 1; break;
case ParityForced1: parity_enable = 1; parity_select = 2; break;
case ParityForced0: parity_enable = 1; parity_select = 3; break;
default:
return;
break;
}

obj->uart->LCR = data_bits << 0
Expand Down
3 changes: 1 addition & 2 deletions targets/TARGET_NXP/TARGET_LPC11XX_11CXX/serial_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -193,15 +193,14 @@ void serial_format(serial_t *obj, int data_bits, SerialParity parity, int stop_b
stop_bits -= 1;
data_bits -= 5;

int parity_enable, parity_select;
int parity_enable = 0, parity_select = 0;
switch (parity) {
case ParityNone: parity_enable = 0; parity_select = 0; break;
case ParityOdd : parity_enable = 1; parity_select = 0; break;
case ParityEven: parity_enable = 1; parity_select = 1; break;
case ParityForced1: parity_enable = 1; parity_select = 2; break;
case ParityForced0: parity_enable = 1; parity_select = 3; break;
default:
parity_enable = 0, parity_select = 0;
break;
}

Expand Down
2 changes: 1 addition & 1 deletion targets/TARGET_NXP/TARGET_LPC13XX/serial_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ void serial_format(serial_t *obj, int data_bits, SerialParity parity, int stop_b
stop_bits -= 1;
data_bits -= 5;

int parity_enable, parity_select;
int parity_enable = 0, parity_select = 0;
switch (parity) {
case ParityNone: parity_enable = 0; parity_select = 0; break;
case ParityOdd : parity_enable = 1; parity_select = 0; break;
Expand Down
2 changes: 1 addition & 1 deletion targets/TARGET_NXP/TARGET_LPC15XX/serial_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ void serial_format(serial_t *obj, int data_bits, SerialParity parity, int stop_b
stop_bits -= 1;
data_bits -= 7;

int paritysel;
int paritysel = 0;
switch (parity) {
case ParityNone: paritysel = 0; break;
case ParityEven: paritysel = 2; break;
Expand Down
3 changes: 1 addition & 2 deletions targets/TARGET_NXP/TARGET_LPC176X/serial_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -256,15 +256,14 @@ void serial_format(serial_t *obj, int data_bits, SerialParity parity, int stop_b
stop_bits -= 1;
data_bits -= 5;

int parity_enable, parity_select;
int parity_enable = 0, parity_select = 0;
switch (parity) {
case ParityNone: parity_enable = 0; parity_select = 0; break;
case ParityOdd : parity_enable = 1; parity_select = 0; break;
case ParityEven: parity_enable = 1; parity_select = 1; break;
case ParityForced1: parity_enable = 1; parity_select = 2; break;
case ParityForced0: parity_enable = 1; parity_select = 3; break;
default:
parity_enable = 0, parity_select = 0;
break;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ void serial_format(serial_t *obj, int data_bits, SerialParity parity, int stop_b
stop_bits -= 1;
data_bits -= 5;

int parity_enable, parity_select;
int parity_enable = 0, parity_select = 0;
switch (parity) {
case ParityNone: parity_enable = 0; parity_select = 0; break;
case ParityOdd : parity_enable = 1; parity_select = 0; break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ void serial_format(serial_t *obj, int data_bits, SerialParity parity, int stop_b
stop_bits -= 1;
data_bits -= 5;

int parity_enable, parity_select;
int parity_enable = 0, parity_select = 0;
switch (parity) {
case ParityNone: parity_enable = 0; parity_select = 0; break;
case ParityOdd : parity_enable = 1; parity_select = 0; break;
Expand Down
5 changes: 2 additions & 3 deletions targets/TARGET_NXP/TARGET_LPC43XX/serial_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -264,16 +264,15 @@ void serial_format(serial_t *obj, int data_bits, SerialParity parity, int stop_b
}
data_bits -= 5;

int parity_enable, parity_select;
int parity_enable = 0, parity_select = 0;
switch (parity) {
case ParityNone: parity_enable = 0; parity_select = 0; break;
case ParityOdd : parity_enable = 1; parity_select = 0; break;
case ParityEven: parity_enable = 1; parity_select = 1; break;
case ParityForced1: parity_enable = 1; parity_select = 2; break;
case ParityForced0: parity_enable = 1; parity_select = 3; break;
default:
error("Invalid serial parity setting");
return;
break;
}

obj->uart->LCR = data_bits << 0
Expand Down
2 changes: 1 addition & 1 deletion targets/TARGET_NXP/TARGET_LPC81X/serial_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ void serial_format(serial_t *obj, int data_bits, SerialParity parity, int stop_b
stop_bits -= 1;
data_bits -= 7;

int paritysel;
int paritysel = 0;
switch (parity) {
case ParityNone: paritysel = 0; break;
case ParityEven: paritysel = 2; break;
Expand Down