interrupt.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. /*
  2. * File : interrupt.h
  3. * This file is part of RT-Thread RTOS
  4. * COPYRIGHT (C) 2017, RT-Thread Development Team
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License along
  17. * with this program; if not, write to the Free Software Foundation, Inc.,
  18. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  19. *
  20. * Change Logs:
  21. * Date Author Notes
  22. * 2018-02-08 RT-Thread the first version
  23. */
  24. #ifndef __INTERRUPT_H__
  25. #define __INTERRUPT_H__
  26. /* Max number of interruptions */
  27. #define INTERRUPTS_MAX (64)
  28. /* a group num */
  29. #define GROUP_NUM (32)
  30. /* Interrupt Source */
  31. #define NMI_INTERRUPT (0)
  32. #define UART0_INTERRUPT (1)
  33. #define UART1_INTERRUPT (2)
  34. #define UART2_INTERRUPT (3)
  35. #define OWA_INTERRUPT (5)
  36. #define CIR_INTERRUPT (6)
  37. #define TWI0_INTERRUPT (7)
  38. #define TWI1_INTERRUPT (8)
  39. #define TWI2_INTERRUPT (9)
  40. #define SPI0_INTERRUPT (10)
  41. #define SPI1_INTERRUPT (11)
  42. #define TIMER0_INTERRUPT (13)
  43. #define TIMER1_INTERRUPT (14)
  44. #define TIMER2_INTERRUPT (15)
  45. #define WATCHDOG_INTERRUPT (16)
  46. #define RSB_INTERRUPT (17)
  47. #define DMA_INTERRUPT (18)
  48. #define TOUCHPANEL_INTERRUPT (20)
  49. #define AUDIOCODEC_INTERRUPT (21)
  50. #define KEYADC_INTERRUPT (22)
  51. #define SDC0_INTERRUPT (23)
  52. #define SDC1_INTERRUPT (24)
  53. #define USB_OTG_INTERRUPT (26)
  54. #define TVD_INTERRUPT (27)
  55. #define TVE_INTERRUPT (28)
  56. #define TCON_INTERRUPT (29)
  57. #define DE_FE_INTERRUPT (30)
  58. #define DE_BE_INTERRUPT (31)
  59. #define CSI_INTERRUPT (32)
  60. #define DE_INTERLACER_INTERRUPT (33)
  61. #define VE_INTERRUPT (34)
  62. #define DAUDIO_INTERRUPT (35)
  63. #define PIOD_INTERRUPT (38)
  64. #define PIOE_INTERRUPT (39)
  65. #define PIOF_INTERRUPT (40)
  66. /* intc register address */
  67. #define INTC_BASE_ADDR (0x01C20400)
  68. struct tina_intc
  69. {
  70. volatile rt_uint32_t vector_reg; /* 0x00 */
  71. volatile rt_uint32_t base_addr_reg; /* 0x04 */
  72. volatile rt_uint32_t reserved0;
  73. volatile rt_uint32_t nmi_ctrl_reg; /* 0x0C */
  74. volatile rt_uint32_t pend_reg0; /* 0x10 */
  75. volatile rt_uint32_t pend_reg1; /* 0x14 */
  76. volatile rt_uint32_t reserved1[2];
  77. volatile rt_uint32_t en_reg0; /* 0x20 */
  78. volatile rt_uint32_t en_reg1; /* 0x24 */
  79. volatile rt_uint32_t reserved2[2];
  80. volatile rt_uint32_t mask_reg0; /* 0x30 */
  81. volatile rt_uint32_t mask_reg1; /* 0x34 */
  82. volatile rt_uint32_t reserved3[2];
  83. volatile rt_uint32_t resp_reg0; /* 0x40 */
  84. volatile rt_uint32_t resp_reg1; /* 0x44 */
  85. volatile rt_uint32_t reserved4[2];
  86. volatile rt_uint32_t ff_reg0; /* 0x50 */
  87. volatile rt_uint32_t ff_reg1; /* 0x54 */
  88. volatile rt_uint32_t reserved5[2];
  89. volatile rt_uint32_t prio_reg0; /* 0x60 */
  90. volatile rt_uint32_t prio_reg1; /* 0x64 */
  91. volatile rt_uint32_t prio_reg2; /* 0x68 */
  92. volatile rt_uint32_t prio_reg3; /* 0x6C */
  93. } ;
  94. typedef struct tina_intc *tina_intc_t;
  95. #define INTC ((tina_intc_t)INTC_BASE_ADDR)
  96. void rt_hw_interrupt_init(void);
  97. void rt_hw_interrupt_mask(int vector);
  98. void rt_hw_interrupt_umask(int vector);
  99. rt_isr_handler_t rt_hw_interrupt_install(int vector, rt_isr_handler_t handler, void *param, char *name);
  100. #endif /* __INTERRUPT_H__ */