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 | |
#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 |
#define GPTIMER_MODE_CONFIG_FREE_RUN ((uint8_t) 0U) |
Free Running Mode.
#define GPTIMER_MODE_CONFIG_INPUT_CAPTURE ((uint8_t) 1U) |
Input Capture Mode.
#define GPTIMER_MODE_CONFIG_OUTPUT_COMPARE ((uint8_t) 2U) |
Output Compare Mode.
#define GPTIMER_MODE_CONFIG_PWM_GEN ((uint8_t) 3U) |
PWM Generation Mode.
#define GPTIMER_INPUT_CAPTURE_MODE_SINGLE ((uint32_t) 0U) |
Capture Single Event.
#define GPTIMER_INPUT_CAPTURE_MODE_SECOND ((uint32_t) 1U) |
Capture Two Events.
#define GPTIMER_INPUT_CAPTURE_EVENT_NO_CAPTURE ((uint32_t) 0U) |
No Event Capture.
#define GPTIMER_INPUT_CAPTURE_EVENT_RISING ((uint32_t) 1U) |
Capture Event on Rising Edge.
#define GPTIMER_INPUT_CAPTURE_EVENT_FALLING ((uint32_t) 2U) |
Capture Event on Falling Edge.
#define GPTIMER_INPUT_CAPTURE_EVENT_EDGE ((uint32_t) 3U) |
Capture Event on both rising and falling edge.
#define GPTIMER_PWM_OUT_NO_TRIGGER ((uint32_t) 0U) |
PWM Uses No Trigger.
#define GPTIMER_PWM_OUT_OVERFLOW_TRIGGER ((uint32_t) 1U) |
PWM uses overflow as a Trigger.
#define GPTIMER_PWM_OUT_OVERFLOW_MATCH_TRIGGER ((uint32_t) 2U) |
PWM uses overflow and compare match as a trigger.
#define GPTIMER_PWM_OUT_PIN_DEFAULT_0 ((uint32_t) 0U) |
Pin Default value 0.
#define GPTIMER_PWM_OUT_PIN_DEFAULT_1 ((uint32_t) 1U) |
Pin Default value 0.
#define GPTIMER_PWM_OUT_PIN_MODULATION_PULSE ((uint32_t) 0U) |
Pin Modulation type Pulse.
#define GPTIMER_PWM_OUT_PIN_MODULATION_TOGGLE ((uint32_t) 1U) |
Pin Modulation type Toggle.
#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 |
typedef struct GPTIMER_Config_s* GPTIMER_Handle |
A handle that is returned from a GPTIMER_open() call.
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.
handle | GPTIMER_Handle |
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.
handle | GPTIMER_Handle |
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.
handle | GPTIMER_Handle |
void GPTIMER_init | ( | void | ) |
Initialize the GPTIMER module.
void GPTIMER_deinit | ( | void | ) |
De-initialize the GPTIMER module.
void GPTIMER_Params_init | ( | GPTIMER_Params * | params | ) |
Function to set default values of GPTIMER_Params in params.
params | [IN] pointer to the structure to be initialized |
GPTIMER_Handle GPTIMER_open | ( | uint32_t | idx, |
const GPTIMER_Params * | params | ||
) |
Open the GPTIMER at index idx with parameters params.
idx | [IN] Index of GPTIMER to open in global config |
params | [IN] GPTIMER_Params values to use for opening |
void GPTIMER_close | ( | GPTIMER_Handle | handle | ) |
Function to close the GPTIMER Peripheral specified by the handle.
handle | [IN] GPTIMER_Handle returned from GPTIMER_open() |
void GPTIMER_start | ( | GPTIMER_Handle | handle | ) |
Start the Timer.
handle | [IN] GPTIMER_Handle returned from GPTIMER_open() |
void GPTIMER_stop | ( | GPTIMER_Handle | handle | ) |
Stop the TImer.
handle | [IN] GPTIMER_Handle returned from GPTIMER_open() |
uint32_t GPTIMER_getCount | ( | GPTIMER_Handle | handle | ) |
Get timer counter value.
handle | [IN] GPTIMER_Handle returned from GPTIMER_open() |
void GPTIMER_setCount | ( | GPTIMER_Handle | handle, |
uint32_t | value | ||
) |
Set timer counter value.
handle | [IN] GPTIMER_Handle returned from GPTIMER_open() |
value | [IN] Counter value to be set |
void GPTIMER_setCompareVal | ( | GPTIMER_Handle | handle, |
uint32_t | value | ||
) |
Set timer compare value.
handle | [IN] GPTIMER_Handle returned from GPTIMER_open() |
value | [IN] Compare value to be set |
uint32_t GPTIMER_getTimerCaptureVal1 | ( | GPTIMER_Handle | handle | ) |
Get Timer Capture Value 1.
handle | [IN] GPTIMER_Handle returned from GPTIMER_open() |
uint32_t GPTIMER_getTimerCaptureVal2 | ( | GPTIMER_Handle | handle | ) |
Get Timer Capture Value 2.
handle | [IN] GPTIMER_Handle returned from GPTIMER_open() |
int32_t GPTIMER_setTimerConfigMode | ( | GPTIMER_Handle | handle, |
uint32_t | timerConfigMode, | ||
void * | config | ||
) |
Change Timer Configuration.
handle | [IN] GPTIMER_Handle returned from GPTIMER_open() |
timerConfigMode | [IN] Timer Config Mode GptimerConfigModes |
config | [IN] Pointer to the respective Configuration Structure. |
void GPTIMER_setCallbackFxn | ( | GPTIMER_Handle | handle, |
GPTIMER_OverflowCallbackFxn | overflowCbFxn, | ||
GPTIMER_CompareMatchCallbackFxn | compMatchCbFxn, | ||
GPTIMER_CaptureCallbackFxn | captureCbFxn | ||
) |
Update Callback Functions.
handle | [IN] GPTIMER_Handle returned from GPTIMER_open() |
overflowCbFxn | [IN] Overflow Callback |
compMatchCbFxn | [IN] Compare Match Callback |
captureCbFxn | [IN] Capture Callback |
uint32_t GPTIMER_getIRQStatus | ( | GPTIMER_Handle | handle | ) |
Get IRQ status.
handle | [IN] GPTIMER_Handle returned from GPTIMER_open() |
void GPTIMER_clearIRQStatus | ( | GPTIMER_Handle | handle, |
uint32_t | irqMask | ||
) |
Clear IRQ status bit.
handle | [IN] GPTIMER_Handle returned from GPTIMER_open() |
irqMask | [IN] IRQ Mask GptimerIrqMask |
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.
handle | [IN] GPTIMER_Handle returned from GPTIMER_open() |
irqMask | [IN] IRQ Mask GptimerIrqMask |
void GPTIMER_disableInterruptStatus | ( | GPTIMER_Handle | handle, |
uint32_t | irqMask | ||
) |
Disable IRQ Status.
handle | [IN] GPTIMER_Handle returned from GPTIMER_open() |
irqMask | [IN] IRQ Mask GptimerIrqMask |