AM263x MCU+ SDK  10.00.00

Introduction

For more details and example usage, see Clock

Data Structures

struct  ClockP_Object
 Opaque clock object used with the clock APIs. More...
 
struct  ClockP_Config
 ClockP module config, set as part of SysConfig, not to be set by end-users directly. More...
 
struct  ClockP_Params
 Parameters passed during ClockP_construct. More...
 

Functions

void ClockP_init (void)
 Initialize the clock module. More...
 
void ClockP_Params_init (ClockP_Params *params)
 Set default values to ClockP_Params. More...
 
int32_t ClockP_construct (ClockP_Object *obj, ClockP_Params *params)
 Create a clock object. More...
 
void ClockP_destruct (ClockP_Object *obj)
 Cleanup, delete, destruct a clock object. More...
 
void ClockP_start (ClockP_Object *obj)
 Start the clock, if not already started. More...
 
void ClockP_stop (ClockP_Object *obj)
 Stop the clock, if not already stopped. No effect if clock is already stopped. More...
 
uint32_t ClockP_isActive (ClockP_Object *obj)
 Check if clock is active i.e not expired. More...
 
void ClockP_setTimeout (ClockP_Object *obj, uint32_t timeout)
 Set clock timeout value, takes effect for next clock start. More...
 
uint32_t ClockP_getTimeout (ClockP_Object *obj)
 Get current remaining time in units of ticks. More...
 
uint32_t ClockP_getTicks (void)
 Get current clock ticks. More...
 
uint32_t ClockP_usecToTicks (uint64_t usecs)
 Convert usecs to clock ticks. More...
 
uint64_t ClockP_ticksToUsec (uint32_t ticks)
 Convert clock ticks to usecs. More...
 
uint64_t ClockP_getTimeUsec (void)
 Get current time in units of usecs. More...
 
void ClockP_usleep (uint32_t usec)
 Sleep for user specified usecs. More...
 
void ClockP_sleep (uint32_t sec)
 Sleep for user specified seconds. More...
 

Typedefs

typedef void(* ClockP_FxnCallback) (ClockP_Object *obj, void *args)
 Callback that is called when the clock expires. More...
 

Macros

#define ClockP_OBJECT_SIZE_MAX   (104u)
 Max size of clock object across no-RTOS and all OS's. More...
 

Macro Definition Documentation

◆ ClockP_OBJECT_SIZE_MAX

#define ClockP_OBJECT_SIZE_MAX   (104u)

Max size of clock object across no-RTOS and all OS's.

Typedef Documentation

◆ ClockP_FxnCallback

typedef void(* ClockP_FxnCallback) (ClockP_Object *obj, void *args)

Callback that is called when the clock expires.

Parameters
obj[in] Clock object associated with this callback
args[in] user specific argument pointer that was passed via ClockP_Params

Function Documentation

◆ ClockP_init()

void ClockP_init ( void  )

Initialize the clock module.

The API is called during system init to setup a timer to run at a periodic time internval of 'n' micro seconds.

'n' can be configued by the user via SysConfig, default value for 'n' is typically 1000 us

Using this single timer, the clock API can be used to start multiple 'clock's in units of clock ticks.

◆ ClockP_Params_init()

void ClockP_Params_init ( ClockP_Params params)

Set default values to ClockP_Params.

Strongly recommended to be called before seting values in ClockP_Params

Parameters
params[out] parameter structure to set to default

◆ ClockP_construct()

int32_t ClockP_construct ( ClockP_Object obj,
ClockP_Params params 
)

Create a clock object.

when ClockP_Params.start = 1, this also starts the clock object

Parameters
obj[out] created object
params[in] parameter structure
Returns
SystemP_SUCCESS on success, SystemP_FAILURE on error

◆ ClockP_destruct()

void ClockP_destruct ( ClockP_Object obj)

Cleanup, delete, destruct a clock object.

Parameters
obj[in] object

◆ ClockP_start()

void ClockP_start ( ClockP_Object obj)

Start the clock, if not already started.

If clock is already started, then this restarts it with updated timeout and period, if any.

Parameters
obj[in] object

◆ ClockP_stop()

void ClockP_stop ( ClockP_Object obj)

Stop the clock, if not already stopped. No effect if clock is already stopped.

Parameters
obj[in] object

◆ ClockP_isActive()

uint32_t ClockP_isActive ( ClockP_Object obj)

Check if clock is active i.e not expired.

For clock setup in periodic mode, clock will always be active after it is started and before it is stopped.

For clock setup in one-shot mode , clock will be active after it is started and will be inactive after clock expires or it is stopped.

Parameters
obj[in] object
Returns
0: clock is not-active or expired,
1: clock is active or not expired

◆ ClockP_setTimeout()

void ClockP_setTimeout ( ClockP_Object obj,
uint32_t  timeout 
)

Set clock timeout value, takes effect for next clock start.

Parameters
obj[in] object
timeout[in] clock expiry period of first clock execution, in units of clock ticks

◆ ClockP_getTimeout()

uint32_t ClockP_getTimeout ( ClockP_Object obj)

Get current remaining time in units of ticks.

Parameters
obj[in] object
Returns
clock expiry period of next clock execution, in units of clock ticks

◆ ClockP_getTicks()

uint32_t ClockP_getTicks ( void  )

Get current clock ticks.

Returns
number of clock ticks that have elasped since ClockP_init()

◆ ClockP_usecToTicks()

uint32_t ClockP_usecToTicks ( uint64_t  usecs)

Convert usecs to clock ticks.

Parameters
usecs[in] time in micro seconds
Returns
nearest integer clock ticks

◆ ClockP_ticksToUsec()

uint64_t ClockP_ticksToUsec ( uint32_t  ticks)

Convert clock ticks to usecs.

Parameters
ticks[in] number of clocks ticks
Returns
nearest integer micro seconds

◆ ClockP_getTimeUsec()

uint64_t ClockP_getTimeUsec ( void  )

Get current time in units of usecs.

Note
This API shouldn't be called from an ISR with priority higher than that of Tick Interrupt. This is because Tick interrupt won't be able
to preempt the current ISR and ClockP_getTimeUsec may return incorrect value.

◆ ClockP_usleep()

void ClockP_usleep ( uint32_t  usec)

Sleep for user specified usecs.

Parameters
usec[in] Time to sleep in units of usecs
Note
Actual sleep will be in the range of usec - ClockP_ticksToUsec(1) to usec. If you need to guarantee atleast minimum sleep of usec, you need to sleep for usec + ClockP_ticksToUsec(1).

◆ ClockP_sleep()

void ClockP_sleep ( uint32_t  sec)

Sleep for user specified seconds.

Note
Actual sleep will be in the range of sec - ClockP_ticksToUsec(1) to sec. If you need to guarantee atleast minimum sleep of sec, you need to sleep for sec + ClockP_ticksToUsec(1).
Parameters
sec[in] Time to sleep in units of secs