hw_comp.h 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277
  1. //*****************************************************************************
  2. //
  3. // hw_comp.h - Macros used when accessing the comparator hardware.
  4. //
  5. // Copyright (c) 2005-2009 Luminary Micro, Inc. All rights reserved.
  6. // Software License Agreement
  7. //
  8. // Luminary Micro, Inc. (LMI) is supplying this software for use solely and
  9. // exclusively on LMI's microcontroller products.
  10. //
  11. // The software is owned by LMI and/or its suppliers, and is protected under
  12. // applicable copyright laws. All rights are reserved. You may not combine
  13. // this software with "viral" open-source software in order to form a larger
  14. // program. Any use in violation of the foregoing restrictions may subject
  15. // the user to criminal sanctions under applicable laws, as well as to civil
  16. // liability for the breach of the terms and conditions of this license.
  17. //
  18. // THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED
  19. // OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
  20. // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
  21. // LMI SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
  22. // CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
  23. //
  24. // This is part of revision 4694 of the Stellaris Firmware Development Package.
  25. //
  26. //*****************************************************************************
  27. #ifndef __HW_COMP_H__
  28. #define __HW_COMP_H__
  29. //*****************************************************************************
  30. //
  31. // The following are defines for the comparator register offsets.
  32. //
  33. //*****************************************************************************
  34. #define COMP_O_ACMIS 0x00000000 // Analog Comparator Masked
  35. // Interrupt Status
  36. #define COMP_O_ACRIS 0x00000004 // Analog Comparator Raw Interrupt
  37. // Status
  38. #define COMP_O_ACINTEN 0x00000008 // Analog Comparator Interrupt
  39. // Enable
  40. #define COMP_O_ACREFCTL 0x00000010 // Analog Comparator Reference
  41. // Voltage Control
  42. #define COMP_O_ACSTAT0 0x00000020 // Comp0 status register
  43. #define COMP_O_ACCTL0 0x00000024 // Comp0 control register
  44. #define COMP_O_ACSTAT1 0x00000040 // Comp1 status register
  45. #define COMP_O_ACCTL1 0x00000044 // Comp1 control register
  46. #define COMP_O_ACSTAT2 0x00000060 // Comp2 status register
  47. #define COMP_O_ACCTL2 0x00000064 // Comp2 control register
  48. //*****************************************************************************
  49. //
  50. // The following are defines for the bit fields in the COMP_O_ACMIS register.
  51. //
  52. //*****************************************************************************
  53. #define COMP_ACMIS_IN2 0x00000004 // Comparator 2 Masked Interrupt
  54. // Status.
  55. #define COMP_ACMIS_IN1 0x00000002 // Comparator 1 Masked Interrupt
  56. // Status.
  57. #define COMP_ACMIS_IN0 0x00000001 // Comparator 0 Masked Interrupt
  58. // Status.
  59. //*****************************************************************************
  60. //
  61. // The following are defines for the bit fields in the COMP_O_ACRIS register.
  62. //
  63. //*****************************************************************************
  64. #define COMP_ACRIS_IN2 0x00000004 // Comparator 2 Interrupt Status.
  65. #define COMP_ACRIS_IN1 0x00000002 // Comparator 1 Interrupt Status.
  66. #define COMP_ACRIS_IN0 0x00000001 // Comparator 0 Interrupt Status.
  67. //*****************************************************************************
  68. //
  69. // The following are defines for the bit fields in the COMP_O_ACINTEN register.
  70. //
  71. //*****************************************************************************
  72. #define COMP_ACINTEN_IN2 0x00000004 // Comparator 2 Interrupt Enable.
  73. #define COMP_ACINTEN_IN1 0x00000002 // Comparator 1 Interrupt Enable.
  74. #define COMP_ACINTEN_IN0 0x00000001 // Comparator 0 Interrupt Enable.
  75. //*****************************************************************************
  76. //
  77. // The following are defines for the bit fields in the COMP_O_ACREFCTL
  78. // register.
  79. //
  80. //*****************************************************************************
  81. #define COMP_ACREFCTL_EN 0x00000200 // Resistor Ladder Enable.
  82. #define COMP_ACREFCTL_RNG 0x00000100 // Resistor Ladder Range.
  83. #define COMP_ACREFCTL_VREF_M 0x0000000F // Resistor Ladder Voltage Ref.
  84. #define COMP_ACREFCTL_VREF_S 0
  85. //*****************************************************************************
  86. //
  87. // The following are defines for the bit fields in the COMP_O_ACSTAT0 register.
  88. //
  89. //*****************************************************************************
  90. #define COMP_ACSTAT0_OVAL 0x00000002 // Comparator Output Value.
  91. //*****************************************************************************
  92. //
  93. // The following are defines for the bit fields in the COMP_O_ACCTL0 register.
  94. //
  95. //*****************************************************************************
  96. #define COMP_ACCTL0_TOEN 0x00000800 // Trigger Output Enable.
  97. #define COMP_ACCTL0_ASRCP_M 0x00000600 // Analog Source Positive.
  98. #define COMP_ACCTL0_ASRCP_PIN 0x00000000 // Pin value
  99. #define COMP_ACCTL0_ASRCP_PIN0 0x00000200 // Pin value of C0+
  100. #define COMP_ACCTL0_ASRCP_REF 0x00000400 // Internal voltage reference
  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
  128. #define COMP_ACCTL1_ASRCP_PIN0 0x00000200 // Pin value of C0+
  129. #define COMP_ACCTL1_ASRCP_REF 0x00000400 // Internal voltage reference
  130. #define COMP_ACCTL1_TSLVAL 0x00000080 // Trigger Sense Level Value.
  131. #define COMP_ACCTL1_TSEN_M 0x00000060 // Trigger Sense.
  132. #define COMP_ACCTL1_TSEN_LEVEL 0x00000000 // Level sense, see TSLVAL
  133. #define COMP_ACCTL1_TSEN_FALL 0x00000020 // Falling edge
  134. #define COMP_ACCTL1_TSEN_RISE 0x00000040 // Rising edge
  135. #define COMP_ACCTL1_TSEN_BOTH 0x00000060 // Either edge
  136. #define COMP_ACCTL1_ISLVAL 0x00000010 // Interrupt Sense Level Value.
  137. #define COMP_ACCTL1_ISEN_M 0x0000000C // Interrupt Sense.
  138. #define COMP_ACCTL1_ISEN_LEVEL 0x00000000 // Level sense, see ISLVAL
  139. #define COMP_ACCTL1_ISEN_FALL 0x00000004 // Falling edge
  140. #define COMP_ACCTL1_ISEN_RISE 0x00000008 // Rising edge
  141. #define COMP_ACCTL1_ISEN_BOTH 0x0000000C // Either edge
  142. #define COMP_ACCTL1_CINV 0x00000002 // Comparator Output Invert.
  143. //*****************************************************************************
  144. //
  145. // The following are defines for the bit fields in the COMP_O_ACSTAT2 register.
  146. //
  147. //*****************************************************************************
  148. #define COMP_ACSTAT2_OVAL 0x00000002 // Comparator Output Value.
  149. //*****************************************************************************
  150. //
  151. // The following are defines for the bit fields in the COMP_O_ACCTL2 register.
  152. //
  153. //*****************************************************************************
  154. #define COMP_ACCTL2_TOEN 0x00000800 // Trigger Output Enable.
  155. #define COMP_ACCTL2_ASRCP_M 0x00000600 // Analog Source Positive.
  156. #define COMP_ACCTL2_ASRCP_PIN 0x00000000 // Pin value
  157. #define COMP_ACCTL2_ASRCP_PIN0 0x00000200 // Pin value of C0+
  158. #define COMP_ACCTL2_ASRCP_REF 0x00000400 // Internal voltage reference
  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_MIS,
  190. // COMP_RIS, and COMP_INTEN registers.
  191. //
  192. //*****************************************************************************
  193. #define COMP_INT_2 0x00000004 // Comp2 interrupt
  194. #define COMP_INT_1 0x00000002 // Comp1 interrupt
  195. #define COMP_INT_0 0x00000001 // Comp0 interrupt
  196. //*****************************************************************************
  197. //
  198. // The following are deprecated defines for the bit fields in the COMP_REFCTL
  199. // register.
  200. //
  201. //*****************************************************************************
  202. #define COMP_REFCTL_EN 0x00000200 // Reference voltage enable
  203. #define COMP_REFCTL_RNG 0x00000100 // Reference voltage range
  204. #define COMP_REFCTL_VREF_MASK 0x0000000F // Reference voltage select mask
  205. #define COMP_REFCTL_VREF_SHIFT 0
  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__