Data Structures | Functions | Variables
TimerMSP432.h File Reference

Detailed Description

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().

MPS432 Timer Driver Configuration

In order to use the Timer APIs, the application is required to define 4 configuration items in the application ti_drivers_config.c file:

  1. An array of TimerMSP432_Object elements, which will be used by by the driver to maintain instance state. Below is an example TimerMSP432_Object array appropriate for the MSP432 LaunchPad board:
    TimerMSP432_Object timerMSP432Objects[3];
  2. An array of TimerMSP432_HWAttrs elements that defines which

Below is an example TimerMSP432_HWAttrs array appropriate for the MSP432 LaunchPad board:

const TimerMSP432_HWAttrs timerMSP432HWAttrs[3] =
.timerBaseAddress = TIMER32_0_BASE,
.intNum = INT_T32_INT1,
.intPriority = ~0,
.timerBaseAddress = TIMER_A1_BASE,
.intNum = INT_TA1_0,
.intPriority = ~0,
.timerBaseAddress = TIMER_A2_BASE,
.intNum = INT_TA2_0,
.intPriority = ~0,
  1. An array of Timer_Config elements, one for each Timer instance. Each element of this array identifies the device-specific API function table, the device specific timer object instance, and the device specific Hardware Attributes to be used for each timer instance. Below is an example Timer_Config array appropriate for the MSP432 LaunchPad board:
    const Timer_Config Timer_config[3] = {
    .object = &timerMSP432Objects[0],
    .hwAttrs = &timerMSP432HWAttrs[0]
    .object = &timerMSP432Objects[1],
    .hwAttrs = &timerMSP432HWAttrs[1]
    .object = &timerMSP432Objects[2],
    .hwAttrs = &timerMSP432HWAttrs[2]
  2. A global variable, Timer_count, that informs the driver how many timer instances are defined:
    const uint_least8_t Timer_count = 3;

Resource Allocation

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.

Power Management

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>
Include dependency graph for TimerMSP432.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  TimerMSP432_HWAttrs
 TimerMSP432 Hardware Attributes. More...
struct  TimerMSP432_Object
 TimerMSP432 Object. More...


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...


const Timer_FxnTable TimerMSP432_Timer_A_fxnTable
const Timer_FxnTable TimerMSP432_Timer32_fxnTable

Function Documentation

§ TimerMSP432_allocateTimerResource()

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.

baseAddressThe base address of a timer hardware peripheral.
A bool returning true if the timer resource was successfully allocated. If the base address is not valid or if the resource is not available, false is returned.
See also

§ TimerMSP432_freeTimerResource()

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();

A successful call to TimerMSP432_allocateTimerResource() using the baseAddress must have been made prior to calling this API.
baseAddressThe base address of a timer hardware peripheral.
See also

Variable Documentation

§ TimerMSP432_Timer_A_fxnTable

const Timer_FxnTable TimerMSP432_Timer_A_fxnTable

§ TimerMSP432_Timer32_fxnTable

const Timer_FxnTable TimerMSP432_Timer32_fxnTable
© Copyright 1995-2019, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale