1.5.4.4.3 SRV_TIME_MANAGEMENT_USTCount Function

C

uint64_t SRV_TIME_MANAGEMENT_USToCount(uint32_t timeUs);

Summary

Converts a given time to microseconds and returns the equivalent value in cycles.

Description

This routine makes use of SYS_TIME service to convert a value in microseconds and return a value in cycles.

Precondition

SYS_TIME_Initialize routine must have been called before.

Parameters

Param Description
timeUS

Time in microseconds

Returns

Value of cycles counter.

Example

uint64_t nextTimeCounter;
uint32_t nextTimeUS;
uint32_t currentTimeUS;

currentTimeUS= SRV_TIME_MANAGEMENT_GetTimeUS();
nextTimeUS = currentTimeUS + 1000;
nextTimeCounter = SRV_TIME_MANAGEMENT_USToCount(nextTimeUS);

Remarks

Time to convert should be as close as possible to the current time to avoid an overflow.