@@ -86,16 +86,37 @@ static void test_irq_handler(uint32_t id, SerialIrq event)
86
86
static void uart_test_common (int baudrate, int data_bits, SerialParity parity, int stop_bits, bool init_direct, PinName tx, PinName rx, PinName cts, PinName rts)
87
87
{
88
88
// The FPGA CI shield only supports None, Odd & Even.
89
- // Forced parity is not supported on Atmel, Freescale, Nordic & STM targets.
89
+ // Forced parity is not supported on many targets
90
90
MBED_ASSERT (parity != ParityForced1 && parity != ParityForced0);
91
91
92
- // STM-specific constraints
93
- // Only 7, 8 & 9 data bits.
94
- MBED_ASSERT (data_bits >= 7 && data_bits <= 9 );
95
- // Only Odd or Even parity for 7 data bits.
92
+ // See TESTS/configs/fpga.json to check which target supports what
93
+ #if defined(UART_9BITS_NOT_SUPPORTED)
94
+ if (data_bits == 9 ) {
95
+ utest_printf (" UART_9BITS_NOT_SUPPORTED set ... " );
96
+ return ;
97
+ }
98
+ #endif
99
+
100
+ #if defined(UART_9BITS_PARITY_NOT_SUPPORTED)
101
+ if ((data_bits == 9 ) && (parity != ParityNone)) {
102
+ utest_printf (" UART_9BITS_PARITY_NOT_SUPPORTED set ... " );
103
+ return ;
104
+ }
105
+ #endif
106
+
107
+ #if defined(UART_7BITS_NOT_SUPPORTED)
96
108
if (data_bits == 7 ) {
97
- MBED_ASSERT (parity != ParityNone);
109
+ utest_printf (" UART_7BITS_NOT_SUPPORTED set ... " );
110
+ return ;
98
111
}
112
+ #endif
113
+
114
+ #if defined(UART_7BITS_PARITY_NONE_NOT_SUPPORTED)
115
+ if ((data_bits == 7 ) && (parity == ParityNone)) {
116
+ utest_printf (" UART_7BITS_PARITY_NONE_NOT_SUPPORTED set ... " );
117
+ return ;
118
+ }
119
+ #endif
99
120
100
121
// Limit the actual TX & RX chars to 8 bits for this test.
101
122
int test_buff_bits = data_bits < 8 ? data_bits : 8 ;
@@ -333,6 +354,10 @@ Case cases[] = {
333
354
Case (" basic, 9600, 8N1, FC off" , all_peripherals<UARTNoFCPort, DefaultFormFactor, fpga_uart_test_common_no_fc<9600 , 8 , ParityNone, 1 , false > >),
334
355
Case (" basic (direct init), 9600, 8N1, FC off" , all_peripherals<UARTNoFCPort, DefaultFormFactor, fpga_uart_test_common_no_fc<9600 , 8 , ParityNone, 1 , true > >),
335
356
357
+ // same test with 7 and 9 bits data length
358
+ Case (" basic, 9600, 7N1, FC off" , all_peripherals<UARTNoFCPort, DefaultFormFactor, fpga_uart_test_common_no_fc<9600 , 7 , ParityNone, 1 , false > >),
359
+ Case (" basic, 9600, 9N1, FC off" , all_peripherals<UARTNoFCPort, DefaultFormFactor, fpga_uart_test_common_no_fc<9600 , 9 , ParityNone, 1 , false > >),
360
+
336
361
// One set of pins from one peripheral.
337
362
// baudrate
338
363
Case (" 19200, 8N1, FC off" , one_peripheral<UARTNoFCPort, DefaultFormFactor, fpga_uart_test_common_no_fc<19200 , 8 , ParityNone, 1 , false > >),
@@ -351,6 +376,10 @@ Case cases[] = {
351
376
Case (" basic, 9600, 8N1, FC on" , all_peripherals<UARTPort, DefaultFormFactor, fpga_uart_test_common<9600 , 8 , ParityNone, 1 , false > >),
352
377
Case (" basic (direct init), 9600, 8N1, FC on" , all_peripherals<UARTPort, DefaultFormFactor, fpga_uart_test_common<9600 , 8 , ParityNone, 1 , true > >),
353
378
379
+ // same test with 7 and 9 bits data length
380
+ Case (" basic, 9600, 7N1, FC on" , all_peripherals<UARTPort, DefaultFormFactor, fpga_uart_test_common<9600 , 7 , ParityNone, 1 , false > >),
381
+ Case (" basic, 9600, 9N1, FC on" , all_peripherals<UARTPort, DefaultFormFactor, fpga_uart_test_common<9600 , 9 , ParityNone, 1 , false > >),
382
+
354
383
// One set of pins from one peripheral.
355
384
// baudrate
356
385
Case (" 19200, 8N1, FC on" , one_peripheral<UARTPort, DefaultFormFactor, fpga_uart_test_common<19200 , 8 , ParityNone, 1 , false > >),
@@ -360,8 +389,17 @@ Case cases[] = {
360
389
// parity
361
390
#if !defined(UART_ODD_PARITY_NOT_SUPPORTED)
362
391
Case (" 9600, 8O1, FC on" , one_peripheral<UARTPort, DefaultFormFactor, fpga_uart_test_common<9600 , 8 , ParityOdd, 1 , false > >),
392
+
393
+ // same test with 7 and 9 bits data length
394
+ Case (" 9600, 7O1, FC on" , one_peripheral<UARTPort, DefaultFormFactor, fpga_uart_test_common<9600 , 7 , ParityOdd, 1 , false > >),
395
+ Case (" 9600, 9O1, FC on" , one_peripheral<UARTPort, DefaultFormFactor, fpga_uart_test_common<9600 , 9 , ParityOdd, 1 , false > >),
363
396
#endif
364
397
Case (" 9600, 8E1, FC on" , one_peripheral<UARTPort, DefaultFormFactor, fpga_uart_test_common<9600 , 8 , ParityEven, 1 , false > >),
398
+
399
+ // same test with 7 and 9 bits data length
400
+ Case (" 9600, 7E1, FC on" , one_peripheral<UARTPort, DefaultFormFactor, fpga_uart_test_common<9600 , 7 , ParityEven, 1 , false > >),
401
+ Case (" 9600, 9E1, FC on" , one_peripheral<UARTPort, DefaultFormFactor, fpga_uart_test_common<9600 , 9 , ParityEven, 1 , false > >),
402
+
365
403
// stop bits
366
404
#if !defined(UART_TWO_STOP_BITS_NOT_SUPPORTED)
367
405
Case (" 9600, 8N2, FC on" , one_peripheral<UARTPort, DefaultFormFactor, fpga_uart_test_common<9600 , 8 , ParityNone, 2 , false > >),
0 commit comments