@@ -92,10 +92,20 @@ static void uart_test_common(int baudrate, int data_bits, SerialParity parity, i
92
92
// STM-specific constraints
93
93
// Only 7, 8 & 9 data bits.
94
94
MBED_ASSERT (data_bits >= 7 && data_bits <= 9 );
95
- // Only Odd or Even parity for 7 data bits.
96
- if (data_bits == 7 ) {
97
- MBED_ASSERT (parity != ParityNone);
95
+
96
+ #if defined(UART_9BITS_PARITY_NOT_SUPPORTED)
97
+ if ((data_bits == 9 ) && (parity != ParityNone)) {
98
+ utest_printf (" UART_9BITS_PARITY_NOT_SUPPORTED set ... " );
99
+ return ;
98
100
}
101
+ #endif
102
+
103
+ #if defined(UART_7BITS_PARITY_NONE_NOT_SUPPORTED)
104
+ if ((data_bits == 7 ) && (parity == ParityNone)) {
105
+ utest_printf (" UART_7BITS_PARITY_NONE_NOT_SUPPORTED set ... " );
106
+ return ;
107
+ }
108
+ #endif
99
109
100
110
// Limit the actual TX & RX chars to 8 bits for this test.
101
111
int test_buff_bits = data_bits < 8 ? data_bits : 8 ;
@@ -333,6 +343,10 @@ Case cases[] = {
333
343
Case (" basic, 9600, 8N1, FC off" , all_peripherals<UARTNoFCPort, DefaultFormFactor, fpga_uart_test_common_no_fc<9600 , 8 , ParityNone, 1 , false > >),
334
344
Case (" basic (direct init), 9600, 8N1, FC off" , all_peripherals<UARTNoFCPort, DefaultFormFactor, fpga_uart_test_common_no_fc<9600 , 8 , ParityNone, 1 , true > >),
335
345
346
+ // same test with 7 and 9 bits data length
347
+ Case (" basic, 9600, 7N1, FC off" , all_peripherals<UARTNoFCPort, DefaultFormFactor, fpga_uart_test_common_no_fc<9600 , 7 , ParityNone, 1 , false > >),
348
+ Case (" basic, 9600, 9N1, FC off" , all_peripherals<UARTNoFCPort, DefaultFormFactor, fpga_uart_test_common_no_fc<9600 , 9 , ParityNone, 1 , false > >),
349
+
336
350
// One set of pins from one peripheral.
337
351
// baudrate
338
352
Case (" 19200, 8N1, FC off" , one_peripheral<UARTNoFCPort, DefaultFormFactor, fpga_uart_test_common_no_fc<19200 , 8 , ParityNone, 1 , false > >),
@@ -351,6 +365,10 @@ Case cases[] = {
351
365
Case (" basic, 9600, 8N1, FC on" , all_peripherals<UARTPort, DefaultFormFactor, fpga_uart_test_common<9600 , 8 , ParityNone, 1 , false > >),
352
366
Case (" basic (direct init), 9600, 8N1, FC on" , all_peripherals<UARTPort, DefaultFormFactor, fpga_uart_test_common<9600 , 8 , ParityNone, 1 , true > >),
353
367
368
+ // same test with 7 and 9 bits data length
369
+ Case (" basic, 9600, 7N1, FC on" , all_peripherals<UARTPort, DefaultFormFactor, fpga_uart_test_common<9600 , 7 , ParityNone, 1 , false > >),
370
+ Case (" basic, 9600, 9N1, FC on" , all_peripherals<UARTPort, DefaultFormFactor, fpga_uart_test_common<9600 , 9 , ParityNone, 1 , false > >),
371
+
354
372
// One set of pins from one peripheral.
355
373
// baudrate
356
374
Case (" 19200, 8N1, FC on" , one_peripheral<UARTPort, DefaultFormFactor, fpga_uart_test_common<19200 , 8 , ParityNone, 1 , false > >),
@@ -360,8 +378,17 @@ Case cases[] = {
360
378
// parity
361
379
#if !defined(UART_ODD_PARITY_NOT_SUPPORTED)
362
380
Case (" 9600, 8O1, FC on" , one_peripheral<UARTPort, DefaultFormFactor, fpga_uart_test_common<9600 , 8 , ParityOdd, 1 , false > >),
381
+
382
+ // same test with 7 and 9 bits data length
383
+ Case (" 9600, 7O1, FC on" , one_peripheral<UARTPort, DefaultFormFactor, fpga_uart_test_common<9600 , 7 , ParityOdd, 1 , false > >),
384
+ Case (" 9600, 9O1, FC on" , one_peripheral<UARTPort, DefaultFormFactor, fpga_uart_test_common<9600 , 9 , ParityOdd, 1 , false > >),
363
385
#endif
364
386
Case (" 9600, 8E1, FC on" , one_peripheral<UARTPort, DefaultFormFactor, fpga_uart_test_common<9600 , 8 , ParityEven, 1 , false > >),
387
+
388
+ // same test with 7 and 9 bits data length
389
+ Case (" 9600, 7E1, FC on" , one_peripheral<UARTPort, DefaultFormFactor, fpga_uart_test_common<9600 , 7 , ParityEven, 1 , false > >),
390
+ Case (" 9600, 9E1, FC on" , one_peripheral<UARTPort, DefaultFormFactor, fpga_uart_test_common<9600 , 9 , ParityEven, 1 , false > >),
391
+
365
392
// stop bits
366
393
#if !defined(UART_TWO_STOP_BITS_NOT_SUPPORTED)
367
394
Case (" 9600, 8N2, FC on" , one_peripheral<UARTPort, DefaultFormFactor, fpga_uart_test_common<9600 , 8 , ParityNone, 2 , false > >),
0 commit comments