PWMTimerCC32XX.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015-2019, 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  */
150 #ifndef ti_driver_pwm_PWMTimerCC32XX__include
151 #define ti_driver_pwm_PWMTimerCC32XX__include
152 
153 #include <stdbool.h>
154 #include <ti/drivers/Power.h>
155 #include <ti/drivers/PWM.h>
156 
157 #ifdef __cplusplus
158 extern "C" {
159 #endif
160 
162 /*
163  * PWMTimer port/pin defines for pin configuration.
164  *
165  * The timer id (0, 1, 2, or 3) is stored in bits 31 - 28
166  * The timer half (0 = A, 1 = B) is stored in bits 27 - 24
167  * The GPIO port (0, 1, 2, or 3) is stored in bits 23 - 20
168  * The GPIO pin index within the port (0 - 7) is stored in bits 19 - 16
169  * The pin mode is stored in bits 11 - 8
170  * The pin number is stored in bits 7 - 0
171  *
172  *
173  * 31 - 28 27 - 24 23 - 20 19 - 16 11 - 8 7 - 0
174  * -----------------------------------------------------------------------
175  * | Timer id | Timer half | GPIO port | GPIO pin index | pin mode | pin |
176  * -----------------------------------------------------------------------
177  *
178  * The CC32XX has fixed GPIO assignments and pin modes for a given pin.
179  * A PWM pin mode for a given pin has a fixed timer/timer-half.
180  */
181 #define PWMTimerCC32XX_T0A (0x00 << 24)
182 #define PWMTimerCC32XX_T0B (0x01 << 24)
183 #define PWMTimerCC32XX_T1A (0x10 << 24)
184 #define PWMTimerCC32XX_T1B (0x11 << 24)
185 #define PWMTimerCC32XX_T2A (0x20 << 24)
186 #define PWMTimerCC32XX_T2B (0x21 << 24)
187 #define PWMTimerCC32XX_T3A (0x30 << 24)
188 #define PWMTimerCC32XX_T3B (0x31 << 24)
189 
190 #define PWMTimerCC32XX_GPIO9 (0x11 << 16)
191 #define PWMTimerCC32XX_GPIO10 (0x12 << 16)
192 #define PWMTimerCC32XX_GPIO11 (0x13 << 16)
193 #define PWMTimerCC32XX_GPIO24 (0x30 << 16)
194 #define PWMTimerCC32XX_GPIO25 (0x31 << 16)
195 
196 #define PWMTimerCC32XX_GPIONONE (0xFF << 16)
197 
207 #define PWMTimerCC32XX_PIN_01 (PWMTimerCC32XX_T3A | PWMTimerCC32XX_GPIO10 | 0x0300)
213 #define PWMTimerCC32XX_PIN_02 (PWMTimerCC32XX_T3B | PWMTimerCC32XX_GPIO11 | 0x0301)
219 #define PWMTimerCC32XX_PIN_17 (PWMTimerCC32XX_T0A | PWMTimerCC32XX_GPIO24 | 0x0510)
225 #define PWMTimerCC32XX_PIN_19 (PWMTimerCC32XX_T1B | PWMTimerCC32XX_GPIONONE | 0x0812)
231 #define PWMTimerCC32XX_PIN_21 (PWMTimerCC32XX_T1A | PWMTimerCC32XX_GPIO25 | 0x0914)
237 #define PWMTimerCC32XX_PIN_64 (PWMTimerCC32XX_T2B | PWMTimerCC32XX_GPIO9 | 0x033F)
251 /* Add PWMTimerCC32XX_STATUS_* macros here */
252 
265 /* Add PWMTimerCC32XX_CMD_* macros here */
266 
269 /* PWM function table pointer */
271 
293 typedef struct {
294  uint32_t pwmPin;
297 
303 typedef struct {
305  uint32_t duty; /* Current duty cycle in Duty_Unites */
306  uint32_t period; /* Current period PERIOD_Units */
307  PWM_Duty_Units dutyUnits; /* Current duty cycle unit */
308  PWM_Period_Units periodUnits; /* Current period unit */
309  PWM_IdleLevel idleLevel; /* PWM idle level when stopped / not started */
310  bool pwmStarted; /* Used to gate Power_set/releaseConstraint() calls */
311  bool isOpen; /* open flag used to check if PWM is opened */
313 
314 #ifdef __cplusplus
315 }
316 #endif
317 
318 #endif /* ti_driver_pwm_PWMTimerCC32XX__include */
uint32_t duty
Definition: PWMTimerCC32XX.h:305
PWM_Duty_Units
PWM duty cycle unit definitions. Refer to device specific implementation if using PWM_DUTY_COUNTS (ra...
Definition: PWM.h:306
PWM_IdleLevel idleLevel
Definition: PWMTimerCC32XX.h:309
bool pwmStarted
Definition: PWMTimerCC32XX.h:310
Power Manager.
bool isOpen
Definition: PWMTimerCC32XX.h:311
Pulse Width Modulation (PWM) driver.
PWM_Period_Units
PWM period unit definitions. Refer to device specific implementation if using PWM_PERIOD_COUNTS (raw ...
Definition: PWM.h:295
uint32_t pwmPin
Definition: PWMTimerCC32XX.h:294
PWMTimerCC32XX Hardware attributes.
Definition: PWMTimerCC32XX.h:293
const PWM_FxnTable PWMTimerCC32XX_fxnTable
The definition of a PWM function table that contains the required set of functions to control a speci...
Definition: PWM.h:410
PWMTimerCC32XX Object.
Definition: PWMTimerCC32XX.h:303
Power notify object structure.
Definition: Power.h:443
uint32_t period
Definition: PWMTimerCC32XX.h:306
PWM_Period_Units periodUnits
Definition: PWMTimerCC32XX.h:308
PWM_IdleLevel
Idle output level when PWM is not running (stopped / not started).
Definition: PWM.h:320
Power_NotifyObj postNotify
Definition: PWMTimerCC32XX.h:304
PWM_Duty_Units dutyUnits
Definition: PWMTimerCC32XX.h:307
© Copyright 1995-2019, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale