20
20
21
21
#include < list>
22
22
23
+ #define UART_NAME " UART"
24
+ #define UARTNOFC_NAME " UART-no-FC"
25
+ #define ANALOGOUT_NAME " DAC"
26
+ #define ANALOGIN_NAME " ADC"
27
+ #define PWM_NAME " PWM"
28
+ #define I2C_NAME " I2C"
29
+ #define SPI_NAME " SPI"
30
+ #define SPISLAVE_NAME " SPISlave"
31
+ #define GPIO_NAME " GPIO"
32
+ #define GPIO_IRQ_NAME " GPIO_IRQ"
33
+
23
34
// test function prototypes
24
35
typedef void (*TF1)(PinName p0);
25
36
typedef void (*TF2)(PinName p0, PinName p1);
@@ -115,11 +126,26 @@ void find_ports(std::list<PortType> &matched_ports, std::list<PortType> ¬_mat
115
126
FormFactorType::pin_to_string (port.pins [i]), port.pins [i]);
116
127
continue ;
117
128
}
118
- if (pinmap_list_has_peripheral (pinmap_restricted_peripherals (), port.peripheral )) {
119
- utest_printf (" Skipping %s peripheral %i with pin %s (%i)\r\n " , pin_type,
120
- port.peripheral , FormFactorType::pin_to_string (port.pins [i]), port.pins [i]);
121
- continue ;
129
+
130
+ if (!strcmp (PortType::PinMap::name, GPIO_IRQ_NAME) || !strcmp (PortType::PinMap::name, GPIO_NAME)) {
131
+ // Don't test restricted gpio pins
132
+ if (pinmap_list_has_pin (pinmap_gpio_restricted_pins (), port.pins [i])) {
133
+ utest_printf (" Skipping %s pin %s (%i)\r\n " , pin_type,
134
+ FormFactorType::pin_to_string (port.pins [i]), port.pins [i]);
135
+ continue ;
136
+ }
122
137
}
138
+
139
+ #if DEVICE_SERIAL
140
+ if (!strcmp (PortType::PinMap::name, UART_NAME) || !strcmp (PortType::PinMap::name, UARTNOFC_NAME)) {
141
+ 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,
143
+ port.peripheral , FormFactorType::pin_to_string (port.pins [i]), port.pins [i]);
144
+ continue ;
145
+ }
146
+ }
147
+ #endif
148
+
123
149
// skipp pin searching if single pin port type
124
150
if (PortType::pin_count > 1 ) {
125
151
find_port_pins<PortType, FormFactorType>(port);
@@ -442,7 +468,7 @@ struct GPIOMaps {
442
468
};
443
469
const PinMap *GPIOMaps::maps[] = { gpio_pinmap () };
444
470
const char *const GPIOMaps::pin_type_names[] = { " IO" };
445
- const char *const GPIOMaps::name = " GPIO " ;
471
+ const char *const GPIOMaps::name = GPIO_NAME ;
446
472
typedef Port<1 , GPIOMaps, DefaultFormFactor, TF1> GPIOPort;
447
473
448
474
#if DEVICE_INTERRUPTIN
@@ -454,7 +480,7 @@ struct GPIOIRQMaps {
454
480
};
455
481
const PinMap *GPIOIRQMaps::maps[] = { gpio_irq_pinmap () };
456
482
const char *const GPIOIRQMaps::pin_type_names[] = { " IRQ_IN" };
457
- const char *const GPIOIRQMaps::name = " GPIO_IRQ " ;
483
+ const char *const GPIOIRQMaps::name = GPIO_IRQ_NAME ;
458
484
typedef Port<1 , GPIOIRQMaps, DefaultFormFactor, TF1> GPIOIRQPort;
459
485
#endif
460
486
@@ -467,7 +493,7 @@ struct SPIMaps {
467
493
};
468
494
const PinMap *SPIMaps::maps[] = { spi_master_mosi_pinmap (), spi_master_miso_pinmap (), spi_master_clk_pinmap (), spi_master_cs_pinmap () };
469
495
const char *const SPIMaps::pin_type_names[] = { " MOSI" , " MISO" , " SCLK" , " SSEL" };
470
- const char *const SPIMaps::name = " SPI " ;
496
+ const char *const SPIMaps::name = SPI_NAME ;
471
497
typedef Port<4 , SPIMaps, DefaultFormFactor, TF4> SPIPort;
472
498
473
499
struct SPINoCSMaps {
@@ -477,7 +503,7 @@ struct SPINoCSMaps {
477
503
};
478
504
const PinMap *SPINoCSMaps::maps[] = { spi_master_mosi_pinmap (), spi_master_miso_pinmap (), spi_master_clk_pinmap ()};
479
505
const char *const SPINoCSMaps::pin_type_names[] = { " MOSI" , " MISO" , " SCLK" };
480
- const char *const SPINoCSMaps::name = " SPI " ;
506
+ const char *const SPINoCSMaps::name = SPI_NAME ;
481
507
typedef Port<3 , SPINoCSMaps, DefaultFormFactor, TF3> SPINoCSPort;
482
508
483
509
struct SPISlaveMaps {
@@ -487,7 +513,7 @@ struct SPISlaveMaps {
487
513
};
488
514
const PinMap *SPISlaveMaps::maps[] = { spi_slave_mosi_pinmap (), spi_slave_miso_pinmap (), spi_slave_clk_pinmap (), spi_slave_cs_pinmap () };
489
515
const char *const SPISlaveMaps::pin_type_names[] = { " MOSI" , " MISO" , " SCLK" , " SSEL" };
490
- const char *const SPISlaveMaps::name = " SPISlave " ;
516
+ const char *const SPISlaveMaps::name = SPISLAVE_NAME ;
491
517
typedef Port<4 , SPISlaveMaps, DefaultFormFactor, TF4> SPISlavePort;
492
518
#endif
493
519
@@ -500,7 +526,7 @@ struct I2CMaps {
500
526
};
501
527
const PinMap *I2CMaps::maps[] = { i2c_master_sda_pinmap (), i2c_master_scl_pinmap () };
502
528
const char *const I2CMaps::pin_type_names[] = { " SDA" , " SCL" };
503
- const char *const I2CMaps::name = " I2C " ;
529
+ const char *const I2CMaps::name = I2C_NAME ;
504
530
typedef Port<2 , I2CMaps, DefaultFormFactor, TF2> I2CPort;
505
531
#endif
506
532
@@ -513,7 +539,7 @@ struct PWMMaps {
513
539
};
514
540
const PinMap *PWMMaps::maps[] = { pwmout_pinmap () };
515
541
const char *const PWMMaps::pin_type_names[] = { " PWM_OUT" };
516
- const char *const PWMMaps::name = " PWM " ;
542
+ const char *const PWMMaps::name = PWM_NAME ;
517
543
typedef Port<1 , PWMMaps, DefaultFormFactor, TF1> PWMPort;
518
544
#endif
519
545
@@ -526,7 +552,7 @@ struct AnaloginMaps {
526
552
};
527
553
const PinMap *AnaloginMaps::maps[] = { analogin_pinmap () };
528
554
const char *const AnaloginMaps::pin_type_names[] = { " ADC_IN" };
529
- const char *const AnaloginMaps::name = " ADC " ;
555
+ const char *const AnaloginMaps::name = ANALOGIN_NAME ;
530
556
typedef Port<1 , AnaloginMaps, DefaultFormFactor, TF1> AnaloginPort;
531
557
#endif
532
558
@@ -539,7 +565,7 @@ struct AnalogoutMaps {
539
565
};
540
566
const PinMap *AnalogoutMaps::maps[] = { analogout_pinmap () };
541
567
const char *const AnalogoutMaps::pin_type_names[] = { " DAC_OUT" };
542
- const char *const AnalogoutMaps::name = " DAC " ;
568
+ const char *const AnalogoutMaps::name = ANALOGOUT_NAME ;
543
569
typedef Port<1 , AnalogoutMaps, DefaultFormFactor, TF1> AnalogoutPort;
544
570
#endif
545
571
@@ -553,7 +579,7 @@ struct UARTMaps {
553
579
};
554
580
const PinMap *UARTMaps::maps[] = { serial_tx_pinmap (), serial_rx_pinmap (), serial_cts_pinmap (), serial_rts_pinmap () };
555
581
const char *const UARTMaps::pin_type_names[] = { " TX" , " RX" , " CLS" , " RTS" };
556
- const char *const UARTMaps::name = " UART " ;
582
+ const char *const UARTMaps::name = UART_NAME ;
557
583
typedef Port<4 , UARTMaps, DefaultFormFactor, TF4> UARTPort;
558
584
#endif
559
585
@@ -564,8 +590,7 @@ struct UARTNoFCMaps {
564
590
};
565
591
const PinMap *UARTNoFCMaps::maps[] = { serial_tx_pinmap (), serial_rx_pinmap () };
566
592
const char *const UARTNoFCMaps::pin_type_names[] = { " TX" , " RX" };
567
- const char *const UARTNoFCMaps::name = " UART-no-FC " ;
593
+ const char *const UARTNoFCMaps::name = UARTNOFC_NAME ;
568
594
typedef Port<2 , UARTNoFCMaps, DefaultFormFactor, TF2> UARTNoFCPort;
569
595
#endif
570
-
571
596
#endif
0 commit comments