AM64x MCU+ SDK  10.01.00

Introduction

This module contains APIs to program and use the GPTIMER modules.

Files

file  gp_timer/v0/gp_timer.h
 GPTIMER Driver API/interface file.
 

Data Structures

struct  GPTIMER_HwAttrs
 GPTIMER Hardware attributes. More...
 
struct  GPTIMER_Params
 GPTIMER Parameters. More...
 
struct  GPTIMER_Compare_Config
 GPTIMER Compare Mode Configuration Parameters. More...
 
struct  GPTIMER_Capture_Config
 GPTIMER Capture Mode Configuration Parameters. More...
 
struct  GPTIMER_PWM_Config
 GPTIMER PWM Generation Mode Configuration Parameters. More...
 
struct  GPTIMER_Object
 GPTIMER driver object. More...
 
struct  GPTIMER_Config
 GPTIMER Global Configuration. More...
 

Functions

void GPTIMER_init (void)
 Initialize the GPTIMER module. More...
 
void GPTIMER_deinit (void)
 De-initialize the GPTIMER module. More...
 
void GPTIMER_Params_init (GPTIMER_Params *params)
 Function to set default values of GPTIMER_Params in params. More...
 
GPTIMER_Handle GPTIMER_open (uint32_t idx, const GPTIMER_Params *params)
 Open the GPTIMER at index idx with parameters params. More...
 
void GPTIMER_close (GPTIMER_Handle handle)
 Function to close the GPTIMER Peripheral specified by the handle. More...
 
void GPTIMER_start (GPTIMER_Handle handle)
 Start the Timer. More...
 
void GPTIMER_stop (GPTIMER_Handle handle)
 Stop the TImer. More...
 
uint32_t GPTIMER_getCount (GPTIMER_Handle handle)
 Get timer counter value. More...
 
void GPTIMER_setCount (GPTIMER_Handle handle, uint32_t value)
 Set timer counter value. More...
 
void GPTIMER_setCompareVal (GPTIMER_Handle handle, uint32_t value)
 Set timer compare value. More...
 
uint32_t GPTIMER_getTimerCaptureVal1 (GPTIMER_Handle handle)
 Get Timer Capture Value 1. More...
 
uint32_t GPTIMER_getTimerCaptureVal2 (GPTIMER_Handle handle)
 Get Timer Capture Value 2. More...
 
int32_t GPTIMER_setTimerConfigMode (GPTIMER_Handle handle, uint32_t timerConfigMode, void *config)
 Change Timer Configuration. More...
 
void GPTIMER_setCallbackFxn (GPTIMER_Handle handle, GPTIMER_OverflowCallbackFxn overflowCbFxn, GPTIMER_CompareMatchCallbackFxn compMatchCbFxn, GPTIMER_CaptureCallbackFxn captureCbFxn)
 Update Callback Functions. More...
 
uint32_t GPTIMER_getIRQStatus (GPTIMER_Handle handle)
 Get IRQ status. More...
 
void GPTIMER_clearIRQStatus (GPTIMER_Handle handle, uint32_t irqMask)
 Clear IRQ status bit. More...
 
void GPTIMER_enableInterruptStatus (GPTIMER_Handle handle, uint32_t irqMask)
 Enable IRQ Status, Corresponding status bit will be set in case of an event. Interrupt and callback will be called if interrupt is registered. More...
 
void GPTIMER_disableInterruptStatus (GPTIMER_Handle handle, uint32_t irqMask)
 Disable IRQ Status. More...
 

Typedefs

typedef struct GPTIMER_Config_s * GPTIMER_Handle
 A handle that is returned from a GPTIMER_open() call. More...
 
typedef void(* GPTIMER_OverflowCallbackFxn) (GPTIMER_Handle handle)
 GPTIMER Overflow Callback Function. More...
 
typedef void(* GPTIMER_CompareMatchCallbackFxn) (GPTIMER_Handle handle)
 GPTIMER Compare Match Callback Function. More...
 
typedef void(* GPTIMER_CaptureCallbackFxn) (GPTIMER_Handle handle)
 GPTIMER Capture Callback Function. More...
 

MACROS for the possible Configurations of GPTIMER.

#define GPTIMER_MODE_CONFIG_FREE_RUN   ((uint8_t) 0U)
 Free Running Mode. More...
 
#define GPTIMER_MODE_CONFIG_INPUT_CAPTURE   ((uint8_t) 1U)
 Input Capture Mode. More...
 
#define GPTIMER_MODE_CONFIG_OUTPUT_COMPARE   ((uint8_t) 2U)
 Output Compare Mode. More...
 
#define GPTIMER_MODE_CONFIG_PWM_GEN   ((uint8_t) 3U)
 PWM Generation Mode. More...
 

