Skip to content

Commit f6acb51

Browse files
committed
Update find_ports() FPGA testing utility function to loop through the form factor pins instead the pin-map
This change is required to fully remove gpio pin-maps which were already added for FPGA testing. One use case of adding gpio pinmap was that pin-map must have the specific format - must be ended with NC pin. Functions that deal with pin-maps loops through the pin-map until NC pin is encountered. Also, our FPGA testing utility function to find pins for testing does that. When gpio pinmaps are fully removed we will have one generic gpio pinmap which provides Arduino pins: D0, D1, D2, etc. (only Arduino form factor is supported at the moment). In some cases may happen that an arduino pin is not connected (e.g. KW24D: D4 == NC). As a result we will have NC not only at the end, but also in the middle of the gpio pin-map. In this case find_ports() function will finish processing pin-map to early (when first NC is encountered). The proposition is to change the find_ports() FPGA testing utility function to loop through form factor pins (instead pin-map) and then check if the pin is not NC and is available on the specific pin-map before using it for testing.
1 parent 119931e commit f6acb51

File tree

1 file changed

+13
-9
lines changed
  • components/testing/COMPONENT_FPGA_CI_TEST_SHIELD

1 file changed

+13
-9
lines changed

components/testing/COMPONENT_FPGA_CI_TEST_SHIELD/test_utils.h

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -111,26 +111,30 @@ void find_ports(std::list<PortType> &matched_ports, std::list<PortType> &not_mat
111111
const char *pin_type = PortType::PinMap::pin_type_names[i];
112112

113113
// Loop through each pin of a given type
114-
for (; map->pin != NC; map++) {
114+
for (uint32_t j = 0; j < FormFactorType::pins()->count; j++) {
115115
PortType port;
116-
// Set pin being tested
117-
port.pins[i] = map->pin;
118-
port.peripheral = map->peripheral;
119-
// Only form factor pins can be tested
120-
if (!pinmap_list_has_pin(FormFactorType::pins(), port.pins[i])) {
116+
117+
if (FormFactorType::pins()->pins[j] == NC) {
118+
utest_printf("Skipping (NC pin) %s pin %s (%i)\r\n", pin_type,
119+
FormFactorType::pin_to_string(port.pins[i]), port.pins[i]);
121120
continue;
122121
}
122+
123+
// Set pin being tested
124+
port.pins[i] = FormFactorType::pins()->pins[j];
125+
port.peripheral = pinmap_find_peripheral(port.pins[i], map);
126+
123127
// Don't test restricted pins
124128
if (pinmap_list_has_pin(FormFactorType::restricted_pins(), port.pins[i])) {
125-
utest_printf("Skipping %s pin %s (%i)\r\n", pin_type,
129+
utest_printf("Skipping (restricted pin) %s pin %s (%i)\r\n", pin_type,
126130
FormFactorType::pin_to_string(port.pins[i]), port.pins[i]);
127131
continue;
128132
}
129133

130134
if (!strcmp(PortType::PinMap::name, GPIO_IRQ_NAME) || !strcmp(PortType::PinMap::name, GPIO_NAME)) {
131135
// Don't test restricted gpio pins
132136
if (pinmap_list_has_pin(pinmap_gpio_restricted_pins(), port.pins[i])) {
133-
utest_printf("Skipping %s pin %s (%i)\r\n", pin_type,
137+
utest_printf("Skipping (restricted gpio pin) %s pin %s (%i)\r\n", pin_type,
134138
FormFactorType::pin_to_string(port.pins[i]), port.pins[i]);
135139
continue;
136140
}
@@ -139,7 +143,7 @@ void find_ports(std::list<PortType> &matched_ports, std::list<PortType> &not_mat
139143
#if DEVICE_SERIAL
140144
if (!strcmp(PortType::PinMap::name, UART_NAME) || !strcmp(PortType::PinMap::name, UARTNOFC_NAME)) {
141145
if (pinmap_list_has_peripheral(pinmap_uart_restricted_peripherals(), port.peripheral)) {
142-
utest_printf("Skipping %s peripheral %i with pin %s (%i)\r\n", pin_type,
146+
utest_printf("Skipping (restricted uart peripheral) %s peripheral %i with pin %s (%i)\r\n", pin_type,
143147
port.peripheral, FormFactorType::pin_to_string(port.pins[i]), port.pins[i]);
144148
continue;
145149
}

0 commit comments

Comments
 (0)