hw_comp.h 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277
  1. //*****************************************************************************
  2. //
  3. // hw_comp.h - Macros used when accessing the comparator hardware.
  4. //
  5. // Copyright (c) 2005-2010 Texas Instruments Incorporated. All rights reserved.
  6. // Software License Agreement
  7. //
  8. // Texas Instruments (TI) is supplying this software for use solely and
  9. // exclusively on TI's microcontroller products. The software is owned by
  10. // TI and/or its suppliers, and is protected under applicable copyright
  11. // laws. You may not combine this software with "viral" open-source
  12. // software in order to form a larger program.
  13. //
  14. // THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS.
  15. // NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT
  16. // NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  17. // A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY
  18. // CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL
  19. // DAMAGES, FOR ANY REASON WHATSOEVER.
  20. //
  21. // This is part of revision 6459 of the Stellaris Firmware Development Package.
  22. //
  23. //*****************************************************************************
  24. #ifndef __HW_COMP_H__
  25. #define __HW_COMP_H__
  26. //*****************************************************************************
  27. //
  28. // The following are defines for the Comparator register offsets.
  29. //
  30. //*****************************************************************************
  31. #define COMP_O_ACMIS 0x00000000 // Analog Comparator Masked
  32. // Interrupt Status
  33. #define COMP_O_ACRIS 0x00000004 // Analog Comparator Raw Interrupt
  34. // Status
  35. #define COMP_O_ACINTEN 0x00000008 // Analog Comparator Interrupt
  36. // Enable
  37. #define COMP_O_ACREFCTL 0x00000010 // Analog Comparator Reference
  38. // Voltage Control
  39. #define COMP_O_ACSTAT0 0x00000020 // Analog Comparator Status 0
  40. #define COMP_O_ACCTL0 0x00000024 // Analog Comparator Control 0
  41. #define COMP_O_ACSTAT1 0x00000040 // Analog Comparator Status 1
  42. #define COMP_O_ACCTL1 0x00000044 // Analog Comparator Control 1
  43. #define COMP_O_ACSTAT2 0x00000060 // Analog Comparator Status 2
  44. #define COMP_O_ACCTL2 0x00000064 // Analog Comparator Control 2
  45. //*****************************************************************************
  46. //
  47. // The following are defines for the bit fields in the COMP_O_ACMIS register.
  48. //
  49. //*****************************************************************************
  50. #define COMP_ACMIS_IN2 0x00000004 // Comparator 2 Masked Interrupt
  51. // Status
  52. #define COMP_ACMIS_IN1 0x00000002 // Comparator 1 Masked Interrupt
  53. // Status
  54. #define COMP_ACMIS_IN0 0x00000001 // Comparator 0 Masked Interrupt
  55. // Status
  56. //*****************************************************************************
  57. //
  58. // The following are defines for the bit fields in the COMP_O_ACRIS register.
  59. //
  60. //*****************************************************************************
  61. #define COMP_ACRIS_IN2 0x00000004 // Comparator 2 Interrupt Status
  62. #define COMP_ACRIS_IN1 0x00000002 // Comparator 1 Interrupt Status
  63. #define COMP_ACRIS_IN0 0x00000001 // Comparator 0 Interrupt Status
  64. //*****************************************************************************
  65. //
  66. // The following are defines for the bit fields in the COMP_O_ACINTEN register.
  67. //
  68. //*****************************************************************************
  69. #define COMP_ACINTEN_IN2 0x00000004 // Comparator 2 Interrupt Enable
  70. #define COMP_ACINTEN_IN1 0x00000002 // Comparator 1 Interrupt Enable
  71. #define COMP_ACINTEN_IN0 0x00000001 // Comparator 0 Interrupt Enable
  72. //*****************************************************************************
  73. //
  74. // The following are defines for the bit fields in the COMP_O_ACREFCTL
  75. // register.
  76. //
  77. //*****************************************************************************
  78. #define COMP_ACREFCTL_EN 0x00000200 // Resistor Ladder Enable
  79. #define COMP_ACREFCTL_RNG 0x00000100 // Resistor Ladder Range
  80. #define COMP_ACREFCTL_VREF_M 0x0000000F // Resistor Ladder Voltage Ref
  81. #define COMP_ACREFCTL_VREF_S 0
  82. //*****************************************************************************
  83. //
  84. // The following are defines for the bit fields in the COMP_O_ACSTAT0 register.
  85. //
  86. //*****************************************************************************
  87. #define COMP_ACSTAT0_OVAL 0x00000002 // Comparator Output Value
  88. //*****************************************************************************
  89. //
  90. // The following are defines for the bit fields in the COMP_O_ACCTL0 register.
  91. //
  92. //*****************************************************************************
  93. #define COMP_ACCTL0_TOEN 0x00000800 // Trigger Output Enable
  94. #define COMP_ACCTL0_ASRCP_M 0x00000600 // Analog Source Positive
  95. #define COMP_ACCTL0_ASRCP_PIN 0x00000000 // Pin value of Cn+
  96. #define COMP_ACCTL0_ASRCP_PIN0 0x00000200 // Pin value of C0+
  97. #define COMP_ACCTL0_ASRCP_REF 0x00000400 // Internal voltage reference
  98. // (VIREF)
  99. #define COMP_ACCTL0_TSLVAL 0x00000080 // Trigger Sense Level Value
  100. #define COMP_ACCTL0_TSEN_M 0x00000060 // Trigger Sense
  101. #define COMP_ACCTL0_TSEN_LEVEL 0x00000000 // Level sense, see TSLVAL
  102. #define COMP_ACCTL0_TSEN_FALL 0x00000020 // Falling edge
  103. #define COMP_ACCTL0_TSEN_RISE 0x00000040 // Rising edge
  104. #define COMP_ACCTL0_TSEN_BOTH 0x00000060 // Either edge
  105. #define COMP_ACCTL0_ISLVAL 0x00000010 // Interrupt Sense Level Value
  106. #define COMP_ACCTL0_ISEN_M 0x0000000C // Interrupt Sense
  107. #define COMP_ACCTL0_ISEN_LEVEL 0x00000000 // Level sense, see ISLVAL
  108. #define COMP_ACCTL0_ISEN_FALL 0x00000004 // Falling edge
  109. #define COMP_ACCTL0_ISEN_RISE 0x00000008 // Rising edge
  110. #define COMP_ACCTL0_ISEN_BOTH 0x0000000C // Either edge
  111. #define COMP_ACCTL0_CINV 0x00000002 // Comparator Output Invert
  112. //*****************************************************************************
  113. //
  114. // The following are defines for the bit fields in the COMP_O_ACSTAT1 register.
  115. //
  116. //*****************************************************************************
  117. #define COMP_ACSTAT1_OVAL 0x00000002 // Comparator Output Value
  118. //*****************************************************************************
  119. //
  120. // The following are defines for the bit fields in the COMP_O_ACCTL1 register.
  121. //
  122. //*****************************************************************************
  123. #define COMP_ACCTL1_TOEN 0x00000800 // Trigger Output Enable
  124. #define COMP_ACCTL1_ASRCP_M 0x00000600 // Analog Source Positive
  125. #define COMP_ACCTL1_ASRCP_PIN 0x00000000 // Pin value of Cn+
  126. #define COMP_ACCTL1_ASRCP_PIN0 0x00000200 // Pin value of C0+
  127. #define COMP_ACCTL1_ASRCP_REF 0x00000400 // Internal voltage reference
  128. // (VIREF)
  129. #define COMP_ACCTL1_TSLVAL 0x00000080 // Trigger Sense Level Value
  130. #define COMP_ACCTL1_TSEN_M 0x00000060 // Trigger Sense
  131. #define COMP_ACCTL1_TSEN_LEVEL 0x00000000 // Level sense, see TSLVAL
  132. #define COMP_ACCTL1_TSEN_FALL 0x00000020 // Falling edge
  133. #define COMP_ACCTL1_TSEN_RISE 0x00000040 // Rising edge
  134. #define COMP_ACCTL1_TSEN_BOTH 0x00000060 // Either edge
  135. #define COMP_ACCTL1_ISLVAL 0x00000010 // Interrupt Sense Level Value
  136. #define COMP_ACCTL1_ISEN_M 0x0000000C // Interrupt Sense
  137. #define COMP_ACCTL1_ISEN_LEVEL 0x00000000 // Level sense, see ISLVAL
  138. #define COMP_ACCTL1_ISEN_FALL 0x00000004 // Falling edge
  139. #define COMP_ACCTL1_ISEN_RISE 0x00000008 // Rising edge
  140. #define COMP_ACCTL1_ISEN_BOTH 0x0000000C // Either edge
  141. #define COMP_ACCTL1_CINV 0x00000002 // Comparator Output Invert
  142. //*****************************************************************************
  143. //
  144. // The following are defines for the bit fields in the COMP_O_ACSTAT2 register.
  145. //
  146. //*****************************************************************************
  147. #define COMP_ACSTAT2_OVAL 0x00000002 // Comparator Output Value
  148. //*****************************************************************************
  149. //
  150. // The following are defines for the bit fields in the COMP_O_ACCTL2 register.
  151. //
  152. //*****************************************************************************
  153. #define COMP_ACCTL2_TOEN 0x00000800 // Trigger Output Enable
  154. #define COMP_ACCTL2_ASRCP_M 0x00000600 // Analog Source Positive
  155. #define COMP_ACCTL2_ASRCP_PIN 0x00000000 // Pin value of Cn+
  156. #define COMP_ACCTL2_ASRCP_PIN0 0x00000200 // Pin value of C0+
  157. #define COMP_ACCTL2_ASRCP_REF 0x00000400 // Internal voltage reference
  158. // (VIREF)
  159. #define COMP_ACCTL2_TSLVAL 0x00000080 // Trigger Sense Level Value
  160. #define COMP_ACCTL2_TSEN_M 0x00000060 // Trigger Sense
  161. #define COMP_ACCTL2_TSEN_LEVEL 0x00000000 // Level sense, see TSLVAL
  162. #define COMP_ACCTL2_TSEN_FALL 0x00000020 // Falling edge
  163. #define COMP_ACCTL2_TSEN_RISE 0x00000040 // Rising edge
  164. #define COMP_ACCTL2_TSEN_BOTH 0x00000060 // Either edge
  165. #define COMP_ACCTL2_ISLVAL 0x00000010 // Interrupt Sense Level Value
  166. #define COMP_ACCTL2_ISEN_M 0x0000000C // Interrupt Sense
  167. #define COMP_ACCTL2_ISEN_LEVEL 0x00000000 // Level sense, see ISLVAL
  168. #define COMP_ACCTL2_ISEN_FALL 0x00000004 // Falling edge
  169. #define COMP_ACCTL2_ISEN_RISE 0x00000008 // Rising edge
  170. #define COMP_ACCTL2_ISEN_BOTH 0x0000000C // Either edge
  171. #define COMP_ACCTL2_CINV 0x00000002 // Comparator Output Invert
  172. //*****************************************************************************
  173. //
  174. // The following definitions are deprecated.
  175. //
  176. //*****************************************************************************
  177. #ifndef DEPRECATED
  178. //*****************************************************************************
  179. //
  180. // The following are deprecated defines for the Comparator register offsets.
  181. //
  182. //*****************************************************************************
  183. #define COMP_O_MIS 0x00000000 // Interrupt status register
  184. #define COMP_O_RIS 0x00000004 // Raw interrupt status register
  185. #define COMP_O_INTEN 0x00000008 // Interrupt enable register
  186. #define COMP_O_REFCTL 0x00000010 // Reference voltage control reg
  187. //*****************************************************************************
  188. //
  189. // The following are deprecated defines for the bit fields in the COMP_O_REFCTL
  190. // register.
  191. //
  192. //*****************************************************************************
  193. #define COMP_REFCTL_EN 0x00000200 // Reference voltage enable
  194. #define COMP_REFCTL_RNG 0x00000100 // Reference voltage range
  195. #define COMP_REFCTL_VREF_MASK 0x0000000F // Reference voltage select mask
  196. #define COMP_REFCTL_VREF_SHIFT 0
  197. //*****************************************************************************
  198. //
  199. // The following are deprecated defines for the bit fields in the COMP_MIS,
  200. // COMP_RIS, and COMP_INTEN registers.
  201. //
  202. //*****************************************************************************
  203. #define COMP_INT_2 0x00000004 // Comp2 interrupt
  204. #define COMP_INT_1 0x00000002 // Comp1 interrupt
  205. #define COMP_INT_0 0x00000001 // Comp0 interrupt
  206. //*****************************************************************************
  207. //
  208. // The following are deprecated defines for the bit fields in the COMP_ACSTAT0,
  209. // COMP_ACSTAT1, and COMP_ACSTAT2 registers.
  210. //
  211. //*****************************************************************************
  212. #define COMP_ACSTAT_OVAL 0x00000002 // Comparator output value
  213. //*****************************************************************************
  214. //
  215. // The following are deprecated defines for the bit fields in the COMP_ACCTL0,
  216. // COMP_ACCTL1, and COMP_ACCTL2 registers.
  217. //
  218. //*****************************************************************************
  219. #define COMP_ACCTL_TMASK 0x00000800 // Trigger enable
  220. #define COMP_ACCTL_ASRCP_MASK 0x00000600 // Vin+ source select mask
  221. #define COMP_ACCTL_ASRCP_PIN 0x00000000 // Dedicated Comp+ pin
  222. #define COMP_ACCTL_ASRCP_PIN0 0x00000200 // Comp0+ pin
  223. #define COMP_ACCTL_ASRCP_REF 0x00000400 // Internal voltage reference
  224. #define COMP_ACCTL_ASRCP_RES 0x00000600 // Reserved
  225. #define COMP_ACCTL_OEN 0x00000100 // Comparator output enable
  226. #define COMP_ACCTL_TSVAL 0x00000080 // Trigger polarity select
  227. #define COMP_ACCTL_TSEN_MASK 0x00000060 // Trigger sense mask
  228. #define COMP_ACCTL_TSEN_LEVEL 0x00000000 // Trigger is level sense
  229. #define COMP_ACCTL_TSEN_FALL 0x00000020 // Trigger is falling edge
  230. #define COMP_ACCTL_TSEN_RISE 0x00000040 // Trigger is rising edge
  231. #define COMP_ACCTL_TSEN_BOTH 0x00000060 // Trigger is both edges
  232. #define COMP_ACCTL_ISLVAL 0x00000010 // Interrupt polarity select
  233. #define COMP_ACCTL_ISEN_MASK 0x0000000C // Interrupt sense mask
  234. #define COMP_ACCTL_ISEN_LEVEL 0x00000000 // Interrupt is level sense
  235. #define COMP_ACCTL_ISEN_FALL 0x00000004 // Interrupt is falling edge
  236. #define COMP_ACCTL_ISEN_RISE 0x00000008 // Interrupt is rising edge
  237. #define COMP_ACCTL_ISEN_BOTH 0x0000000C // Interrupt is both edges
  238. #define COMP_ACCTL_CINV 0x00000002 // Comparator output invert
  239. //*****************************************************************************
  240. //
  241. // The following are deprecated defines for the reset values for the comparator
  242. // registers.
  243. //
  244. //*****************************************************************************
  245. #define COMP_RV_ACCTL1 0x00000000 // Comp1 control register
  246. #define COMP_RV_ACSTAT2 0x00000000 // Comp2 status register
  247. #define COMP_RV_ACSTAT0 0x00000000 // Comp0 status register
  248. #define COMP_RV_RIS 0x00000000 // Raw interrupt status register
  249. #define COMP_RV_INTEN 0x00000000 // Interrupt enable register
  250. #define COMP_RV_ACCTL2 0x00000000 // Comp2 control register
  251. #define COMP_RV_MIS 0x00000000 // Interrupt status register
  252. #define COMP_RV_ACCTL0 0x00000000 // Comp0 control register
  253. #define COMP_RV_ACSTAT1 0x00000000 // Comp1 status register
  254. #define COMP_RV_REFCTL 0x00000000 // Reference voltage control reg
  255. #endif
  256. #endif // __HW_COMP_H__