1 |
581 |
jeremybenn |
//*****************************************************************************
|
2 |
|
|
//
|
3 |
|
|
// hw_timer.h - Defines and macros used when accessing the timer.
|
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 816 of the Stellaris Driver Library.
|
25 |
|
|
//
|
26 |
|
|
//*****************************************************************************
|
27 |
|
|
|
28 |
|
|
#ifndef __HW_TIMER_H__
|
29 |
|
|
#define __HW_TIMER_H__
|
30 |
|
|
|
31 |
|
|
//*****************************************************************************
|
32 |
|
|
//
|
33 |
|
|
// The following define the offsets of the timer registers.
|
34 |
|
|
//
|
35 |
|
|
//*****************************************************************************
|
36 |
|
|
#define TIMER_O_CFG 0x00000000 // Configuration register
|
37 |
|
|
#define TIMER_O_TAMR 0x00000004 // TimerA mode register
|
38 |
|
|
#define TIMER_O_TBMR 0x00000008 // TimerB mode register
|
39 |
|
|
#define TIMER_O_CTL 0x0000000C // Control register
|
40 |
|
|
#define TIMER_O_IMR 0x00000018 // Interrupt mask register
|
41 |
|
|
#define TIMER_O_RIS 0x0000001C // Interrupt status register
|
42 |
|
|
#define TIMER_O_MIS 0x00000020 // Masked interrupt status reg.
|
43 |
|
|
#define TIMER_O_ICR 0x00000024 // Interrupt clear register
|
44 |
|
|
#define TIMER_O_TAILR 0x00000028 // TimerA interval load register
|
45 |
|
|
#define TIMER_O_TBILR 0x0000002C // TimerB interval load register
|
46 |
|
|
#define TIMER_O_TAMATCHR 0x00000030 // TimerA match register
|
47 |
|
|
#define TIMER_O_TBMATCHR 0x00000034 // TimerB match register
|
48 |
|
|
#define TIMER_O_TAPR 0x00000038 // TimerA prescale register
|
49 |
|
|
#define TIMER_O_TBPR 0x0000003C // TimerB prescale register
|
50 |
|
|
#define TIMER_O_TAPMR 0x00000040 // TimerA prescale match register
|
51 |
|
|
#define TIMER_O_TBPMR 0x00000044 // TimerB prescale match register
|
52 |
|
|
#define TIMER_O_TAR 0x00000048 // TimerA register
|
53 |
|
|
#define TIMER_O_TBR 0x0000004C // TimerB register
|
54 |
|
|
|
55 |
|
|
//*****************************************************************************
|
56 |
|
|
//
|
57 |
|
|
// The following define the reset values of the timer registers.
|
58 |
|
|
//
|
59 |
|
|
//*****************************************************************************
|
60 |
|
|
#define TIMER_RV_CFG 0x00000000 // Configuration register RV
|
61 |
|
|
#define TIMER_RV_TAMR 0x00000000 // TimerA mode register RV
|
62 |
|
|
#define TIMER_RV_TBMR 0x00000000 // TimerB mode register RV
|
63 |
|
|
#define TIMER_RV_CTL 0x00000000 // Control register RV
|
64 |
|
|
#define TIMER_RV_IMR 0x00000000 // Interrupt mask register RV
|
65 |
|
|
#define TIMER_RV_RIS 0x00000000 // Interrupt status register RV
|
66 |
|
|
#define TIMER_RV_MIS 0x00000000 // Masked interrupt status reg RV
|
67 |
|
|
#define TIMER_RV_ICR 0x00000000 // Interrupt clear register RV
|
68 |
|
|
#define TIMER_RV_TAILR 0xFFFFFFFF // TimerA interval load reg RV
|
69 |
|
|
#define TIMER_RV_TBILR 0x0000FFFF // TimerB interval load reg RV
|
70 |
|
|
#define TIMER_RV_TAMATCHR 0xFFFFFFFF // TimerA match register RV
|
71 |
|
|
#define TIMER_RV_TBMATCHR 0x0000FFFF // TimerB match register RV
|
72 |
|
|
#define TIMER_RV_TAPR 0x00000000 // TimerA prescale register RV
|
73 |
|
|
#define TIMER_RV_TBPR 0x00000000 // TimerB prescale register RV
|
74 |
|
|
#define TIMER_RV_TAPMR 0x00000000 // TimerA prescale match reg RV
|
75 |
|
|
#define TIMER_RV_TBPMR 0x00000000 // TimerB prescale match regi RV
|
76 |
|
|
#define TIMER_RV_TAR 0xFFFFFFFF // TimerA register RV
|
77 |
|
|
#define TIMER_RV_TBR 0x0000FFFF // TimerB register RV
|
78 |
|
|
|
79 |
|
|
//*****************************************************************************
|
80 |
|
|
//
|
81 |
|
|
// The following define the bit fields in the TIMER_CFG register.
|
82 |
|
|
//
|
83 |
|
|
//*****************************************************************************
|
84 |
|
|
#define TIMER_CFG_CFG_MSK 0x00000007 // Configuration options mask
|
85 |
|
|
#define TIMER_CFG_16_BIT 0x00000004 // Two 16 bit timers
|
86 |
|
|
#define TIMER_CFG_32_BIT_RTC 0x00000001 // 32 bit RTC
|
87 |
|
|
#define TIMER_CFG_32_BIT_TIMER 0x00000000 // 32 bit timer
|
88 |
|
|
|
89 |
|
|
//*****************************************************************************
|
90 |
|
|
//
|
91 |
|
|
// The following define the bit fields in the TIMER_TnMR register.
|
92 |
|
|
//
|
93 |
|
|
//*****************************************************************************
|
94 |
|
|
#define TIMER_TNMR_TNAMS 0x00000008 // Alternate mode select
|
95 |
|
|
#define TIMER_TNMR_TNCMR 0x00000004 // Capture mode - count or time
|
96 |
|
|
#define TIMER_TNMR_TNTMR_MSK 0x00000003 // Timer mode mask
|
97 |
|
|
#define TIMER_TNMR_TNTMR_CAP 0x00000003 // Mode - capture
|
98 |
|
|
#define TIMER_TNMR_TNTMR_PERIOD 0x00000002 // Mode - periodic
|
99 |
|
|
#define TIMER_TNMR_TNTMR_1_SHOT 0x00000001 // Mode - one shot
|
100 |
|
|
|
101 |
|
|
//*****************************************************************************
|
102 |
|
|
//
|
103 |
|
|
// The following define the bit fields in the TIMER_CTL register.
|
104 |
|
|
//
|
105 |
|
|
//*****************************************************************************
|
106 |
|
|
#define TIMER_CTL_TBPWML 0x00004000 // TimerB PWM output level invert
|
107 |
|
|
#define TIMER_CTL_TBOTE 0x00002000 // TimerB output trigger enable
|
108 |
|
|
#define TIMER_CTL_TBEVENT_MSK 0x00000C00 // TimerB event mode mask
|
109 |
|
|
#define TIMER_CTL_TBEVENT_BOTH 0x00000C00 // TimerB event mode - both edges
|
110 |
|
|
#define TIMER_CTL_TBEVENT_NEG 0x00000400 // TimerB event mode - neg edge
|
111 |
|
|
#define TIMER_CTL_TBEVENT_POS 0x00000000 // TimerB event mode - pos edge
|
112 |
|
|
#define TIMER_CTL_TBSTALL 0x00000200 // TimerB stall enable
|
113 |
|
|
#define TIMER_CTL_TBEN 0x00000100 // TimerB enable
|
114 |
|
|
#define TIMER_CTL_TAPWML 0x00000040 // TimerA PWM output level invert
|
115 |
|
|
#define TIMER_CTL_TAOTE 0x00000020 // TimerA output trigger enable
|
116 |
|
|
#define TIMER_CTL_RTCEN 0x00000010 // RTC counter enable
|
117 |
|
|
#define TIMER_CTL_TAEVENT_MSK 0x0000000C // TimerA event mode mask
|
118 |
|
|
#define TIMER_CTL_TAEVENT_BOTH 0x0000000C // TimerA event mode - both edges
|
119 |
|
|
#define TIMER_CTL_TAEVENT_NEG 0x00000004 // TimerA event mode - neg edge
|
120 |
|
|
#define TIMER_CTL_TAEVENT_POS 0x00000000 // TimerA event mode - pos edge
|
121 |
|
|
#define TIMER_CTL_TASTALL 0x00000002 // TimerA stall enable
|
122 |
|
|
#define TIMER_CTL_TAEN 0x00000001 // TimerA enable
|
123 |
|
|
|
124 |
|
|
//*****************************************************************************
|
125 |
|
|
//
|
126 |
|
|
// The following define the bit fields in the TIMER_IMR register.
|
127 |
|
|
//
|
128 |
|
|
//*****************************************************************************
|
129 |
|
|
#define TIMER_IMR_CBEIM 0x00000400 // CaptureB event interrupt mask
|
130 |
|
|
#define TIMER_IMR_CBMIM 0x00000200 // CaptureB match interrupt mask
|
131 |
|
|
#define TIMER_IMR_TBTOIM 0x00000100 // TimerB time out interrupt mask
|
132 |
|
|
#define TIMER_IMR_RTCIM 0x00000008 // RTC interrupt mask
|
133 |
|
|
#define TIMER_IMR_CAEIM 0x00000004 // CaptureA event interrupt mask
|
134 |
|
|
#define TIMER_IMR_CAMIM 0x00000002 // CaptureA match interrupt mask
|
135 |
|
|
#define TIMER_IMR_TATOIM 0x00000001 // TimerA time out interrupt mask
|
136 |
|
|
|
137 |
|
|
//*****************************************************************************
|
138 |
|
|
//
|
139 |
|
|
// The following define the bit fields in the TIMER_RIS register.
|
140 |
|
|
//
|
141 |
|
|
//*****************************************************************************
|
142 |
|
|
#define TIMER_RIS_CBERIS 0x00000400 // CaptureB event raw int status
|
143 |
|
|
#define TIMER_RIS_CBMRIS 0x00000200 // CaptureB match raw int status
|
144 |
|
|
#define TIMER_RIS_TBTORIS 0x00000100 // TimerB time out raw int status
|
145 |
|
|
#define TIMER_RIS_RTCRIS 0x00000008 // RTC raw int status
|
146 |
|
|
#define TIMER_RIS_CAERIS 0x00000004 // CaptureA event raw int status
|
147 |
|
|
#define TIMER_RIS_CAMRIS 0x00000002 // CaptureA match raw int status
|
148 |
|
|
#define TIMER_RIS_TATORIS 0x00000001 // TimerA time out raw int status
|
149 |
|
|
|
150 |
|
|
//*****************************************************************************
|
151 |
|
|
//
|
152 |
|
|
// The following define the bit fields in the TIMER_MIS register.
|
153 |
|
|
//
|
154 |
|
|
//*****************************************************************************
|
155 |
|
|
#define TIMER_RIS_CBEMIS 0x00000400 // CaptureB event masked int status
|
156 |
|
|
#define TIMER_RIS_CBMMIS 0x00000200 // CaptureB match masked int status
|
157 |
|
|
#define TIMER_RIS_TBTOMIS 0x00000100 // TimerB time out masked int stat
|
158 |
|
|
#define TIMER_RIS_RTCMIS 0x00000008 // RTC masked int status
|
159 |
|
|
#define TIMER_RIS_CAEMIS 0x00000004 // CaptureA event masked int status
|
160 |
|
|
#define TIMER_RIS_CAMMIS 0x00000002 // CaptureA match masked int status
|
161 |
|
|
#define TIMER_RIS_TATOMIS 0x00000001 // TimerA time out masked int stat
|
162 |
|
|
|
163 |
|
|
//*****************************************************************************
|
164 |
|
|
//
|
165 |
|
|
// The following define the bit fields in the TIMER_ICR register.
|
166 |
|
|
//
|
167 |
|
|
//*****************************************************************************
|
168 |
|
|
#define TIMER_ICR_CBECINT 0x00000400 // CaptureB event interrupt clear
|
169 |
|
|
#define TIMER_ICR_CBMCINT 0x00000200 // CaptureB match interrupt clear
|
170 |
|
|
#define TIMER_ICR_TBTOCINT 0x00000100 // TimerB time out interrupt clear
|
171 |
|
|
#define TIMER_ICR_RTCCINT 0x00000008 // RTC interrupt clear
|
172 |
|
|
#define TIMER_ICR_CAECINT 0x00000004 // CaptureA event interrupt clear
|
173 |
|
|
#define TIMER_ICR_CAMCINT 0x00000002 // CaptureA match interrupt clear
|
174 |
|
|
#define TIMER_ICR_TATOCINT 0x00000001 // TimerA time out interrupt clear
|
175 |
|
|
|
176 |
|
|
//*****************************************************************************
|
177 |
|
|
//
|
178 |
|
|
// The following define the bit fields in the TIMER_TAILR register.
|
179 |
|
|
//
|
180 |
|
|
//*****************************************************************************
|
181 |
|
|
#define TIMER_TAILR_TAILRH 0xFFFF0000 // TimerB load val in 32 bit mode
|
182 |
|
|
#define TIMER_TAILR_TAILRL 0x0000FFFF // TimerA interval load value
|
183 |
|
|
|
184 |
|
|
//*****************************************************************************
|
185 |
|
|
//
|
186 |
|
|
// The following defines the bit fields in the TIMER_TBILR register.
|
187 |
|
|
//
|
188 |
|
|
//*****************************************************************************
|
189 |
|
|
#define TIMER_TBILR_TBILRL 0x0000FFFF // TimerB interval load value
|
190 |
|
|
|
191 |
|
|
//*****************************************************************************
|
192 |
|
|
//
|
193 |
|
|
// The following define the bit fields in the TIMER_TAMATCHR register.
|
194 |
|
|
//
|
195 |
|
|
//*****************************************************************************
|
196 |
|
|
#define TIMER_TAMATCHR_TAMRH 0xFFFF0000 // TimerB match val in 32 bit mode
|
197 |
|
|
#define TIMER_TAMATCHR_TAMRL 0x0000FFFF // TimerA match value
|
198 |
|
|
|
199 |
|
|
//*****************************************************************************
|
200 |
|
|
//
|
201 |
|
|
// The following defines the bit fields in the TIMER_TBMATCHR register.
|
202 |
|
|
//
|
203 |
|
|
//*****************************************************************************
|
204 |
|
|
#define TIMER_TBMATCHR_TBMRL 0x0000FFFF // TimerB match load value
|
205 |
|
|
|
206 |
|
|
//*****************************************************************************
|
207 |
|
|
//
|
208 |
|
|
// The following defines the bit fields in the TIMER_TnPR register.
|
209 |
|
|
//
|
210 |
|
|
//*****************************************************************************
|
211 |
|
|
#define TIMER_TNPR_TNPSR 0x000000FF // TimerN prescale value
|
212 |
|
|
|
213 |
|
|
//*****************************************************************************
|
214 |
|
|
//
|
215 |
|
|
// The following defines the bit fields in the TIMER_TnPMR register.
|
216 |
|
|
//
|
217 |
|
|
//*****************************************************************************
|
218 |
|
|
#define TIMER_TNPMR_TNPSMR 0x000000FF // TimerN prescale match value
|
219 |
|
|
|
220 |
|
|
//*****************************************************************************
|
221 |
|
|
//
|
222 |
|
|
// The following define the bit fields in the TIMER_TAR register.
|
223 |
|
|
//
|
224 |
|
|
//*****************************************************************************
|
225 |
|
|
#define TIMER_TAR_TARH 0xFFFF0000 // TimerB val in 32 bit mode
|
226 |
|
|
#define TIMER_TAR_TARL 0x0000FFFF // TimerA value
|
227 |
|
|
|
228 |
|
|
//*****************************************************************************
|
229 |
|
|
//
|
230 |
|
|
// The following defines the bit fields in the TIMER_TBR register.
|
231 |
|
|
//
|
232 |
|
|
//*****************************************************************************
|
233 |
|
|
#define TIMER_TBR_TBRL 0x0000FFFF // TimerB value
|
234 |
|
|
|
235 |
|
|
#endif // __HW_TIMER_H__
|