Skip to content

Commit 35635f8

Browse files
committed
Remove pinmap_restricted_peripherals() function from Nuvoton (STDIO uart is restricted by default)
1 parent 6537e39 commit 35635f8

File tree

7 files changed

+17
-122
lines changed

7 files changed

+17
-122
lines changed

targets/TARGET_NUVOTON/TARGET_M2351/pinmap.c

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ void pin_mode(PinName pin, PinMode mode)
4343
uint32_t pin_index = NU_PINNAME_TO_PIN(pin);
4444
uint32_t port_index = NU_PINNAME_TO_PORT(pin);
4545
GPIO_T *gpio_base = NU_PORT_BASE(port_index);
46-
46+
4747
uint32_t mode_intern = GPIO_MODE_INPUT;
4848

4949
switch (mode) {
@@ -81,38 +81,23 @@ void pin_mode(PinName pin, PinMode mode)
8181
*/
8282
}
8383

84-
/* List of peripherals excluded from testing */
85-
const PeripheralList *pinmap_restricted_peripherals()
86-
{
87-
static const int perifs[] = {
88-
STDIO_UART // Dedicated to USB VCOM
89-
};
90-
91-
static const PeripheralList peripheral_list = {
92-
sizeof(perifs) / sizeof(perifs[0]),
93-
perifs
94-
};
95-
96-
return &peripheral_list;
97-
}
98-
9984
#if defined(__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
10085

10186
static void pin_function_impl(int32_t pin, int32_t data, bool nonsecure_caller)
10287
{
10388
MBED_ASSERT(pin != (PinName)NC);
10489
uint32_t pin_index = NU_PINNAME_TO_PIN(pin);
10590
uint32_t port_index = NU_PINNAME_TO_PORT(pin);
106-
91+
10792
/* Guard access to secure GPIO from non-secure domain */
108-
if (nonsecure_caller &&
93+
if (nonsecure_caller &&
10994
(! (SCU_INIT_IONSSET_VAL & (1 << (port_index + 0))))) {
11095
error("Non-secure domain tries to control secure or undefined GPIO.");
11196
}
11297

11398
__IO uint32_t *GPx_MFPx = ((__IO uint32_t *) &SYS->GPA_MFPL) + port_index * 2 + (pin_index / 8);
11499
uint32_t MFP_Msk = NU_MFP_MSK(pin_index);
115-
100+
116101
// E.g.: SYS->GPA_MFPL = (SYS->GPA_MFPL & (~SYS_GPA_MFPL_PA0MFP_Msk) ) | SYS_GPA_MFPL_PA0MFP_SC0_CD ;
117102
*GPx_MFPx = (*GPx_MFPx & (~MFP_Msk)) | data;
118103
}

targets/TARGET_NUVOTON/TARGET_M251/pinmap.c

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -83,18 +83,3 @@ void pin_mode(PinName pin, PinMode mode)
8383
* 2. PushPullOutput/PIN_INPUT
8484
*/
8585
}
86-
87-
/* List of peripherals excluded from testing */
88-
const PeripheralList *pinmap_restricted_peripherals()
89-
{
90-
static const int perifs[] = {
91-
STDIO_UART // Dedicated to USB VCOM
92-
};
93-
94-
static const PeripheralList peripheral_list = {
95-
sizeof(perifs) / sizeof(perifs[0]),
96-
perifs
97-
};
98-
99-
return &peripheral_list;
100-
}

