source: rtems/cpukit/itron/src/itrontime.c @ 23a0105a

4.104.114.84.95
Last change on this file since 23a0105a was 812da54, checked in by Joel Sherrill <joel.sherrill@…>, on 04/02/07 at 18:23:59

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

  • itron/src/itrontime.c, libcsupport/src/gettod.c, posix/include/rtems/posix/time.h, posix/include/rtems/posix/timer.h, posix/src/clockgettime.c, posix/src/clocksettime.c, posix/src/nanosleep.c, posix/src/posixtimespecsubtract.c, posix/src/posixtimespectointerval.c, posix/src/ptimer1.c, posix/src/sleep.c, rtems/Makefile.am, rtems/include/rtems/rtems/clock.h, rtems/include/rtems/rtems/timer.h, rtems/include/rtems/rtems/types.h, rtems/src/clockget.c, rtems/src/clockset.c, rtems/src/clocktodtoseconds.c, rtems/src/clocktodvalidate.c, rtems/src/taskwakewhen.c, score/Makefile.am, score/include/rtems/score/tod.h, score/inline/rtems/score/tod.inl, score/src/coretod.c, score/src/coretodset.c: Convert from Classic API style TOD_Control as fundamental time structure to POSIX struct timespec. Add clock_get_uptime().
  • rtems/src/clockgetuptime.c, score/src/coretodget.c, score/src/coretodgetuptime.c: New files.
  • score/src/coretodtickle.c, score/src/coretodtoseconds.c, score/src/coretodvalidate.c: Removed.
  • Property mode set to 100644
File size: 3.5 KB
Line 
1/*
2 *  COPYRIGHT (c) 1989-1999.
3 *  On-Line Applications Research Corporation (OAR).
4 *
5 *  The license and distribution terms for this file may be
6 *  found in the file LICENSE in this distribution or at
7 *  http://www.rtems.com/license/LICENSE.
8 *
9 *  $Id$
10 */
11
12#if HAVE_CONFIG_H
13#include "config.h"
14#endif
15
16#include <rtems/itron.h>
17
18#include <rtems/score/thread.h>
19#include <rtems/score/tod.h>
20
21#include <rtems/itron/time.h>
22
23/*
24 *  set_tim - Set System Clock
25 */
26
27ER set_tim(
28  SYSTIME *pk_tim
29)
30{
31#if 0
32 struct timespec   time;
33
34/* convert *pk_tim which is 48 bits integer in binary into an ordinary
35 integer in milliseconds */
36
37/* XXX */ temp = 0;
38  if(temp > 0) {
39    _Thread_Disable_dispatch();
40      _TOD_Set(&the_tod);
41    _Thread_Enable_dispatch();
42    return E_OK;
43  }
44#endif
45  return E_SYS;
46}
47
48/*
49 *  get_tim - Get System Clock
50 */
51
52ER get_tim(
53  SYSTIME *pk_tim
54)
55{
56  return E_OK;
57}
58
59/*
60 *  dly_tsk - Delay Task
61 */
62
63ER dly_tsk(
64  DLYTIME dlytim
65)
66{
67  Watchdog_Interval ticks;
68
69  ticks = TOD_MILLISECONDS_TO_TICKS(dlytim);
70
71  _Thread_Disable_dispatch();
72    if ( ticks == 0 ) {
73      _Thread_Yield_processor();
74    } else {
75      _Thread_Set_state( _Thread_Executing, STATES_DELAYING );
76      _Watchdog_Initialize(
77        &_Thread_Executing->Timer,
78        _Thread_Delay_ended,
79        _Thread_Executing->Object.id,
80        NULL
81      );
82      _Watchdog_Insert_ticks( &_Thread_Executing->Timer, ticks );
83    }
84  _Thread_Enable_dispatch();
85  return E_OK;
86}
87
88/*
89 *  def_cyc - Define Cyclic Handler
90 */
91
92ER def_cyc(
93  HNO     cycno,
94  T_DCYC *pk_dcyc
95)
96{
97  Watchdog_Control *object;
98#if 0
99  Watchdog_Interval timeInterval;
100#endif
101
102/* XXX */ object = 0;
103  if ( pk_dcyc->cycatr != TA_HLNG)
104     return E_RSATR;
105#if 0
106  timeInterval = pk_dcyc->cyctim / 1000;
107  object->delta_interval = timeInterval;
108#endif
109  _Watchdog_Initialize(
110         object,
111         pk_dcyc->cychdr,
112         cycno,
113         pk_dcyc->exinf);
114  _Watchdog_Deactivate(object);
115
116  return E_OK;
117}
118
119/*
120 *  act_cyc - Activate Cyclic Handler
121 */
122
123ER act_cyc(
124  HNO   cycno,
125  UINT  cycact
126)
127{
128  Watchdog_Control *object;
129
130  if(cycact != TCY_OFF || cycact != TCY_ON)
131     return E_PAR;
132
133#if 0
134  if( object->Object_ID != cycno)
135     return E_NOEXS;
136#endif
137
138  _Watchdog_Activate(object);
139
140  return E_OK;
141}
142
143/*
144 *  ref_cyc - Reference Cyclic Handler Status
145 */
146
147ER ref_cyc(
148  T_RCYC *pk_rcyc,
149  HNO     cycno
150)
151{
152#if 0
153  int timeElapse_since_actCyclic;
154#endif
155  T_DCYC *pk_dcyc;
156#if 0
157  Watchdog_Control *object;
158#endif
159
160/* XXX */ pk_dcyc = 0;
161
162/* XXX will to use a "get" routine to map from id to object pointer */
163/* XXX and the object pointer should be of type specific to this manager */
164#if 0
165  if( object->Object_ID == cycno))
166#else
167  if ( 1 )
168#endif
169  {
170     pk_rcyc->exinf = pk_dcyc->exinf;
171     pk_rcyc->cycact = pk_dcyc->cycact;
172#if 0
173     pk_rcyc->lfttim = pk_dcyc->cyctim - timeElapse_since_actCyclic;
174#endif
175
176     return E_OK;
177  }
178  else
179     return E_NOEXS;
180}
181
182/*
183 *  def_alm - Define Alarm Handler
184 */
185
186ER def_alm(
187  HNO     almno,
188  T_DALM *pk_dalm
189)
190{
191#if 0
192  Objects_Control *objectAlrm;
193  Watchdog_Interval timeInterval;
194
195  timeInterval = pk_dalm->almtim / 1000;
196  (void) _Watchdog_Remove(&objectAlrm);
197  _Watchdog_Initialize(
198           objectAlrm,
199           pk_dalm->almhdr,
200           almno,
201           pk_dalm->exinf);
202  _Watchdong_Insert_seconds(objectAlrm,timeInterval);
203  _Thread_Enable_dispatch();
204#endif
205
206  return E_OK;
207}
208
209/*
210 *  ref_alm - Reference Alarm Handler Status
211 */
212
213ER ref_alm(
214  T_RALM *pk_ralm,
215  HNO     almno
216)
217{
218
219  return E_OK;
220}
221
222/*
223 *  ret_tmr - Return from Timer Handler
224 */
225
226void ret_tmr( void )
227{
228}
Note: See TracBrowser for help on using the repository browser.