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