From ed41994a3a6c794a714ae2f77b387609891d8567 Mon Sep 17 00:00:00 2001 From: Filip Jagodzinski Date: Tue, 9 Jul 2019 13:21:42 +0200 Subject: [PATCH] Test: HAL: serial: Add DEVICE_SERIAL_FC guards Fix undefined references to serial_set_flow_control. --- .../uart/main.cpp | 26 ++++++++++++++----- .../test_utils.h | 2 ++ 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/TESTS/mbed_hal_fpga_ci_test_shield/uart/main.cpp b/TESTS/mbed_hal_fpga_ci_test_shield/uart/main.cpp index 6b81a7652f..c83ebb48d7 100644 --- a/TESTS/mbed_hal_fpga_ci_test_shield/uart/main.cpp +++ b/TESTS/mbed_hal_fpga_ci_test_shield/uart/main.cpp @@ -118,11 +118,13 @@ static void uart_test_common(int baudrate, int data_bits, SerialParity parity, i serial_init(&serial, tx, rx); serial_baud(&serial, baudrate); serial_format(&serial, data_bits, parity, stop_bits); +#if DEVICE_SERIAL_FC if (use_flow_control) { serial_set_flow_control(&serial, FlowControlRTSCTS, rts, cts); } else { serial_set_flow_control(&serial, FlowControlNone, NC, NC); } +#endif // Reset tester stats and select UART tester.peripherals_reset(); @@ -277,9 +279,11 @@ void test_init_free(PinName tx, PinName rx, PinName cts = NC, PinName rts = NC) serial_init(&serial, tx, rx); serial_baud(&serial, 9600); serial_format(&serial, 8, ParityNone, 1); +#if DEVICE_SERIAL_FC if (use_flow_control) { serial_set_flow_control(&serial, FlowControlRTSCTS, rts, cts); } +#endif serial_free(&serial); } @@ -302,28 +306,38 @@ void test_common_no_fc(PinName tx, PinName rx) Case cases[] = { // Every set of pins from every peripheral. - Case("init/free, FC on", all_ports), Case("init/free, FC off", all_ports), // One set of pins from every peripheral. - Case("basic, 9600, 8N1, FC on", all_peripherals >), Case("basic, 9600, 8N1, FC off", all_peripherals >), // One set of pins from one peripheral. // baudrate - Case("19200, 8N1, FC on", one_peripheral >), Case("19200, 8N1, FC off", one_peripheral >), - Case("38400, 8N1, FC on", one_peripheral >), Case("38400, 8N1, FC off", one_peripheral >), - Case("115200, 8N1, FC on", one_peripheral >), Case("115200, 8N1, FC off", one_peripheral >), + // stop bits + Case("9600, 8N2, FC off", one_peripheral >), + +#if DEVICE_SERIAL_FC + // Every set of pins from every peripheral. + Case("init/free, FC on", all_ports), + + // One set of pins from every peripheral. + Case("basic, 9600, 8N1, FC on", all_peripherals >), + + // One set of pins from one peripheral. + // baudrate + Case("19200, 8N1, FC on", one_peripheral >), + Case("38400, 8N1, FC on", one_peripheral >), + Case("115200, 8N1, FC on", one_peripheral >), // data bits: not tested (some platforms support 8 bits only) // parity Case("9600, 8O1, FC on", one_peripheral >), Case("9600, 8E1, FC on", one_peripheral >), // stop bits Case("9600, 8N2, FC on", one_peripheral >), - Case("9600, 8N2, FC off", one_peripheral >), +#endif }; utest::v1::status_t greentea_test_setup(const size_t number_of_cases) diff --git a/components/testing/COMPONENT_FPGA_CI_TEST_SHIELD/test_utils.h b/components/testing/COMPONENT_FPGA_CI_TEST_SHIELD/test_utils.h index e439a45064..d97739d7f9 100644 --- a/components/testing/COMPONENT_FPGA_CI_TEST_SHIELD/test_utils.h +++ b/components/testing/COMPONENT_FPGA_CI_TEST_SHIELD/test_utils.h @@ -511,6 +511,7 @@ typedef Port<1, AnalogoutMaps, DefaultFormFactor, TF1> AnalogoutPort; #endif #if DEVICE_SERIAL +#if DEVICE_SERIAL_FC struct UARTMaps { static const PinMap *maps[]; static const char *const pin_type_names[]; @@ -520,6 +521,7 @@ const PinMap *UARTMaps::maps[] = { serial_tx_pinmap(), serial_rx_pinmap(), seria const char *const UARTMaps::pin_type_names[] = { "TX", "RX", "CLS", "RTS" }; const char *const UARTMaps::name = "UART"; typedef Port<4, UARTMaps, DefaultFormFactor, TF4> UARTPort; +#endif struct UARTNoFCMaps { static const PinMap *maps[];