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 25 #ifndef __HW_COMP_H__ 26 #define __HW_COMP_H__ 27 28 //***************************************************************************** 29 // 30 // The following are defines for the Comparator register offsets. 31 // 32 //***************************************************************************** 33 #define COMP_O_ACMIS 0x00000000 // Analog Comparator Masked 34 // Interrupt Status 35 #define COMP_O_ACRIS 0x00000004 // Analog Comparator Raw Interrupt 36 // Status 37 #define COMP_O_ACINTEN 0x00000008 // Analog Comparator Interrupt 38 // Enable 39 #define COMP_O_ACREFCTL 0x00000010 // Analog Comparator Reference 40 // Voltage Control 41 #define COMP_O_ACSTAT0 0x00000020 // Analog Comparator Status 0 42 #define COMP_O_ACCTL0 0x00000024 // Analog Comparator Control 0 43 #define COMP_O_ACSTAT1 0x00000040 // Analog Comparator Status 1 44 #define COMP_O_ACCTL1 0x00000044 // Analog Comparator Control 1 45 #define COMP_O_ACSTAT2 0x00000060 // Analog Comparator Status 2 46 #define COMP_O_ACCTL2 0x00000064 // Analog Comparator Control 2 47 #define COMP_O_PP 0x00000FC0 // Analog Comparator Peripheral 48 // Properties 49 50 //***************************************************************************** 51 // 52 // The following are defines for the bit fields in the COMP_O_ACMIS register. 53 // 54 //***************************************************************************** 55 #define COMP_ACMIS_IN2 0x00000004 // Comparator 2 Masked Interrupt 56 // Status 57 #define COMP_ACMIS_IN1 0x00000002 // Comparator 1 Masked Interrupt 58 // Status 59 #define COMP_ACMIS_IN0 0x00000001 // Comparator 0 Masked Interrupt 60 // Status 61 62 //***************************************************************************** 63 // 64 // The following are defines for the bit fields in the COMP_O_ACRIS register. 65 // 66 //***************************************************************************** 67 #define COMP_ACRIS_IN2 0x00000004 // Comparator 2 Interrupt Status 68 #define COMP_ACRIS_IN1 0x00000002 // Comparator 1 Interrupt Status 69 #define COMP_ACRIS_IN0 0x00000001 // Comparator 0 Interrupt Status 70 71 //***************************************************************************** 72 // 73 // The following are defines for the bit fields in the COMP_O_ACINTEN register. 74 // 75 //***************************************************************************** 76 #define COMP_ACINTEN_IN2 0x00000004 // Comparator 2 Interrupt Enable 77 #define COMP_ACINTEN_IN1 0x00000002 // Comparator 1 Interrupt Enable 78 #define COMP_ACINTEN_IN0 0x00000001 // Comparator 0 Interrupt Enable 79 80 //***************************************************************************** 81 // 82 // The following are defines for the bit fields in the COMP_O_ACREFCTL 83 // register. 84 // 85 //***************************************************************************** 86 #define COMP_ACREFCTL_EN 0x00000200 // Resistor Ladder Enable 87 #define COMP_ACREFCTL_RNG 0x00000100 // Resistor Ladder Range 88 #define COMP_ACREFCTL_VREF_M 0x0000000F // Resistor Ladder Voltage Ref 89 #define COMP_ACREFCTL_VREF_S 0 90 91 //***************************************************************************** 92 // 93 // The following are defines for the bit fields in the COMP_O_ACSTAT0 register. 94 // 95 //***************************************************************************** 96 #define COMP_ACSTAT0_OVAL 0x00000002 // Comparator Output Value 97 98 //***************************************************************************** 99 // 100 // The following are defines for the bit fields in the COMP_O_ACCTL0 register. 101 // 102 //***************************************************************************** 103 #define COMP_ACCTL0_TOEN 0x00000800 // Trigger Output Enable 104 #define COMP_ACCTL0_ASRCP_M 0x00000600 // Analog Source Positive 105 #define COMP_ACCTL0_ASRCP_PIN 0x00000000 // Pin value of Cn+ 106 #define COMP_ACCTL0_ASRCP_PIN0 0x00000200 // Pin value of C0+ 107 #define COMP_ACCTL0_ASRCP_REF 0x00000400 // Internal voltage reference 108 // (VIREF) 109 #define COMP_ACCTL0_TSLVAL 0x00000080 // Trigger Sense Level Value 110 #define COMP_ACCTL0_TSEN_M 0x00000060 // Trigger Sense 111 #define COMP_ACCTL0_TSEN_LEVEL 0x00000000 // Level sense, see TSLVAL 112 #define COMP_ACCTL0_TSEN_FALL 0x00000020 // Falling edge 113 #define COMP_ACCTL0_TSEN_RISE 0x00000040 // Rising edge 114 #define COMP_ACCTL0_TSEN_BOTH 0x00000060 // Either edge 115 #define COMP_ACCTL0_ISLVAL 0x00000010 // Interrupt Sense Level Value 116 #define COMP_ACCTL0_ISEN_M 0x0000000C // Interrupt Sense 117 #define COMP_ACCTL0_ISEN_LEVEL 0x00000000 // Level sense, see ISLVAL 118 #define COMP_ACCTL0_ISEN_FALL 0x00000004 // Falling edge 119 #define COMP_ACCTL0_ISEN_RISE 0x00000008 // Rising edge 120 #define COMP_ACCTL0_ISEN_BOTH 0x0000000C // Either edge 121 #define COMP_ACCTL0_CINV 0x00000002 // Comparator Output Invert 122 123 //***************************************************************************** 124 // 125 // The following are defines for the bit fields in the COMP_O_ACSTAT1 register. 126 // 127 //***************************************************************************** 128 #define COMP_ACSTAT1_OVAL 0x00000002 // Comparator Output Value 129 130 //***************************************************************************** 131 // 132 // The following are defines for the bit fields in the COMP_O_ACCTL1 register. 133 // 134 //***************************************************************************** 135 #define COMP_ACCTL1_TOEN 0x00000800 // Trigger Output Enable 136 #define COMP_ACCTL1_ASRCP_M 0x00000600 // Analog Source Positive 137 #define COMP_ACCTL1_ASRCP_PIN 0x00000000 // Pin value of Cn+ 138 #define COMP_ACCTL1_ASRCP_PIN0 0x00000200 // Pin value of C0+ 139 #define COMP_ACCTL1_ASRCP_REF 0x00000400 // Internal voltage reference 140 // (VIREF) 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 of Cn+ 170 #define COMP_ACCTL2_ASRCP_PIN0 0x00000200 // Pin value of C0+ 171 #define COMP_ACCTL2_ASRCP_REF 0x00000400 // Internal voltage reference 172 // (VIREF) 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 // 189 // The following are defines for the bit fields in the COMP_O_PP register. 190 // 191 //***************************************************************************** 192 #define COMP_PP_C2O 0x00040000 // Comparator Output 2 Present 193 #define COMP_PP_C1O 0x00020000 // Comparator Output 1 Present 194 #define COMP_PP_C0O 0x00010000 // Comparator Output 0 Present 195 #define COMP_PP_CMP2 0x00000004 // Comparator 2 Present 196 #define COMP_PP_CMP1 0x00000002 // Comparator 1 Present 197 #define COMP_PP_CMP0 0x00000001 // Comparator 0 Present 198 199 //***************************************************************************** 200 // 201 // The following definitions are deprecated. 202 // 203 //***************************************************************************** 204 #ifndef DEPRECATED 205 206 //***************************************************************************** 207 // 208 // The following are deprecated defines for the Comparator register offsets. 209 // 210 //***************************************************************************** 211 #define COMP_O_MIS 0x00000000 // Interrupt status register 212 #define COMP_O_RIS 0x00000004 // Raw interrupt status register 213 #define COMP_O_INTEN 0x00000008 // Interrupt enable register 214 #define COMP_O_REFCTL 0x00000010 // Reference voltage control reg 215 216 //***************************************************************************** 217 // 218 // The following are deprecated defines for the bit fields in the COMP_O_REFCTL 219 // register. 220 // 221 //***************************************************************************** 222 #define COMP_REFCTL_EN 0x00000200 // Reference voltage enable 223 #define COMP_REFCTL_RNG 0x00000100 // Reference voltage range 224 #define COMP_REFCTL_VREF_MASK 0x0000000F // Reference voltage select mask 225 #define COMP_REFCTL_VREF_SHIFT 0 226 227 //***************************************************************************** 228 // 229 // The following are deprecated defines for the bit fields in the COMP_MIS, 230 // COMP_RIS, and COMP_INTEN registers. 231 // 232 //***************************************************************************** 233 #define COMP_INT_2 0x00000004 // Comp2 interrupt 234 #define COMP_INT_1 0x00000002 // Comp1 interrupt 235 #define COMP_INT_0 0x00000001 // Comp0 interrupt 236 237 //***************************************************************************** 238 // 239 // The following are deprecated defines for the bit fields in the COMP_ACSTAT0, 240 // COMP_ACSTAT1, and COMP_ACSTAT2 registers. 241 // 242 //***************************************************************************** 243 #define COMP_ACSTAT_OVAL 0x00000002 // Comparator output value 244 245 //***************************************************************************** 246 // 247 // The following are deprecated defines for the bit fields in the COMP_ACCTL0, 248 // COMP_ACCTL1, and COMP_ACCTL2 registers. 249 // 250 //***************************************************************************** 251 #define COMP_ACCTL_TMASK 0x00000800 // Trigger enable 252 #define COMP_ACCTL_ASRCP_MASK 0x00000600 // Vin+ source select mask 253 #define COMP_ACCTL_ASRCP_PIN 0x00000000 // Dedicated Comp+ pin 254 #define COMP_ACCTL_ASRCP_PIN0 0x00000200 // Comp0+ pin 255 #define COMP_ACCTL_ASRCP_REF 0x00000400 // Internal voltage reference 256 #define COMP_ACCTL_ASRCP_RES 0x00000600 // Reserved 257 #define COMP_ACCTL_OEN 0x00000100 // Comparator output enable 258 #define COMP_ACCTL_TSVAL 0x00000080 // Trigger polarity select 259 #define COMP_ACCTL_TSEN_MASK 0x00000060 // Trigger sense mask 260 #define COMP_ACCTL_TSEN_LEVEL 0x00000000 // Trigger is level sense 261 #define COMP_ACCTL_TSEN_FALL 0x00000020 // Trigger is falling edge 262 #define COMP_ACCTL_TSEN_RISE 0x00000040 // Trigger is rising edge 263 #define COMP_ACCTL_TSEN_BOTH 0x00000060 // Trigger is both edges 264 #define COMP_ACCTL_ISLVAL 0x00000010 // Interrupt polarity select 265 #define COMP_ACCTL_ISEN_MASK 0x0000000C // Interrupt sense mask 266 #define COMP_ACCTL_ISEN_LEVEL 0x00000000 // Interrupt is level sense 267 #define COMP_ACCTL_ISEN_FALL 0x00000004 // Interrupt is falling edge 268 #define COMP_ACCTL_ISEN_RISE 0x00000008 // Interrupt is rising edge 269 #define COMP_ACCTL_ISEN_BOTH 0x0000000C // Interrupt is both edges 270 #define COMP_ACCTL_CINV 0x00000002 // Comparator output invert 271 272 //***************************************************************************** 273 // 274 // The following are deprecated defines for the reset values for the comparator 275 // registers. 276 // 277 //***************************************************************************** 278 #define COMP_RV_ACCTL1 0x00000000 // Comp1 control register 279 #define COMP_RV_ACSTAT2 0x00000000 // Comp2 status register 280 #define COMP_RV_ACSTAT0 0x00000000 // Comp0 status register 281 #define COMP_RV_RIS 0x00000000 // Raw interrupt status register 282 #define COMP_RV_INTEN 0x00000000 // Interrupt enable register 283 #define COMP_RV_ACCTL2 0x00000000 // Comp2 control register 284 #define COMP_RV_MIS 0x00000000 // Interrupt status register 285 #define COMP_RV_ACCTL0 0x00000000 // Comp0 control register 286 #define COMP_RV_ACSTAT1 0x00000000 // Comp1 status register 287 #define COMP_RV_REFCTL 0x00000000 // Reference voltage control reg 288 289 #endif 290 291 #endif // __HW_COMP_H__ 292