TimerCC32XX.h
Go to the documentation of this file.
1 /*
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  */
32 /*!*****************************************************************************
33  * @file TimerCC32XX.h
34  * @brief Timer driver interface for CC32XX devices
35  *
36  * # Operation #
37  * This driver implements half and full width general purpose timers for the
38  * CC32XX device. For CC32XX devices, the system clock is 80 MHz and a 16-bit
39  * timer has 24-bits of resolution. The desired period may not always be
40  * achieved due to hardware limitations, such as the aforementioned. The timer
41  * resolution is limited to 12.5ns due to the 80 MHz clock. A timer period no
42  * greater than 209,714us can be achieved when operating in 16-bit mode.
43  * Similarly, a period no greater than 53,687,090us can be achieved when
44  * operating in 32-bit mode. The same time contraints apply to the 16-bit
45  * timer when attempting to use a frequency less than 5 hertz. For additional
46  * details, refer to the device's technical reference manual.
47  *
48  * # Resource Allocation #
49  * Each general purpose timer block contains two timers, Timer A and Timer B,
50  * that can be configured to operate independently; or concatenated to operate
51  * as one 32-bit timer. This behavior is managed through a set of resource
52  * allocation APIs. For example, the TimerCC32XX_allocateTimerResource API
53  * will allocate a timer for exclusive use. Any attempt to allocate this
54  * resource in the future will result in a false value being returned from the
55  * allocation API. To free a timer resource, the TimerCC32XX_freeTimerResource
56  * is used.
57  *
58  *******************************************************************************
59  */
60 #ifndef ti_drivers_timer_TimerCC32XX__include
61 #define ti_drivers_timer_TimerCC32XX__include
62 
63 #ifdef __cplusplus
64 extern "C"
65 {
66 #endif
67 
68 #include <stdbool.h>
69 #include <stdint.h>
70 
71 #include <ti/drivers/Timer.h>
72 #include <ti/drivers/Power.h>
73 #include <ti/drivers/dpl/HwiP.h>
74 #include <ti/drivers/dpl/SemaphoreP.h>
75 
87 typedef enum TimerCC32XX_SubTimer_ {
92 
94 
126 typedef struct TimerCC32XX_HWAttrs_ {
128  uint32_t baseAddress;
129 
132 
134  uint32_t intNum;
135 
137  uint32_t intPriority;
139 
145 typedef struct TimerCC32XX_Object_ {
146  HwiP_Handle hwiHandle;
148  SemaphoreP_Handle timerSem;
151  uint32_t timer;
152  uint32_t period;
153  uint32_t prescaler;
154  bool isRunning;
156 
176 
195 extern void TimerCC32XX_freeTimerResource(uint32_t baseAddress,
197 
198 #ifdef __cplusplus
199 }
200 #endif
201 
202 #endif /* ti_drivers_timer_TimerCC32XX__include */
Definition: TimerCC32XX.h:89
HwiP_Handle hwiHandle
Definition: TimerCC32XX.h:146
The definition of a timer function table that contains the required set of functions to control a spe...
Definition: Timer.h:350
Definition: TimerCC32XX.h:88
uint32_t intPriority
Definition: TimerCC32XX.h:137
Power manager interface.
enum Timer_Mode_ Timer_Mode
Timer mode settings.
Power notify object structure.
Definition: Power.h:113
uint32_t prescaler
Definition: TimerCC32XX.h:153
struct TimerCC32XX_Object_ TimerCC32XX_Object
TimerCC32XX_Object.
uint32_t timer
Definition: TimerCC32XX.h:151
Timer_Mode mode
Definition: TimerCC32XX.h:150
bool TimerCC32XX_allocateTimerResource(uint32_t baseAddress, TimerCC32XX_SubTimer subTimer)
Function to allocate a timer peripheral.
enum TimerCC32XX_SubTimer_ TimerCC32XX_SubTimer
uint32_t baseAddress
Definition: TimerCC32XX.h:128
uint32_t period
Definition: TimerCC32XX.h:152
bool isRunning
Definition: TimerCC32XX.h:154
void TimerCC32XX_freeTimerResource(uint32_t baseAddress, TimerCC32XX_SubTimer subTimer)
Function to de-allocate a timer peripheral.
Timer driver interface.
TimerCC32XX Hardware Attributes.
Definition: TimerCC32XX.h:126
TimerCC32XX_Object.
Definition: TimerCC32XX.h:145
Timer_CallBackFxn callBack
Definition: TimerCC32XX.h:149
TimerCC32XX_SubTimer subTimer
Definition: TimerCC32XX.h:131
struct TimerCC32XX_HWAttrs_ TimerCC32XX_HWAttrs
TimerCC32XX Hardware Attributes.
Power_NotifyObj notifyObj
Definition: TimerCC32XX.h:147
uint32_t intNum
Definition: TimerCC32XX.h:134
Definition: TimerCC32XX.h:90
TimerCC32XX_SubTimer_
Definition: TimerCC32XX.h:87
const Timer_FxnTable TimerCC32XX_fxnTable
void(* Timer_CallBackFxn)(Timer_Handle handle)
Timer callback function.
Definition: Timer.h:277
SemaphoreP_Handle timerSem
Definition: TimerCC32XX.h:148
Copyright 2017, Texas Instruments Incorporated