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