gic_registers.h 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. /*
  2. * Copyright (c) 2012, Freescale Semiconductor, Inc.
  3. * All rights reserved.
  4. *
  5. * Redistribution and use in source and binary forms, with or without modification,
  6. * are permitted provided that the following conditions are met:
  7. *
  8. * o Redistributions of source code must retain the above copyright notice, this list
  9. * of conditions and the following disclaimer.
  10. *
  11. * o Redistributions in binary form must reproduce the above copyright notice, this
  12. * list of conditions and the following disclaimer in the documentation and/or
  13. * other materials provided with the distribution.
  14. *
  15. * o Neither the name of Freescale Semiconductor, Inc. nor the names of its
  16. * contributors may be used to endorse or promote products derived from this
  17. * software without specific prior written permission.
  18. *
  19. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
  20. * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  21. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  22. * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
  23. * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  24. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  25. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
  26. * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  27. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  28. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  29. */
  30. #include "sdk_types.h"
  31. ////////////////////////////////////////////////////////////////////////////////
  32. // Definitions
  33. ////////////////////////////////////////////////////////////////////////////////
  34. //! @brief Offsets to the GIC registers.
  35. enum _gic_base_offsets
  36. {
  37. kGICDBaseOffset = 0x1000, //!< GIC distributor offset.
  38. #if defined(CHIP_MX6UL)
  39. kGICCBaseOffset = 0x2000 //!< GIC CPU interface offset.
  40. #else
  41. kGICCBaseOffset = 0x100 //!< GIC CPU interface offset.
  42. #endif
  43. };
  44. //! @brief GIC distributor registers.
  45. //!
  46. //! Uses the GICv2 register names, but does not include GICv2 registers.
  47. //!
  48. //! The IPRIORITYRn and ITARGETSRn registers are byte accessible, so their types are uint8_t
  49. //! instead of uint32_t to reflect this. These members are indexed directly with the interrupt
  50. //! number.
  51. struct _gicd_registers
  52. {
  53. uint32_t CTLR; //!< Distributor Control Register.
  54. uint32_t TYPER; //!< Interrupt Controller Type Register.
  55. uint32_t IIDR; //!< Distributor Implementer Identification Register.
  56. uint32_t _reserved0[29];
  57. uint32_t IGROUPRn[8]; //!< Interrupt Group Registers.
  58. uint32_t _reserved1[24];
  59. uint32_t ISENABLERn[32]; //!< Interrupt Set-Enable Registers.
  60. uint32_t ICENABLERn[32]; //!< Interrupt Clear-Enable Registers.
  61. uint32_t ISPENDRn[32]; //!< Interrupt Set-Pending Registers.
  62. uint32_t ICPENDRn[32]; //!< Interrupt Clear-Pending Registers.
  63. uint32_t ICDABRn[32]; //!< Active Bit Registers.
  64. uint32_t _reserved2[32];
  65. uint8_t IPRIORITYRn[255 * sizeof(uint32_t)]; //!< Interrupt Priority Registers. (Byte accessible)
  66. uint32_t _reserved3;
  67. uint8_t ITARGETSRn[255 * sizeof(uint32_t)]; //!< Interrupt Processor Targets Registers. (Byte accessible)
  68. uint32_t _reserved4;
  69. uint32_t ICFGRn[64]; //!< Interrupt Configuration Registers.
  70. uint32_t _reserved5[128];
  71. uint32_t SGIR; //!< Software Generated Interrupt Register
  72. };
  73. //! @brief Bitfields constants for the GICD_CTLR register.
  74. enum _gicd_ctlr_fields
  75. {
  76. kBM_GICD_CTLR_EnableGrp1 = (1 << 1),
  77. kBM_GICD_CTLR_EnableGrp0 = (1 << 0)
  78. };
  79. //! @brief Bitfields constants for the GICD_SGIR register.
  80. enum _gicd_sgir_fields
  81. {
  82. kBP_GICD_SGIR_TargetListFilter = 24,
  83. kBM_GICD_SGIR_TargetListFilter = (0x3 << kBP_GICD_SGIR_TargetListFilter),
  84. kBP_GICD_SGIR_CPUTargetList = 16,
  85. kBM_GICD_SGIR_CPUTargetList = (0xff << kBP_GICD_SGIR_CPUTargetList),
  86. kBP_GICD_SGIR_NSATT = 15,
  87. kBM_GICD_SGIR_NSATT = (1 << kBP_GICD_SGIR_NSATT),
  88. kBP_GICD_SGIR_SGIINTID = 0,
  89. kBM_GICD_SGIR_SGIINTID = 0xf
  90. };
  91. //! @brief GIC CPU interface registers.
  92. //!
  93. //! Uses the GICv2 register names. Does not include GICv2 registers.
  94. struct _gicc_registers
  95. {
  96. uint32_t CTLR; //!< CPU Interface Control Register.
  97. uint32_t PMR; //!< Interrupt Priority Mask Register.
  98. uint32_t BPR; //!< Binary Point Register.
  99. uint32_t IAR; //!< Interrupt Acknowledge Register.
  100. uint32_t EOIR; //!< End of Interrupt Register.
  101. uint32_t RPR; //!< Running Priority Register.
  102. uint32_t HPPIR; //!< Highest Priority Pending Interrupt Register.
  103. uint32_t ABPR; //!< Aliased Binary Point Register. (only visible with a secure access)
  104. uint32_t _reserved[56];
  105. uint32_t IIDR; //!< CPU Interface Identification Register.
  106. };
  107. //! @brief Bitfields constants for the GICC_CTLR register.
  108. enum _gicc_ctlr_fields
  109. {
  110. kBP_GICC_CTLR_EnableS = 0,
  111. kBM_GICC_CTLR_EnableS = (1 << 0),
  112. kBP_GICC_CTLR_EnableNS = 1,
  113. kBM_GICC_CTLR_EnableNS = (1 << 1),
  114. kBP_GICC_CTLR_AckCtl = 2,
  115. kBM_GICC_CTLR_AckCtl = (1 << 2),
  116. kBP_GICC_CTLR_FIQEn = 3,
  117. kBM_GICC_CTLR_FIQEn = (1 << 3),
  118. kBP_GICC_CTLR_SBPR = 4,
  119. kBM_GICC_CTLR_SBPR = (1 << 4)
  120. };
  121. //! @brier Type for the GIC distributor registers.
  122. typedef volatile struct _gicd_registers gicd_t;
  123. //! @brier Type for the GIC CPU interface registers.
  124. typedef volatile struct _gicc_registers gicc_t;
  125. ////////////////////////////////////////////////////////////////////////////////
  126. // EOF
  127. ////////////////////////////////////////////////////////////////////////////////