hw_comp.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. //*****************************************************************************
  2. //
  3. // hw_comp.h - Macros used when accessing the comparator 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_COMP_H__
  40. #define __HW_COMP_H__
  41. //*****************************************************************************
  42. //
  43. // The following are defines for the Comparator register offsets.
  44. //
  45. //*****************************************************************************
  46. #define COMP_O_ACMIS 0x00000000 // Analog Comparator Masked
  47. // Interrupt Status
  48. #define COMP_O_ACRIS 0x00000004 // Analog Comparator Raw Interrupt
  49. // Status
  50. #define COMP_O_ACINTEN 0x00000008 // Analog Comparator Interrupt
  51. // Enable
  52. #define COMP_O_ACREFCTL 0x00000010 // Analog Comparator Reference
  53. // Voltage Control
  54. #define COMP_O_ACSTAT0 0x00000020 // Analog Comparator Status 0
  55. #define COMP_O_ACCTL0 0x00000024 // Analog Comparator Control 0
  56. #define COMP_O_ACSTAT1 0x00000040 // Analog Comparator Status 1
  57. #define COMP_O_ACCTL1 0x00000044 // Analog Comparator Control 1
  58. #define COMP_O_ACSTAT2 0x00000060 // Analog Comparator Status 2
  59. #define COMP_O_ACCTL2 0x00000064 // Analog Comparator Control 2
  60. #define COMP_O_PP 0x00000FC0 // Analog Comparator Peripheral
  61. // Properties
  62. //*****************************************************************************
  63. //
  64. // The following are defines for the bit fields in the COMP_O_ACMIS register.
  65. //
  66. //*****************************************************************************
  67. #define COMP_ACMIS_IN2 0x00000004 // Comparator 2 Masked Interrupt
  68. // Status
  69. #define COMP_ACMIS_IN1 0x00000002 // Comparator 1 Masked Interrupt
  70. // Status
  71. #define COMP_ACMIS_IN0 0x00000001 // Comparator 0 Masked Interrupt
  72. // Status
  73. //*****************************************************************************
  74. //
  75. // The following are defines for the bit fields in the COMP_O_ACRIS register.
  76. //
  77. //*****************************************************************************
  78. #define COMP_ACRIS_IN2 0x00000004 // Comparator 2 Interrupt Status
  79. #define COMP_ACRIS_IN1 0x00000002 // Comparator 1 Interrupt Status
  80. #define COMP_ACRIS_IN0 0x00000001 // Comparator 0 Interrupt Status
  81. //*****************************************************************************
  82. //
  83. // The following are defines for the bit fields in the COMP_O_ACINTEN register.
  84. //
  85. //*****************************************************************************
  86. #define COMP_ACINTEN_IN2 0x00000004 // Comparator 2 Interrupt Enable
  87. #define COMP_ACINTEN_IN1 0x00000002 // Comparator 1 Interrupt Enable
  88. #define COMP_ACINTEN_IN0 0x00000001 // Comparator 0 Interrupt Enable
  89. //*****************************************************************************
  90. //
  91. // The following are defines for the bit fields in the COMP_O_ACREFCTL
  92. // register.
  93. //
  94. //*****************************************************************************
  95. #define COMP_ACREFCTL_EN 0x00000200 // Resistor Ladder Enable
  96. #define COMP_ACREFCTL_RNG 0x00000100 // Resistor Ladder Range
  97. #define COMP_ACREFCTL_VREF_M 0x0000000F // Resistor Ladder Voltage Ref
  98. #define COMP_ACREFCTL_VREF_S 0
  99. //*****************************************************************************
  100. //
  101. // The following are defines for the bit fields in the COMP_O_ACSTAT0 register.
  102. //
  103. //*****************************************************************************
  104. #define COMP_ACSTAT0_OVAL 0x00000002 // Comparator Output Value
  105. //*****************************************************************************
  106. //
  107. // The following are defines for the bit fields in the COMP_O_ACCTL0 register.
  108. //
  109. //*****************************************************************************
  110. #define COMP_ACCTL0_TOEN 0x00000800 // Trigger Output Enable
  111. #define COMP_ACCTL0_ASRCP_M 0x00000600 // Analog Source Positive
  112. #define COMP_ACCTL0_ASRCP_PIN 0x00000000 // Pin value of Cn+
  113. #define COMP_ACCTL0_ASRCP_PIN0 0x00000200 // Pin value of C0+
  114. #define COMP_ACCTL0_ASRCP_REF 0x00000400 // Internal voltage reference
  115. #define COMP_ACCTL0_TSLVAL 0x00000080 // Trigger Sense Level Value
  116. #define COMP_ACCTL0_TSEN_M 0x00000060 // Trigger Sense
  117. #define COMP_ACCTL0_TSEN_LEVEL 0x00000000 // Level sense, see TSLVAL
  118. #define COMP_ACCTL0_TSEN_FALL 0x00000020 // Falling edge
  119. #define COMP_ACCTL0_TSEN_RISE 0x00000040 // Rising edge
  120. #define COMP_ACCTL0_TSEN_BOTH 0x00000060 // Either edge
  121. #define COMP_ACCTL0_ISLVAL 0x00000010 // Interrupt Sense Level Value
  122. #define COMP_ACCTL0_ISEN_M 0x0000000C // Interrupt Sense
  123. #define COMP_ACCTL0_ISEN_LEVEL 0x00000000 // Level sense, see ISLVAL
  124. #define COMP_ACCTL0_ISEN_FALL 0x00000004 // Falling edge
  125. #define COMP_ACCTL0_ISEN_RISE 0x00000008 // Rising edge
  126. #define COMP_ACCTL0_ISEN_BOTH 0x0000000C // Either edge
  127. #define COMP_ACCTL0_CINV 0x00000002 // Comparator Output Invert
  128. //*****************************************************************************
  129. //
  130. // The following are defines for the bit fields in the COMP_O_ACSTAT1 register.
  131. //
  132. //*****************************************************************************
  133. #define COMP_ACSTAT1_OVAL 0x00000002 // Comparator Output Value
  134. //*****************************************************************************
  135. //
  136. // The following are defines for the bit fields in the COMP_O_ACCTL1 register.
  137. //
  138. //*****************************************************************************
  139. #define COMP_ACCTL1_TOEN 0x00000800 // Trigger Output Enable
  140. #define COMP_ACCTL1_ASRCP_M 0x00000600 // Analog Source Positive
  141. #define COMP_ACCTL1_ASRCP_PIN 0x00000000 // Pin value of Cn+
  142. #define COMP_ACCTL1_ASRCP_PIN0 0x00000200 // Pin value of C0+
  143. #define COMP_ACCTL1_ASRCP_REF 0x00000400 // Internal voltage reference
  144. #define COMP_ACCTL1_TSLVAL 0x00000080 // Trigger Sense Level Value
  145. #define COMP_ACCTL1_TSEN_M 0x00000060 // Trigger Sense
  146. #define COMP_ACCTL1_TSEN_LEVEL 0x00000000 // Level sense, see TSLVAL
  147. #define COMP_ACCTL1_TSEN_FALL 0x00000020 // Falling edge
  148. #define COMP_ACCTL1_TSEN_RISE 0x00000040 // Rising edge
  149. #define COMP_ACCTL1_TSEN_BOTH 0x00000060 // Either edge
  150. #define COMP_ACCTL1_ISLVAL 0x00000010 // Interrupt Sense Level Value
  151. #define COMP_ACCTL1_ISEN_M 0x0000000C // Interrupt Sense
  152. #define COMP_ACCTL1_ISEN_LEVEL 0x00000000 // Level sense, see ISLVAL
  153. #define COMP_ACCTL1_ISEN_FALL 0x00000004 // Falling edge
  154. #define COMP_ACCTL1_ISEN_RISE 0x00000008 // Rising edge
  155. #define COMP_ACCTL1_ISEN_BOTH 0x0000000C // Either edge
  156. #define COMP_ACCTL1_CINV 0x00000002 // Comparator Output Invert
  157. //*****************************************************************************
  158. //
  159. // The following are defines for the bit fields in the COMP_O_ACSTAT2 register.
  160. //
  161. //*****************************************************************************
  162. #define COMP_ACSTAT2_OVAL 0x00000002 // Comparator Output Value
  163. //*****************************************************************************
  164. //
  165. // The following are defines for the bit fields in the COMP_O_ACCTL2 register.
  166. //
  167. //*****************************************************************************
  168. #define COMP_ACCTL2_TOEN 0x00000800 // Trigger Output Enable
  169. #define COMP_ACCTL2_ASRCP_M 0x00000600 // Analog Source Positive
  170. #define COMP_ACCTL2_ASRCP_PIN 0x00000000 // Pin value of Cn+
  171. #define COMP_ACCTL2_ASRCP_PIN0 0x00000200 // Pin value of C0+
  172. #define COMP_ACCTL2_ASRCP_REF 0x00000400 // Internal voltage reference
  173. #define COMP_ACCTL2_TSLVAL 0x00000080 // Trigger Sense Level Value
  174. #define COMP_ACCTL2_TSEN_M 0x00000060 // Trigger Sense
  175. #define COMP_ACCTL2_TSEN_LEVEL 0x00000000 // Level sense, see TSLVAL
  176. #define COMP_ACCTL2_TSEN_FALL 0x00000020 // Falling edge
  177. #define COMP_ACCTL2_TSEN_RISE 0x00000040 // Rising edge
  178. #define COMP_ACCTL2_TSEN_BOTH 0x00000060 // Either edge
  179. #define COMP_ACCTL2_ISLVAL 0x00000010 // Interrupt Sense Level Value
  180. #define COMP_ACCTL2_ISEN_M 0x0000000C // Interrupt Sense
  181. #define COMP_ACCTL2_ISEN_LEVEL 0x00000000 // Level sense, see ISLVAL
  182. #define COMP_ACCTL2_ISEN_FALL 0x00000004 // Falling edge
  183. #define COMP_ACCTL2_ISEN_RISE 0x00000008 // Rising edge
  184. #define COMP_ACCTL2_ISEN_BOTH 0x0000000C // Either edge
  185. #define COMP_ACCTL2_CINV 0x00000002 // Comparator Output Invert
  186. //*****************************************************************************
  187. //
  188. // The following are defines for the bit fields in the COMP_O_PP register.
  189. //
  190. //*****************************************************************************
  191. #define COMP_PP_C2O 0x00040000 // Comparator Output 2 Present
  192. #define COMP_PP_C1O 0x00020000 // Comparator Output 1 Present
  193. #define COMP_PP_C0O 0x00010000 // Comparator Output 0 Present
  194. #define COMP_PP_CMP2 0x00000004 // Comparator 2 Present
  195. #define COMP_PP_CMP1 0x00000002 // Comparator 1 Present
  196. #define COMP_PP_CMP0 0x00000001 // Comparator 0 Present
  197. #endif // __HW_COMP_H__