Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Description

Application-defined function to get current CPU timestamp timer count. Anchor10541171054117

Files

...

cpu_core.h / Application’s cpu_bsp.c Anchor10541221054122

Prototype

...

Code Block

...

HTML Table
summary
classCode_Listing
Table Row (tr)
Table Cell (td)
Anchor
10541211054121
language

...

cpp
          CPU_TS_TMR  CPU_TS_TmrRd (void);

...


Arguments

...

1053507None. Anchor10535081053508

Returned Value

...

CPU timestamp timer count value. Anchor10535101053510

Required Configuration

...

CPU_TS_TmrRd() is an application/BSP function that must be defined by the developer if either of the following CPU features is enabled in cpu_cfg.h : Anchor10567701056770

  • CPU timestamps when either CPU_CFG_TS_32_EN or CPU_CFG_TS_64_EN is DEF_ENABLED

...

...

Notes / Warnings

...

  1. CPU timestamp timer count values must be returned via word-size-configurable CPU_TS_TMR data type. If timer has more bits, truncate timer values’ higher-order bits greater than the configured CPU_TS_TMR timestamp timer data type word size. However, since the timer must not have less bits than the configured CPU_TS_TMR timestamp timer data type word size; CPU_CFG_TS_TMR_SIZE must be configured so that all bits in CPU_TS_TMR data type are significant. In other words, if timer size is not a binary-multiple of 8-bit octets (e.g. 20-bits or even 24-bits), then the next lower, binary-multiple octet word size should be configured (e.g. to 16-bits). However, the minimum supported word size for CPU timestamp timers is 8-bits.

...

  1. CPU timestamp timer should be an ‘up’ counter whose values increase with each time count. If timer is a ‘down’ counter whose values decrease with each time count, then the returned timer value must be ones-complemented.

...

  1. When applicable, CPU timestamp timer period should be less than the typical measured time but must be less than the maximum measured time; otherwise, timer resolution inadequate to measure desired times.

...

Implementation Template

...

Anchor
10611661061166
 

...

Listing - CPU_TS_TmrRd() implementation template
Listing - CPU_TS_TmrRd() implementation template

{

          {
              CPU_TS_TMR  ts_tmr_cnts;
  ...

           
              ...
              ts_tmr_cnts =  /* Insert code to get/return CPU timestamp timer counts. */
; ...   return
 ;
              ...
           
              return (ts_tmr_cnts);
}
Code Block
languagecpp
titleListing - CPU_TS_TmrRd() implementation template
linenumberstrue
          CPU_TS_TMR  CPU_TS_TmrRd (void)
Anchor
10537691053769
Anchor
10537701053770
Anchor
10537711053771
Anchor
10537721053772
Anchor
10537731053773
Anchor
10537741053774
Anchor
10537751053775
Anchor
10537761053776
Anchor
10537771053777

...


          }


16-bit Up Timer Example

...

Anchor
10611721061172
 

...

Listing - 16-bit Up timer example
Listing - 16-bit Up timer example

{

          {
              CPU_TS_TMR  ts_tmr_cnts;  /* sizeof(CPU_TS_TMR) = 16 bits
*/    
 */
           
           
              ts_tmr_cnts =  /* Insert code to read 16-bit up timer value. */
;   return
 ;
           
              return (ts_tmr_cnts);
}
Code Block
languagecpp
titleListing - 16-bit Up timer example
linenumberstrue
          CPU_TS_TMR  CPU_TS_TmrRd (void)
Anchor
10538681053868
Anchor
10538691053869
Anchor
10538701053870
Anchor
10538711053871
Anchor
10538721053872
Anchor
10538731053873
Anchor
10538741053874
Anchor
10538751053875

...


          }


16-bit Down Timer Example

...

Anchor
10611781061178
 

...

Listing - 16-bit Down timer example
Listing - 16-bit Down timer example

{ CPU_INT16U tmr_val;

          {
              CPU_INT16U  tmr_val;
              CPU_TS_TMR  ts_tmr_cnts;  /* sizeof(CPU_TS_TMR) = 16 bits
*/     tmr_val = /* Insert code to read 16-bit down timer value. */ ;
 */
           
           
              tmr_val     =             /* Insert code to read 16-bit down timer value. */ ;
              ts_tmr_cnts = ~tmr_val;   /* Ones-complement     16-bit down timer value.
*/   return
 */
           
              return (ts_tmr_cnts);
}
Code Block
languagecpp
titleListing - 16-bit Down timer example
linenumberstrue
          CPU_TS_TMR  CPU_TS_TmrRd (void)
Anchor
10538911053891
Anchor
10538921053892
Anchor
10538931053893
Anchor
10538941053894
Anchor
10538951053895
Anchor
10538961053896
Anchor
10538971053897
Anchor
10538981053898
Anchor
10538991053899
Anchor
10539001053900

...


          }


32-bit Up Timer Example

...

Anchor
10611891061189
 

...

Listing - 32-bit Up timer example
Listing - 32-bit Up timer example

{

          {
              CPU_TS_TMR  ts_tmr_cnts;  /* sizeof(CPU_TS_TMR) = 32 bits
*/    
 */
           
           
              ts_tmr_cnts =  /* Insert code to read 32-bit up timer value. */
;   return
 ;
           
              return (ts_tmr_cnts);
}
Code Block
languagecpp
titleListing - 32-bit Up timer example
linenumberstrue
          CPU_TS_TMR  CPU_TS_TmrRd (void)
Anchor
10539161053916
Anchor
10539171053917
Anchor
10539181053918
Anchor
10539191053919
Anchor
10539201053920
Anchor
10539211053921
Anchor
10539221053922
Anchor
10539231053923

...


          }


48-bit Down Timer Example

...

Anchor
10611951061195
 

...

Listing - 48-bit Down timer example
Listing - 48-bit Down timer example

{ CPU_INT64U tmr_val;

          {
              CPU_INT64U  tmr_val;
              CPU_TS_TMR  ts_tmr_cnts;  /* sizeof(CPU_TS_TMR) = 32 bits
*/     tmr_val = /* Insert code to read 48-bit down timer value. */ ;
 */
           
           
              tmr_val     =                       /* Insert code to read 48-bit down timer value.        */ ;
              ts_tmr_cnts = (CPU_TS_TMR)tmr_val;  /* Truncate 48-bit timer value to 32-bit timestamp ...
*/ /* ... timer data type. */
 */
                                                  /* ... timer data type.                                */
              ts_tmr_cnts = ~ts_tmr_cnts;         /* Ones-complement truncated  down timer value.
*/   return
        */
           
              return (ts_tmr_cnts);

          }
Code Block
languagecpp
titleListing - 48-bit Down timer example
linenumberstrue
          CPU_TS_TMR  CPU_TS_TmrRd (void)
Anchor
10539371053937
Anchor
10539381053938
Anchor
10539391053939
Anchor
10539401053940
Anchor
10539411053941
Anchor
10539421053942
Anchor
10539431053943
Anchor
10539441053944
Anchor
10539451053945
Anchor
10539471053947
Anchor
10539681053968
Anchor
10539481053948