timer32.h
Go to the documentation of this file.
1 /* --COPYRIGHT--,BSD
2  * Copyright (c) 2017, Texas Instruments Incorporated
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *
9  * * Redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer.
11  *
12  * * Redistributions in binary form must reproduce the above copyright
13  * notice, this list of conditions and the following disclaimer in the
14  * documentation and/or other materials provided with the distribution.
15  *
16  * * Neither the name of Texas Instruments Incorporated nor the names of
17  * its contributors may be used to endorse or promote products derived
18  * from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  * --/COPYRIGHT--*/
32 #ifndef TIMER32_H_
33 #define TIMER32_H_
34 
35 //*****************************************************************************
36 //
39 //
40 //*****************************************************************************
41 
42 //*****************************************************************************
43 //
44 // If building with a C++ compiler, make all of the definitions in this header
45 // have a C binding.
46 //
47 //*****************************************************************************
48 #ifdef __cplusplus
49 extern "C"
50 {
51 #endif
52 #include <stdint.h>
53 #include <stdbool.h>
54 #include <ti/devices/msp432p4xx/inc/msp.h>
55 
56 //*****************************************************************************
57 //
58 // Control specific variables
59 //
60 //*****************************************************************************
61 #define TIMER32_CMSIS(x) ((Timer32_Type *) x)
62 
63 #define TIMER_OFFSET 0x020
64 
65 #define TIMER32_0_BASE (uint32_t)TIMER32_1
66 #define TIMER32_1_BASE (uint32_t)TIMER32_2
67 
68 #define TIMER32_0_INTERRUPT INT_T32_INT1
69 #define TIMER32_1_INTERRUPT INT_T32_INT2
70 #define TIMER32_COMBINED_INTERRUPT INT_T32_INTC
71 
72 #define TIMER32_16BIT 0x00
73 #define TIMER32_32BIT 0x01
74 
75 #define TIMER32_PRESCALER_1 0x00
76 #define TIMER32_PRESCALER_16 0x04
77 #define TIMER32_PRESCALER_256 0x08
78 
79 #define TIMER32_FREE_RUN_MODE 0x00
80 #define TIMER32_PERIODIC_MODE 0x01
81 
82 //*****************************************************************************
83 //
84 // API Function prototypes
85 //
86 //*****************************************************************************
87 
88 //*****************************************************************************
89 //
117 //
118 //*****************************************************************************
119 extern void Timer32_initModule(uint32_t timer, uint32_t preScaler,
120  uint32_t resolution, uint32_t mode);
121 
122 //*****************************************************************************
123 //
141 //
142 //*****************************************************************************
143 extern void Timer32_setCount(uint32_t timer, uint32_t count);
144 
145 //*****************************************************************************
146 //
164 //
165 //*****************************************************************************
166 extern void Timer32_setCountInBackground(uint32_t timer, uint32_t count);
167 
168 //*****************************************************************************
169 //
178 //
179 //*****************************************************************************
180 extern uint32_t Timer32_getValue(uint32_t timer);
181 
182 //*****************************************************************************
183 //
186 // starting the timer.
204 //
205 //*****************************************************************************
206 extern void Timer32_startTimer(uint32_t timer, bool oneShot);
207 
208 //*****************************************************************************
209 //
218 //
219 //*****************************************************************************
220 extern void Timer32_haltTimer(uint32_t timer);
221 
222 //*****************************************************************************
223 //
234 //
235 //*****************************************************************************
236 extern void Timer32_enableInterrupt(uint32_t timer);
237 
238 //*****************************************************************************
239 //
250 //
251 //*****************************************************************************
252 extern void Timer32_disableInterrupt(uint32_t timer);
253 
254 //*****************************************************************************
255 //
266 //
267 //*****************************************************************************
268 extern void Timer32_clearInterruptFlag(uint32_t timer);
269 
270 //*****************************************************************************
271 //
284 //
285 //*****************************************************************************
286 extern uint32_t Timer32_getInterruptStatus(uint32_t timer);
287 
288 //*****************************************************************************
289 //
311 //
312 //*****************************************************************************
313 extern void Timer32_registerInterrupt(uint32_t timerInterrupt,
314  void (*intHandler)(void));
315 
316 //*****************************************************************************
317 //
336 //
337 //*****************************************************************************
338 extern void Timer32_unregisterInterrupt(uint32_t timerInterrupt);
339 
340 //*****************************************************************************
341 //
342 // Mark the end of the C bindings section for C++ compilers.
343 //
344 //*****************************************************************************
345 #ifdef __cplusplus
346 }
347 #endif
348 
349 //*****************************************************************************
350 //
351 // Close the Doxygen group.
353 //
354 //*****************************************************************************
355 
356 #endif /* TIMER32_H_ */
void Timer32_clearInterruptFlag(uint32_t timer)
Definition: timer32.c:124
void Timer32_setCountInBackground(uint32_t timer, uint32_t count)
Definition: timer32.c:79
void Timer32_setCount(uint32_t timer, uint32_t count)
Definition: timer32.c:70
uint32_t Timer32_getValue(uint32_t timer)
Definition: timer32.c:88
void Timer32_initModule(uint32_t timer, uint32_t preScaler, uint32_t resolution, uint32_t mode)
Definition: timer32.c:36
void Timer32_haltTimer(uint32_t timer)
Definition: timer32.c:107
void Timer32_startTimer(uint32_t timer, bool oneShot)
Definition: timer32.c:93
void Timer32_disableInterrupt(uint32_t timer)
Definition: timer32.c:119
uint32_t Timer32_getInterruptStatus(uint32_t timer)
Definition: timer32.c:129
void Timer32_registerInterrupt(uint32_t timerInterrupt, void(*intHandler)(void))
Definition: timer32.c:134
void Timer32_unregisterInterrupt(uint32_t timerInterrupt)
Definition: timer32.c:141
void Timer32_enableInterrupt(uint32_t timer)
Definition: timer32.c:114

Copyright 2018, Texas Instruments Incorporated