targets/TARGET_NUVOTON/TARGET_M261/pinmap.c

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*
1+
/*
22
* Copyright (c) 2019-2020 Nuvoton Technology Corporation
33
* SPDX-License-Identifier: Apache-2.0
44
*
@@ -29,10 +29,10 @@ void pin_function(PinName pin, int data)
2929
MBED_ASSERT(pin != (PinName)NC);
3030
uint32_t pin_index = NU_PINNAME_TO_PIN(pin);
3131
uint32_t port_index = NU_PINNAME_TO_PORT(pin);
32-
32+
3333
__IO uint32_t *GPx_MFPx = ((__IO uint32_t *) &SYS->GPA_MFPL) + port_index * 2 + (pin_index / 8);
3434
uint32_t MFP_Msk = NU_MFP_MSK(pin_index);
35-
35+
3636
// E.g.: SYS->GPA_MFPL = (SYS->GPA_MFPL & (~SYS_GPA_MFPL_PA0MFP_Msk) ) | SYS_GPA_MFPL_PA0MFP_SC0_CD ;
3737
*GPx_MFPx = (*GPx_MFPx & (~MFP_Msk)) | data;
3838
}
@@ -46,7 +46,7 @@ void pin_mode(PinName pin, PinMode mode)
4646
uint32_t pin_index = NU_PINNAME_TO_PIN(pin);
4747
uint32_t port_index = NU_PINNAME_TO_PORT(pin);
4848
GPIO_T *gpio_base = NU_PORT_BASE(port_index);
49-
49+
5050
uint32_t mode_intern = GPIO_MODE_INPUT;
5151

5252
switch (mode) {
@@ -83,18 +83,3 @@ void pin_mode(PinName pin, PinMode mode)
8383
* 2. PushPullOutput/PIN_INPUT
8484
*/
8585
}
86-
87-
/* List of peripherals excluded from testing */
88-
const PeripheralList *pinmap_restricted_peripherals()
89-
{
90-
static const int perifs[] = {
91-
STDIO_UART // Dedicated to USB VCOM
92-
};
93-
94-
static const PeripheralList peripheral_list = {
95-
sizeof(perifs) / sizeof(perifs[0]),
96-
perifs
97-
};
98-
99-
return &peripheral_list;
100-
}

targets/TARGET_NUVOTON/TARGET_M451/pinmap.c

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ void pin_function(PinName pin, int data)
3131
__IO uint32_t *GPx_MFPx = ((__IO uint32_t *) &SYS->GPA_MFPL) + port_index * 2 + (pin_index / 8);
3232
//uint32_t MFP_Pos = NU_MFP_POS(pin_index);
3333
uint32_t MFP_Msk = NU_MFP_MSK(pin_index);
34-
34+
3535
// E.g.: SYS->GPA_MFPL = (SYS->GPA_MFPL & (~SYS_GPA_MFPL_PA0MFP_Msk) ) | SYS_GPA_MFPL_PA0MFP_SC0_CD ;
3636
*GPx_MFPx = (*GPx_MFPx & (~MFP_Msk)) | data;
37-
37+
3838
// [TODO] Disconnect JTAG-DP + SW-DP signals.
3939
// Warning: Need to reconnect under reset
4040
//if ((pin == PA_13) || (pin == PA_14)) {
@@ -54,7 +54,7 @@ void pin_mode(PinName pin, PinMode mode)
5454
uint32_t pin_index = NU_PINNAME_TO_PIN(pin);
5555
uint32_t port_index = NU_PINNAME_TO_PORT(pin);
5656
GPIO_T *gpio_base = NU_PORT_BASE(port_index);
57-
57+
5858
uint32_t mode_intern = GPIO_MODE_INPUT;
5959

6060
switch (mode) {
@@ -91,18 +91,3 @@ void pin_mode(PinName pin, PinMode mode)
9191
* 2. PushPullOutput/PIN_INPUT
9292
*/
9393
}
94-
95-
/* List of peripherals excluded from testing */
96-
const PeripheralList *pinmap_restricted_peripherals()
97-
{
98-
static const int perifs[] = {
99-
STDIO_UART // Dedicated to USB VCOM
100-
};
101-
102-
static const PeripheralList peripheral_list = {
103-
sizeof(perifs) / sizeof(perifs[0]),
104-
perifs
105-
};
106-
107-
return &peripheral_list;
108-
}

targets/TARGET_NUVOTON/TARGET_M480/pinmap.c

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -97,18 +97,3 @@ const PinList *pinmap_restricted_pins()
9797
};
9898
return &pin_list;
9999
}
100-
101-
/* List of peripherals excluded from testing */
102-
const PeripheralList *pinmap_restricted_peripherals()
103-
{
104-
static const int perifs[] = {
105-
STDIO_UART // Dedicated to USB VCOM
106-
};
107-
108-
static const PeripheralList peripheral_list = {
109-
sizeof(perifs) / sizeof(perifs[0]),
110-
perifs
111-
};
112-
113-
return &peripheral_list;
114-
}

