1 |
27 |
unneback |
//===========================================================================
|
2 |
|
|
//
|
3 |
|
|
// test4.c
|
4 |
|
|
//
|
5 |
|
|
// uITRON "C" test program four
|
6 |
|
|
//
|
7 |
|
|
//===========================================================================
|
8 |
|
|
//####ECOSGPLCOPYRIGHTBEGIN####
|
9 |
|
|
// -------------------------------------------
|
10 |
|
|
// This file is part of eCos, the Embedded Configurable Operating System.
|
11 |
|
|
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
|
12 |
|
|
//
|
13 |
|
|
// eCos is free software; you can redistribute it and/or modify it under
|
14 |
|
|
// the terms of the GNU General Public License as published by the Free
|
15 |
|
|
// Software Foundation; either version 2 or (at your option) any later version.
|
16 |
|
|
//
|
17 |
|
|
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
|
18 |
|
|
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
19 |
|
|
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
20 |
|
|
// for more details.
|
21 |
|
|
//
|
22 |
|
|
// You should have received a copy of the GNU General Public License along
|
23 |
|
|
// with eCos; if not, write to the Free Software Foundation, Inc.,
|
24 |
|
|
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
|
25 |
|
|
//
|
26 |
|
|
// As a special exception, if other files instantiate templates or use macros
|
27 |
|
|
// or inline functions from this file, or you compile this file and link it
|
28 |
|
|
// with other works to produce a work based on this file, this file does not
|
29 |
|
|
// by itself cause the resulting work to be covered by the GNU General Public
|
30 |
|
|
// License. However the source code for this file must still be made available
|
31 |
|
|
// in accordance with section (3) of the GNU General Public License.
|
32 |
|
|
//
|
33 |
|
|
// This exception does not invalidate any other reasons why a work based on
|
34 |
|
|
// this file might be covered by the GNU General Public License.
|
35 |
|
|
//
|
36 |
|
|
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
|
37 |
|
|
// at http://sources.redhat.com/ecos/ecos-license/
|
38 |
|
|
// -------------------------------------------
|
39 |
|
|
//####ECOSGPLCOPYRIGHTEND####
|
40 |
|
|
//===========================================================================
|
41 |
|
|
//#####DESCRIPTIONBEGIN####
|
42 |
|
|
//
|
43 |
|
|
// Author(s): dsm
|
44 |
|
|
// Contributors: dsm
|
45 |
|
|
// Date: 1998-06-12
|
46 |
|
|
// Purpose: uITRON API testing
|
47 |
|
|
// Description:
|
48 |
|
|
//
|
49 |
|
|
//####DESCRIPTIONEND####
|
50 |
|
|
//
|
51 |
|
|
//===========================================================================
|
52 |
|
|
|
53 |
|
|
#include <pkgconf/uitron.h> // uITRON setup CYGNUM_UITRON_SEMAS
|
54 |
|
|
// CYGPKG_UITRON et al
|
55 |
|
|
#include <cyg/infra/testcase.h> // testing infrastructure
|
56 |
|
|
|
57 |
|
|
#ifdef CYGPKG_UITRON // we DO want the uITRON package
|
58 |
|
|
|
59 |
|
|
#ifdef CYGSEM_KERNEL_SCHED_MLQUEUE // we DO want prioritized threads
|
60 |
|
|
|
61 |
|
|
#ifdef CYGFUN_KERNEL_THREADS_TIMER // we DO want timout-able calls
|
62 |
|
|
|
63 |
|
|
#ifdef CYGVAR_KERNEL_COUNTERS_CLOCK // we DO want the realtime clock
|
64 |
|
|
|
65 |
|
|
// we're OK if it's C++ or neither of those two is defined:
|
66 |
|
|
#if defined( __cplusplus ) || \
|
67 |
|
|
(!defined( CYGIMP_UITRON_INLINE_FUNCS ) && \
|
68 |
|
|
!defined( CYGIMP_UITRON_CPP_OUTLINE_FUNCS) )
|
69 |
|
|
|
70 |
|
|
// =================== TEST CONFIGURATION ===================
|
71 |
|
|
#if \
|
72 |
|
|
/* test configuration for enough tasks */ \
|
73 |
|
|
(CYGNUM_UITRON_TASKS >= 4) && \
|
74 |
|
|
(CYGNUM_UITRON_TASKS < 90) && \
|
75 |
|
|
(CYGNUM_UITRON_START_TASKS == 1) && \
|
76 |
|
|
( !defined(CYGPKG_UITRON_TASKS_CREATE_DELETE) || \
|
77 |
|
|
CYGNUM_UITRON_TASKS_INITIALLY >= 4 ) && \
|
78 |
|
|
\
|
79 |
|
|
/* test configuration for enough cyclic handlers */ \
|
80 |
|
|
defined( CYGPKG_UITRON_CYCLICS ) && \
|
81 |
|
|
(CYGNUM_UITRON_CYCLICS >= 3) && \
|
82 |
|
|
(CYGNUM_UITRON_CYCLICS < 90) && \
|
83 |
|
|
\
|
84 |
|
|
/* test configuration for enough alarm handlers */ \
|
85 |
|
|
defined( CYGPKG_UITRON_ALARMS ) && \
|
86 |
|
|
(CYGNUM_UITRON_ALARMS >= 3) && \
|
87 |
|
|
(CYGNUM_UITRON_ALARMS < 90) && \
|
88 |
|
|
\
|
89 |
|
|
/* the end of the large #if statement */ \
|
90 |
|
|
1
|
91 |
|
|
|
92 |
|
|
// ============================ END ============================
|
93 |
|
|
|
94 |
|
|
|
95 |
|
|
|
96 |
|
|
#include <cyg/compat/uitron/uit_func.h> // uITRON
|
97 |
|
|
|
98 |
|
|
externC void
|
99 |
|
|
cyg_package_start( void )
|
100 |
|
|
{
|
101 |
|
|
CYG_TEST_INIT();
|
102 |
|
|
CYG_TEST_INFO( "Calling cyg_uitron_start()" );
|
103 |
|
|
cyg_uitron_start();
|
104 |
|
|
}
|
105 |
|
|
|
106 |
|
|
volatile int intercount = 0;
|
107 |
|
|
INT scratch;
|
108 |
|
|
|
109 |
|
|
void hand1(void)
|
110 |
|
|
{
|
111 |
|
|
CYG_TEST_INFO("Handler 1 called");
|
112 |
|
|
intercount++;
|
113 |
|
|
}
|
114 |
|
|
|
115 |
|
|
void hand2(void)
|
116 |
|
|
{
|
117 |
|
|
CYG_TEST_CHECK( 2 == intercount, "handler out of sync" );
|
118 |
|
|
CYG_TEST_INFO("Handler 2 called");
|
119 |
|
|
intercount++;
|
120 |
|
|
}
|
121 |
|
|
|
122 |
|
|
void task1( unsigned int arg )
|
123 |
|
|
{
|
124 |
|
|
ER ercd;
|
125 |
|
|
|
126 |
|
|
T_DCYC dcyc;
|
127 |
|
|
T_DALM dalm;
|
128 |
|
|
T_RCYC rcyc;
|
129 |
|
|
T_RALM ralm;
|
130 |
|
|
|
131 |
|
|
unsigned int tm;
|
132 |
|
|
|
133 |
|
|
static char foo[] = "Test message";
|
134 |
|
|
VP info = (VP)foo;
|
135 |
|
|
|
136 |
|
|
// Increase times when running on HW since overhead of GDB packet
|
137 |
|
|
// acknowledgements may cause tests of timing to fail.
|
138 |
|
|
if (cyg_test_is_simulator)
|
139 |
|
|
tm = 1;
|
140 |
|
|
else
|
141 |
|
|
tm = 4;
|
142 |
|
|
|
143 |
|
|
CYG_TEST_INFO( "Task 1 running" );
|
144 |
|
|
ercd = get_tid( &scratch );
|
145 |
|
|
CYG_TEST_CHECK( E_OK == ercd, "get_tid bad ercd" );
|
146 |
|
|
CYG_TEST_CHECK( 1 == scratch, "tid not 1" );
|
147 |
|
|
|
148 |
|
|
dcyc.exinf = (VP)info;
|
149 |
|
|
dcyc.cycatr = TA_HLNG;
|
150 |
|
|
dcyc.cychdr = (FP)&hand1;
|
151 |
|
|
dcyc.cycact = TCY_INI; // bad
|
152 |
|
|
dcyc.cyctim = 2;
|
153 |
|
|
|
154 |
|
|
#ifdef CYGSEM_UITRON_BAD_PARAMS_RETURN_ERRORS
|
155 |
|
|
ercd = def_cyc(3, &dcyc);
|
156 |
|
|
CYG_TEST_CHECK( E_PAR == ercd, "def_cyc bad ercd !E_PAR" );
|
157 |
|
|
#endif // we can test bad param error returns
|
158 |
|
|
|
159 |
|
|
dcyc.cycact = TCY_OFF; // make good
|
160 |
|
|
dcyc.cyctim = 0; // bad
|
161 |
|
|
|
162 |
|
|
#ifdef CYGSEM_UITRON_BAD_PARAMS_RETURN_ERRORS
|
163 |
|
|
ercd = def_cyc(3, &dcyc);
|
164 |
|
|
CYG_TEST_CHECK( E_PAR == ercd, "def_cyc bad ercd !E_PAR" );
|
165 |
|
|
#endif // we can test bad param error returns
|
166 |
|
|
|
167 |
|
|
dcyc.cyctim = 1; // make good
|
168 |
|
|
|
169 |
|
|
ercd = def_cyc(3, &dcyc);
|
170 |
|
|
CYG_TEST_CHECK( E_OK == ercd, "def_cyc bad ercd" );
|
171 |
|
|
|
172 |
|
|
#ifdef CYGSEM_UITRON_BAD_PARAMS_RETURN_ERRORS
|
173 |
|
|
ercd = def_cyc(-6, &dcyc);
|
174 |
|
|
CYG_TEST_CHECK( E_PAR == ercd, "def_cyc bad ercd !E_PAR" );
|
175 |
|
|
ercd = def_cyc(99, &dcyc);
|
176 |
|
|
CYG_TEST_CHECK( E_PAR == ercd, "def_cyc bad ercd !E_PAR" );
|
177 |
|
|
|
178 |
|
|
ercd = act_cyc(-6, TCY_OFF);
|
179 |
|
|
CYG_TEST_CHECK( E_PAR == ercd, "act_cyc bad ercd !E_PAR" );
|
180 |
|
|
ercd = act_cyc(99, TCY_OFF);
|
181 |
|
|
CYG_TEST_CHECK( E_PAR == ercd, "act_cyc bad ercd !E_PAR" );
|
182 |
|
|
ercd = act_cyc( 3, ~0);
|
183 |
|
|
CYG_TEST_CHECK( E_PAR == ercd, "act_cyc bad ercd !E_PAR" );
|
184 |
|
|
|
185 |
|
|
ercd = ref_cyc(&rcyc, -6);
|
186 |
|
|
CYG_TEST_CHECK( E_PAR == ercd, "ref_cyc bad ercd !E_PAR" );
|
187 |
|
|
ercd = ref_cyc(&rcyc, 99);
|
188 |
|
|
CYG_TEST_CHECK( E_PAR == ercd, "ref_cyc bad ercd !E_PAR" );
|
189 |
|
|
#ifndef CYGSEM_UITRON_PARAMS_NULL_IS_GOOD_PTR
|
190 |
|
|
ercd = ref_cyc(NULL, 3);
|
191 |
|
|
CYG_TEST_CHECK( E_PAR == ercd, "ref_cyc bad ercd !E_PAR" );
|
192 |
|
|
#endif
|
193 |
|
|
ercd = ref_cyc(NADR, 3);
|
194 |
|
|
CYG_TEST_CHECK( E_PAR == ercd, "ref_cyc bad ercd !E_PAR" );
|
195 |
|
|
#endif // we can test bad param error returns
|
196 |
|
|
|
197 |
|
|
ercd = def_cyc(3, (T_DCYC *)NADR);
|
198 |
|
|
CYG_TEST_CHECK( E_OK == ercd, "def_cyc bad ercd" );
|
199 |
|
|
#ifdef CYGSEM_UITRON_BAD_PARAMS_RETURN_ERRORS
|
200 |
|
|
ercd = ref_cyc(&rcyc, 3);
|
201 |
|
|
CYG_TEST_CHECK( E_NOEXS == ercd, "ref_cyc bad ercd !E_NOEXS" );
|
202 |
|
|
#endif // we can test bad param error returns
|
203 |
|
|
|
204 |
|
|
CYG_TEST_PASS( "bad calls: def_cyc, act_cyc, ref_cyc" );
|
205 |
|
|
|
206 |
|
|
dalm.exinf = (VP)info;
|
207 |
|
|
dalm.almatr = TA_HLNG;
|
208 |
|
|
dalm.almhdr = (FP)&hand2;
|
209 |
|
|
dalm.tmmode = ~0; // bad
|
210 |
|
|
dalm.almtim = 20;
|
211 |
|
|
|
212 |
|
|
#ifdef CYGSEM_UITRON_BAD_PARAMS_RETURN_ERRORS
|
213 |
|
|
ercd = def_alm(3, &dalm);
|
214 |
|
|
CYG_TEST_CHECK( E_PAR == ercd, "def_alm bad ercd !E_PAR" );
|
215 |
|
|
#endif // we can test bad param error returns
|
216 |
|
|
|
217 |
|
|
dalm.tmmode = TTM_REL; // make good
|
218 |
|
|
dalm.almtim = 0; // bad
|
219 |
|
|
|
220 |
|
|
#ifdef CYGSEM_UITRON_BAD_PARAMS_RETURN_ERRORS
|
221 |
|
|
ercd = def_alm(3, &dalm);
|
222 |
|
|
CYG_TEST_CHECK( E_PAR == ercd, "def_alm bad ercd !E_PAR" );
|
223 |
|
|
#endif // we can test bad param error returns
|
224 |
|
|
|
225 |
|
|
dalm.almtim = 1000; // make good
|
226 |
|
|
|
227 |
|
|
ercd = def_alm(3, &dalm);
|
228 |
|
|
CYG_TEST_CHECK( E_OK == ercd, "def_alm bad ercd" );
|
229 |
|
|
|
230 |
|
|
#ifdef CYGSEM_UITRON_BAD_PARAMS_RETURN_ERRORS
|
231 |
|
|
ercd = ref_alm(&ralm, -6);
|
232 |
|
|
CYG_TEST_CHECK( E_PAR == ercd, "ref_alm bad ercd !E_PAR" );
|
233 |
|
|
ercd = ref_alm(&ralm, 99);
|
234 |
|
|
CYG_TEST_CHECK( E_PAR == ercd, "ref_alm bad ercd !E_PAR" );
|
235 |
|
|
#ifndef CYGSEM_UITRON_PARAMS_NULL_IS_GOOD_PTR
|
236 |
|
|
ercd = ref_alm(NULL, 3);
|
237 |
|
|
CYG_TEST_CHECK( E_PAR == ercd, "ref_alm bad ercd !E_PAR" );
|
238 |
|
|
#endif
|
239 |
|
|
ercd = ref_alm(NADR, 3);
|
240 |
|
|
CYG_TEST_CHECK( E_PAR == ercd, "ref_alm bad ercd !E_PAR" );
|
241 |
|
|
|
242 |
|
|
#endif // we can test bad param error returns
|
243 |
|
|
ercd = def_alm(3, (T_DALM *)NADR);
|
244 |
|
|
CYG_TEST_CHECK( E_OK == ercd, "def_cyc bad ercd" );
|
245 |
|
|
#ifdef CYGSEM_UITRON_BAD_PARAMS_RETURN_ERRORS
|
246 |
|
|
ercd = ref_alm(&ralm, 3);
|
247 |
|
|
CYG_TEST_CHECK( E_NOEXS == ercd, "ref_cyc bad ercd !E_NOEXS" );
|
248 |
|
|
#endif // we can test bad param error returns
|
249 |
|
|
|
250 |
|
|
CYG_TEST_PASS( "bad calls: def_alm, act_alm, ref_alm" );
|
251 |
|
|
|
252 |
|
|
dcyc.exinf = (VP)info;
|
253 |
|
|
dcyc.cycatr = TA_HLNG;
|
254 |
|
|
dcyc.cychdr = (FP)&hand1;
|
255 |
|
|
dcyc.cycact = TCY_ON;
|
256 |
|
|
dcyc.cyctim = 50*tm;
|
257 |
|
|
|
258 |
|
|
ercd = def_cyc(3, &dcyc);
|
259 |
|
|
CYG_TEST_CHECK( E_OK == ercd, "ref_cyc bad ercd" );
|
260 |
|
|
ercd = ref_cyc(&rcyc, 3);
|
261 |
|
|
CYG_TEST_CHECK( E_OK == ercd, "ref_cyc bad ercd" );
|
262 |
|
|
CYG_TEST_CHECK( info == rcyc.exinf, "rcyc.exinf should be info" );
|
263 |
|
|
CYG_TEST_CHECK( 45*tm < rcyc.lfttim, "rcyc.lfttim too small" );
|
264 |
|
|
CYG_TEST_CHECK( rcyc.lfttim <= 50*tm, "rcyc.lfttim too big" );
|
265 |
|
|
CYG_TEST_CHECK( TCY_ON == rcyc.cycact, "rcyc.cycact should be TCY_ON" );
|
266 |
|
|
ercd = act_cyc(3, TCY_OFF);
|
267 |
|
|
CYG_TEST_CHECK( E_OK == ercd, "act_cyc bad ercd" );
|
268 |
|
|
ercd = ref_cyc(&rcyc, 3);
|
269 |
|
|
CYG_TEST_CHECK( E_OK == ercd, "ref_cyc bad ercd" );
|
270 |
|
|
CYG_TEST_CHECK( info == rcyc.exinf, "rcyc.exinf should be info" );
|
271 |
|
|
CYG_TEST_CHECK( 45*tm < rcyc.lfttim, "rcyc.lfttim too small" );
|
272 |
|
|
CYG_TEST_CHECK( rcyc.lfttim <= 50*tm, "rcyc.lfttim too big" );
|
273 |
|
|
CYG_TEST_CHECK( TCY_OFF == rcyc.cycact, "rcyc.cycact should be TCY_OFF" );
|
274 |
|
|
ercd = act_cyc(3, TCY_ON);
|
275 |
|
|
CYG_TEST_CHECK( E_OK == ercd, "act_cyc bad ercd" );
|
276 |
|
|
|
277 |
|
|
CYG_TEST_PASS("good calls: def_cyc, act_cyc, ref_cyc");
|
278 |
|
|
|
279 |
|
|
dalm.exinf = (VP)info;
|
280 |
|
|
dalm.almatr = TA_HLNG;
|
281 |
|
|
dalm.almhdr = (FP)&hand2;
|
282 |
|
|
dalm.tmmode = TTM_REL;
|
283 |
|
|
dalm.almtim = 120*tm;
|
284 |
|
|
|
285 |
|
|
ercd = def_alm(3, &dalm);
|
286 |
|
|
CYG_TEST_CHECK( E_OK == ercd, "def_alm bad ercd" );
|
287 |
|
|
ercd = ref_alm(&ralm, 3);
|
288 |
|
|
CYG_TEST_CHECK( E_OK == ercd, "ref_alm bad ercd" );
|
289 |
|
|
CYG_TEST_CHECK( info == ralm.exinf, "ralm.exinf should be info" );
|
290 |
|
|
CYG_TEST_CHECK( 115*tm < ralm.lfttim, "ralm.lfttim too small" );
|
291 |
|
|
CYG_TEST_CHECK( ralm.lfttim <= 120*tm, "ralm.lfttim too big" );
|
292 |
|
|
|
293 |
|
|
// Expect handlers to be called at approximate times
|
294 |
|
|
// time intercount
|
295 |
|
|
// tm*50 hand1 0
|
296 |
|
|
// tm*100 hand1 1
|
297 |
|
|
// tm*120 hand2 2
|
298 |
|
|
// tm*150 hand1 3
|
299 |
|
|
|
300 |
|
|
ercd = dly_tsk(160*tm);
|
301 |
|
|
CYG_TEST_CHECK( E_OK == ercd, "dly_tsk bad ercd" );
|
302 |
|
|
CYG_TEST_CHECK( 4 == intercount, "handlers not both called" );
|
303 |
|
|
|
304 |
|
|
ercd = act_cyc(3, TCY_OFF);
|
305 |
|
|
CYG_TEST_CHECK( E_OK == ercd, "act_cyc(off) bad ercd" );
|
306 |
|
|
|
307 |
|
|
ercd = dly_tsk(60*tm); // enough for at least one tick
|
308 |
|
|
CYG_TEST_CHECK( E_OK == ercd, "dly_tsk bad ercd" );
|
309 |
|
|
CYG_TEST_CHECK( 4 == intercount, "cyclic not disabled" );
|
310 |
|
|
|
311 |
|
|
// approx time now 220, so we expect a cycle in about 30 ticks
|
312 |
|
|
ercd = act_cyc(3, TCY_ON);
|
313 |
|
|
CYG_TEST_CHECK( E_OK == ercd, "act_cyc(on) bad ercd" );
|
314 |
|
|
ercd = ref_cyc(&rcyc, 3);
|
315 |
|
|
CYG_TEST_CHECK( E_OK == ercd, "ref_cyc bad ercd" );
|
316 |
|
|
CYG_TEST_CHECK( info == rcyc.exinf, "rcyc.exinf should be info" );
|
317 |
|
|
CYG_TEST_CHECK( 25*tm < rcyc.lfttim, "rcyc.lfttim too small" );
|
318 |
|
|
CYG_TEST_CHECK( rcyc.lfttim <= 35*tm, "rcyc.lfttim too big" );
|
319 |
|
|
CYG_TEST_CHECK( TCY_ON == rcyc.cycact, "rcyc.cycact should be TCY_ON" );
|
320 |
|
|
|
321 |
|
|
// now resynchronize with right now:
|
322 |
|
|
ercd = act_cyc(3, TCY_ON|TCY_INI);
|
323 |
|
|
CYG_TEST_CHECK( E_OK == ercd, "act_cyc(on) bad ercd" );
|
324 |
|
|
ercd = ref_cyc(&rcyc, 3);
|
325 |
|
|
CYG_TEST_CHECK( E_OK == ercd, "ref_cyc bad ercd" );
|
326 |
|
|
CYG_TEST_CHECK( info == rcyc.exinf, "rcyc.exinf should be info" );
|
327 |
|
|
CYG_TEST_CHECK( 45*tm < rcyc.lfttim, "rcyc.lfttim too small" );
|
328 |
|
|
CYG_TEST_CHECK( rcyc.lfttim <= 50*tm, "rcyc.lfttim too big" );
|
329 |
|
|
CYG_TEST_CHECK( TCY_ON == rcyc.cycact, "rcyc.cycact should be TCY_ON" );
|
330 |
|
|
|
331 |
|
|
// wait a bit and check that time marches on, or even down
|
332 |
|
|
ercd = dly_tsk(10*tm);
|
333 |
|
|
CYG_TEST_CHECK( E_OK == ercd, "dly_tsk bad ercd" );
|
334 |
|
|
ercd = ref_cyc(&rcyc, 3);
|
335 |
|
|
CYG_TEST_CHECK( E_OK == ercd, "ref_cyc bad ercd" );
|
336 |
|
|
CYG_TEST_CHECK( info == rcyc.exinf, "rcyc.exinf should be info" );
|
337 |
|
|
CYG_TEST_CHECK( 35*tm < rcyc.lfttim, "rcyc.lfttim too small" );
|
338 |
|
|
CYG_TEST_CHECK( rcyc.lfttim <= 45*tm, "rcyc.lfttim too big" );
|
339 |
|
|
CYG_TEST_CHECK( TCY_ON == rcyc.cycact, "rcyc.cycact should be TCY_ON" );
|
340 |
|
|
|
341 |
|
|
// now turn it off and re-synch with right now:
|
342 |
|
|
ercd = act_cyc(3, TCY_OFF|TCY_INI);
|
343 |
|
|
CYG_TEST_CHECK( E_OK == ercd, "act_cyc(on) bad ercd" );
|
344 |
|
|
ercd = ref_cyc(&rcyc, 3);
|
345 |
|
|
CYG_TEST_CHECK( E_OK == ercd, "ref_cyc bad ercd" );
|
346 |
|
|
CYG_TEST_CHECK( info == rcyc.exinf, "rcyc.exinf should be info" );
|
347 |
|
|
CYG_TEST_CHECK( 45*tm < rcyc.lfttim, "rcyc.lfttim too small" );
|
348 |
|
|
CYG_TEST_CHECK( rcyc.lfttim <= 50*tm, "rcyc.lfttim too big" );
|
349 |
|
|
CYG_TEST_CHECK( TCY_OFF == rcyc.cycact, "rcyc.cycact should be TCY_OFF" );
|
350 |
|
|
|
351 |
|
|
ercd = act_cyc(3, TCY_OFF);
|
352 |
|
|
CYG_TEST_CHECK( E_OK == ercd, "act_cyc(on) bad ercd" );
|
353 |
|
|
|
354 |
|
|
CYG_TEST_PASS("good calls: def_cyc, act_cyc, ref_cyc, def_alm, ref_alm");
|
355 |
|
|
|
356 |
|
|
// all done
|
357 |
|
|
CYG_TEST_EXIT( "All done" );
|
358 |
|
|
ext_tsk();
|
359 |
|
|
}
|
360 |
|
|
|
361 |
|
|
|
362 |
|
|
|
363 |
|
|
void task2( unsigned int arg )
|
364 |
|
|
{
|
365 |
|
|
}
|
366 |
|
|
|
367 |
|
|
void task3( unsigned int arg )
|
368 |
|
|
{
|
369 |
|
|
}
|
370 |
|
|
|
371 |
|
|
void task4( unsigned int arg )
|
372 |
|
|
{
|
373 |
|
|
}
|
374 |
|
|
|
375 |
|
|
#else // not enough (or too many) uITRON objects configured in
|
376 |
|
|
#define N_A_MSG "not enough uITRON objects to run test"
|
377 |
|
|
#endif // not enough (or too many) uITRON objects configured in
|
378 |
|
|
#else // not C++ and some C++ specific options enabled
|
379 |
|
|
#define N_A_MSG "C++ specific options selected but this is C"
|
380 |
|
|
#endif // not C++ and some C++ specific options enabled
|
381 |
|
|
#else // ! CYGVAR_KERNEL_COUNTERS_CLOCK - can't test without it
|
382 |
|
|
#define N_A_MSG "no CYGVAR_KERNEL_COUNTERS_CLOCK"
|
383 |
|
|
#endif // ! CYGVAR_KERNEL_COUNTERS_CLOCK - can't test without it
|
384 |
|
|
#else // ! CYGFUN_KERNEL_THREADS_TIMER - can't test without it
|
385 |
|
|
#define N_A_MSG "no CYGFUN_KERNEL_THREADS_TIMER"
|
386 |
|
|
#endif // ! CYGFUN_KERNEL_THREADS_TIMER - can't test without it
|
387 |
|
|
#else // ! CYGIMP_THREAD_PRIORITY - can't test without it
|
388 |
|
|
#define N_A_MSG "no CYGSEM_KERNEL_SCHED_MLQUEUE"
|
389 |
|
|
#endif // ! CYGSEM_KERNEL_SCHED_MLQUEUE - can't test without it
|
390 |
|
|
#else // ! CYGPKG_UITRON
|
391 |
|
|
#define N_A_MSG "uITRON Compatibility layer disabled"
|
392 |
|
|
#endif // CYGPKG_UITRON
|
393 |
|
|
|
394 |
|
|
#ifdef N_A_MSG
|
395 |
|
|
void
|
396 |
|
|
cyg_start( void )
|
397 |
|
|
{
|
398 |
|
|
CYG_TEST_INIT();
|
399 |
|
|
CYG_TEST_NA( N_A_MSG );
|
400 |
|
|
}
|
401 |
|
|
#endif // N_A_MSG defined ie. we are N/A.
|
402 |
|
|
|
403 |
|
|
// EOF test4.c
|