isr.c 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. /*
  2. * Copyright (C) 2017 C-SKY Microsystems Co., Ltd. All rights reserved.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. /******************************************************************************
  17. * @file isr.c
  18. * @brief source file for the interrupt server route
  19. * @version V1.0
  20. * @date 02. June 2017
  21. ******************************************************************************/
  22. #include <drv_common.h>
  23. #include "config.h"
  24. #include "soc.h"
  25. extern void dw_usart_irqhandler(int32_t idx);
  26. extern void dw_timer_irqhandler(int32_t idx);
  27. extern void dw_gpio_irqhandler(int32_t idx);
  28. extern void dw_iic_irqhandler(int32_t idx);
  29. extern void ck_rtc_irqhandler(int32_t idx);
  30. extern void dw_spi_irqhandler(int32_t idx);
  31. extern void dw_wdt_irqhandler(int32_t idx);
  32. extern void ck_dma_irqhandler(int32_t idx);
  33. extern void ck_aes_irqhandler(int32_t idx);
  34. extern void ck_sha_irqhandler(int32_t idx);
  35. #ifdef CONFIG_KERNEL_FREERTOS
  36. extern void CKTimer1Isr(void);
  37. extern void CKPendSVIsr(void);
  38. #endif
  39. #define readl(addr) \
  40. ({ unsigned int __v = (*(volatile unsigned int *) (addr)); __v; })
  41. __attribute__((isr)) void CORET_IRQHandler(void)
  42. {
  43. readl(0xE000E010);
  44. }
  45. #if defined(CONFIG_USART)
  46. /*
  47. __attribute__((isr)) void USART0_IRQHandler(void)
  48. {
  49. dw_usart_irqhandler(0);
  50. }
  51. __attribute__((isr)) void USART1_IRQHandler(void)
  52. {
  53. dw_usart_irqhandler(1);
  54. }
  55. __attribute__((isr)) void USART2_IRQHandler(void)
  56. {
  57. dw_usart_irqhandler(2);
  58. }
  59. __attribute__((isr)) void USART3_IRQHandler(void)
  60. {
  61. dw_usart_irqhandler(3);
  62. }
  63. */
  64. #endif
  65. #if defined(CONFIG_TIMER)
  66. __attribute__((isr)) void TIMA0_IRQHandler(void)
  67. {
  68. dw_timer_irqhandler(0);
  69. }
  70. __attribute__((isr)) void TIMA1_IRQHandler(void)
  71. {
  72. dw_timer_irqhandler(1);
  73. }
  74. __attribute__((isr)) void TIMB0_IRQHandler(void)
  75. {
  76. dw_timer_irqhandler(2);
  77. }
  78. __attribute__((isr)) void TIMB1_IRQHandler(void)
  79. {
  80. dw_timer_irqhandler(3);
  81. }
  82. #endif
  83. #if defined(CONFIG_GPIO)
  84. __attribute__((isr)) void GPIOA_IRQHandler(void)
  85. {
  86. dw_gpio_irqhandler(0);
  87. }
  88. __attribute__((isr)) void GPIOB_IRQHandler(void)
  89. {
  90. dw_gpio_irqhandler(1);
  91. }
  92. #endif
  93. #if defined(CONFIG_IIC)
  94. __attribute__((isr)) void I2C0_IRQHandler(void)
  95. {
  96. dw_iic_irqhandler(0);
  97. }
  98. __attribute__((isr)) void I2C1_IRQHandler(void)
  99. {
  100. dw_iic_irqhandler(1);
  101. }
  102. #endif
  103. #if defined(CONFIG_RTC)
  104. __attribute__((isr)) void RTC_IRQHandler(void)
  105. {
  106. ck_rtc_irqhandler(0);
  107. }
  108. #endif
  109. #if defined(CONFIG_AES)
  110. __attribute__((isr)) void AES_IRQHandler(void)
  111. {
  112. ck_aes_irqhandler(0);
  113. }
  114. #endif
  115. #if defined(CONFIG_SHA)
  116. __attribute__((isr)) void SHA_IRQHandler(void)
  117. {
  118. ck_sha_irqhandler(0);
  119. }
  120. #endif
  121. #if defined(CONFIG_SPI) && defined(CONFIG_GPIO)
  122. __attribute__((isr)) void SPI0_IRQHandler(void)
  123. {
  124. dw_spi_irqhandler(0);
  125. }
  126. __attribute__((isr)) void SPI1_IRQHandler(void)
  127. {
  128. dw_spi_irqhandler(1);
  129. }
  130. #endif
  131. #if defined(CONFIG_WDT)
  132. __attribute__((isr)) void WDT_IRQHandler(void)
  133. {
  134. dw_wdt_irqhandler(0);
  135. }
  136. #endif
  137. #if defined(CONFIG_DMAC)
  138. __attribute__((isr)) void DMAC_IRQHandler(void)
  139. {
  140. ck_dma_irqhandler(0);
  141. }
  142. #endif