OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [freertos-6.1.1/] [Demo/] [Common/] [drivers/] [LuminaryMicro/] [hw_timer.h] - Blame information for rev 831

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 610 jeremybenn
//*****************************************************************************
2
//
3
// hw_timer.h - Defines and macros used when accessing the timer.
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_TIMER_H__
30
#define __HW_TIMER_H__
31
 
32
//*****************************************************************************
33
//
34
// The following are defines for the timer register offsets.
35
//
36
//*****************************************************************************
37
#define TIMER_O_CFG             0x00000000  // Configuration register
38
#define TIMER_O_TAMR            0x00000004  // TimerA mode register
39
#define TIMER_O_TBMR            0x00000008  // TimerB mode register
40
#define TIMER_O_CTL             0x0000000C  // Control register
41
#define TIMER_O_IMR             0x00000018  // Interrupt mask register
42
#define TIMER_O_RIS             0x0000001C  // Interrupt status register
43
#define TIMER_O_MIS             0x00000020  // Masked interrupt status reg.
44
#define TIMER_O_ICR             0x00000024  // Interrupt clear register
45
#define TIMER_O_TAILR           0x00000028  // TimerA interval load register
46
#define TIMER_O_TBILR           0x0000002C  // TimerB interval load register
47
#define TIMER_O_TAMATCHR        0x00000030  // TimerA match register
48
#define TIMER_O_TBMATCHR        0x00000034  // TimerB match register
49
#define TIMER_O_TAPR            0x00000038  // TimerA prescale register
50
#define TIMER_O_TBPR            0x0000003C  // TimerB prescale register
51
#define TIMER_O_TAPMR           0x00000040  // TimerA prescale match register
52
#define TIMER_O_TBPMR           0x00000044  // TimerB prescale match register
53
#define TIMER_O_TAR             0x00000048  // TimerA register
54
#define TIMER_O_TBR             0x0000004C  // TimerB register
55
 
56
//*****************************************************************************
57
//
58
// The following are defines for the bit fields in the TIMER_CFG register.
59
//
60
//*****************************************************************************
61
#define TIMER_CFG_M             0x00000007  // GPTM Configuration.
62
#define TIMER_CFG_16_BIT        0x00000004  // Two 16 bit timers
63
#define TIMER_CFG_32_BIT_RTC    0x00000001  // 32 bit RTC
64
#define TIMER_CFG_32_BIT_TIMER  0x00000000  // 32 bit timer
65
 
66
//*****************************************************************************
67
//
68
// The following are defines for the bit fields in the TIMER_CTL register.
69
//
70
//*****************************************************************************
71
#define TIMER_CTL_TBPWML        0x00004000  // TimerB PWM output level invert
72
#define TIMER_CTL_TBOTE         0x00002000  // TimerB output trigger enable
73
#define TIMER_CTL_TBEVENT_POS   0x00000000  // TimerB event mode - pos edge
74
#define TIMER_CTL_TBEVENT_NEG   0x00000400  // TimerB event mode - neg edge
75
#define TIMER_CTL_TBEVENT_BOTH  0x00000C00  // TimerB event mode - both edges
76
#define TIMER_CTL_TBEVENT_M     0x00000C00  // GPTM TimerB Event Mode.
77
#define TIMER_CTL_TBSTALL       0x00000200  // TimerB stall enable
78
#define TIMER_CTL_TBEN          0x00000100  // TimerB enable
79
#define TIMER_CTL_TAPWML        0x00000040  // TimerA PWM output level invert
80
#define TIMER_CTL_TAOTE         0x00000020  // TimerA output trigger enable
81
#define TIMER_CTL_RTCEN         0x00000010  // RTC counter enable
82
#define TIMER_CTL_TAEVENT_M     0x0000000C  // GPTM TimerA Event Mode.
83
#define TIMER_CTL_TAEVENT_POS   0x00000000  // TimerA event mode - pos edge
84
#define TIMER_CTL_TAEVENT_NEG   0x00000004  // TimerA event mode - neg edge
85
#define TIMER_CTL_TAEVENT_BOTH  0x0000000C  // TimerA event mode - both edges
86
#define TIMER_CTL_TASTALL       0x00000002  // TimerA stall enable
87
#define TIMER_CTL_TAEN          0x00000001  // TimerA enable
88
 
