Changeset b9ffb624 in rtems for testsuites


Ignore:
Timestamp:
Nov 30, 2018, 12:57:04 PM (12 months ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
577d9a5
Parents:
d0a7f03
git-author:
Sebastian Huber <sebastian.huber@…> (11/30/18 12:57:04)
git-committer:
Sebastian Huber <sebastian.huber@…> (12/03/18 08:45:37)
Message:

Convert CPU counter ticks to/from sbintime_t

The sbintime_t is an efficient time format. Add the ability to convert
CPU counter ticks to/from sbintime_t.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • testsuites/sptests/spcpucounter01/init.c

    rd0a7f03 rb9ffb624  
    5454static void test_converter(void)
    5555{
    56   CPU_Counter_ticks frequency = rtems_counter_nanoseconds_to_ticks(1000000000);
    57   uint64_t ns = rtems_counter_ticks_to_nanoseconds(frequency);
     56  CPU_Counter_ticks frequency;
     57  CPU_Counter_ticks frequency2;
     58  uint64_t ns;
     59  int64_t sbt;
     60
     61  frequency = rtems_counter_nanoseconds_to_ticks(1000000000);
     62  ns = rtems_counter_ticks_to_nanoseconds(frequency);
    5863
    5964  printf("CPU counter frequency: %" PRIu32 "Hz\n", frequency);
     
    6166
    6267  rtems_test_assert(ns == 1000000000);
     68
     69  sbt = rtems_counter_ticks_to_sbintime(frequency);
     70  rtems_test_assert(sbt == (INT64_C(1) << 32));
     71
     72  frequency2 = rtems_counter_sbintime_to_ticks(sbt);
     73  rtems_test_assert(frequency == frequency2);
    6374}
    6475
Note: See TracChangeset for help on using the changeset viewer.