1 //*****************************************************************************
\r
3 // hw_comp.h - Macros used when accessing the comparator hardware.
\r
5 // Copyright (c) 2005,2006 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 Stellaris Family of 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. Any use in violation
\r
14 // of the foregoing restrictions may subject the user to criminal sanctions
\r
15 // under applicable laws, as well as to civil liability for the breach of the
\r
16 // terms and conditions of this license.
\r
18 // THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED
\r
19 // OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
\r
20 // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
\r
21 // LMI SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
\r
22 // CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
\r
24 // This is part of revision 635 of the Stellaris Driver Library.
\r
26 //*****************************************************************************
\r
28 #ifndef __HW_COMP_H__
\r
29 #define __HW_COMP_H__
\r
31 //*****************************************************************************
\r
33 // The following define the offsets of the comparator registers.
\r
35 //*****************************************************************************
\r
36 #define COMP_O_MIS 0x00000000 // Interrupt status register
\r
37 #define COMP_O_RIS 0x00000004 // Raw interrupt status register
\r
38 #define COMP_O_INTEN 0x00000008 // Interrupt enable register
\r
39 #define COMP_O_REFCTL 0x00000010 // Reference voltage control reg.
\r
40 #define COMP_O_ACSTAT0 0x00000020 // Comp0 status register
\r
41 #define COMP_O_ACCTL0 0x00000024 // Comp0 control register
\r
42 #define COMP_O_ACSTAT1 0x00000040 // Comp1 status register
\r
43 #define COMP_O_ACCTL1 0x00000044 // Comp1 control register
\r
44 #define COMP_O_ACSTAT2 0x00000060 // Comp2 status register
\r
45 #define COMP_O_ACCTL2 0x00000064 // Comp2 control register
\r
47 //*****************************************************************************
\r
49 // The following define the bit fields in the COMP_MIS, COMP_RIS, and
\r
50 // COMP_INTEN registers.
\r
52 //*****************************************************************************
\r
53 #define COMP_INT_2 0x00000004 // Comp2 interrupt
\r
54 #define COMP_INT_1 0x00000002 // Comp1 interrupt
\r
55 #define COMP_INT_0 0x00000001 // Comp0 interrupt
\r
57 //*****************************************************************************
\r
59 // The following define the bit fields in the COMP_REFCTL register.
\r
61 //*****************************************************************************
\r
62 #define COMP_REFCTL_EN 0x00000200 // Reference voltage enable
\r
63 #define COMP_REFCTL_RNG 0x00000100 // Reference voltage range
\r
64 #define COMP_REFCTL_VREF_MASK 0x0000000F // Reference voltage select mask
\r
65 #define COMP_REFCTL_VREF_SHIFT 0
\r
67 //*****************************************************************************
\r
69 // The following define the bit fields in the COMP_ACSTAT0, COMP_ACSTAT1, and
\r
70 // COMP_ACSTAT2 registers.
\r
72 //*****************************************************************************
\r
73 #define COMP_ACSTAT_OVAL 0x00000002 // Comparator output value
\r
75 //*****************************************************************************
\r
77 // The following define the bit fields in the COMP_ACCTL0, COMP_ACCTL1, and
\r
78 // COMP_ACCTL2 registers.
\r
80 //*****************************************************************************
\r
81 #define COMP_ACCTL_TMASK 0x00000800 // Trigger enable
\r
82 #define COMP_ACCTL_ASRCP_MASK 0x00000600 // Vin+ source select mask
\r
83 #define COMP_ACCTL_ASRCP_PIN 0x00000000 // Dedicated Comp+ pin
\r
84 #define COMP_ACCTL_ASRCP_PIN0 0x00000200 // Comp0+ pin
\r
85 #define COMP_ACCTL_ASRCP_REF 0x00000400 // Internal voltage reference
\r
86 #define COMP_ACCTL_ASRCP_RES 0x00000600 // Reserved
\r
87 #define COMP_ACCTL_OEN 0x00000100 // Comparator output enable
\r
88 #define COMP_ACCTL_TSVAL 0x00000080 // Trigger polarity select
\r
89 #define COMP_ACCTL_TSEN_MASK 0x00000060 // Trigger sense mask
\r
90 #define COMP_ACCTL_TSEN_LEVEL 0x00000000 // Trigger is level sense
\r
91 #define COMP_ACCTL_TSEN_FALL 0x00000020 // Trigger is falling edge
\r
92 #define COMP_ACCTL_TSEN_RISE 0x00000040 // Trigger is rising edge
\r
93 #define COMP_ACCTL_TSEN_BOTH 0x00000060 // Trigger is both edges
\r
94 #define COMP_ACCTL_ISLVAL 0x00000010 // Interrupt polarity select
\r
95 #define COMP_ACCTL_ISEN_MASK 0x0000000C // Interrupt sense mask
\r
96 #define COMP_ACCTL_ISEN_LEVEL 0x00000000 // Interrupt is level sense
\r
97 #define COMP_ACCTL_ISEN_FALL 0x00000004 // Interrupt is falling edge
\r
98 #define COMP_ACCTL_ISEN_RISE 0x00000008 // Interrupt is rising edge
\r
99 #define COMP_ACCTL_ISEN_BOTH 0x0000000C // Interrupt is both edges
\r
100 #define COMP_ACCTL_CINV 0x00000002 // Comparator output invert
\r
102 //*****************************************************************************
\r
104 // The following define the reset values for the comparator registers.
\r
106 //*****************************************************************************
\r
107 #define COMP_RV_MIS 0x00000000 // Interrupt status register
\r
108 #define COMP_RV_RIS 0x00000000 // Raw interrupt status register
\r
109 #define COMP_RV_INTEN 0x00000000 // Interrupt enable register
\r
110 #define COMP_RV_REFCTL 0x00000000 // Reference voltage control reg.
\r
111 #define COMP_RV_ACSTAT0 0x00000000 // Comp0 status register
\r
112 #define COMP_RV_ACCTL0 0x00000000 // Comp0 control register
\r
113 #define COMP_RV_ACSTAT1 0x00000000 // Comp1 status register
\r
114 #define COMP_RV_ACCTL1 0x00000000 // Comp1 control register
\r
115 #define COMP_RV_ACSTAT2 0x00000000 // Comp2 status register
\r
116 #define COMP_RV_ACCTL2 0x00000000 // Comp2 control register
\r
118 #endif // __HW_COMP_H__
\r