|
| 1 | +/* generated pin source file - do not edit */ |
| 2 | +#include "bsp_api.h" |
| 3 | +#include "r_ioport.h" |
| 4 | + |
| 5 | + |
| 6 | +const ioport_pin_cfg_t g_bsp_pin_cfg_data[] = { |
| 7 | + { |
| 8 | + .pin = BSP_IO_PORT_01_PIN_07, |
| 9 | + .pin_cfg = ((uint32_t) IOPORT_CFG_PORT_DIRECTION_OUTPUT | (uint32_t) IOPORT_CFG_PORT_OUTPUT_LOW) |
| 10 | + }, |
| 11 | + { |
| 12 | + .pin = BSP_IO_PORT_01_PIN_08, |
| 13 | + .pin_cfg = ((uint32_t) IOPORT_CFG_PERIPHERAL_PIN | (uint32_t) IOPORT_PERIPHERAL_DEBUG) |
| 14 | + }, |
| 15 | + { |
| 16 | + .pin = BSP_IO_PORT_03_PIN_00, |
| 17 | + .pin_cfg = ((uint32_t) IOPORT_CFG_PERIPHERAL_PIN | (uint32_t) IOPORT_PERIPHERAL_DEBUG) |
| 18 | + }, |
| 19 | + { |
| 20 | + .pin = BSP_IO_PORT_04_PIN_07, |
| 21 | + .pin_cfg = ((uint32_t) IOPORT_CFG_PERIPHERAL_PIN | (uint32_t) IOPORT_PERIPHERAL_USB_FS) |
| 22 | + }, |
| 23 | + { |
| 24 | + .pin = BSP_IO_PORT_04_PIN_08, |
| 25 | + .pin_cfg = ((uint32_t) IOPORT_CFG_PORT_DIRECTION_INPUT | (uint32_t) IOPORT_CFG_PULLUP_ENABLE) |
| 26 | + }, |
| 27 | + { |
| 28 | + .pin = BSP_IO_PORT_11_PIN_01, |
| 29 | + .pin_cfg = ((uint32_t) IOPORT_CFG_PERIPHERAL_PIN | (uint32_t) IOPORT_PERIPHERAL_USB_HS) |
| 30 | + }, |
| 31 | +}; |
| 32 | + |
| 33 | +const ioport_cfg_t g_bsp_pin_cfg = { |
| 34 | + .number_of_pins = sizeof(g_bsp_pin_cfg_data)/sizeof(ioport_pin_cfg_t), |
| 35 | + .p_pin_cfg_data = &g_bsp_pin_cfg_data[0], |
| 36 | +}; |
| 37 | + |
| 38 | +#if BSP_TZ_SECURE_BUILD |
| 39 | + |
| 40 | +void R_BSP_PinCfgSecurityInit(void); |
| 41 | + |
| 42 | +/* Initialize SAR registers for secure pins. */ |
| 43 | +void R_BSP_PinCfgSecurityInit(void) |
| 44 | +{ |
| 45 | + #if (2U == BSP_FEATURE_IOPORT_VERSION) |
| 46 | + uint32_t pmsar[BSP_FEATURE_BSP_NUM_PMSAR]; |
| 47 | + #else |
| 48 | + uint16_t pmsar[BSP_FEATURE_BSP_NUM_PMSAR]; |
| 49 | + #endif |
| 50 | + memset(pmsar, 0xFF, BSP_FEATURE_BSP_NUM_PMSAR * sizeof(R_PMISC->PMSAR[0])); |
| 51 | + |
| 52 | + |
| 53 | + for(uint32_t i = 0; i < g_bsp_pin_cfg.number_of_pins; i++) |
| 54 | + { |
| 55 | + uint32_t port_pin = g_bsp_pin_cfg.p_pin_cfg_data[i].pin; |
| 56 | + uint32_t port = port_pin >> 8U; |
| 57 | + uint32_t pin = port_pin & 0xFFU; |
| 58 | + pmsar[port] &= (uint16_t) ~(1U << pin); |
| 59 | + } |
| 60 | + |
| 61 | + for(uint32_t i = 0; i < BSP_FEATURE_BSP_NUM_PMSAR; i++) |
| 62 | + { |
| 63 | + #if (2U == BSP_FEATURE_IOPORT_VERSION) |
| 64 | + R_PMISC->PMSAR[i].PMSAR = (uint16_t) pmsar[i]; |
| 65 | + #else |
| 66 | + R_PMISC->PMSAR[i].PMSAR = pmsar[i]; |
| 67 | + #endif |
| 68 | + } |
| 69 | + |
| 70 | +} |
| 71 | +#endif |
0 commit comments