MACROS for the possible Configurations of GPTIMER input Capture Mode.

#define GPTIMER_INPUT_CAPTURE_MODE_SINGLE   ((uint32_t) 0U)
 Capture Single Event. More...
 
#define GPTIMER_INPUT_CAPTURE_MODE_SECOND   ((uint32_t) 1U)
 Capture Two Events. More...
 

MACROS for the possible Configurations of GPTIMER input Capture event.

#define GPTIMER_INPUT_CAPTURE_EVENT_NO_CAPTURE   ((uint32_t) 0U)
 No Event Capture. More...
 
#define GPTIMER_INPUT_CAPTURE_EVENT_RISING   ((uint32_t) 1U)
 Capture Event on Rising Edge. More...
 
#define GPTIMER_INPUT_CAPTURE_EVENT_FALLING   ((uint32_t) 2U)
 Capture Event on Falling Edge. More...
 
#define GPTIMER_INPUT_CAPTURE_EVENT_EDGE   ((uint32_t) 3U)
 Capture Event on both rising and falling edge. More...
 

MACROS for the possible Configurations of GPTIMER PWM output Trigger.

#define GPTIMER_PWM_OUT_NO_TRIGGER   ((uint32_t) 0U)
 PWM Uses No Trigger. More...
 
#define GPTIMER_PWM_OUT_OVERFLOW_TRIGGER   ((uint32_t) 1U)
 PWM uses overflow as a Trigger. More...
 
#define GPTIMER_PWM_OUT_OVERFLOW_MATCH_TRIGGER   ((uint32_t) 2U)
 PWM uses overflow and compare match as a trigger. More...
 

MACROS for the possible Configurations of PWM output Pin Default Val.

#define GPTIMER_PWM_OUT_PIN_DEFAULT_0   ((uint32_t) 0U)
 Pin Default value 0. More...
 
#define GPTIMER_PWM_OUT_PIN_DEFAULT_1   ((uint32_t) 1U)
 Pin Default value 0. More...
 

MACROS for the possible Configurations of PWM output Pin Modulation

Type.

#define GPTIMER_PWM_OUT_PIN_MODULATION_PULSE   ((uint32_t) 0U)
 Pin Modulation type Pulse. More...
 
#define GPTIMER_PWM_OUT_PIN_MODULATION_TOGGLE   ((uint32_t) 1U)
 Pin Modulation type Toggle. More...
 

MACROS for the possible IRQ Status Mask.

#define TIMER_IRQ_TCAR_IT_FLAG_MASK   (uint32_t)0x04U
 
#define TIMER_IRQ_OVF_IT_FLAG_MASK   (uint32_t)0x02U
 
#define TIMER_IRQ_MAT_IT_FLAG_MASK   (uint32_t)0x01U
 

Macro Definition Documentation

◆ GPTIMER_MODE_CONFIG_FREE_RUN

#define GPTIMER_MODE_CONFIG_FREE_RUN   ((uint8_t) 0U)

Free Running Mode.

◆ GPTIMER_MODE_CONFIG_INPUT_CAPTURE

#define GPTIMER_MODE_CONFIG_INPUT_CAPTURE   ((uint8_t) 1U)

Input Capture Mode.

◆ GPTIMER_MODE_CONFIG_OUTPUT_COMPARE

#define GPTIMER_MODE_CONFIG_OUTPUT_COMPARE   ((uint8_t) 2U)

Output Compare Mode.

◆ GPTIMER_MODE_CONFIG_PWM_GEN

#define GPTIMER_MODE_CONFIG_PWM_GEN   ((uint8_t) 3U)

PWM Generation Mode.

◆ GPTIMER_INPUT_CAPTURE_MODE_SINGLE

#define GPTIMER_INPUT_CAPTURE_MODE_SINGLE   ((uint32_t) 0U)

Capture Single Event.

◆ GPTIMER_INPUT_CAPTURE_MODE_SECOND

#define GPTIMER_INPUT_CAPTURE_MODE_SECOND   ((uint32_t) 1U)

Capture Two Events.

◆ GPTIMER_INPUT_CAPTURE_EVENT_NO_CAPTURE

#define GPTIMER_INPUT_CAPTURE_EVENT_NO_CAPTURE   ((uint32_t) 0U)

No Event Capture.

◆ GPTIMER_INPUT_CAPTURE_EVENT_RISING

#define GPTIMER_INPUT_CAPTURE_EVENT_RISING   ((uint32_t) 1U)

Capture Event on Rising Edge.

◆ GPTIMER_INPUT_CAPTURE_EVENT_FALLING

#define GPTIMER_INPUT_CAPTURE_EVENT_FALLING   ((uint32_t) 2U)

