1 | /** |
---|
2 | * @file itronsys/time.h |
---|
3 | */ |
---|
4 | |
---|
5 | /* |
---|
6 | * COPYRIGHT (c) 1989-1999. |
---|
7 | * On-Line Applications Research Corporation (OAR). |
---|
8 | * |
---|
9 | * The license and distribution terms for this file may be |
---|
10 | * found in the file LICENSE in this distribution or at |
---|
11 | * http://www.rtems.com/license/LICENSE. |
---|
12 | * |
---|
13 | * $Id$ |
---|
14 | */ |
---|
15 | |
---|
16 | #ifndef _ITRONSYS_TIME_H |
---|
17 | #define _ITRONSYS_TIME_H |
---|
18 | |
---|
19 | #ifdef __cplusplus |
---|
20 | extern "C" { |
---|
21 | #endif |
---|
22 | |
---|
23 | /* |
---|
24 | * System Time Data Type |
---|
25 | * |
---|
26 | * Member configuration depends on the bit width of the processor and |
---|
27 | * on the implementation. A total of 48 bits is recommended. |
---|
28 | * |
---|
29 | */ |
---|
30 | |
---|
31 | typedef struct t_systime { |
---|
32 | H utime; /* upper 16 bits */ |
---|
33 | UW ltime; /* lower 32 bits */ |
---|
34 | } SYSTIME, CYCTIME, ALMTIME; |
---|
35 | |
---|
36 | /* |
---|
37 | * XXX Look this up in the spec and figure out where it comes |
---|
38 | * XXX from. dly_tim() references it but it was left out |
---|
39 | * XXX of the initial cut at the header files. |
---|
40 | */ |
---|
41 | |
---|
42 | typedef int DLYTIME; |
---|
43 | |
---|
44 | /* |
---|
45 | * XXX (def_cyc) Structure |
---|
46 | */ |
---|
47 | |
---|
48 | typedef struct t_dcyc { |
---|
49 | VP exinf; /* extended information */ |
---|
50 | ATR cycatr; /* cyclic handler attributes */ |
---|
51 | FP cychdr; /* cyclic handler address */ |
---|
52 | UINT cycact; /* cyclic handler activation */ |
---|
53 | CYCTIME cyctim; /* cyclic startup period */ |
---|
54 | } T_DCYC; |
---|
55 | |
---|
56 | /* |
---|
57 | * cycact |
---|
58 | */ |
---|
59 | |
---|
60 | #define TCY_OFF 0x00 /* do not invoke cyclic handler */ |
---|
61 | #define TCY_ON 0x01 /* invoke cyclic handler */ |
---|
62 | #define TCY_INT 0x02 /* initialize cycle count */ |
---|
63 | |
---|
64 | /* |
---|
65 | * Reference Cyclic Handler (ref_cyc) Structure |
---|
66 | */ |
---|
67 | |
---|
68 | typedef struct t_rcyc { |
---|
69 | VP exinf; /* extended information */ |
---|
70 | CYCTIME lfttim; /* time left before next handler startup */ |
---|
71 | UINT cycact; /* cyclic handler activation */ |
---|
72 | /* additional information may be included depending on the implementation */ |
---|
73 | } T_RCYC; |
---|
74 | |
---|
75 | /* |
---|
76 | * Define Alarm (def_alm) Structure |
---|
77 | */ |
---|
78 | |
---|
79 | typedef struct t_dalm { |
---|
80 | VP exinf; /* extended information */ |
---|
81 | ATR almatr; /* alarm handler attributes */ |
---|
82 | FP almhdr; /* alarm handler address */ |
---|
83 | UINT tmmode; /* start time specification mode */ |
---|
84 | ALMTIME almtim; /* handler startup time */ |
---|
85 | } T_DALM; |
---|
86 | |
---|
87 | /* |
---|
88 | * tmmode |
---|
89 | */ |
---|
90 | |
---|
91 | #define TTM_ABS 0x00 /* specified as an absolute time */ |
---|
92 | #define TTM_REL 0x01 /* specified as a relative time */ |
---|
93 | |
---|
94 | /* |
---|
95 | * Reference Alarm (ref_alm) Structure |
---|
96 | */ |
---|
97 | |
---|
98 | typedef struct t_ralm { |
---|
99 | VP exinf; /* extended information */ |
---|
100 | ALMTIME lfttim; /* time left before next handler startup */ |
---|
101 | /* additional information may be included depending on the implementation */ |
---|
102 | } T_RALM; |
---|
103 | |
---|
104 | /* |
---|
105 | * Time Management Functions |
---|
106 | */ |
---|
107 | |
---|
108 | /* |
---|
109 | * set_tim - Set System Clock |
---|
110 | */ |
---|
111 | |
---|
112 | ER set_tim( |
---|
113 | SYSTIME *pk_tim |
---|
114 | ); |
---|
115 | |
---|
116 | /* |
---|
117 | * get_tim - Get System Clock |
---|
118 | */ |
---|
119 | |
---|
120 | ER get_tim( |
---|
121 | SYSTIME *pk_tim |
---|
122 | ); |
---|
123 | |
---|
124 | /* |
---|
125 | * dly_tsk - Delay Task |
---|
126 | */ |
---|
127 | |
---|
128 | ER dly_tsk( |
---|
129 | DLYTIME dlytim |
---|
130 | ); |
---|
131 | |
---|
132 | /* |
---|
133 | * def_cyc - Define Cyclic Handler |
---|
134 | */ |
---|
135 | |
---|
136 | ER def_cyc( |
---|
137 | HNO cycno, |
---|
138 | T_DCYC *pk_dcyc |
---|
139 | ); |
---|
140 | |
---|
141 | /* |
---|
142 | * act_cyc - Activate Cyclic Handler |
---|
143 | */ |
---|
144 | |
---|
145 | ER act_cyc( |
---|
146 | HNO cycno, |
---|
147 | UINT cycact |
---|
148 | ); |
---|
149 | |
---|
150 | /* |
---|
151 | * ref_cyc - Reference Cyclic Handler Status |
---|
152 | */ |
---|
153 | |
---|
154 | ER ref_cyc( |
---|
155 | T_RCYC *pk_rcyc, |
---|
156 | HNO cycno |
---|
157 | ); |
---|
158 | |
---|
159 | /* |
---|
160 | * def_alm - Define Alarm Handler |
---|
161 | */ |
---|
162 | |
---|
163 | ER def_alm( |
---|
164 | HNO almno, |
---|
165 | T_DALM *pk_dalm |
---|
166 | ); |
---|
167 | |
---|
168 | /* |
---|
169 | * ref_alm - Reference Alarm Handler Status |
---|
170 | */ |
---|
171 | |
---|
172 | ER ref_alm( |
---|
173 | T_RALM *pk_ralm, |
---|
174 | HNO almno |
---|
175 | ); |
---|
176 | |
---|
177 | /* |
---|
178 | * ret_tmr - Return from Timer Handler |
---|
179 | */ |
---|
180 | |
---|
181 | void ret_tmr( void ); |
---|
182 | |
---|
183 | #ifdef __cplusplus |
---|
184 | } |
---|
185 | #endif |
---|
186 | |
---|
187 | #endif |
---|
188 | /* end of include file */ |
---|