89
//*****************************************************************************
90
//
91
// The following are defines for the bit fields in the TIMER_IMR register.
92
//
93
//*****************************************************************************
94
#define TIMER_IMR_CBEIM         0x00000400  // CaptureB event interrupt mask
95
#define TIMER_IMR_CBMIM         0x00000200  // CaptureB match interrupt mask
96
#define TIMER_IMR_TBTOIM        0x00000100  // TimerB time out interrupt mask
97
#define TIMER_IMR_RTCIM         0x00000008  // RTC interrupt mask
98
#define TIMER_IMR_CAEIM         0x00000004  // CaptureA event interrupt mask
99
#define TIMER_IMR_CAMIM         0x00000002  // CaptureA match interrupt mask
100
#define TIMER_IMR_TATOIM        0x00000001  // TimerA time out interrupt mask
101
 
102
//*****************************************************************************
103
//
104
// The following are defines for the bit fields in the TIMER_RIS register.
105
//
106
//*****************************************************************************
107
#define TIMER_RIS_CBERIS        0x00000400  // CaptureB event raw int status
108
#define TIMER_RIS_CBMRIS        0x00000200  // CaptureB match raw int status
109
#define TIMER_RIS_TBTORIS       0x00000100  // TimerB time out raw int status
110
#define TIMER_RIS_RTCRIS        0x00000008  // RTC raw int status
111
#define TIMER_RIS_CAERIS        0x00000004  // CaptureA event raw int status
112
#define TIMER_RIS_CAMRIS        0x00000002  // CaptureA match raw int status
113
#define TIMER_RIS_TATORIS       0x00000001  // TimerA time out raw int status
114
 
115
//*****************************************************************************
116
//
117
// The following are defines for the bit fields in the TIMER_ICR register.
118
//
119
//*****************************************************************************
120
#define TIMER_ICR_CBECINT       0x00000400  // CaptureB event interrupt clear
121
#define TIMER_ICR_CBMCINT       0x00000200  // CaptureB match interrupt clear
122
#define TIMER_ICR_TBTOCINT      0x00000100  // TimerB time out interrupt clear
123
#define TIMER_ICR_RTCCINT       0x00000008  // RTC interrupt clear
124
#define TIMER_ICR_CAECINT       0x00000004  // CaptureA event interrupt clear
125
#define TIMER_ICR_CAMCINT       0x00000002  // CaptureA match interrupt clear
126
#define TIMER_ICR_TATOCINT      0x00000001  // TimerA time out interrupt clear
127
 
128
//*****************************************************************************
129
//
130
// The following are defines for the bit fields in the TIMER_TAILR register.
131
//
132
//*****************************************************************************
133
#define TIMER_TAILR_TAILRH_M    0xFFFF0000  // GPTM TimerA Interval Load
134
                                            // Register High.
135
#define TIMER_TAILR_TAILRL_M    0x0000FFFF  // GPTM TimerA Interval Load
136
                                            // Register Low.
137
#define TIMER_TAILR_TAILRH_S    16
138
#define TIMER_TAILR_TAILRL_S    0
139
 
140
//*****************************************************************************
141
//
142
// The following are defines for the bit fields in the TIMER_TBILR register.
143
//
144
//*****************************************************************************
145
#define TIMER_TBILR_TBILRL_M    0x0000FFFF  // GPTM TimerB Interval Load
146
                                            // Register.
147
#define TIMER_TBILR_TBILRL_S    0
148
 
149
//*****************************************************************************
150
//
151
// The following are defines for the bit fields in the TIMER_TAMATCHR register.
152
//
153
//*****************************************************************************
154
#define TIMER_TAMATCHR_TAMRH_M  0xFFFF0000  // GPTM TimerA Match Register High.
155
#define TIMER_TAMATCHR_TAMRL_M  0x0000FFFF  // GPTM TimerA Match Register Low.
156
#define TIMER_TAMATCHR_TAMRH_S  16
157
#define TIMER_TAMATCHR_TAMRL_S  0
158
 
159
//*****************************************************************************
160
//
161
// The following are defines for the bit fields in the TIMER_TBMATCHR register.
162
//
163
//*****************************************************************************
164
#define TIMER_TBMATCHR_TBMRL_M  0x0000FFFF  // GPTM TimerB Match Register Low.
165
#define TIMER_TBMATCHR_TBMRL_S  0
166
 
167
//*****************************************************************************
168
//
169
// The following are defines for the bit fields in the TIMER_TAR register.
170
//
171
//*****************************************************************************
172
#define TIMER_TAR_TARH_M        0xFFFF0000  // GPTM TimerA Register High.
173
#define TIMER_TAR_TARL_M        0x0000FFFF  // GPTM TimerA Register Low.
174
#define TIMER_TAR_TARH_S        16
175
#define TIMER_TAR_TARL_S        0
176
 
177
//*****************************************************************************
178
//
179
// The following are defines for the bit fields in the TIMER_TBR register.
180
//
181
//*****************************************************************************
182
#define TIMER_TBR_TBRL_M        0x0000FFFF  // GPTM TimerB.
183
#define TIMER_TBR_TBRL_S        0
184
 
185
//*****************************************************************************
186
//
187
// The following are defines for the bit fields in the TIMER_O_TAMR register.
188
//
189
//*****************************************************************************
190
#define TIMER_TAMR_TAAMS        0x00000008  // GPTM TimerA Alternate Mode
191
                                            // Select.
192
#define TIMER_TAMR_TACMR        0x00000004  // GPTM TimerA Capture Mode.
193
#define TIMER_TAMR_TAMR_M       0x00000003  // GPTM TimerA Mode.
194
#define TIMER_TAMR_TAMR_1_SHOT  0x00000001  // One-Shot Timer mode.
195
#define TIMER_TAMR_TAMR_PERIOD  0x00000002  // Periodic Timer mode.
196
#define TIMER_TAMR_TAMR_CAP     0x00000003  // Capture mode.
197
 
198
//*****************************************************************************
199
//
200
// The following are defines for the bit fields in the TIMER_O_TBMR register.
201
//
202
//*****************************************************************************
203
#define TIMER_TBMR_TBAMS        0x00000008  // GPTM TimerB Alternate Mode
204
                                            // Select.
205
#define TIMER_TBMR_TBCMR        0x00000004  // GPTM TimerB Capture Mode.
206
#define TIMER_TBMR_TBMR_M       0x00000003  // GPTM TimerB Mode.
207
#define TIMER_TBMR_TBMR_1_SHOT  0x00000001  // One-Shot Timer mode.
208
#define TIMER_TBMR_TBMR_PERIOD  0x00000002  // Periodic Timer mode.
209
#define TIMER_TBMR_TBMR_CAP     0x00000003  // Capture mode.
210
 
211
//*****************************************************************************
212
//
213
// The following are defines for the bit fields in the TIMER_O_MIS register.
214
//
215
//*****************************************************************************
216
#define TIMER_MIS_CBEMIS        0x00000400  // GPTM CaptureB Event Masked
217
                                            // Interrupt.
218
#define TIMER_MIS_CBMMIS        0x00000200  // GPTM CaptureB Match Masked
219
                                            // Interrupt.
220
#define TIMER_MIS_TBTOMIS       0x00000100  // GPTM TimerB Time-Out Masked
221
                                            // Interrupt.
222
#define TIMER_MIS_RTCMIS        0x00000008  // GPTM RTC Masked Interrupt.
223
#define TIMER_MIS_CAEMIS        0x00000004  // GPTM CaptureA Event Masked
224
                                            // Interrupt.
225
#define TIMER_MIS_CAMMIS        0x00000002  // GPTM CaptureA Match Masked
226
                                            // Interrupt.
227
#define TIMER_MIS_TATOMIS       0x00000001  // GPTM TimerA Time-Out Masked
228
                                            // Interrupt.
229
 
