Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,6 @@ void find_ports(std::list<PortType> &matched_ports, std::list<PortType> &not_mat
PortType port;

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;
}

Expand All @@ -143,7 +141,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 (restricted uart peripheral) %s peripheral %i with pin %s (%i)\r\n", pin_type,
utest_printf("Skipping (restricted uart peripheral) %s peripheral 0x%x with pin %s (%x)\r\n", pin_type,
port.peripheral, FormFactorType::pin_to_string(port.pins[i]), port.pins[i]);
continue;
}
Expand Down Expand Up @@ -178,31 +176,35 @@ void test_all_ports(std::list<PortType> &matched_ports, std::list<PortType> &not
}

for (uint32_t i = 0; i < ff_pins->count; i++) {
for (Iter it = matched_ports.begin(); it != matched_ports.end(); ++it) {
PortType &port = *it;
for (uint32_t j = 0; j < PortType::pin_count; j++) {
if (ff_pins->pins[i] == port.pins[j]) {
utest_printf("%3s - %s pin tested on port: %s...", FormFactorType::pin_to_string(ff_pins->pins[i]),
PortType::PinMap::pin_type_names[j], port.str());
if (port.status == PortType::StatusNotTested) {
call(port);
port.status = PortType::StatusPass;
if (ff_pins->pins[i] != NC) {
for (Iter it = matched_ports.begin(); it != matched_ports.end(); ++it) {
PortType &port = *it;
for (uint32_t j = 0; j < PortType::pin_count; j++) {
if (ff_pins->pins[i] == port.pins[j]) {
utest_printf("%3s - %s pin tested on port: %s...", FormFactorType::pin_to_string(ff_pins->pins[i]),
PortType::PinMap::pin_type_names[j], port.str());
if (port.status == PortType::StatusNotTested) {
call(port);
port.status = PortType::StatusPass;
} else {
utest_printf("test already done...");
}
utest_printf("%s\n", port.status == PortType::StatusPass ? "succeeded" : "failed");
goto end_port_iteration;
}
utest_printf("%s\n", port.status == PortType::StatusPass ? "succeeded" : "failed");
goto end_port_iteration;
}
}
}
for (Iter it = not_matched_ports.begin(); it != not_matched_ports.end(); ++it) {
PortType &port = *it;
for (uint32_t j = 0; j < PortType::pin_count; j++) {
if (ff_pins->pins[i] == port.pins[j]) {
utest_printf("%3s - Could not find pins to test %s pin %s (%d)\n",
FormFactorType::pin_to_string(ff_pins->pins[i]),
PortType::PinMap::pin_type_names[j],
FormFactorType::pin_to_string(ff_pins->pins[i]),
ff_pins->pins[i]);
goto end_port_iteration;
for (Iter it = not_matched_ports.begin(); it != not_matched_ports.end(); ++it) {
PortType &port = *it;
for (uint32_t j = 0; j < PortType::pin_count; j++) {
if (ff_pins->pins[i] == port.pins[j]) {
utest_printf("%3s - Could not find pins to test %s pin %s (%d)\n",
FormFactorType::pin_to_string(ff_pins->pins[i]),
PortType::PinMap::pin_type_names[j],
FormFactorType::pin_to_string(ff_pins->pins[i]),
ff_pins->pins[i]);
goto end_port_iteration;
}
}
}
}
Expand All @@ -215,9 +217,11 @@ template<typename PortType, typename FunctionType, FunctionType f>
void test_peripheral(PortType &port)
{
if (port.empty()) {
utest_printf("%d - Could not find pins to test peripheral\n", port.peripheral);
if (port.peripheral != NC) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't port.empty() already do the trick do we need additional if here? If yes, lets move it to line 219 (condtion && condition)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, as the following else is valid only for the first condition

utest_printf("0x%x - Could not find pins to test peripheral\n", port.peripheral);
}
} else {
utest_printf("%d - peripheral tested on port: %s...", port.peripheral, port.str());
utest_printf("0x%x - peripheral tested on port: %s...", port.peripheral, port.str());
if (port.status == PortType::StatusNotTested) {
FunctionCaller<PortType, FunctionType, f> call;
call(port); // run test
Expand Down Expand Up @@ -403,7 +407,7 @@ class Port {
{
static char port_str[128];
char pin_str[32];
sprintf(port_str, "peripheral=(%d) ", peripheral);
sprintf(port_str, "peripheral=(0x%x) ", peripheral);
for (uint32_t i = 0; i < N; i++) {
sprintf(pin_str, "%s=(%s) ", PinMap::pin_type_names[i], FormFactorType::pin_to_string(pins[i]));
strcat(port_str, pin_str);
Expand Down Expand Up @@ -582,7 +586,7 @@ struct UARTMaps {
static const char *const name;
};
const PinMap *UARTMaps::maps[] = { serial_tx_pinmap(), serial_rx_pinmap(), serial_cts_pinmap(), serial_rts_pinmap() };
const char *const UARTMaps::pin_type_names[] = { "TX", "RX", "CLS", "RTS" };
const char *const UARTMaps::pin_type_names[] = { "TX", "RX", "CTS", "RTS" };
const char *const UARTMaps::name = UART_NAME;
typedef Port<4, UARTMaps, DefaultFormFactor, TF4> UARTPort;
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include "platform/mbed_wait_api.h"
#include "platform/mbed_error.h"
#include "drivers/MbedCRC.h"
#include "utest/utest_print.h"

#define mbed_tester_printf(...)

Expand Down Expand Up @@ -948,6 +949,7 @@ void MbedTester::pin_map_set(PinName physical, LogicalPin logical)
error("Invalid logical pin %i", logical);
return;
}
utest_printf("(FPGA %u)...", index);
pin_map_index(index, logical);
}

Expand Down