![]() |
PDK API Guide for J721E
|
TimerP interface
Files | |
file | TimerP.h |
Timer interface for the RTOS Porting Interface. | |
Data Structures | |
struct | TimerP_FreqHz |
Frequency-in-hertz struct. More... | |
struct | TimerP_Params |
Basic TimerP Parameters. More... | |
Functions | |
TimerP_Handle | TimerP_create (uint32_t id, TimerP_Fxn tickFxn, const TimerP_Params *timerParams) |
Function to create a timer object. More... | |
TimerP_Status | TimerP_delete (TimerP_Handle timerHandle) |
Function to delete a timer. More... | |
TimerP_Status | TimerP_setPeriodMicroSecs (TimerP_Handle timerHandle, uint32_t microsecs) |
Function to set timer period specified in micro seconds A best-effort method will be used to set the period register. There might be a slight rounding error based on resolution of timer period register. If the timer frequency cannot support the requested period, i.e. the timer period register cannot support the requested period, then this function returns false. TimerP_setPeriodMicroSecs() invokes TimerP_stop() prior to setting the period and leaves the timer in the stopped state. More... | |
void | TimerP_Params_init (TimerP_Params *timerParams) |
Initialize params structure to default values. More... | |
TimerP_Status | TimerP_start (TimerP_Handle timerHandle) |
Function to start a timer. More... | |
TimerP_Status | TimerP_stop (TimerP_Handle timerHandle) |
Function to stop a timer. More... | |
TimerP_Status | TimerP_ClearInterrupt (TimerP_Handle timerHandle) |
Function to clear the interrupt of the timer. More... | |
uint64_t | TimerP_getTimeInUsecs (void) |
Function to return current time in units of micro-secs. More... | |
uint32_t | TimerP_getReloadCount (TimerP_Handle timerHandle) |
Get timer reload count. More... | |
uint32_t | TimerP_getCount (TimerP_Handle timerHandle) |
Get timer current count. More... | |
Typedefs | |
typedef void * | TimerP_Handle |
Opaque client reference to an instance of a TimerP. More... | |
typedef void(* | TimerP_Fxn) (uintptr_t arg) |
Prototype for a TimerP function. More... | |
Enumerations | |
enum | TimerP_Status { TimerP_OK = 0, TimerP_FAILURE = (-(int32_t) 1), TimerP_NOT_AVAILABLE = (-(int32_t) 2), TimerP_BAD_INT_NUM = (-(int32_t) 3), TimerP_ISR_HOOK_ERR = (-(int32_t) 4) } |
Status codes for TimerP APIs. More... | |
enum | TimerP_Timer64Mode { TimerP_Timer64Mode_64BITGPTIMER, TimerP_Timer64Mode_UNCHAINED, TimerP_Timer64Mode_CHAINED } |
Timer mode for 64 bit timers (KeyStone devices) More... | |
enum | TimerP_Timer64Half { TimerP_Timer64Half_LOWER, TimerP_Timer64Half_UPPER, TimerP_Timer64Half_DEFAULT } |
Timer half when 64 bit timer is split into two 32 bit timer (Keystone devices) More... | |
Macros | |
#define | TimerP_ANY ((uint32_t)0xFEEDU) |
#define | TimerP_ANY_MAX_RESTRICTIONS ((uint32_t)15U) |
#define | TimerP_ID_INVALID ((uint32_t)0xFFFFU) |
#define | TimerP_MAX_PERIOD ((uint32_t)0xFFFFFFFFU) |
#define | TimerP_USE_DEFAULT ((uint32_t)0xFFFFFFFFU) |
Timer period units for TimerP APIs | |
typedef uint32_t | TimerP_PeriodType |
This enumerator defines the Timer Period unit. More... | |
#define | TimerP_PeriodType_MICROSECS ( (uint32_t) 0U) |
#define | TimerP_PeriodType_COUNTS ( (uint32_t) 1U) |
Timer runtime modes for TimerP APIs | |
typedef uint32_t | TimerP_RunMode |
This enumerator defines the Timer runtime modes. More... | |
#define | TimerP_RunMode_CONTINUOUS ( (uint32_t) 0U) |
#define | TimerP_RunMode_ONESHOT ( (uint32_t) 1U) |
Timer start modes for TimerP APIs | |
typedef uint32_t | TimerP_StartMode |
This enumerator defines the Timer start modes. More... | |
#define | TimerP_StartMode_AUTO ( (uint32_t) 0U) |
#define | TimerP_StartMode_USER ( (uint32_t) 1U) |
#define TimerP_ANY ((uint32_t)0xFEEDU) |
Const used to specify any timer
#define TimerP_ANY_MAX_RESTRICTIONS ((uint32_t)15U) |
Const used to specify maximum number of programmable restrictions for TimerP_ANY flag
#define TimerP_ID_INVALID ((uint32_t)0xFFFFU) |
Const used to specify invalid timer
#define TimerP_MAX_PERIOD ((uint32_t)0xFFFFFFFFU) |
Max value of Timer period for PeriodType_COUNTS
#define TimerP_USE_DEFAULT ((uint32_t)0xFFFFFFFFU) |
Use default values as provided by the OSAL package
#define TimerP_PeriodType_MICROSECS ( (uint32_t) 0U) |
Timer period unit is in micro seconds
#define TimerP_PeriodType_COUNTS ( (uint32_t) 1U) |
Timer period unit is in counts
#define TimerP_RunMode_CONTINUOUS ( (uint32_t) 0U) |
Timer is periodic and runs continuously
#define TimerP_RunMode_ONESHOT ( (uint32_t) 1U) |
Timer runs for a single period values and stops
#define TimerP_StartMode_AUTO ( (uint32_t) 0U) |
Timer starts automatically after create
#define TimerP_StartMode_USER ( (uint32_t) 1U) |
Timer will be started by the user
typedef uint32_t TimerP_PeriodType |
This enumerator defines the Timer Period unit.
typedef uint32_t TimerP_RunMode |
This enumerator defines the Timer runtime modes.
typedef uint32_t TimerP_StartMode |
This enumerator defines the Timer start modes.
typedef void* TimerP_Handle |
Opaque client reference to an instance of a TimerP.
A TimerP_Handle returned from the TimerP_create represents that instance. and then is used in the other instance based functions (e.g. TimerP_start, TimerP_stop, etc.).
typedef void(* TimerP_Fxn) (uintptr_t arg) |
Prototype for a TimerP function.
enum TimerP_Status |
enum TimerP_Timer64Mode |
enum TimerP_Timer64Half |
TimerP_Handle TimerP_create | ( | uint32_t | id, |
TimerP_Fxn | tickFxn, | ||
const TimerP_Params * | timerParams | ||
) |
Function to create a timer object.
id | Timer Id |
tickFxn | Function that runs upon timer expiry |
timerParams | Pointer to the instance configuration parameters. NULL denotes to use the default parameters. The TimerP default parameters are noted in TimerP_Params_init. |
TimerP_Status TimerP_delete | ( | TimerP_Handle | timerHandle | ) |
Function to delete a timer.
timerHandle | A TimerP_Handle returned from TimerP_create |
TimerP_Status TimerP_setPeriodMicroSecs | ( | TimerP_Handle | timerHandle, |
uint32_t | microsecs | ||
) |
Function to set timer period specified in micro seconds A best-effort method will be used to set the period register. There might be a slight rounding error based on resolution of timer period register. If the timer frequency cannot support the requested period, i.e. the timer period register cannot support the requested period, then this function returns false. TimerP_setPeriodMicroSecs() invokes TimerP_stop() prior to setting the period and leaves the timer in the stopped state.
timerHandle | A TimerP_Handle returned from TimerP_create |
microsecs | time in micro seconds |
void TimerP_Params_init | ( | TimerP_Params * | timerParams | ) |
Initialize params structure to default values.
The default parameters are:
timerParams | Pointer to the instance configuration parameters. |
TimerP_Status TimerP_start | ( | TimerP_Handle | timerHandle | ) |
Function to start a timer.
timerHandle | A TimerP_Handle returned from TimerP_create |
TimerP_Status TimerP_stop | ( | TimerP_Handle | timerHandle | ) |
Function to stop a timer.
timerHandle | A TimerP_Handle returned from TimerP_create |
TimerP_Status TimerP_ClearInterrupt | ( | TimerP_Handle | timerHandle | ) |
Function to clear the interrupt of the timer.
timerHandle | A TimerP_Handle returned from TimerP_create |
uint64_t TimerP_getTimeInUsecs | ( | void | ) |
Function to return current time in units of micro-secs.
Note: This API is not supported for J7/OMAPL13x platforms and result in link errors if used in the application
uint32_t TimerP_getReloadCount | ( | TimerP_Handle | timerHandle | ) |
Get timer reload count.
timerHandle | A TimerP_Handle returned from TimerP_create |
uint32_t TimerP_getCount | ( | TimerP_Handle | timerHandle | ) |
Get timer current count.
timerHandle | A TimerP_Handle returned from TimerP_create |