sama_aic.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. /*
  2. ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. */
  13. /**
  14. * @file SAMA5D2x/aic.h
  15. * @brief SAMA AIC support macros and structures.
  16. *
  17. * @addtogroup SAMA5D2x_AIC
  18. * @{
  19. */
  20. #ifndef AIC_H
  21. #define AIC_H
  22. /*===========================================================================*/
  23. /* Driver constants. */
  24. /*===========================================================================*/
  25. /**
  26. * @name INTERRUPT SOURCE TYPE mode macros
  27. * @{
  28. */
  29. /**
  30. * @brief High-level sensitive for internal source.
  31. * Low-level sensitive for external source.
  32. */
  33. #define INT_LEVEL_SENSITIVE 0x0U
  34. /**
  35. * @brief Negative-edge triggered for external source.
  36. */
  37. #define EXT_NEGATIVE_EDGE 0x1U
  38. /**
  39. * @brief High-level sensitive for internal source.
  40. * High-level sensitive for external source.
  41. */
  42. #define EXT_HIGH_LEVEL 0x2U
  43. /**
  44. * @brief Positive-edge triggered for external source.
  45. */
  46. #define EXT_POSITIVE_EDGE 0x3U
  47. /** @} */
  48. /**
  49. * @brief AIC unique redirect key.
  50. */
  51. #define AIC_REDIR_KEY 0x5B6C0E26U
  52. /*===========================================================================*/
  53. /* Driver pre-compile time settings. */
  54. /*===========================================================================*/
  55. /*===========================================================================*/
  56. /* Derived constants and error checks. */
  57. /*===========================================================================*/
  58. /*===========================================================================*/
  59. /* Driver data structures and types. */
  60. /*===========================================================================*/
  61. /*===========================================================================*/
  62. /* Driver macros. */
  63. /*===========================================================================*/
  64. /**
  65. * @brief Acknowledge the current interrupt.
  66. */
  67. #if SAMA_HAL_IS_SECURE
  68. #define aicAckInt() { \
  69. SAIC->AIC_EOICR = AIC_EOICR_ENDIT; \
  70. }
  71. #else
  72. #define aicAckInt() { \
  73. AIC->AIC_EOICR = AIC_EOICR_ENDIT; \
  74. }
  75. #endif
  76. /*===========================================================================*/
  77. /* External declarations. */
  78. /*===========================================================================*/
  79. #ifdef __cplusplus
  80. extern "C" {
  81. #endif
  82. void aicInit(void);
  83. void aicSetSourcePriority(uint32_t source, uint8_t priority);
  84. void aicSetIntSourceType(uint32_t source, uint8_t type);
  85. void aicSetSourceHandler(uint32_t source, bool (*handler)(void));
  86. void aicSetSpuriousHandler(bool (*handler)(void));
  87. void aicEnableInt(uint32_t source);
  88. void aicDisableInt(uint32_t source);
  89. void aicClearInt(uint32_t source);
  90. void aicSetInt(uint32_t source);
  91. #ifdef __cplusplus
  92. }
  93. #endif
  94. #endif /* AIC_H */
  95. /** @} */