Skip to content

Commit ed41994

Browse files
author
Filip Jagodzinski
committed
Test: HAL: serial: Add DEVICE_SERIAL_FC guards
Fix undefined references to serial_set_flow_control.
1 parent 07baf07 commit ed41994

File tree

2 files changed

+22
-6
lines changed
  • TESTS/mbed_hal_fpga_ci_test_shield/uart
  • components/testing/COMPONENT_FPGA_CI_TEST_SHIELD

2 files changed

+22
-6
lines changed

TESTS/mbed_hal_fpga_ci_test_shield/uart/main.cpp

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -118,11 +118,13 @@ static void uart_test_common(int baudrate, int data_bits, SerialParity parity, i
118118
serial_init(&serial, tx, rx);
119119
serial_baud(&serial, baudrate);
120120
serial_format(&serial, data_bits, parity, stop_bits);
121+
#if DEVICE_SERIAL_FC
121122
if (use_flow_control) {
122123
serial_set_flow_control(&serial, FlowControlRTSCTS, rts, cts);
123124
} else {
124125
serial_set_flow_control(&serial, FlowControlNone, NC, NC);
125126
}
127+
#endif
126128

127129
// Reset tester stats and select UART
128130
tester.peripherals_reset();
@@ -277,9 +279,11 @@ void test_init_free(PinName tx, PinName rx, PinName cts = NC, PinName rts = NC)
277279
serial_init(&serial, tx, rx);
278280
serial_baud(&serial, 9600);
279281
serial_format(&serial, 8, ParityNone, 1);
282+
#if DEVICE_SERIAL_FC
280283
if (use_flow_control) {
281284
serial_set_flow_control(&serial, FlowControlRTSCTS, rts, cts);
282285
}
286+
#endif
283287
serial_free(&serial);
284288
}
285289

@@ -302,28 +306,38 @@ void test_common_no_fc(PinName tx, PinName rx)
302306

303307
Case cases[] = {
304308
// Every set of pins from every peripheral.
305-
Case("init/free, FC on", all_ports<UARTPort, DefaultFormFactor, test_init_free>),
306309
Case("init/free, FC off", all_ports<UARTNoFCPort, DefaultFormFactor, test_init_free_no_fc>),
307310

308311
// One set of pins from every peripheral.
309-
Case("basic, 9600, 8N1, FC on", all_peripherals<UARTPort, DefaultFormFactor, test_common<9600, 8, ParityNone, 1> >),
310312
Case("basic, 9600, 8N1, FC off", all_peripherals<UARTNoFCPort, DefaultFormFactor, test_common_no_fc<9600, 8, ParityNone, 1> >),
311313

312314
// One set of pins from one peripheral.
313315
// baudrate
314-
Case("19200, 8N1, FC on", one_peripheral<UARTPort, DefaultFormFactor, test_common<19200, 8, ParityNone, 1> >),
315316
Case("19200, 8N1, FC off", one_peripheral<UARTNoFCPort, DefaultFormFactor, test_common_no_fc<19200, 8, ParityNone, 1> >),
316-
Case("38400, 8N1, FC on", one_peripheral<UARTPort, DefaultFormFactor, test_common<38400, 8, ParityNone, 1> >),
317317
Case("38400, 8N1, FC off", one_peripheral<UARTNoFCPort, DefaultFormFactor, test_common_no_fc<38400, 8, ParityNone, 1> >),
318-
Case("115200, 8N1, FC on", one_peripheral<UARTPort, DefaultFormFactor, test_common<115200, 8, ParityNone, 1> >),
319318
Case("115200, 8N1, FC off", one_peripheral<UARTNoFCPort, DefaultFormFactor, test_common_no_fc<115200, 8, ParityNone, 1> >),
319+
// stop bits
320+
Case("9600, 8N2, FC off", one_peripheral<UARTNoFCPort, DefaultFormFactor, test_common_no_fc<9600, 8, ParityNone, 2> >),
321+
322+
#if DEVICE_SERIAL_FC
323+
// Every set of pins from every peripheral.
324+
Case("init/free, FC on", all_ports<UARTPort, DefaultFormFactor, test_init_free>),
325+
326+
// One set of pins from every peripheral.
327+
Case("basic, 9600, 8N1, FC on", all_peripherals<UARTPort, DefaultFormFactor, test_common<9600, 8, ParityNone, 1> >),
328+
329+
// One set of pins from one peripheral.
330+
// baudrate
331+
Case("19200, 8N1, FC on", one_peripheral<UARTPort, DefaultFormFactor, test_common<19200, 8, ParityNone, 1> >),
332+
Case("38400, 8N1, FC on", one_peripheral<UARTPort, DefaultFormFactor, test_common<38400, 8, ParityNone, 1> >),
333+
Case("115200, 8N1, FC on", one_peripheral<UARTPort, DefaultFormFactor, test_common<115200, 8, ParityNone, 1> >),
320334
// data bits: not tested (some platforms support 8 bits only)
321335
// parity
322336
Case("9600, 8O1, FC on", one_peripheral<UARTPort, DefaultFormFactor, test_common<9600, 8, ParityOdd, 1> >),
323337
Case("9600, 8E1, FC on", one_peripheral<UARTPort, DefaultFormFactor, test_common<9600, 8, ParityEven, 1> >),
324338
// stop bits
325339
Case("9600, 8N2, FC on", one_peripheral<UARTPort, DefaultFormFactor, test_common<9600, 8, ParityNone, 2> >),
326-
Case("9600, 8N2, FC off", one_peripheral<UARTNoFCPort, DefaultFormFactor, test_common_no_fc<9600, 8, ParityNone, 2> >),
340+
#endif
327341
};
328342

329343
utest::v1::status_t greentea_test_setup(const size_t number_of_cases)

components/testing/COMPONENT_FPGA_CI_TEST_SHIELD/test_utils.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -511,6 +511,7 @@ typedef Port<1, AnalogoutMaps, DefaultFormFactor, TF1> AnalogoutPort;
511511
#endif
512512

513513
#if DEVICE_SERIAL
514+
#if DEVICE_SERIAL_FC
514515
struct UARTMaps {
515516
static const PinMap *maps[];
516517
static const char *const pin_type_names[];
@@ -520,6 +521,7 @@ const PinMap *UARTMaps::maps[] = { serial_tx_pinmap(), serial_rx_pinmap(), seria
520521
const char *const UARTMaps::pin_type_names[] = { "TX", "RX", "CLS", "RTS" };
521522
const char *const UARTMaps::name = "UART";
522523
typedef Port<4, UARTMaps, DefaultFormFactor, TF4> UARTPort;
524+
#endif
523525

524526
struct UARTNoFCMaps {
525527
static const PinMap *maps[];

0 commit comments

Comments
 (0)