Skip to content

Commit e175d77

Browse files
committed
FGGA UART test: add test cases with 7 and 9 bits data length
1 parent 92cdcfb commit e175d77

File tree

1 file changed

+30
-3
lines changed
  • TESTS/mbed_hal_fpga_ci_test_shield/uart

1 file changed

+30
-3
lines changed

TESTS/mbed_hal_fpga_ci_test_shield/uart/main.cpp

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,20 @@ static void uart_test_common(int baudrate, int data_bits, SerialParity parity, i
9292
// STM-specific constraints
9393
// Only 7, 8 & 9 data bits.
9494
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;
98100
}
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
99109

100110
// Limit the actual TX & RX chars to 8 bits for this test.
101111
int test_buff_bits = data_bits < 8 ? data_bits : 8;
@@ -333,6 +343,10 @@ Case cases[] = {
333343
Case("basic, 9600, 8N1, FC off", all_peripherals<UARTNoFCPort, DefaultFormFactor, fpga_uart_test_common_no_fc<9600, 8, ParityNone, 1, false> >),
334344
Case("basic (direct init), 9600, 8N1, FC off", all_peripherals<UARTNoFCPort, DefaultFormFactor, fpga_uart_test_common_no_fc<9600, 8, ParityNone, 1, true> >),
335345

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+
336350
// One set of pins from one peripheral.
337351
// baudrate
338352
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[] = {
351365
Case("basic, 9600, 8N1, FC on", all_peripherals<UARTPort, DefaultFormFactor, fpga_uart_test_common<9600, 8, ParityNone, 1, false> >),
352366
Case("basic (direct init), 9600, 8N1, FC on", all_peripherals<UARTPort, DefaultFormFactor, fpga_uart_test_common<9600, 8, ParityNone, 1, true> >),
353367

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+
354372
// One set of pins from one peripheral.
355373
// baudrate
356374
Case("19200, 8N1, FC on", one_peripheral<UARTPort, DefaultFormFactor, fpga_uart_test_common<19200, 8, ParityNone, 1, false> >),
@@ -360,8 +378,17 @@ Case cases[] = {
360378
// parity
361379
#if !defined(UART_ODD_PARITY_NOT_SUPPORTED)
362380
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> >),
363385
#endif
364386
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+
365392
// stop bits
366393
#if !defined(UART_TWO_STOP_BITS_NOT_SUPPORTED)
367394
Case("9600, 8N2, FC on", one_peripheral<UARTPort, DefaultFormFactor, fpga_uart_test_common<9600, 8, ParityNone, 2, false> >),

0 commit comments

Comments
 (0)