hw_comp.h 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291
  1. //*****************************************************************************
  2. //
  3. // hw_comp.h - Macros used when accessing the comparator hardware.
  4. //
  5. // Copyright (c) 2005-2011 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 8264 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. #define COMP_O_PP 0x00000FC0 // Analog Comparator Peripheral
  46. // Properties
  47. //*****************************************************************************
  48. //
  49. // The following are defines for the bit fields in the COMP_O_ACMIS register.
  50. //
  51. //*****************************************************************************
  52. #define COMP_ACMIS_IN2 0x00000004 // Comparator 2 Masked Interrupt
  53. // Status
  54. #define COMP_ACMIS_IN1 0x00000002 // Comparator 1 Masked Interrupt
  55. // Status
  56. #define COMP_ACMIS_IN0 0x00000001 // Comparator 0 Masked Interrupt
  57. // Status
  58. //*****************************************************************************
  59. //
  60. // The following are defines for the bit fields in the COMP_O_ACRIS register.
  61. //
  62. //*****************************************************************************
  63. #define COMP_ACRIS_IN2 0x00000004 // Comparator 2 Interrupt Status
  64. #define COMP_ACRIS_IN1 0x00000002 // Comparator 1 Interrupt Status
  65. #define COMP_ACRIS_IN0 0x00000001 // Comparator 0 Interrupt Status
  66. //*****************************************************************************
  67. //
  68. // The following are defines for the bit fields in the COMP_O_ACINTEN register.
  69. //
  70. //*****************************************************************************
  71. #define COMP_ACINTEN_IN2 0x00000004 // Comparator 2 Interrupt Enable
  72. #define COMP_ACINTEN_IN1 0x00000002 // Comparator 1 Interrupt Enable
  73. #define COMP_ACINTEN_IN0 0x00000001 // Comparator 0 Interrupt Enable
  74. //*****************************************************************************
  75. //
  76. // The following are defines for the bit fields in the COMP_O_ACREFCTL
  77. // register.
  78. //
  79. //*****************************************************************************
  80. #define COMP_ACREFCTL_EN 0x00000200 // Resistor Ladder Enable
  81. #define COMP_ACREFCTL_RNG 0x00000100 // Resistor Ladder Range
  82. #define COMP_ACREFCTL_VREF_M 0x0000000F // Resistor Ladder Voltage Ref
  83. #define COMP_ACREFCTL_VREF_S 0
  84. //*****************************************************************************
  85. //
  86. // The following are defines for the bit fields in the COMP_O_ACSTAT0 register.
  87. //
  88. //*****************************************************************************
  89. #define COMP_ACSTAT0_OVAL 0x00000002 // Comparator Output Value
  90. //*****************************************************************************
  91. //
  92. // The following are defines for the bit fields in the COMP_O_ACCTL0 register.
  93. //
  94. //*****************************************************************************
  95. #define COMP_ACCTL0_TOEN 0x00000800 // Trigger Output Enable
  96. #define COMP_ACCTL0_ASRCP_M 0x00000600 // Analog Source Positive
  97. #define COMP_ACCTL0_ASRCP_PIN 0x00000000 // Pin value of Cn+
  98. #define COMP_ACCTL0_ASRCP_PIN0 0x00000200 // Pin value of C0+
  99. #define COMP_ACCTL0_ASRCP_REF 0x00000400 // Internal voltage reference
  100. // (VIREF)
  101. #define COMP_ACCTL0_TSLVAL 0x00000080 // Trigger Sense Level Value
  102. #define COMP_ACCTL0_TSEN_M 0x00000060 // Trigger Sense
  103. #define COMP_ACCTL0_TSEN_LEVEL 0x00000000 // Level sense, see TSLVAL
  104. #define COMP_ACCTL0_TSEN_FALL 0x00000020 // Falling edge
  105. #define COMP_ACCTL0_TSEN_RISE 0x00000040 // Rising edge
  106. #define COMP_ACCTL0_TSEN_BOTH 0x00000060 // Either edge
  107. #define COMP_ACCTL0_ISLVAL 0x00000010 // Interrupt Sense Level Value
  108. #define COMP_ACCTL0_ISEN_M 0x0000000C // Interrupt Sense
  109. #define COMP_ACCTL0_ISEN_LEVEL 0x00000000 // Level sense, see ISLVAL
  110. #define COMP_ACCTL0_ISEN_FALL 0x00000004 // Falling edge
  111. #define COMP_ACCTL0_ISEN_RISE 0x00000008 // Rising edge
  112. #define COMP_ACCTL0_ISEN_BOTH 0x0000000C // Either edge
  113. #define COMP_ACCTL0_CINV 0x00000002 // Comparator Output Invert
  114. //*****************************************************************************
  115. //
  116. // The following are defines for the bit fields in the COMP_O_ACSTAT1 register.
  117. //
  118. //*****************************************************************************
  119. #define COMP_ACSTAT1_OVAL 0x00000002 // Comparator Output Value
  120. //*****************************************************************************
  121. //
  122. // The following are defines for the bit fields in the COMP_O_ACCTL1 register.
  123. //
  124. //*****************************************************************************
  125. #define COMP_ACCTL1_TOEN 0x00000800 // Trigger Output Enable
  126. #define COMP_ACCTL1_ASRCP_M 0x00000600 // Analog Source Positive
  127. #define COMP_ACCTL1_ASRCP_PIN 0x00000000 // Pin value of Cn+
  128. #define COMP_ACCTL1_ASRCP_PIN0 0x00000200 // Pin value of C0+
  129. #define COMP_ACCTL1_ASRCP_REF 0x00000400 // Internal voltage reference
  130. // (VIREF)
  131. #define COMP_ACCTL1_TSLVAL 0x00000080 // Trigger Sense Level Value
  132. #define COMP_ACCTL1_TSEN_M 0x00000060 // Trigger Sense
  133. #define COMP_ACCTL1_TSEN_LEVEL 0x00000000 // Level sense, see TSLVAL
  134. #define COMP_ACCTL1_TSEN_FALL 0x00000020 // Falling edge
  135. #define COMP_ACCTL1_TSEN_RISE 0x00000040 // Rising edge
  136. #define COMP_ACCTL1_TSEN_BOTH 0x00000060 // Either edge
  137. #define COMP_ACCTL1_ISLVAL 0x00000010 // Interrupt Sense Level Value
  138. #define COMP_ACCTL1_ISEN_M 0x0000000C // Interrupt Sense
  139. #define COMP_ACCTL1_ISEN_LEVEL 0x00000000 // Level sense, see ISLVAL
  140. #define COMP_ACCTL1_ISEN_FALL 0x00000004 // Falling edge
  141. #define COMP_ACCTL1_ISEN_RISE 0x00000008 // Rising edge
  142. #define COMP_ACCTL1_ISEN_BOTH 0x0000000C // Either edge
  143. #define COMP_ACCTL1_CINV 0x00000002 // Comparator Output Invert
  144. //*****************************************************************************
  145. //
  146. // The following are defines for the bit fields in the COMP_O_ACSTAT2 register.
  147. //
  148. //*****************************************************************************
  149. #define COMP_ACSTAT2_OVAL 0x00000002 // Comparator Output Value
  150. //*****************************************************************************
  151. //
  152. // The following are defines for the bit fields in the COMP_O_ACCTL2 register.
  153. //
  154. //*****************************************************************************
  155. #define COMP_ACCTL2_TOEN 0x00000800 // Trigger Output Enable
  156. #define COMP_ACCTL2_ASRCP_M 0x00000600 // Analog Source Positive
  157. #define COMP_ACCTL2_ASRCP_PIN 0x00000000 // Pin value of Cn+
  158. #define COMP_ACCTL2_ASRCP_PIN0 0x00000200 // Pin value of C0+
  159. #define COMP_ACCTL2_ASRCP_REF 0x00000400 // Internal voltage reference
  160. // (VIREF)
  161. #define COMP_ACCTL2_TSLVAL 0x00000080 // Trigger Sense Level Value
  162. #define COMP_ACCTL2_TSEN_M 0x00000060 // Trigger Sense
  163. #define COMP_ACCTL2_TSEN_LEVEL 0x00000000 // Level sense, see TSLVAL
  164. #define COMP_ACCTL2_TSEN_FALL 0x00000020 // Falling edge
  165. #define COMP_ACCTL2_TSEN_RISE 0x00000040 // Rising edge
  166. #define COMP_ACCTL2_TSEN_BOTH 0x00000060 // Either edge
  167. #define COMP_ACCTL2_ISLVAL 0x00000010 // Interrupt Sense Level Value
  168. #define COMP_ACCTL2_ISEN_M 0x0000000C // Interrupt Sense
  169. #define COMP_ACCTL2_ISEN_LEVEL 0x00000000 // Level sense, see ISLVAL
  170. #define COMP_ACCTL2_ISEN_FALL 0x00000004 // Falling edge
  171. #define COMP_ACCTL2_ISEN_RISE 0x00000008 // Rising edge
  172. #define COMP_ACCTL2_ISEN_BOTH 0x0000000C // Either edge
  173. #define COMP_ACCTL2_CINV 0x00000002 // Comparator Output Invert
  174. //*****************************************************************************
  175. //
  176. // The following are defines for the bit fields in the COMP_O_PP register.
  177. //
  178. //*****************************************************************************
  179. #define COMP_PP_C2O 0x00040000 // Comparator Output 2 Present
  180. #define COMP_PP_C1O 0x00020000 // Comparator Output 1 Present
  181. #define COMP_PP_C0O 0x00010000 // Comparator Output 0 Present
  182. #define COMP_PP_CMP2 0x00000004 // Comparator 2 Present
  183. #define COMP_PP_CMP1 0x00000002 // Comparator 1 Present
  184. #define COMP_PP_CMP0 0x00000001 // Comparator 0 Present
  185. //*****************************************************************************
  186. //
  187. // The following definitions are deprecated.
  188. //
  189. //*****************************************************************************
  190. #ifndef DEPRECATED
  191. //*****************************************************************************
  192. //
  193. // The following are deprecated defines for the Comparator register offsets.
  194. //
  195. //*****************************************************************************
  196. #define COMP_O_MIS 0x00000000 // Interrupt status register
  197. #define COMP_O_RIS 0x00000004 // Raw interrupt status register
  198. #define COMP_O_INTEN 0x00000008 // Interrupt enable register
  199. #define COMP_O_REFCTL 0x00000010 // Reference voltage control reg
  200. //*****************************************************************************
  201. //
  202. // The following are deprecated defines for the bit fields in the COMP_O_REFCTL
  203. // register.
  204. //
  205. //*****************************************************************************
  206. #define COMP_REFCTL_EN 0x00000200 // Reference voltage enable
  207. #define COMP_REFCTL_RNG 0x00000100 // Reference voltage range
  208. #define COMP_REFCTL_VREF_MASK 0x0000000F // Reference voltage select mask
  209. #define COMP_REFCTL_VREF_SHIFT 0
  210. //*****************************************************************************
  211. //
  212. // The following are deprecated defines for the bit fields in the COMP_MIS,
  213. // COMP_RIS, and COMP_INTEN registers.
  214. //
  215. //*****************************************************************************
  216. #define COMP_INT_2 0x00000004 // Comp2 interrupt
  217. #define COMP_INT_1 0x00000002 // Comp1 interrupt
  218. #define COMP_INT_0 0x00000001 // Comp0 interrupt
  219. //*****************************************************************************
  220. //
  221. // The following are deprecated defines for the bit fields in the COMP_ACSTAT0,
  222. // COMP_ACSTAT1, and COMP_ACSTAT2 registers.
  223. //
  224. //*****************************************************************************
  225. #define COMP_ACSTAT_OVAL 0x00000002 // Comparator output value
  226. //*****************************************************************************
  227. //
  228. // The following are deprecated defines for the bit fields in the COMP_ACCTL0,
  229. // COMP_ACCTL1, and COMP_ACCTL2 registers.
  230. //
  231. //*****************************************************************************
  232. #define COMP_ACCTL_TMASK 0x00000800 // Trigger enable
  233. #define COMP_ACCTL_ASRCP_MASK 0x00000600 // Vin+ source select mask
  234. #define COMP_ACCTL_ASRCP_PIN 0x00000000 // Dedicated Comp+ pin
  235. #define COMP_ACCTL_ASRCP_PIN0 0x00000200 // Comp0+ pin
  236. #define COMP_ACCTL_ASRCP_REF 0x00000400 // Internal voltage reference
  237. #define COMP_ACCTL_ASRCP_RES 0x00000600 // Reserved
  238. #define COMP_ACCTL_OEN 0x00000100 // Comparator output enable
  239. #define COMP_ACCTL_TSVAL 0x00000080 // Trigger polarity select
  240. #define COMP_ACCTL_TSEN_MASK 0x00000060 // Trigger sense mask
  241. #define COMP_ACCTL_TSEN_LEVEL 0x00000000 // Trigger is level sense
  242. #define COMP_ACCTL_TSEN_FALL 0x00000020 // Trigger is falling edge
  243. #define COMP_ACCTL_TSEN_RISE 0x00000040 // Trigger is rising edge
  244. #define COMP_ACCTL_TSEN_BOTH 0x00000060 // Trigger is both edges
  245. #define COMP_ACCTL_ISLVAL 0x00000010 // Interrupt polarity select
  246. #define COMP_ACCTL_ISEN_MASK 0x0000000C // Interrupt sense mask
  247. #define COMP_ACCTL_ISEN_LEVEL 0x00000000 // Interrupt is level sense
  248. #define COMP_ACCTL_ISEN_FALL 0x00000004 // Interrupt is falling edge
  249. #define COMP_ACCTL_ISEN_RISE 0x00000008 // Interrupt is rising edge
  250. #define COMP_ACCTL_ISEN_BOTH 0x0000000C // Interrupt is both edges
  251. #define COMP_ACCTL_CINV 0x00000002 // Comparator output invert
  252. //*****************************************************************************
  253. //
  254. // The following are deprecated defines for the reset values for the comparator
  255. // registers.
  256. //
  257. //*****************************************************************************
  258. #define COMP_RV_ACCTL1 0x00000000 // Comp1 control register
  259. #define COMP_RV_ACSTAT2 0x00000000 // Comp2 status register
  260. #define COMP_RV_ACSTAT0 0x00000000 // Comp0 status register
  261. #define COMP_RV_RIS 0x00000000 // Raw interrupt status register
  262. #define COMP_RV_INTEN 0x00000000 // Interrupt enable register
  263. #define COMP_RV_ACCTL2 0x00000000 // Comp2 control register
  264. #define COMP_RV_MIS 0x00000000 // Interrupt status register
  265. #define COMP_RV_ACCTL0 0x00000000 // Comp0 control register
  266. #define COMP_RV_ACSTAT1 0x00000000 // Comp1 status register
  267. #define COMP_RV_REFCTL 0x00000000 // Reference voltage control reg
  268. #endif
  269. #endif // __HW_COMP_H__