targets/TARGET_NUVOTON/TARGET_NANO100/pinmap.c

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ void pin_function(PinName pin, int data)
3030
uint32_t port_index = NU_PINNAME_TO_PORT(pin);
3131
__IO uint32_t *Px_x_MFP = ((__IO uint32_t *) &SYS->PA_L_MFP) + port_index * 2 + (pin_index / 8);
3232
uint32_t MFP_Msk = NU_MFP_MSK(pin_index);
33-
33+
3434
// E.g.: SYS->PA_L_MFP = (SYS->PA_L_MFP & (~SYS_PA_L_MFP_PA0_MFP_Msk) ) | SYS_PA_L_MFP_PA0_MFP_SC0_CD ;
3535
*Px_x_MFP = (*Px_x_MFP & (~MFP_Msk)) | data;
3636
}
@@ -44,7 +44,7 @@ void pin_mode(PinName pin, PinMode mode)
4444
uint32_t pin_index = NU_PINNAME_TO_PIN(pin);
4545
uint32_t port_index = NU_PINNAME_TO_PORT(pin);
4646
GPIO_T *gpio_base = NU_PORT_BASE(port_index);
47-
47+
4848
uint32_t mode_intern;
4949

5050
switch (mode) {
@@ -59,7 +59,7 @@ void pin_mode(PinName pin, PinMode mode)
5959
case OpenDrain:
6060
mode_intern = GPIO_PMD_OPEN_DRAIN;
6161
break;
62-
62+
6363
default:
6464
/* H/W doesn't support separate configuration for input pull mode/direction.
6565
* We expect upper layer would have translated input pull mode/direction
@@ -77,18 +77,3 @@ void pin_mode(PinName pin, PinMode mode)
7777
* 2. PushPullOutput/PIN_INPUT
7878
*/
7979
}
80-
81-
/* List of peripherals excluded from testing */
82-
const PeripheralList *pinmap_restricted_peripherals()
83-
{
84-
static const int perifs[] = {
85-
STDIO_UART // Dedicated to USB VCOM
86-
};
87-
88-
static const PeripheralList peripheral_list = {
89-
sizeof(perifs) / sizeof(perifs[0]),
90-
perifs
91-
};
92-
93-
return &peripheral_list;
94-
}

targets/TARGET_NUVOTON/TARGET_NUC472/pinmap.c

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ void pin_function(PinName pin, int data)
3131
__IO uint32_t *GPx_MFPx = ((__IO uint32_t *) &SYS->GPA_MFPL) + port_index * 2 + (pin_index / 8);
3232
//uint32_t MFP_Pos = NU_MFP_POS(pin_index);
3333
uint32_t MFP_Msk = NU_MFP_MSK(pin_index);
34-
34+
3535
// E.g.: SYS->GPA_MFPL = (SYS->GPA_MFPL & (~SYS_GPA_MFPL_PA0MFP_Msk) ) | SYS_GPA_MFPL_PA0MFP_SC0_CD ;
3636
*GPx_MFPx = (*GPx_MFPx & (~MFP_Msk)) | data;
37-
37+
3838
// [TODO] Disconnect JTAG-DP + SW-DP signals.
3939
// Warning: Need to reconnect under reset
4040
//if ((pin == PA_13) || (pin == PA_14)) {
@@ -54,7 +54,7 @@ void pin_mode(PinName pin, PinMode mode)
5454
uint32_t pin_index = NU_PINNAME_TO_PIN(pin);
5555
uint32_t port_index = NU_PINNAME_TO_PORT(pin);
5656
GPIO_T *gpio_base = NU_PORT_BASE(port_index);
57-
57+
5858
uint32_t mode_intern;
5959

6060
switch (mode) {
@@ -91,18 +91,3 @@ void pin_mode(PinName pin, PinMode mode)
9191
* 2. PushPullOutput/PIN_INPUT
9292
*/
9393
}
94-
95-
/* List of peripherals excluded from testing */
96-
const PeripheralList *pinmap_restricted_peripherals()
97-
{
98-
static const int perifs[] = {
99-
STDIO_UART // Dedicated to USB VCOM
100-
};
101-
102-
static const PeripheralList peripheral_list = {
103-
sizeof(perifs) / sizeof(perifs[0]),
104-
perifs
105-
};
106-
107-
return &peripheral_list;
108-
}

0 commit comments

Comments
 (0)