2 * -------------------------------------------
3 * CC3220 SDK - v0.10.00.00
4 * -------------------------------------------
6 * Copyright (C) 2015 Texas Instruments Incorporated - http://www.ti.com/
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
12 * Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
15 * Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the
20 * Neither the name of Texas Instruments Incorporated nor the names of
21 * its contributors may be used to endorse or promote products derived
22 * from this software without specific prior written permission.
24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
25 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
26 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
27 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
28 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
29 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
30 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
31 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
32 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
33 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
34 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37 //*****************************************************************************
41 // Prototypes for the timer module
43 //*****************************************************************************
48 //*****************************************************************************
50 // If building with a C++ compiler, make all of the definitions in this header
53 //*****************************************************************************
59 //*****************************************************************************
61 // Values that can be passed to TimerConfigure as the ulConfig parameter.
63 //*****************************************************************************
65 #define TIMER_CFG_ONE_SHOT 0x00000021 // Full-width one-shot timer
66 #define TIMER_CFG_ONE_SHOT_UP 0x00000031 // Full-width one-shot up-count
68 #define TIMER_CFG_PERIODIC 0x00000022 // Full-width periodic timer
69 #define TIMER_CFG_PERIODIC_UP 0x00000032 // Full-width periodic up-count
71 #define TIMER_CFG_SPLIT_PAIR 0x04000000 // Two half-width timers
73 #define TIMER_CFG_A_ONE_SHOT 0x00000021 // Timer A one-shot timer
74 #define TIMER_CFG_A_ONE_SHOT_UP 0x00000031 // Timer A one-shot up-count timer
75 #define TIMER_CFG_A_PERIODIC 0x00000022 // Timer A periodic timer
76 #define TIMER_CFG_A_PERIODIC_UP 0x00000032 // Timer A periodic up-count timer
77 #define TIMER_CFG_A_CAP_COUNT 0x00000003 // Timer A event counter
78 #define TIMER_CFG_A_CAP_COUNT_UP 0x00000013 // Timer A event up-counter
79 #define TIMER_CFG_A_CAP_TIME 0x00000007 // Timer A event timer
80 #define TIMER_CFG_A_CAP_TIME_UP 0x00000017 // Timer A event up-count timer
81 #define TIMER_CFG_A_PWM 0x0000000A // Timer A PWM output
82 #define TIMER_CFG_B_ONE_SHOT 0x00002100 // Timer B one-shot timer
83 #define TIMER_CFG_B_ONE_SHOT_UP 0x00003100 // Timer B one-shot up-count timer
84 #define TIMER_CFG_B_PERIODIC 0x00002200 // Timer B periodic timer
85 #define TIMER_CFG_B_PERIODIC_UP 0x00003200 // Timer B periodic up-count timer
86 #define TIMER_CFG_B_CAP_COUNT 0x00000300 // Timer B event counter
87 #define TIMER_CFG_B_CAP_COUNT_UP 0x00001300 // Timer B event up-counter
88 #define TIMER_CFG_B_CAP_TIME 0x00000700 // Timer B event timer
89 #define TIMER_CFG_B_CAP_TIME_UP 0x00001700 // Timer B event up-count timer
90 #define TIMER_CFG_B_PWM 0x00000A00 // Timer B PWM output
92 //*****************************************************************************
94 // Values that can be passed to TimerIntEnable, TimerIntDisable, and
95 // TimerIntClear as the ulIntFlags parameter, and returned from TimerIntStatus.
97 //*****************************************************************************
99 #define TIMER_TIMB_DMA 0x00002000 // TimerB DMA Done interrupt
100 #define TIMER_TIMB_MATCH 0x00000800 // TimerB match interrupt
101 #define TIMER_CAPB_EVENT 0x00000400 // CaptureB event interrupt
102 #define TIMER_CAPB_MATCH 0x00000200 // CaptureB match interrupt
103 #define TIMER_TIMB_TIMEOUT 0x00000100 // TimerB time out interrupt
104 #define TIMER_TIMA_DMA 0x00000020 // TimerA DMA Done interrupt
105 #define TIMER_TIMA_MATCH 0x00000010 // TimerA match interrupt
106 #define TIMER_CAPA_EVENT 0x00000004 // CaptureA event interrupt
107 #define TIMER_CAPA_MATCH 0x00000002 // CaptureA match interrupt
108 #define TIMER_TIMA_TIMEOUT 0x00000001 // TimerA time out interrupt
110 //*****************************************************************************
112 // Values that can be passed to TimerControlEvent as the ulEvent parameter.
114 //*****************************************************************************
115 #define TIMER_EVENT_POS_EDGE 0x00000000 // Count positive edges
116 #define TIMER_EVENT_NEG_EDGE 0x00000404 // Count negative edges
117 #define TIMER_EVENT_BOTH_EDGES 0x00000C0C // Count both edges
119 //*****************************************************************************
121 // Values that can be passed to most of the timer APIs as the ulTimer
124 //*****************************************************************************
125 #define TIMER_A 0x000000ff // Timer A
126 #define TIMER_B 0x0000ff00 // Timer B
127 #define TIMER_BOTH 0x0000ffff // Timer Both
130 //*****************************************************************************
132 // Values that can be passed to TimerSynchronize as the ulTimers parameter.
134 //*****************************************************************************
135 #define TIMER_0A_SYNC 0x00000001 // Synchronize Timer 0A
136 #define TIMER_0B_SYNC 0x00000002 // Synchronize Timer 0B
137 #define TIMER_1A_SYNC 0x00000004 // Synchronize Timer 1A
138 #define TIMER_1B_SYNC 0x00000008 // Synchronize Timer 1B
139 #define TIMER_2A_SYNC 0x00000010 // Synchronize Timer 2A
140 #define TIMER_2B_SYNC 0x00000020 // Synchronize Timer 2B
141 #define TIMER_3A_SYNC 0x00000040 // Synchronize Timer 3A
142 #define TIMER_3B_SYNC 0x00000080 // Synchronize Timer 3B
144 //*****************************************************************************
146 // Values that can be passed to TimerDMAEventSet() or returned from
147 // TimerDMAEventGet().
149 //*****************************************************************************
150 #define TIMER_DMA_MODEMATCH_B 0x00000800
151 #define TIMER_DMA_CAPEVENT_B 0x00000400
152 #define TIMER_DMA_CAPMATCH_B 0x00000200
153 #define TIMER_DMA_TIMEOUT_B 0x00000100
154 #define TIMER_DMA_MODEMATCH_A 0x00000010
155 #define TIMER_DMA_CAPEVENT_A 0x00000004
156 #define TIMER_DMA_CAPMATCH_A 0x00000002
157 #define TIMER_DMA_TIMEOUT_A 0x00000001
160 //*****************************************************************************
162 // Prototypes for the APIs.
164 //*****************************************************************************
165 extern void TimerEnable(unsigned long ulBase, unsigned long ulTimer);
166 extern void TimerDisable(unsigned long ulBase, unsigned long ulTimer);
167 extern void TimerConfigure(unsigned long ulBase, unsigned long ulConfig);
168 extern void TimerControlLevel(unsigned long ulBase, unsigned long ulTimer,
170 extern void TimerControlEvent(unsigned long ulBase, unsigned long ulTimer,
171 unsigned long ulEvent);
172 extern void TimerControlStall(unsigned long ulBase, unsigned long ulTimer,
174 extern void TimerPrescaleSet(unsigned long ulBase, unsigned long ulTimer,
175 unsigned long ulValue);
176 extern unsigned long TimerPrescaleGet(unsigned long ulBase,
177 unsigned long ulTimer);
178 extern void TimerPrescaleMatchSet(unsigned long ulBase, unsigned long ulTimer,
179 unsigned long ulValue);
180 extern unsigned long TimerPrescaleMatchGet(unsigned long ulBase,
181 unsigned long ulTimer);
182 extern void TimerLoadSet(unsigned long ulBase, unsigned long ulTimer,
183 unsigned long ulValue);
184 extern unsigned long TimerLoadGet(unsigned long ulBase, unsigned long ulTimer);
186 extern unsigned long TimerValueGet(unsigned long ulBase,
187 unsigned long ulTimer);
188 extern void TimerValueSet(unsigned long ulBase, unsigned long ulTimer,
189 unsigned long ulValue);
191 extern void TimerMatchSet(unsigned long ulBase, unsigned long ulTimer,
192 unsigned long ulValue);
193 extern unsigned long TimerMatchGet(unsigned long ulBase,
194 unsigned long ulTimer);
195 extern void TimerIntRegister(unsigned long ulBase, unsigned long ulTimer,
196 void (*pfnHandler)(void));
197 extern void TimerIntUnregister(unsigned long ulBase, unsigned long ulTimer);
198 extern void TimerIntEnable(unsigned long ulBase, unsigned long ulIntFlags);
199 extern void TimerIntDisable(unsigned long ulBase, unsigned long ulIntFlags);
200 extern unsigned long TimerIntStatus(unsigned long ulBase, tBoolean bMasked);
201 extern void TimerIntClear(unsigned long ulBase, unsigned long ulIntFlags);
202 extern void TimerDMAEventSet(unsigned long ulBase, unsigned long ulDMAEvent);
203 extern unsigned long TimerDMAEventGet(unsigned long ulBase);
206 //*****************************************************************************
208 // Mark the end of the C bindings section for C++ compilers.
210 //*****************************************************************************
215 #endif // __TIMER_H__