1
0

hw_gpio.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  1. //*****************************************************************************
  2. //
  3. // hw_gpio.h - Defines and Macros for GPIO hardware.
  4. //
  5. // Copyright (c) 2005-2014 Texas Instruments Incorporated. All rights reserved.
  6. // Software License Agreement
  7. //
  8. // Redistribution and use in source and binary forms, with or without
  9. // modification, are permitted provided that the following conditions
  10. // are met:
  11. //
  12. // Redistributions of source code must retain the above copyright
  13. // notice, this list of conditions and the following disclaimer.
  14. //
  15. // Redistributions in binary form must reproduce the above copyright
  16. // notice, this list of conditions and the following disclaimer in the
  17. // documentation and/or other materials provided with the
  18. // distribution.
  19. //
  20. // Neither the name of Texas Instruments Incorporated nor the names of
  21. // its contributors may be used to endorse or promote products derived
  22. // from this software without specific prior written permission.
  23. //
  24. // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  25. // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  26. // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  27. // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  28. // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  29. // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  30. // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  31. // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  32. // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  33. // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  34. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  35. //
  36. // This is part of revision 2.1.0.12573 of the Tiva Firmware Development Package.
  37. //
  38. //*****************************************************************************
  39. #ifndef __HW_GPIO_H__
  40. #define __HW_GPIO_H__
  41. //*****************************************************************************
  42. //
  43. // The following are defines for the GPIO register offsets.
  44. //
  45. //*****************************************************************************
  46. #define GPIO_O_DATA 0x00000000 // GPIO Data
  47. #define GPIO_O_DIR 0x00000400 // GPIO Direction
  48. #define GPIO_O_IS 0x00000404 // GPIO Interrupt Sense
  49. #define GPIO_O_IBE 0x00000408 // GPIO Interrupt Both Edges
  50. #define GPIO_O_IEV 0x0000040C // GPIO Interrupt Event
  51. #define GPIO_O_IM 0x00000410 // GPIO Interrupt Mask
  52. #define GPIO_O_RIS 0x00000414 // GPIO Raw Interrupt Status
  53. #define GPIO_O_MIS 0x00000418 // GPIO Masked Interrupt Status
  54. #define GPIO_O_ICR 0x0000041C // GPIO Interrupt Clear
  55. #define GPIO_O_AFSEL 0x00000420 // GPIO Alternate Function Select
  56. #define GPIO_O_DR2R 0x00000500 // GPIO 2-mA Drive Select
  57. #define GPIO_O_DR4R 0x00000504 // GPIO 4-mA Drive Select
  58. #define GPIO_O_DR8R 0x00000508 // GPIO 8-mA Drive Select
  59. #define GPIO_O_ODR 0x0000050C // GPIO Open Drain Select
  60. #define GPIO_O_PUR 0x00000510 // GPIO Pull-Up Select
  61. #define GPIO_O_PDR 0x00000514 // GPIO Pull-Down Select
  62. #define GPIO_O_SLR 0x00000518 // GPIO Slew Rate Control Select
  63. #define GPIO_O_DEN 0x0000051C // GPIO Digital Enable
  64. #define GPIO_O_LOCK 0x00000520 // GPIO Lock
  65. #define GPIO_O_CR 0x00000524 // GPIO Commit
  66. #define GPIO_O_AMSEL 0x00000528 // GPIO Analog Mode Select
  67. #define GPIO_O_PCTL 0x0000052C // GPIO Port Control
  68. #define GPIO_O_ADCCTL 0x00000530 // GPIO ADC Control
  69. #define GPIO_O_DMACTL 0x00000534 // GPIO DMA Control
  70. #define GPIO_O_SI 0x00000538 // GPIO Select Interrupt
  71. #define GPIO_O_DR12R 0x0000053C // GPIO 12-mA Drive Select
  72. #define GPIO_O_WAKEPEN 0x00000540 // GPIO Wake Pin Enable
  73. #define GPIO_O_WAKELVL 0x00000544 // GPIO Wake Level
  74. #define GPIO_O_WAKESTAT 0x00000548 // GPIO Wake Status
  75. #define GPIO_O_PP 0x00000FC0 // GPIO Peripheral Property
  76. #define GPIO_O_PC 0x00000FC4 // GPIO Peripheral Configuration
  77. //*****************************************************************************
  78. //
  79. // The following are defines for the bit fields in the GPIO_O_IM register.
  80. //
  81. //*****************************************************************************
  82. #define GPIO_IM_DMAIME 0x00000100 // GPIO uDMA Done Interrupt Mask
  83. // Enable
  84. #define GPIO_IM_GPIO_M 0x000000FF // GPIO Interrupt Mask Enable
  85. #define GPIO_IM_GPIO_S 0
  86. //*****************************************************************************
  87. //
  88. // The following are defines for the bit fields in the GPIO_O_RIS register.
  89. //
  90. //*****************************************************************************
  91. #define GPIO_RIS_DMARIS 0x00000100 // GPIO uDMA Done Interrupt Raw
  92. // Status
  93. #define GPIO_RIS_GPIO_M 0x000000FF // GPIO Interrupt Raw Status
  94. #define GPIO_RIS_GPIO_S 0
  95. //*****************************************************************************
  96. //
  97. // The following are defines for the bit fields in the GPIO_O_MIS register.
  98. //
  99. //*****************************************************************************
  100. #define GPIO_MIS_DMAMIS 0x00000100 // GPIO uDMA Done Masked Interrupt
  101. // Status
  102. #define GPIO_MIS_GPIO_M 0x000000FF // GPIO Masked Interrupt Status
  103. #define GPIO_MIS_GPIO_S 0
  104. //*****************************************************************************
  105. //
  106. // The following are defines for the bit fields in the GPIO_O_ICR register.
  107. //
  108. //*****************************************************************************
  109. #define GPIO_ICR_DMAIC 0x00000100 // GPIO uDMA Interrupt Clear
  110. #define GPIO_ICR_GPIO_M 0x000000FF // GPIO Interrupt Clear
  111. #define GPIO_ICR_GPIO_S 0
  112. //*****************************************************************************
  113. //
  114. // The following are defines for the bit fields in the GPIO_O_LOCK register.
  115. //
  116. //*****************************************************************************
  117. #define GPIO_LOCK_M 0xFFFFFFFF // GPIO Lock
  118. #define GPIO_LOCK_UNLOCKED 0x00000000 // The GPIOCR register is unlocked
  119. // and may be modified
  120. #define GPIO_LOCK_LOCKED 0x00000001 // The GPIOCR register is locked
  121. // and may not be modified
  122. #define GPIO_LOCK_KEY 0x4C4F434B // Unlocks the GPIO_CR register
  123. //*****************************************************************************
  124. //
  125. // The following are defines for the bit fields in the GPIO_O_SI register.
  126. //
  127. //*****************************************************************************
  128. #define GPIO_SI_SUM 0x00000001 // Summary Interrupt
  129. //*****************************************************************************
  130. //
  131. // The following are defines for the bit fields in the GPIO_O_DR12R register.
  132. //
  133. //*****************************************************************************
  134. #define GPIO_DR12R_DRV12_M 0x000000FF // Output Pad 12-mA Drive Enable
  135. #define GPIO_DR12R_DRV12_12MA 0x00000001 // The corresponding GPIO pin has
  136. // 12-mA drive. This encoding is
  137. // only valid if the GPIOPP EDE bit
  138. // is set and the appropriate
  139. // GPIOPC EDM bit field is
  140. // programmed to 0x3
  141. //*****************************************************************************
  142. //
  143. // The following are defines for the bit fields in the GPIO_O_WAKEPEN register.
  144. //
  145. //*****************************************************************************
  146. #define GPIO_WAKEPEN_WAKEP4 0x00000010 // P[4] Wake Enable
  147. //*****************************************************************************
  148. //
  149. // The following are defines for the bit fields in the GPIO_O_WAKELVL register.
  150. //
  151. //*****************************************************************************
  152. #define GPIO_WAKELVL_WAKELVL4 0x00000010 // P[4] Wake Level
  153. //*****************************************************************************
  154. //
  155. // The following are defines for the bit fields in the GPIO_O_WAKESTAT
  156. // register.
  157. //
  158. //*****************************************************************************
  159. #define GPIO_WAKESTAT_STAT4 0x00000010 // P[4] Wake Status
  160. //*****************************************************************************
  161. //
  162. // The following are defines for the bit fields in the GPIO_O_PP register.
  163. //
  164. //*****************************************************************************
  165. #define GPIO_PP_EDE 0x00000001 // Extended Drive Enable
  166. //*****************************************************************************
  167. //
  168. // The following are defines for the bit fields in the GPIO_O_PC register.
  169. //
  170. //*****************************************************************************
  171. #define GPIO_PC_EDM7_M 0x0000C000 // Extended Drive Mode Bit 7
  172. #define GPIO_PC_EDM6_M 0x00003000 // Extended Drive Mode Bit 6
  173. #define GPIO_PC_EDM5_M 0x00000C00 // Extended Drive Mode Bit 5
  174. #define GPIO_PC_EDM4_M 0x00000300 // Extended Drive Mode Bit 4
  175. #define GPIO_PC_EDM3_M 0x000000C0 // Extended Drive Mode Bit 3
  176. #define GPIO_PC_EDM2_M 0x00000030 // Extended Drive Mode Bit 2
  177. #define GPIO_PC_EDM1_M 0x0000000C // Extended Drive Mode Bit 1
  178. #define GPIO_PC_EDM0_M 0x00000003 // Extended Drive Mode Bit 0
  179. #define GPIO_PC_EDM0_DISABLE 0x00000000 // Drive values of 2, 4 and 8 mA
  180. // are maintained. GPIO n Drive
  181. // Select (GPIODRnR) registers
  182. // function as normal
  183. #define GPIO_PC_EDM0_6MA 0x00000001 // An additional 6 mA option is
  184. // provided
  185. #define GPIO_PC_EDM0_PLUS2MA 0x00000003 // A 2 mA driver is always enabled;
  186. // setting the corresponding
  187. // GPIODR4R register bit adds 2 mA
  188. // and setting the corresponding
  189. // GPIODR8R of GPIODR12R register
  190. // bit adds an additional 4 mA
  191. #define GPIO_PC_EDM7_S 14
  192. #define GPIO_PC_EDM6_S 12
  193. #define GPIO_PC_EDM5_S 10
  194. #define GPIO_PC_EDM4_S 8
  195. #define GPIO_PC_EDM3_S 6
  196. #define GPIO_PC_EDM2_S 4
  197. #define GPIO_PC_EDM1_S 2
  198. #endif // __HW_GPIO_H__