Skip to content

Commit 8604f80

Browse files
authored
Merge pull request #8010 from NXPmicro/NXP_Fix_UART_Parity_Sel
NXP: Update serial driver's parity handling
2 parents aca7740 + 16ff8e7 commit 8604f80

File tree

9 files changed

+11
-14
lines changed

9 files changed

+11
-14
lines changed

targets/TARGET_NXP/TARGET_LPC11U6X/serial_api.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,15 +266,15 @@ void serial_format(serial_t *obj, int data_bits, SerialParity parity, int stop_b
266266
(parity == ParityForced1) || (parity == ParityForced0));
267267
data_bits -= 5;
268268

269-
int parity_enable, parity_select;
269+
int parity_enable = 0, parity_select = 0;
270270
switch (parity) {
271271
case ParityNone: parity_enable = 0; parity_select = 0; break;
272272
case ParityOdd : parity_enable = 1; parity_select = 0; break;
273273
case ParityEven: parity_enable = 1; parity_select = 1; break;
274274
case ParityForced1: parity_enable = 1; parity_select = 2; break;
275275
case ParityForced0: parity_enable = 1; parity_select = 3; break;
276276
default:
277-
return;
277+
break;
278278
}
279279

280280
obj->uart->LCR = data_bits << 0

targets/TARGET_NXP/TARGET_LPC11XX_11CXX/serial_api.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,15 +193,14 @@ void serial_format(serial_t *obj, int data_bits, SerialParity parity, int stop_b
193193
stop_bits -= 1;
194194
data_bits -= 5;
195195

196-
int parity_enable, parity_select;
196+
int parity_enable = 0, parity_select = 0;
197197
switch (parity) {
198198
case ParityNone: parity_enable = 0; parity_select = 0; break;
199199
case ParityOdd : parity_enable = 1; parity_select = 0; break;
200200
case ParityEven: parity_enable = 1; parity_select = 1; break;
201201
case ParityForced1: parity_enable = 1; parity_select = 2; break;
202202
case ParityForced0: parity_enable = 1; parity_select = 3; break;
203203
default:
204-
parity_enable = 0, parity_select = 0;
205204
break;
206205
}
207206

targets/TARGET_NXP/TARGET_LPC13XX/serial_api.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ void serial_format(serial_t *obj, int data_bits, SerialParity parity, int stop_b
196196
stop_bits -= 1;
197197
data_bits -= 5;
198198

199-
int parity_enable, parity_select;
199+
int parity_enable = 0, parity_select = 0;
200200
switch (parity) {
201201
case ParityNone: parity_enable = 0; parity_select = 0; break;
202202
case ParityOdd : parity_enable = 1; parity_select = 0; break;

targets/TARGET_NXP/TARGET_LPC15XX/serial_api.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ void serial_format(serial_t *obj, int data_bits, SerialParity parity, int stop_b
203203
stop_bits -= 1;
204204
data_bits -= 7;
205205

206-
int paritysel;
206+
int paritysel = 0;
207207
switch (parity) {
208208
case ParityNone: paritysel = 0; break;
209209
case ParityEven: paritysel = 2; break;

targets/TARGET_NXP/TARGET_LPC176X/serial_api.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,15 +256,14 @@ void serial_format(serial_t *obj, int data_bits, SerialParity parity, int stop_b
256256
stop_bits -= 1;
257257
data_bits -= 5;
258258

259-
int parity_enable, parity_select;
259+
int parity_enable = 0, parity_select = 0;
260260
switch (parity) {
261261
case ParityNone: parity_enable = 0; parity_select = 0; break;
262262
case ParityOdd : parity_enable = 1; parity_select = 0; break;
263263
case ParityEven: parity_enable = 1; parity_select = 1; break;
264264
case ParityForced1: parity_enable = 1; parity_select = 2; break;
265265
case ParityForced0: parity_enable = 1; parity_select = 3; break;
266266
default:
267-
parity_enable = 0, parity_select = 0;
268267
break;
269268
}
270269

targets/TARGET_NXP/TARGET_LPC408X/TARGET_LPC4088/serial_api.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ void serial_format(serial_t *obj, int data_bits, SerialParity parity, int stop_b
219219
stop_bits -= 1;
220220
data_bits -= 5;
221221

222-
int parity_enable, parity_select;
222+
int parity_enable = 0, parity_select = 0;
223223
switch (parity) {
224224
case ParityNone: parity_enable = 0; parity_select = 0; break;
225225
case ParityOdd : parity_enable = 1; parity_select = 0; break;

targets/TARGET_NXP/TARGET_LPC408X/TARGET_LPC4088_DM/serial_api.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ void serial_format(serial_t *obj, int data_bits, SerialParity parity, int stop_b
206206
stop_bits -= 1;
207207
data_bits -= 5;
208208

209-
int parity_enable, parity_select;
209+
int parity_enable = 0, parity_select = 0;
210210
switch (parity) {
211211
case ParityNone: parity_enable = 0; parity_select = 0; break;
212212
case ParityOdd : parity_enable = 1; parity_select = 0; break;

targets/TARGET_NXP/TARGET_LPC43XX/serial_api.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -264,16 +264,15 @@ void serial_format(serial_t *obj, int data_bits, SerialParity parity, int stop_b
264264
}
265265
data_bits -= 5;
266266

267-
int parity_enable, parity_select;
267+
int parity_enable = 0, parity_select = 0;
268268
switch (parity) {
269269
case ParityNone: parity_enable = 0; parity_select = 0; break;
270270
case ParityOdd : parity_enable = 1; parity_select = 0; break;
271271
case ParityEven: parity_enable = 1; parity_select = 1; break;
272272
case ParityForced1: parity_enable = 1; parity_select = 2; break;
273273
case ParityForced0: parity_enable = 1; parity_select = 3; break;
274274
default:
275-
error("Invalid serial parity setting");
276-
return;
275+
break;
277276
}
278277

279278
obj->uart->LCR = data_bits << 0

targets/TARGET_NXP/TARGET_LPC81X/serial_api.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ void serial_format(serial_t *obj, int data_bits, SerialParity parity, int stop_b
188188
stop_bits -= 1;
189189
data_bits -= 7;
190190

191-
int paritysel;
191+
int paritysel = 0;
192192
switch (parity) {
193193
case ParityNone: paritysel = 0; break;
194194
case ParityEven: paritysel = 2; break;

0 commit comments

Comments
 (0)