Changeset 599d71f in rtems


Ignore:
Timestamp:
Jan 11, 2016, 12:02:06 PM (4 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
e4752d1d
Parents:
1506658c
git-author:
Sebastian Huber <sebastian.huber@…> (01/11/16 12:02:06)
git-committer:
Sebastian Huber <sebastian.huber@…> (01/12/16 10:35:41)
Message:

score: Statically initialize TOD handler

Files:
6 edited

Legend:

Unmodified
Added
Removed
  • cpukit/sapi/src/exinit.c

    r1506658c r599d71f  
    115115
    116116  _Watchdog_Handler_initialization();
    117   _TOD_Handler_initialization();
    118117
    119118  _Thread_Handler_initialization();
  • cpukit/score/include/rtems/score/timecounterimpl.h

    r1506658c r599d71f  
    3737 */
    3838
    39 void _Timecounter_Initialize( void );
    40 
    4139void _Timecounter_Set_clock( const struct timespec *ts );
    4240
  • cpukit/score/include/rtems/score/todimpl.h

    r1506658c r599d71f  
    150150} TOD_Control;
    151151
    152 SCORE_EXTERN TOD_Control _TOD;
    153 
    154 /**
    155  *  @brief Initializes the time of day handler.
    156  *
    157  *  Performs the initialization necessary for the Time Of Day handler.
    158  */
    159 void _TOD_Handler_initialization(void);
     152extern TOD_Control _TOD;
    160153
    161154/**
  • cpukit/score/src/coretod.c

    r1506658c r599d71f  
    2121#include <rtems/score/todimpl.h>
    2222
    23 void _TOD_Handler_initialization(void)
    24 {
    25   struct timespec ts;
    26 
    27   _Timecounter_Initialize();
    28 
    29   ts.tv_sec = TOD_SECONDS_1970_THROUGH_1988;
    30   ts.tv_nsec = 0;
    31   _Timecounter_Set_clock( &ts );
    32 
    33   /* TOD has not been set */
    34   _TOD.is_set = false;
    35 }
     23TOD_Control _TOD;
  • cpukit/score/src/kern_tc.c

    r1506658c r599d71f  
    3434#define time_uptime _Timecounter_Time_uptime
    3535#include <rtems/score/timecounterimpl.h>
     36#include <rtems/score/todimpl.h>
    3637#include <rtems/score/watchdogimpl.h>
    3738#endif /* __rtems__ */
     
    145146        0,
    146147        {1, 0},
     148#ifndef __rtems__
    147149        {0, 0},
    148150        {0, 0},
     151#else /* __rtems__ */
     152        {TOD_SECONDS_1970_THROUGH_1988, 0},
     153        {TOD_SECONDS_1970_THROUGH_1988, 0},
     154#endif /* __rtems__ */
    149155        1,
    150156#if defined(RTEMS_SMP)
     
    163169#endif /* __rtems__ */
    164170
     171#ifndef __rtems__
    165172volatile time_t time_second = 1;
     173#else /* __rtems__ */
     174volatile time_t time_second = TOD_SECONDS_1970_THROUGH_1988;
     175#endif /* __rtems__ */
    166176volatile time_t time_uptime = 1;
    167177
     178#ifndef __rtems__
    168179struct bintime boottimebin;
     180#else /* __rtems__ */
     181struct bintime boottimebin = {
     182  .sec = TOD_SECONDS_1970_THROUGH_1988 - 1
     183};
     184#endif /* __rtems__ */
    169185#ifndef __rtems__
    170186struct timeval boottime;
     
    20462062        return (0);
    20472063}
    2048 #endif /* __rtems__ */
    2049 
    2050 #ifndef __rtems__
     2064
    20512065static void
    20522066inittimecounter(void *dummy)
    2053 #else /* __rtems__ */
    2054 void
    2055 _Timecounter_Initialize(void)
    2056 #endif /* __rtems__ */
    2057 {
    2058 #ifndef __rtems__
     2067{
    20592068        u_int p;
    20602069        int tick_rate;
     
    20802089        p = (tc_tick * 1000000) / hz;
    20812090        printf("Timecounters tick every %d.%03u msec\n", p / 1000, p % 1000);
    2082 #endif /* __rtems__ */
    20832091
    20842092#ifdef FFCLOCK
     
    20912099}
    20922100
    2093 #ifndef __rtems__
    20942101SYSINIT(timecounter, SI_SUB_CLOCKS, SI_ORDER_SECOND, inittimecounter, NULL);
    2095 #endif /* __rtems__ */
    2096 
    2097 #ifndef __rtems__
     2102
    20982103/* Cpu tick handling -------------------------------------------------*/
    20992104
  • testsuites/sptests/sptimecounter01/init.c

    r1506658c r599d71f  
    2424
    2525#include <rtems/score/timecounterimpl.h>
     26#include <rtems/score/todimpl.h>
    2627#include <rtems/score/watchdogimpl.h>
    2728#include <rtems/timecounter.h>
    2829#include <rtems/bsd.h>
    2930
    30 const char rtems_test_name[] = "SPTIMECOUNTER_1";
     31const char rtems_test_name[] = "SPTIMECOUNTER 1";
    3132
    3233typedef struct {
     
    5253  uint64_t soft_freq = 1000000;
    5354  struct bintime bt;
     55  struct timeval tv;
     56  struct timespec ts;
    5457
    5558  rtems_test_begink();
    5659
    57   _Timecounter_Initialize();
    5860  _Watchdog_Handler_initialization();
     61
     62  assert(time(NULL) == TOD_SECONDS_1970_THROUGH_1988);
     63
     64  rtems_bsd_bintime(&bt);
     65  assert(bt.sec == TOD_SECONDS_1970_THROUGH_1988);
     66  assert(bt.frac == 0);
     67
     68  rtems_bsd_getbintime(&bt);
     69  assert(bt.sec == TOD_SECONDS_1970_THROUGH_1988);
     70  assert(bt.frac == 0);
     71
     72  rtems_bsd_microtime(&tv);
     73  assert(tv.tv_sec == TOD_SECONDS_1970_THROUGH_1988);
     74  assert(tv.tv_usec == 0);
     75
     76  rtems_bsd_getmicrotime(&tv);
     77  assert(tv.tv_sec == TOD_SECONDS_1970_THROUGH_1988);
     78  assert(tv.tv_usec == 0);
     79
     80  rtems_bsd_nanotime(&ts);
     81  assert(ts.tv_sec == TOD_SECONDS_1970_THROUGH_1988);
     82  assert(ts.tv_nsec == 0);
     83
     84  rtems_bsd_getnanotime(&ts);
     85  assert(ts.tv_sec == TOD_SECONDS_1970_THROUGH_1988);
     86  assert(ts.tv_nsec == 0);
     87
     88  assert(rtems_clock_get_uptime_seconds() == 0);
     89  assert(rtems_clock_get_uptime_nanoseconds() == 0);
    5990
    6091  rtems_bsd_binuptime(&bt);
    6192  assert(bt.sec == 1);
    62   assert(bt.frac== 0);
     93  assert(bt.frac == 0);
    6394
     95  rtems_bsd_getbinuptime(&bt);
     96  assert(bt.sec == 1);
     97  assert(bt.frac == 0);
     98
     99  rtems_bsd_microuptime(&tv);
     100  assert(tv.tv_sec == 1);
     101  assert(tv.tv_usec == 0);
     102
     103  rtems_bsd_getmicrouptime(&tv);
     104  assert(tv.tv_sec == 1);
     105  assert(tv.tv_usec == 0);
     106
     107  rtems_bsd_nanouptime(&ts);
     108  assert(ts.tv_sec == 1);
     109  assert(ts.tv_nsec == 0);
     110
     111  rtems_bsd_getnanouptime(&ts);
     112  assert(ts.tv_sec == 1);
     113  assert(ts.tv_nsec == 0);
     114
     115  /* On RTEMS time does not advance using the dummy timecounter */
    64116  rtems_bsd_binuptime(&bt);
    65117  assert(bt.sec == 1);
Note: See TracChangeset for help on using the changeset viewer.