Timer driver interface for MSP432 devices.
This driver implements two independent hardware peripherals on the MSP432: Timer_A and Timer32. The Timer_A implementation supports two clock sources, SMCLK and ACLCK, with multiple clock dividers. The Timer32 implementation supports a single clock source, MCLK, with 3 clock dividers. For each driver instance, the configuration of the clock dividers is determined using the clock source, period, and period units. Note that the SMCLK and MCLK frequencies can change after Timer_open().
In order to use the Timer APIs, the application is required to define 4 configuration items in the application ti_drivers_config.c file:
Below is an example TimerMSP432_HWAttrs array appropriate for the MSP432 LaunchPad board:
Allocation of each timer peripheral is managed through a set of resource allocation APIs. For example, the TimerMSP432_allocateTimerResource API will allocate a timer for exclusive use. Any attempt to allocate this resource in the future will result in a false value being returned from the allocation API. To free a timer resource, the TimerMSP432_freeTimerResource is used. The application is not responsible for calling these allocation APIs directly.
The TI-RTOS power management framework will try to put the device into the most power efficient mode whenever possible. Please see the technical reference manual for further details on each power mode.
This driver supports dynamic power performance levels. The driver will determine which power performance levels are compatible with the desired period and period units. The driver prevents transitions to performance levels in which the period cannot be generated.
After a performance level change, the period is recalculated such that the generated period will remain the same. The exact period may vary after a performance level transition. This is due to a change in clock frequency and hence period per clock cycle.
The following statements are valid:
#include <stdbool.h>
#include <stdint.h>
#include <ti/drivers/Power.h>
#include <ti/drivers/Timer.h>
#include <ti/drivers/dpl/HwiP.h>
#include <ti/drivers/dpl/SemaphoreP.h>
Go to the source code of this file.
Data Structures | |
struct | TimerMSP432_HWAttrs |
TimerMSP432 Hardware Attributes. More... | |
struct | TimerMSP432_Object |
TimerMSP432 Object. More... | |
Functions | |
bool | TimerMSP432_allocateTimerResource (uint32_t baseAddress) |
Function to allocate a timer peripheral. More... | |
void | TimerMSP432_freeTimerResource (uint32_t baseAddress) |
Function to de-allocate a timer peripheral. More... | |
Variables | |
const Timer_FxnTable | TimerMSP432_Timer_A_fxnTable |
const Timer_FxnTable | TimerMSP432_Timer32_fxnTable |
bool TimerMSP432_allocateTimerResource | ( | uint32_t | baseAddress | ) |
Function to allocate a timer peripheral.
This function is intended to be used by any driver which implements a timer hardware peripheral.
baseAddress | The base address of a timer hardware peripheral. |
void TimerMSP432_freeTimerResource | ( | uint32_t | baseAddress | ) |
Function to de-allocate a timer peripheral.
This function is intended to be used by any driver which implements a timer hardware peripheral. Calling this function will release power constraints set in TimerMSP432_allocateTimerResource();
baseAddress | The base address of a timer hardware peripheral. |
const Timer_FxnTable TimerMSP432_Timer_A_fxnTable |
const Timer_FxnTable TimerMSP432_Timer32_fxnTable |