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