Capture Event on Falling Edge.

◆ GPTIMER_INPUT_CAPTURE_EVENT_EDGE

#define GPTIMER_INPUT_CAPTURE_EVENT_EDGE   ((uint32_t) 3U)

Capture Event on both rising and falling edge.

◆ GPTIMER_PWM_OUT_NO_TRIGGER

#define GPTIMER_PWM_OUT_NO_TRIGGER   ((uint32_t) 0U)

PWM Uses No Trigger.

◆ GPTIMER_PWM_OUT_OVERFLOW_TRIGGER

#define GPTIMER_PWM_OUT_OVERFLOW_TRIGGER   ((uint32_t) 1U)

PWM uses overflow as a Trigger.

◆ GPTIMER_PWM_OUT_OVERFLOW_MATCH_TRIGGER

#define GPTIMER_PWM_OUT_OVERFLOW_MATCH_TRIGGER   ((uint32_t) 2U)

PWM uses overflow and compare match as a trigger.

◆ GPTIMER_PWM_OUT_PIN_DEFAULT_0

#define GPTIMER_PWM_OUT_PIN_DEFAULT_0   ((uint32_t) 0U)

Pin Default value 0.

◆ GPTIMER_PWM_OUT_PIN_DEFAULT_1

#define GPTIMER_PWM_OUT_PIN_DEFAULT_1   ((uint32_t) 1U)

Pin Default value 0.

◆ GPTIMER_PWM_OUT_PIN_MODULATION_PULSE

#define GPTIMER_PWM_OUT_PIN_MODULATION_PULSE   ((uint32_t) 0U)

Pin Modulation type Pulse.

◆ GPTIMER_PWM_OUT_PIN_MODULATION_TOGGLE

#define GPTIMER_PWM_OUT_PIN_MODULATION_TOGGLE   ((uint32_t) 1U)

Pin Modulation type Toggle.

◆ TIMER_IRQ_TCAR_IT_FLAG_MASK

#define TIMER_IRQ_TCAR_IT_FLAG_MASK   (uint32_t)0x04U

◆ TIMER_IRQ_OVF_IT_FLAG_MASK

#define TIMER_IRQ_OVF_IT_FLAG_MASK   (uint32_t)0x02U

◆ TIMER_IRQ_MAT_IT_FLAG_MASK

#define TIMER_IRQ_MAT_IT_FLAG_MASK   (uint32_t)0x01U

Typedef Documentation

◆ GPTIMER_Handle

typedef struct GPTIMER_Config_s* GPTIMER_Handle

A handle that is returned from a GPTIMER_open() call.

◆ GPTIMER_OverflowCallbackFxn

typedef void(* GPTIMER_OverflowCallbackFxn) (GPTIMER_Handle handle)

GPTIMER Overflow Callback Function.

User definable callback function prototype. The GPTIMER driver will call the defined function and pass in the GPTIMER driver's handle when an overflow happens.

The callback will be called if the overflow interrupt is enabled.

Parameters
handleGPTIMER_Handle

◆ GPTIMER_CompareMatchCallbackFxn

typedef void(* GPTIMER_CompareMatchCallbackFxn) (GPTIMER_Handle handle)

GPTIMER Compare Match Callback Function.

User definable callback function prototype. The GPTIMER driver will call the defined function and pass in the GPTIMER driver's handle when a compare match happens.

The Callback will be called if the Compare Match interrupt is enabled.

Parameters
handleGPTIMER_Handle

◆ GPTIMER_CaptureCallbackFxn

typedef void(* GPTIMER_CaptureCallbackFxn) (GPTIMER_Handle handle)

GPTIMER Capture Callback Function.

User definable callback function prototype. The GPTIMER driver will call the defined function and pass in the GPTIMER driver's handle when a capture event happens.

The Callback will be called if the Capture interrupt is enabled.

Parameters
handleGPTIMER_Handle

Function Documentation

◆ GPTIMER_init()

void GPTIMER_init ( void  )

Initialize the GPTIMER module.

◆ GPTIMER_deinit()

void GPTIMER_deinit ( void  )

De-initialize the GPTIMER module.

◆ GPTIMER_Params_init()

void GPTIMER_Params_init ( GPTIMER_Params params)

Function to set default values of GPTIMER_Params in params.

Parameters
params[IN] pointer to the structure to be initialized

◆ GPTIMER_open()

GPTIMER_Handle GPTIMER_open ( uint32_t  idx,
const GPTIMER_Params params 
)

Open the GPTIMER at index idx with parameters params.

Parameters
idx[IN] Index of GPTIMER to open in global config
params[IN] GPTIMER_Params values to use for opening
Returns
GPTIMER_Handle

