pin_data.c 2.6 KB

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