system.c 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. #include <rtthread.h>
  2. #include "board.h"
  3. #include "gicv3.h"
  4. /* MCU1 interrupt numbers extracted from the original SDK configuration. */
  5. #define Os_IntChannel_PDMA0_Ch0Isr 213U
  6. #define Os_IntChannel_Pps_IcuRtcIsr 221U
  7. #define Os_IntChannel_Pps_IcuEthIsr 229U
  8. #define Os_IntChannel_Spi0_Isr 171U
  9. #define Os_IntChannel_Spi1_Isr 172U
  10. #define Os_IntChannel_Spi2_Isr 173U
  11. #define Os_IntChannel_Spi3_Isr 174U
  12. #define Os_IntChannel_Uart4_Isr 45U
  13. #define Os_IntChannel_Uart5_Isr 46U
  14. #define Os_IntChannel_Adc_Ch0WdIsr 48U
  15. #define Os_IntChannel_Adc_Ch1WdIsr 49U
  16. #define Os_IntChannel_Adc_Ch2WdIsr 50U
  17. #define Os_IntChannel_Adc_Ch3WdIsr 51U
  18. #define Os_IntChannel_Adc_Ch4WdIsr 52U
  19. #define Os_IntChannel_Adc_Ch5WdIsr 53U
  20. #define Os_IntChannel_Adc_Ch6WdIsr 54U
  21. #define Os_IntChannel_Adc_Ch7WdIsr 55U
  22. #define Os_IntChannel_Adc_Ch8WdIsr 56U
  23. #define Os_IntChannel_Adc_Ch9WdIsr 57U
  24. #define Os_IntChannel_Adc_Ch10WdIsr 58U
  25. #define Os_IntChannel_Adc_Ch11WdIsr 59U
  26. #define Os_IntChannel_Adc_Ch12WdIsr 60U
  27. #define Os_IntChannel_Adc_Ch13WdIsr 61U
  28. #define Os_IntChannel_Adc_InjIsr 62U
  29. #define Os_IntChannel_Adc_NorIsr 63U
  30. #define Os_IntChannel_I2c0_Isr 64U
  31. #define Os_IntChannel_I2c1_Isr 65U
  32. #define Os_IntChannel_I2c2_Isr 66U
  33. #define Os_IntChannel_I2c3_Isr 67U
  34. #define Os_IntChannel_Gpio_Icu0ExtIsr 68U
  35. #define Os_IntChannel_Gpio_Icu1ExtIsr 69U
  36. #define Os_IntChannel_Gpio_Icu2ExtIsr 70U
  37. #define Os_IntChannel_Mdma1_Ch1Isr 212U
  38. #define Os_IntChannel_Ipc_CpuIpc0Ch0Isr 254U
  39. #define Os_IntChannel_Ipc_CpuIpc0Ch4Isr 258U
  40. #define Os_IntChannel_Ipc_CpuIpc0Ch7Isr 261U
  41. #define Os_IntChannel_Ipc_CpuIpc0Ch10Isr 264U
  42. #define Os_Cross_Core_Ins0_Isr 237U
  43. #define Os_Cross_Core_Ins1_Isr 238U
  44. #define Os_Cross_Core_Ins2_Isr 239U
  45. #define Os_Cross_Core_Ins3_Isr 234U
  46. #define Os_Cross_Core_Ins4_Isr 235U
  47. #define Os_Cross_Core_Ins5_Isr 236U
  48. #define Os_IntChannel_Can5_DataIsr 136U
  49. #define Os_IntChannel_Can6_DataIsr 140U
  50. #define Os_IntChannel_Can7_DataIsr 144U
  51. #define Os_IntChannel_Can8_DataIsr 148U
  52. #define Os_IntChannel_Can9_DataIsr 152U
  53. /*
  54. * MCU1 interrupt whitelist extracted from the original SDK interrupt map.
  55. * The current BSP only manages these SPI IDs; everything else is treated as
  56. * out-of-scope to avoid colliding with resources still owned by MCU0.
  57. */
  58. const s100_rt_irq_config_t s100_mcu1_rt_irq_configs[] =
  59. {
  60. {Os_IntChannel_PDMA0_Ch0Isr, RT_TRUE, "PDMA0_Ch0"},
  61. {Os_IntChannel_Pps_IcuRtcIsr, RT_TRUE, "Pps_IcuRtc"},
  62. {Os_IntChannel_Pps_IcuEthIsr, RT_TRUE, "Pps_IcuEth"},
  63. {Os_IntChannel_Spi0_Isr, RT_TRUE, "Spi0"},
  64. {Os_IntChannel_Spi1_Isr, RT_TRUE, "Spi1"},
  65. {Os_IntChannel_Spi2_Isr, RT_TRUE, "Spi2"},
  66. {Os_IntChannel_Spi3_Isr, RT_TRUE, "Spi3"},
  67. {Os_IntChannel_Uart4_Isr, RT_TRUE, "Uart4"},
  68. {Os_IntChannel_Uart5_Isr, RT_TRUE, "Uart5"},
  69. {Os_IntChannel_Adc_Ch0WdIsr, RT_TRUE, "Adc_Ch0Wd"},
  70. {Os_IntChannel_Adc_Ch1WdIsr, RT_TRUE, "Adc_Ch1Wd"},
  71. {Os_IntChannel_Adc_Ch2WdIsr, RT_TRUE, "Adc_Ch2Wd"},
  72. {Os_IntChannel_Adc_Ch3WdIsr, RT_TRUE, "Adc_Ch3Wd"},
  73. {Os_IntChannel_Adc_Ch4WdIsr, RT_TRUE, "Adc_Ch4Wd"},
  74. {Os_IntChannel_Adc_Ch5WdIsr, RT_TRUE, "Adc_Ch5Wd"},
  75. {Os_IntChannel_Adc_Ch6WdIsr, RT_TRUE, "Adc_Ch6Wd"},
  76. {Os_IntChannel_Adc_Ch7WdIsr, RT_TRUE, "Adc_Ch7Wd"},
  77. {Os_IntChannel_Adc_Ch8WdIsr, RT_TRUE, "Adc_Ch8Wd"},
  78. {Os_IntChannel_Adc_Ch9WdIsr, RT_TRUE, "Adc_Ch9Wd"},
  79. {Os_IntChannel_Adc_Ch10WdIsr, RT_TRUE, "Adc_Ch10Wd"},
  80. {Os_IntChannel_Adc_Ch11WdIsr, RT_TRUE, "Adc_Ch11Wd"},
  81. {Os_IntChannel_Adc_Ch12WdIsr, RT_TRUE, "Adc_Ch12Wd"},
  82. {Os_IntChannel_Adc_Ch13WdIsr, RT_TRUE, "Adc_Ch13Wd"},
  83. {Os_IntChannel_Adc_InjIsr, RT_TRUE, "Adc_Inj"},
  84. {Os_IntChannel_Adc_NorIsr, RT_TRUE, "Adc_Nor"},
  85. {Os_IntChannel_I2c0_Isr, RT_TRUE, "I2c0"},
  86. {Os_IntChannel_I2c1_Isr, RT_TRUE, "I2c1"},
  87. {Os_IntChannel_I2c2_Isr, RT_TRUE, "I2c2"},
  88. {Os_IntChannel_I2c3_Isr, RT_TRUE, "I2c3"},
  89. {Os_IntChannel_Gpio_Icu0ExtIsr, RT_TRUE, "Gpio_Icu0Ext"},
  90. {Os_IntChannel_Gpio_Icu1ExtIsr, RT_TRUE, "Gpio_Icu1Ext"},
  91. {Os_IntChannel_Gpio_Icu2ExtIsr, RT_TRUE, "Gpio_Icu2Ext"},
  92. {Os_IntChannel_Mdma1_Ch1Isr, RT_TRUE, "Mdma1_Ch1"},
  93. {Os_IntChannel_Ipc_CpuIpc0Ch0Isr, RT_TRUE, "Ipc_CpuIpc0Ch0"},
  94. {Os_IntChannel_Ipc_CpuIpc0Ch4Isr, RT_TRUE, "Ipc_CpuIpc0Ch4"},
  95. {Os_IntChannel_Ipc_CpuIpc0Ch7Isr, RT_TRUE, "Ipc_CpuIpc0Ch7"},
  96. {Os_IntChannel_Ipc_CpuIpc0Ch10Isr, RT_TRUE, "Ipc_CpuIpc0Ch10"},
  97. {Os_Cross_Core_Ins0_Isr, RT_TRUE, "Cross_Core_Ins0"},
  98. {Os_Cross_Core_Ins1_Isr, RT_TRUE, "Cross_Core_Ins1"},
  99. {Os_Cross_Core_Ins2_Isr, RT_TRUE, "Cross_Core_Ins2"},
  100. {Os_Cross_Core_Ins3_Isr, RT_TRUE, "Cross_Core_Ins3"},
  101. {Os_Cross_Core_Ins4_Isr, RT_TRUE, "Cross_Core_Ins4"},
  102. {Os_Cross_Core_Ins5_Isr, RT_TRUE, "Cross_Core_Ins5"},
  103. {Os_IntChannel_Can5_DataIsr, RT_TRUE, "Can5_Data"},
  104. {Os_IntChannel_Can6_DataIsr, RT_TRUE, "Can6_Data"},
  105. {Os_IntChannel_Can7_DataIsr, RT_TRUE, "Can7_Data"},
  106. {Os_IntChannel_Can8_DataIsr, RT_TRUE, "Can8_Data"},
  107. {Os_IntChannel_Can9_DataIsr, RT_TRUE, "Can9_Data"},
  108. };
  109. const rt_size_t s100_mcu1_rt_irq_configs_count =
  110. sizeof(s100_mcu1_rt_irq_configs) / sizeof(s100_mcu1_rt_irq_configs[0]);
  111. rt_bool_t s100_board_irq_is_supported(int irq)
  112. {
  113. rt_size_t i;
  114. if ((irq >= 0) && (irq < 32))
  115. {
  116. return RT_TRUE;
  117. }
  118. for (i = 0; i < s100_mcu1_rt_irq_configs_count; i++)
  119. {
  120. if (s100_mcu1_rt_irq_configs[i].irq_number == irq)
  121. {
  122. return RT_TRUE;
  123. }
  124. }
  125. return RT_FALSE;
  126. }