pin_data.c 2.2 KB

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