◆ GPTIMER_close()

void GPTIMER_close ( GPTIMER_Handle  handle)

Function to close the GPTIMER Peripheral specified by the handle.

Precondition
GPTIMER_open() has to be called first
Parameters
handle[IN] GPTIMER_Handle returned from GPTIMER_open()
See also
GPTIMER_open()

◆ GPTIMER_start()

void GPTIMER_start ( GPTIMER_Handle  handle)

Start the Timer.

Parameters
handle[IN] GPTIMER_Handle returned from GPTIMER_open()

◆ GPTIMER_stop()

void GPTIMER_stop ( GPTIMER_Handle  handle)

Stop the TImer.

Parameters
handle[IN] GPTIMER_Handle returned from GPTIMER_open()

◆ GPTIMER_getCount()

uint32_t GPTIMER_getCount ( GPTIMER_Handle  handle)

Get timer counter value.

Parameters
handle[IN] GPTIMER_Handle returned from GPTIMER_open()
Returns
Current Counter value

◆ GPTIMER_setCount()

void GPTIMER_setCount ( GPTIMER_Handle  handle,
uint32_t  value 
)

Set timer counter value.

Parameters
handle[IN] GPTIMER_Handle returned from GPTIMER_open()
value[IN] Counter value to be set

◆ GPTIMER_setCompareVal()

void GPTIMER_setCompareVal ( GPTIMER_Handle  handle,
uint32_t  value 
)

Set timer compare value.

Parameters
handle[IN] GPTIMER_Handle returned from GPTIMER_open()
value[IN] Compare value to be set

◆ GPTIMER_getTimerCaptureVal1()

uint32_t GPTIMER_getTimerCaptureVal1 ( GPTIMER_Handle  handle)

Get Timer Capture Value 1.

Parameters
handle[IN] GPTIMER_Handle returned from GPTIMER_open()
Returns
Capture Value 1

◆ GPTIMER_getTimerCaptureVal2()

uint32_t GPTIMER_getTimerCaptureVal2 ( GPTIMER_Handle  handle)

Get Timer Capture Value 2.

Parameters
handle[IN] GPTIMER_Handle returned from GPTIMER_open()
Returns
Capture Value 2

◆ GPTIMER_setTimerConfigMode()

int32_t GPTIMER_setTimerConfigMode ( GPTIMER_Handle  handle,
uint32_t  timerConfigMode,
void *  config 
)

Change Timer Configuration.

Parameters
handle[IN] GPTIMER_Handle returned from GPTIMER_open()
timerConfigMode[IN] Timer Config Mode GptimerConfigModes
config[IN] Pointer to the respective Configuration Structure.
Returns
SystemP_SUCCESS if successful; else error on failure

◆ GPTIMER_setCallbackFxn()

void GPTIMER_setCallbackFxn ( GPTIMER_Handle  handle,
GPTIMER_OverflowCallbackFxn  overflowCbFxn,
GPTIMER_CompareMatchCallbackFxn  compMatchCbFxn,
GPTIMER_CaptureCallbackFxn  captureCbFxn 
)

Update Callback Functions.

Parameters
handle[IN] GPTIMER_Handle returned from GPTIMER_open()
overflowCbFxn[IN] Overflow Callback
compMatchCbFxn[IN] Compare Match Callback
captureCbFxn[IN] Capture Callback

◆ GPTIMER_getIRQStatus()

uint32_t GPTIMER_getIRQStatus ( GPTIMER_Handle  handle)

Get IRQ status.

Parameters
handle[IN] GPTIMER_Handle returned from GPTIMER_open()

◆ GPTIMER_clearIRQStatus()

void GPTIMER_clearIRQStatus ( GPTIMER_Handle  handle,
uint32_t  irqMask 
)

Clear IRQ status bit.

Parameters
handle[IN] GPTIMER_Handle returned from GPTIMER_open()
irqMask[IN] IRQ Mask GptimerIrqMask

◆ GPTIMER_enableInterruptStatus()

void GPTIMER_enableInterruptStatus ( GPTIMER_Handle  handle,
uint32_t  irqMask 
)

Enable IRQ Status, Corresponding status bit will be set in case of an event. Interrupt and callback will be called if interrupt is registered.

Parameters
handle[IN] GPTIMER_Handle returned from GPTIMER_open()
irqMask[IN] IRQ Mask GptimerIrqMask

◆ GPTIMER_disableInterruptStatus()

void GPTIMER_disableInterruptStatus ( GPTIMER_Handle  handle,
uint32_t  irqMask 
)

Disable IRQ Status.

Parameters
handle[IN] GPTIMER_Handle returned from GPTIMER_open()
irqMask[IN] IRQ Mask GptimerIrqMask