230
//*****************************************************************************
231
//
232
// The following are defines for the bit fields in the TIMER_O_TAPR register.
233
//
234
//*****************************************************************************
235
#define TIMER_TAPR_TAPSR_M      0x000000FF  // GPTM TimerA Prescale.
236
#define TIMER_TAPR_TAPSR_S      0
237
 
238
//*****************************************************************************
239
//
240
// The following are defines for the bit fields in the TIMER_O_TBPR register.
241
//
242
//*****************************************************************************
243
#define TIMER_TBPR_TBPSR_M      0x000000FF  // GPTM TimerB Prescale.
244
#define TIMER_TBPR_TBPSR_S      0
245
 
246
//*****************************************************************************
247
//
248
// The following are defines for the bit fields in the TIMER_O_TAPMR register.
249
//
250
//*****************************************************************************
251
#define TIMER_TAPMR_TAPSMR_M    0x000000FF  // GPTM TimerA Prescale Match.
252
#define TIMER_TAPMR_TAPSMR_S    0
253
 
254
//*****************************************************************************
255
//
256
// The following are defines for the bit fields in the TIMER_O_TBPMR register.
257
//
258
//*****************************************************************************
259
#define TIMER_TBPMR_TBPSMR_M    0x000000FF  // GPTM TimerB Prescale Match.
260
#define TIMER_TBPMR_TBPSMR_S    0
261
 
262
//*****************************************************************************
263
//
264
// The following definitions are deprecated.
265
//
266
//*****************************************************************************
267
#ifndef DEPRECATED
268
 
269
//*****************************************************************************
270
//
271
// The following are deprecated defines for the reset values of the timer
272
// registers.
273
//
274
//*****************************************************************************
275
#define TIMER_RV_TAILR          0xFFFFFFFF  // TimerA interval load reg RV
276
#define TIMER_RV_TAR            0xFFFFFFFF  // TimerA register RV
277
#define TIMER_RV_TAMATCHR       0xFFFFFFFF  // TimerA match register RV
278
#define TIMER_RV_TBILR          0x0000FFFF  // TimerB interval load reg RV
279
#define TIMER_RV_TBMATCHR       0x0000FFFF  // TimerB match register RV
280
#define TIMER_RV_TBR            0x0000FFFF  // TimerB register RV
281
#define TIMER_RV_TAPR           0x00000000  // TimerA prescale register RV
282
#define TIMER_RV_CFG            0x00000000  // Configuration register RV
283
#define TIMER_RV_TBPMR          0x00000000  // TimerB prescale match regi RV
284
#define TIMER_RV_TAPMR          0x00000000  // TimerA prescale match reg RV
285
#define TIMER_RV_CTL            0x00000000  // Control register RV
286
#define TIMER_RV_ICR            0x00000000  // Interrupt clear register RV
287
#define TIMER_RV_TBMR           0x00000000  // TimerB mode register RV
288
#define TIMER_RV_MIS            0x00000000  // Masked interrupt status reg RV
289
#define TIMER_RV_RIS            0x00000000  // Interrupt status register RV
290
#define TIMER_RV_TBPR           0x00000000  // TimerB prescale register RV
291
#define TIMER_RV_IMR            0x00000000  // Interrupt mask register RV
292
#define TIMER_RV_TAMR           0x00000000  // TimerA mode register RV
293
 
294
//*****************************************************************************
295
//
296
// The following are deprecated defines for the bit fields in the TIMER_CFG
297
// register.
298
//
299
//*****************************************************************************
300
#define TIMER_CFG_CFG_MSK       0x00000007  // Configuration options mask
301
 
302
//*****************************************************************************
303
//
304
// The following are deprecated defines for the bit fields in the TIMER_TnMR
305
// register.
306
//
307
//*****************************************************************************
308
#define TIMER_TNMR_TNAMS        0x00000008  // Alternate mode select
309
#define TIMER_TNMR_TNCMR        0x00000004  // Capture mode - count or time
310
#define TIMER_TNMR_TNTMR_MSK    0x00000003  // Timer mode mask
311
#define TIMER_TNMR_TNTMR_1_SHOT 0x00000001  // Mode - one shot
312
#define TIMER_TNMR_TNTMR_PERIOD 0x00000002  // Mode - periodic
313
#define TIMER_TNMR_TNTMR_CAP    0x00000003  // Mode - capture
314
 
