CPU_TS32_to_uSec

Description

Application-defined function to convert a 32-bit CPU timestamp from timer counts to microseconds.

Files

cpu_core.h / Application’s cpu_bsp.c

Prototype

          CPU_INT64U  CPU_TS32_to_uSec (CPU_TS32  ts_cnts);


Arguments

ts_cnts

32-bit CPU timestamp (in CPU timestamp timer counts).

Returned Value

Converted 32-bit CPU timestamp (in microseconds).

Required Configuration

CPU_TS32_to_uSec() is an application/BSP function that may be optionally defined by the developer if CPU_CFG_TS_32_EN is DEF_ENABLED in cpu_cfg.h. See Timestamps Configuration.

Notes / Warnings

  1. The amount of time measured by CPU timestamps is calculated by either of the following equations:

Time measured = Number timer counts * Timer period * 10^6 microseconds
Time measured = (Number timer counts / Timer frequency) * 10^6 microseconds

Number timer counts

Number of timer counts measured

Timer period

Timer’s period in some units of (fractional) seconds

Timer frequency

Timer’s frequency in some units of counts per second

Time measured

Amount of time measured, in microseconds

Developer-defined CPU_TS32_to_uSec() implementations may convert any number of CPU_TS32 bits, up to 32, into microseconds.

Implementation Template

Listing - CPU_TS32_to_uSec() implementation template
          CPU_INT64U  CPU_TS32_to_uSec (CPU_TS32  ts_cnts)
          {
              CPU_INT64U  ts_usec;
           
              :
              :  /* Insert code to convert 32-bit CPU timestamp into microseconds. */
              :
           
              return (ts_usec);
          }