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.
pull/12436/head
Przemyslaw Stekiel 2020-02-11 11:25:01 +01:00
parent 119931e56d
commit f6acb51893
1 changed files with 13 additions and 9 deletions

View File

@ -111,18 +111,22 @@ void find_ports(std::list<PortType> &matched_ports, std::list<PortType> &not_mat
const char *pin_type = PortType::PinMap::pin_type_names[i];
// Loop through each pin of a given type
for (; map->pin != NC; map++) {
for (uint32_t j = 0; j < FormFactorType::pins()->count; j++) {
PortType port;
// Set pin being tested
port.pins[i] = map->pin;
port.peripheral = map->peripheral;
// Only form factor pins can be tested
if (!pinmap_list_has_pin(FormFactorType::pins(), port.pins[i])) {
if (FormFactorType::pins()->pins[j] == NC) {
utest_printf("Skipping (NC pin) %s pin %s (%i)\r\n", pin_type,
FormFactorType::pin_to_string(port.pins[i]), port.pins[i]);
continue;
}
// Set pin being tested
port.pins[i] = FormFactorType::pins()->pins[j];
port.peripheral = pinmap_find_peripheral(port.pins[i], map);
// Don't test restricted pins
if (pinmap_list_has_pin(FormFactorType::restricted_pins(), port.pins[i])) {
utest_printf("Skipping %s pin %s (%i)\r\n", pin_type,
utest_printf("Skipping (restricted pin) %s pin %s (%i)\r\n", pin_type,
FormFactorType::pin_to_string(port.pins[i]), port.pins[i]);
continue;
}
@ -130,7 +134,7 @@ void find_ports(std::list<PortType> &matched_ports, std::list<PortType> &not_mat
if (!strcmp(PortType::PinMap::name, GPIO_IRQ_NAME) || !strcmp(PortType::PinMap::name, GPIO_NAME)) {
// Don't test restricted gpio pins
if (pinmap_list_has_pin(pinmap_gpio_restricted_pins(), port.pins[i])) {
utest_printf("Skipping %s pin %s (%i)\r\n", pin_type,
utest_printf("Skipping (restricted gpio pin) %s pin %s (%i)\r\n", pin_type,
FormFactorType::pin_to_string(port.pins[i]), port.pins[i]);
continue;
}
@ -139,7 +143,7 @@ void find_ports(std::list<PortType> &matched_ports, std::list<PortType> &not_mat
#if DEVICE_SERIAL
if (!strcmp(PortType::PinMap::name, UART_NAME) || !strcmp(PortType::PinMap::name, UARTNOFC_NAME)) {
if (pinmap_list_has_peripheral(pinmap_uart_restricted_peripherals(), port.peripheral)) {
utest_printf("Skipping %s peripheral %i with pin %s (%i)\r\n", pin_type,
utest_printf("Skipping (restricted uart peripheral) %s peripheral %i with pin %s (%i)\r\n", pin_type,
port.peripheral, FormFactorType::pin_to_string(port.pins[i]), port.pins[i]);
continue;
}