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