source: rtems/cpukit/score/inline/rtems/score/tod.inl @ fc054ca

4.104.114.84.9
Last change on this file since fc054ca was fc054ca, checked in by Joel Sherrill <joel.sherrill@…>, on Apr 4, 2007 at 1:54:10 PM

2007-04-04 Joel Sherrill <joel@…>

  • score/Makefile.am, score/include/rtems/score/tod.h, score/inline/rtems/score/tod.inl: Make _TOD_Tickle_ticks a real non-inlined routine. It should only be used once so there is little advantage to inlining it.
  • score/src/coretodtickle.c: New file.
  • Property mode set to 100644
File size: 1.8 KB
Line 
1/**
2 *  @file  rtems/score/tod.inl
3 *
4 *  This file contains the static inline implementation of the inlined routines
5 *  from the Time of Day Handler.
6 */
7
8/*
9 *  COPYRIGHT (c) 1989-2007.
10 *  On-Line Applications Research Corporation (OAR).
11 *
12 *  The license and distribution terms for this file may be
13 *  found in the file LICENSE in this distribution or at
14 *  http://www.rtems.com/license/LICENSE.
15 *
16 *  $Id$
17 */
18
19#ifndef _RTEMS_SCORE_TOD_INL
20#define _RTEMS_SCORE_TOD_INL
21
22#include <rtems/score/isr.h>
23
24/**
25 *  @addtogroup ScoreTOD
26 *  @{
27 */
28
29/**
30 *
31 *  This routines adds two timespecs.  The second argument is added
32 *  to the first.
33 */
34
35RTEMS_INLINE_ROUTINE uint32_t _TOD_Add_timespec(
36  struct timespec *time,
37  struct timespec *add
38)
39{
40  uint32_t seconds = 0;
41
42 
43  /* Add the basics */
44  time->tv_sec += add->tv_sec;
45  time->tv_nsec += add->tv_nsec;
46
47  /* Now adjust it so nanoseconds is in range */
48  while ( time->tv_nsec >= TOD_NANOSECONDS_PER_SECOND ) {
49    time->tv_nsec -= TOD_NANOSECONDS_PER_SECOND;
50    time->tv_sec++;
51    seconds++;
52  }
53
54  return seconds;
55}
56
57/**
58 *  This routine deactivates updating of the current time of day.
59 */
60
61RTEMS_INLINE_ROUTINE void _TOD_Deactivate( void )
62{
63  /* XXX do we need something now that we are using timespec for TOD */
64}
65
66/**
67 *  This routine activates updating of the current time of day.
68 */
69
70RTEMS_INLINE_ROUTINE void _TOD_Activate()
71{
72  /* XXX do we need something now that we are using timespec for TOD */
73}
74
75/**
76 *  This routine returns a timeval based upon the internal timespec format TOD.
77 */
78
79RTEMS_INLINE_ROUTINE void _TOD_Get_timeval(
80  struct timeval *time
81)
82{
83  ISR_Level level;
84  struct timespec now;
85
86  _ISR_Disable(level);
87    _TOD_Get( &now );
88  _ISR_Enable(level);
89
90  time->tv_sec  = now.tv_sec;
91  time->tv_usec = now.tv_nsec / TOD_NANOSECONDS_PER_MICROSECOND;
92}
93
94/**@}*/
95
96#endif
97/* end of include file */
Note: See TracBrowser for help on using the repository browser.