OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [rtems/] [c/] [src/] [exec/] [itron/] [src/] [itrontime.c] - Blame information for rev 609

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 30 unneback
/*
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.OARcorp.com/rtems/license.html.
8
 *
9
 *  $Id: itrontime.c,v 1.2 2001-09-27 11:59:13 chris Exp $
10
 */
11
 
12
#include <itron.h>
13
 
14
#include <rtems/score/thread.h>
15
#include <rtems/score/tod.h>
16
 
17
#include <rtems/itron/time.h>
18
 
19
/*
20
 *  set_tim - Set System Clock
21
 */
22
 
23
void converTime(SYSTIME ms, TOD_Control *time)
24
{
25
  int millisecond;
26
 
27
/* XXX need to dereference structure */
28
#if 0
29
  milisecond = ms % 1000;
30
  tempSecond = ms / 1000;
31
#else
32
   millisecond = 0;
33
#endif
34
}
35
 
36
 
37
/*
38
 *  set_tim - Set System Clock
39
 */
40
 
41
ER set_tim(
42
  SYSTIME *pk_tim
43
)
44
{
45
 Watchdog_Interval temp; /* an integer in seconds after conversion from SYSTIME */
46
 TOD_Control the_tod;
47
 
48
/* convert *pk_tim which is 48 bits integer in binary into an ordinary
49
 integer in milliseconds */
50
 
51
/* XXX */ temp = 0;
52
  if(temp > 0) {
53
    _Thread_Disable_dispatch();
54
      _TOD_Set(&the_tod, temp);
55
    _Thread_Enable_dispatch();
56
      if(_TOD_Validate(&the_tod)){
57
      return E_OK;
58
      }
59
  }
60
  return E_SYS;
61
}
62
 
63
/*
64
 *  get_tim - Get System Clock
65
 */
66
 
67
ER get_tim(
68
  SYSTIME *pk_tim
69
)
70
{
71
  return E_OK;
72
}
73
 
74
/*
75
 *  dly_tsk - Delay Task
76
 */
77
 
78
ER dly_tsk(
79
  DLYTIME dlytim
80
)
81
{
82
  Watchdog_Interval ticks;
83
 
84
  ticks = TOD_MILLISECONDS_TO_TICKS(dlytim);
85
 
86
  _Thread_Disable_dispatch();
87
    if ( ticks == 0 ) {
88
      _Thread_Yield_processor();
89
    } else {
90
      _Thread_Set_state( _Thread_Executing, STATES_DELAYING );
91
      _Watchdog_Initialize(
92
        &_Thread_Executing->Timer,
93
        _Thread_Delay_ended,
94
        _Thread_Executing->Object.id,
95
        NULL
96
      );
97
      _Watchdog_Insert_ticks( &_Thread_Executing->Timer, ticks );
98
    }
99
  _Thread_Enable_dispatch();
100
  return E_OK;
101
}
102
 
103
/*
104
 *  def_cyc - Define Cyclic Handler
105
 */
106
 
107
ER def_cyc(
108
  HNO     cycno,
109
  T_DCYC *pk_dcyc
110
)
111
{
112
  Watchdog_Control *object;
113
#if 0
114
  Watchdog_Interval timeInterval;
115
#endif
116
 
117
/* XXX */ object = 0;
118
  if ( pk_dcyc->cycatr != TA_HLNG)
119
     return E_RSATR;
120
#if 0
121
  timeInterval = pk_dcyc->cyctim / 1000;
122
  object->delta_interval = timeInterval;
123
#endif
124
  _Watchdog_Initialize(
125
         object,
126
         pk_dcyc->cychdr,
127
         cycno,
128
         pk_dcyc->exinf);
129
  _Watchdog_Deactivate(object);
130
 
131
  return E_OK;
132
}
133
 
134
/*
135
 *  act_cyc - Activate Cyclic Handler
136
 */
137
 
138
ER act_cyc(
139
  HNO   cycno,
140
  UINT  cycact
141
)
142
{
143
  Watchdog_Control *object;
144
 
145
  if(cycact != TCY_OFF || cycact != TCY_ON)
146
     return E_PAR;
147
 
148
#if 0
149
  if( object->Object_ID != cycno)
150
     return E_NOEXS;
151
#endif
152
 
153
  _Watchdog_Activate(object);
154
 
155
  return E_OK;
156
}
157
 
158
/*
159
 *  ref_cyc - Reference Cyclic Handler Status
160
 */
161
 
162
ER ref_cyc(
163
  T_RCYC *pk_rcyc,
164
  HNO     cycno
165
)
166
{
167
#if 0
168
  int timeElapse_since_actCyclic;
169
#endif
170
  T_DCYC *pk_dcyc;
171
#if 0
172
  Watchdog_Control *object;
173
#endif
174
 
175
/* XXX */ pk_dcyc = 0;
176
 
177
/* XXX will to use a "get" routine to map from id to object pointer */
178
/* XXX and the object pointer should be of type specific to this manager */
179
#if 0
180
  if( object->Object_ID == cycno))
181
#else
182
  if ( 1 )
183
#endif
184
  {
185
     pk_rcyc->exinf = pk_dcyc->exinf;
186
     pk_rcyc->cycact = pk_dcyc->cycact;
187
#if 0
188
     pk_rcyc->lfttim = pk_dcyc->cyctim - timeElapse_since_actCyclic;
189
#endif
190
 
191
     return E_OK;
192
  }
193
  else
194
     return E_NOEXS;
195
}
196
 
197
/*
198
 *  def_alm - Define Alarm Handler
199
 */
200
 
201
ER def_alm(
202
  HNO     almno,
203
  T_DALM *pk_dalm
204
)
205
{
206
#if 0
207
  Objects_Control *objectAlrm;
208
  Watchdog_Interval timeInterval;
209
 
210
  timeInterval = pk_dalm->almtim / 1000;
211
  (void) _Watchdog_Remove(&objectAlrm);
212
  _Watchdog_Initialize(
213
           objectAlrm,
214
           pk_dalm->almhdr,
215
           almno,
216
           pk_dalm->exinf);
217
  _Watchdong_Insert_seconds(objectAlrm,timeInterval);
218
  _Thread_Enable_dispatch();
219
#endif
220
 
221
  return E_OK;
222
}
223
 
224
/*
225
 *  ref_alm - Reference Alarm Handler Status
226
 */
227
 
228
ER ref_alm(
229
  T_RALM *pk_ralm,
230
  HNO     almno
231
)
232
{
233
 
234
  return E_OK;
235
}
236
 
237
/*
238
 *  ret_tmr - Return from Timer Handler
239
 */
240
 
241
void ret_tmr( void )
242
{
243
}
244
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.