315
//*****************************************************************************
316
//
317
// The following are deprecated defines for the bit fields in the TIMER_CTL
318
// register.
319
//
320
//*****************************************************************************
321
#define TIMER_CTL_TBEVENT_MSK   0x00000C00  // TimerB event mode mask
322
#define TIMER_CTL_TAEVENT_MSK   0x0000000C  // TimerA event mode mask
323
 
324
//*****************************************************************************
325
//
326
// The following are deprecated defines for the bit fields in the TIMER_MIS
327
// register.
328
//
329
//*****************************************************************************
330
#define TIMER_RIS_CBEMIS        0x00000400  // CaptureB event masked int status
331
#define TIMER_RIS_CBMMIS        0x00000200  // CaptureB match masked int status
332
#define TIMER_RIS_TBTOMIS       0x00000100  // TimerB time out masked int stat
333
#define TIMER_RIS_RTCMIS        0x00000008  // RTC masked int status
334
#define TIMER_RIS_CAEMIS        0x00000004  // CaptureA event masked int status
335
#define TIMER_RIS_CAMMIS        0x00000002  // CaptureA match masked int status
336
#define TIMER_RIS_TATOMIS       0x00000001  // TimerA time out masked int stat
337
 
338
//*****************************************************************************
339
//
340
// The following are deprecated defines for the bit fields in the TIMER_TAILR
341
// register.
342
//
343
//*****************************************************************************
344
#define TIMER_TAILR_TAILRH      0xFFFF0000  // TimerB load val in 32 bit mode
345
#define TIMER_TAILR_TAILRL      0x0000FFFF  // TimerA interval load value
346
 
347
//*****************************************************************************
348
//
349
// The following are deprecated defines for the bit fields in the TIMER_TBILR
350
// register.
351
//
352
//*****************************************************************************
353
#define TIMER_TBILR_TBILRL      0x0000FFFF  // TimerB interval load value
354
 
355
//*****************************************************************************
356
//
357
// The following are deprecated defines for the bit fields in the
358
// TIMER_TAMATCHR register.
359
//
360
//*****************************************************************************
361
#define TIMER_TAMATCHR_TAMRH    0xFFFF0000  // TimerB match val in 32 bit mode
362
#define TIMER_TAMATCHR_TAMRL    0x0000FFFF  // TimerA match value
363
 
364
//*****************************************************************************
365
//
366
// The following are deprecated defines for the bit fields in the
367
// TIMER_TBMATCHR register.
368
//
369
//*****************************************************************************
370
#define TIMER_TBMATCHR_TBMRL    0x0000FFFF  // TimerB match load value
371
 
372
//*****************************************************************************
373
//
374
// The following are deprecated defines for the bit fields in the TIMER_TnPR
375
// register.
376
//
377
//*****************************************************************************
378
#define TIMER_TNPR_TNPSR        0x000000FF  // TimerN prescale value
379
 
380
//*****************************************************************************
381
//
382
// The following are deprecated defines for the bit fields in the TIMER_TnPMR
383
// register.
384
//
385
//*****************************************************************************
386
#define TIMER_TNPMR_TNPSMR      0x000000FF  // TimerN prescale match value
387
 
388
//*****************************************************************************
389
//
390
// The following are deprecated defines for the bit fields in the TIMER_TAR
391
// register.
392
//
393
//*****************************************************************************
394
#define TIMER_TAR_TARH          0xFFFF0000  // TimerB val in 32 bit mode
395
#define TIMER_TAR_TARL          0x0000FFFF  // TimerA value
396
 
397
//*****************************************************************************
398
//
399
// The following are deprecated defines for the bit fields in the TIMER_TBR
400
// register.
401
//
402
//*****************************************************************************
403
#define TIMER_TBR_TBRL          0x0000FFFF  // TimerB value
404
 
405
#endif
406
 
407
#endif // __HW_TIMER_H__

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.