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