1 |
610 |
jeremybenn |
//*****************************************************************************
|
2 |
|
|
//
|
3 |
|
|
// timer.h - Prototypes for the timer module
|
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 __TIMER_H__
|
30 |
|
|
#define __TIMER_H__
|
31 |
|
|
|
32 |
|
|
//*****************************************************************************
|
33 |
|
|
//
|
34 |
|
|
// If building with a C++ compiler, make all of the definitions in this header
|
35 |
|
|
// have a C binding.
|
36 |
|
|
//
|
37 |
|
|
//*****************************************************************************
|
38 |
|
|
#ifdef __cplusplus
|
39 |
|
|
extern "C"
|
40 |
|
|
{
|
41 |
|
|
#endif
|
42 |
|
|
|
43 |
|
|
//*****************************************************************************
|
44 |
|
|
//
|
45 |
|
|
// Values that can be passed to TimerConfigure as the ulConfig parameter.
|
46 |
|
|
//
|
47 |
|
|
//*****************************************************************************
|
48 |
|
|
#define TIMER_CFG_32_BIT_OS 0x00000001 // 32-bit one-shot timer
|
49 |
|
|
#define TIMER_CFG_32_BIT_PER 0x00000002 // 32-bit periodic timer
|
50 |
|
|
#define TIMER_CFG_32_RTC 0x01000000 // 32-bit RTC timer
|
51 |
|
|
#define TIMER_CFG_16_BIT_PAIR 0x04000000 // Two 16-bit timers
|
52 |
|
|
#define TIMER_CFG_A_ONE_SHOT 0x00000001 // Timer A one-shot timer
|
53 |
|
|
#define TIMER_CFG_A_PERIODIC 0x00000002 // Timer A periodic timer
|
54 |
|
|
#define TIMER_CFG_A_CAP_COUNT 0x00000003 // Timer A event counter
|
55 |
|
|
#define TIMER_CFG_A_CAP_TIME 0x00000007 // Timer A event timer
|
56 |
|
|
#define TIMER_CFG_A_PWM 0x0000000A // Timer A PWM output
|
57 |
|
|
#define TIMER_CFG_B_ONE_SHOT 0x00000100 // Timer B one-shot timer
|
58 |
|
|
#define TIMER_CFG_B_PERIODIC 0x00000200 // Timer B periodic timer
|
59 |
|
|
#define TIMER_CFG_B_CAP_COUNT 0x00000300 // Timer B event counter
|
60 |
|
|
#define TIMER_CFG_B_CAP_TIME 0x00000700 // Timer B event timer
|
61 |
|
|
#define TIMER_CFG_B_PWM 0x00000A00 // Timer B PWM output
|
62 |
|
|
|
63 |
|
|
//*****************************************************************************
|
64 |
|
|
//
|
65 |
|
|
// Values that can be passed to TimerIntEnable, TimerIntDisable, and
|
66 |
|
|
// TimerIntClear as the ulIntFlags parameter, and returned from TimerIntStatus.
|
67 |
|
|
//
|
68 |
|
|
//*****************************************************************************
|
69 |
|
|
#define TIMER_CAPB_EVENT 0x00000400 // CaptureB event interrupt
|
70 |
|
|
#define TIMER_CAPB_MATCH 0x00000200 // CaptureB match interrupt
|
71 |
|
|
#define TIMER_TIMB_TIMEOUT 0x00000100 // TimerB time out interrupt
|
72 |
|
|
#define TIMER_RTC_MATCH 0x00000008 // RTC interrupt mask
|
73 |
|
|
#define TIMER_CAPA_EVENT 0x00000004 // CaptureA event interrupt
|
74 |
|
|
#define TIMER_CAPA_MATCH 0x00000002 // CaptureA match interrupt
|
75 |
|
|
#define TIMER_TIMA_TIMEOUT 0x00000001 // TimerA time out interrupt
|
76 |
|
|
|
77 |
|
|
//*****************************************************************************
|
78 |
|
|
//
|
79 |
|
|
// Values that can be passed to TimerControlEvent as the ulEvent parameter.
|
80 |
|
|
//
|
81 |
|
|
//*****************************************************************************
|
82 |
|
|
#define TIMER_EVENT_POS_EDGE 0x00000000 // Count positive edges
|
83 |
|
|
#define TIMER_EVENT_NEG_EDGE 0x00000404 // Count negative edges
|
84 |
|
|
#define TIMER_EVENT_BOTH_EDGES 0x00000C0C // Count both edges
|
85 |
|
|
|
86 |
|
|
//*****************************************************************************
|
87 |
|
|
//
|
88 |
|
|
// Values that can be passed to most of the timer APIs as the ulTimer
|
89 |
|
|
// parameter.
|
90 |
|
|
//
|
91 |
|
|
//*****************************************************************************
|
92 |
|
|
#define TIMER_A 0x000000ff // Timer A
|
93 |
|
|
#define TIMER_B 0x0000ff00 // Timer B
|
94 |
|
|
#define TIMER_BOTH 0x0000ffff // Timer Both
|
95 |
|
|
|
96 |
|
|
//*****************************************************************************
|
97 |
|
|
//
|
98 |
|
|
// Prototypes for the APIs.
|
99 |
|
|
//
|
100 |
|
|
//*****************************************************************************
|
101 |
|
|
extern void TimerEnable(unsigned long ulBase, unsigned long ulTimer);
|
102 |
|
|
extern void TimerDisable(unsigned long ulBase, unsigned long ulTimer);
|
103 |
|
|
extern void TimerConfigure(unsigned long ulBase, unsigned long ulConfig);
|
104 |
|
|
extern void TimerControlLevel(unsigned long ulBase, unsigned long ulTimer,
|
105 |
|
|
tBoolean bInvert);
|
106 |
|
|
extern void TimerControlTrigger(unsigned long ulBase, unsigned long ulTimer,
|
107 |
|
|
tBoolean bEnable);
|
108 |
|
|
extern void TimerControlEvent(unsigned long ulBase, unsigned long ulTimer,
|
109 |
|
|
unsigned long ulEvent);
|
110 |
|
|
extern void TimerControlStall(unsigned long ulBase, unsigned long ulTimer,
|
111 |
|
|
tBoolean bStall);
|
112 |
|
|
extern void TimerRTCEnable(unsigned long ulBase);
|
113 |
|
|
extern void TimerRTCDisable(unsigned long ulBase);
|
114 |
|
|
extern void TimerPrescaleSet(unsigned long ulBase, unsigned long ulTimer,
|
115 |
|
|
unsigned long ulValue);
|
116 |
|
|
extern unsigned long TimerPrescaleGet(unsigned long ulBase,
|
117 |
|
|
unsigned long ulTimer);
|
118 |
|
|
extern void TimerLoadSet(unsigned long ulBase, unsigned long ulTimer,
|
119 |
|
|
unsigned long ulValue);
|
120 |
|
|
extern unsigned long TimerLoadGet(unsigned long ulBase, unsigned long ulTimer);
|
121 |
|
|
extern unsigned long TimerValueGet(unsigned long ulBase,
|
122 |
|
|
unsigned long ulTimer);
|
123 |
|
|
extern void TimerMatchSet(unsigned long ulBase, unsigned long ulTimer,
|
124 |
|
|
unsigned long ulValue);
|
125 |
|
|
extern unsigned long TimerMatchGet(unsigned long ulBase,
|
126 |
|
|
unsigned long ulTimer);
|
127 |
|
|
extern void TimerIntRegister(unsigned long ulBase, unsigned long ulTimer,
|
128 |
|
|
void (*pfnHandler)(void));
|
129 |
|
|
extern void TimerIntUnregister(unsigned long ulBase, unsigned long ulTimer);
|
130 |
|
|
extern void TimerIntEnable(unsigned long ulBase, unsigned long ulIntFlags);
|
131 |
|
|
extern void TimerIntDisable(unsigned long ulBase, unsigned long ulIntFlags);
|
132 |
|
|
extern unsigned long TimerIntStatus(unsigned long ulBase, tBoolean bMasked);
|
133 |
|
|
extern void TimerIntClear(unsigned long ulBase, unsigned long ulIntFlags);
|
134 |
|
|
|
135 |
|
|
//*****************************************************************************
|
136 |
|
|
//
|
137 |
|
|
// TimerQuiesce() has been deprecated. SysCtlPeripheralReset() should be used
|
138 |
|
|
// instead to return the timer to its reset state.
|
139 |
|
|
//
|
140 |
|
|
//*****************************************************************************
|
141 |
|
|
#ifndef DEPRECATED
|
142 |
|
|
extern void TimerQuiesce(unsigned long ulBase);
|
143 |
|
|
#endif
|
144 |
|
|
|
145 |
|
|
//*****************************************************************************
|
146 |
|
|
//
|
147 |
|
|
// Mark the end of the C bindings section for C++ compilers.
|
148 |
|
|
//
|
149 |
|
|
//*****************************************************************************
|
150 |
|
|
#ifdef __cplusplus
|
151 |
|
|
}
|
152 |
|
|
#endif
|
153 |
|
|
|
154 |
|
|
#endif // __TIMER_H__
|