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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-3.0/] [packages/] [compat/] [uitron/] [current/] [tests/] [test9.c] - Blame information for rev 810

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

Line No. Rev Author Line
1 786 skrzyp
//===========================================================================
2
//
3
//      test9.c
4
//
5
//      uITRON "C" test program nine
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 Free Software Foundation, 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      
16
// version.                                                                 
17
//
18
// eCos is distributed in the hope that it will be useful, but WITHOUT      
19
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or    
20
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License    
21
// for more details.                                                        
22
//
23
// You should have received a copy of the GNU General Public License        
24
// along with eCos; if not, write to the Free Software Foundation, Inc.,    
25
// 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.            
26
//
27
// As a special exception, if other files instantiate templates or use      
28
// macros or inline functions from this file, or you compile this file      
29
// and link it with other works to produce a work based on this file,       
30
// this file does not by itself cause the resulting work to be covered by   
31
// the GNU General Public License. However the source code for this file    
32
// must still be made available in accordance with section (3) of the GNU   
33
// General Public License v2.                                               
34
//
35
// This exception does not invalidate any other reasons why a work based    
36
// on this file might be covered by the GNU General Public License.         
37
// -------------------------------------------                              
38
// ####ECOSGPLCOPYRIGHTEND####                                              
39
//===========================================================================
40
//#####DESCRIPTIONBEGIN####
41
//
42
// Author(s):   hmt
43
// Contributors:        hmt
44
// Date:        1998-10-16
45
// Purpose:     uITRON API testing
46
// Description: 
47
//
48
//####DESCRIPTIONEND####
49
//
50
//===========================================================================
51
 
52
#include <pkgconf/uitron.h>             // uITRON setup CYGNUM_UITRON_SEMAS
53
                                        // CYGPKG_UITRON et al
54
#include <cyg/infra/testcase.h>         // testing infrastructure
55
 
56
#ifdef CYGPKG_UITRON                    // we DO want the uITRON package
57
 
58
#ifdef CYGSEM_KERNEL_SCHED_MLQUEUE      // we DO want prioritized threads
59
 
60
#ifdef CYGFUN_KERNEL_THREADS_TIMER      // we DO want timout-able calls
61
 
62
#ifdef CYGVAR_KERNEL_COUNTERS_CLOCK     // we DO want the realtime clock
63
 
64
// we're OK if it's C++ or neither of those two is defined:
65
#if defined( __cplusplus ) || \
66
    (!defined( CYGIMP_UITRON_INLINE_FUNCS ) && \
67
     !defined( CYGIMP_UITRON_CPP_OUTLINE_FUNCS) )
68
 
69
// =================== TEST CONFIGURATION ===================
70
#if \
71
    /* test configuration for enough tasks */                      \
72
    (CYGNUM_UITRON_TASKS >= 4)                                  && \
73
    (CYGNUM_UITRON_TASKS < 90)                                  && \
74
    (CYGNUM_UITRON_START_TASKS == 1)                            && \
75
    ( !defined(CYGPKG_UITRON_TASKS_CREATE_DELETE) ||               \
76
      CYGNUM_UITRON_TASKS_INITIALLY >= 4             )          && \
77
                                                                   \
78
    /* test configuration for enough fixed memory pools */         \
79
    defined( CYGPKG_UITRON_MEMPOOLFIXED )                       && \
80
    (CYGNUM_UITRON_MEMPOOLFIXED >= 3)                           && \
81
    (CYGNUM_UITRON_MEMPOOLFIXED < 90)                           && \
82
    ( !defined(CYGPKG_UITRON_MEMPOOLFIXED_CREATE_DELETE) ||        \
83
      CYGNUM_UITRON_MEMPOOLFIXED_INITIALLY >= 3       )         && \
84
                                                                   \
85
    /* test configuration for enough variable mempools */          \
86
    defined( CYGPKG_UITRON_MEMPOOLVAR )                         && \
87
    (CYGNUM_UITRON_MEMPOOLVAR >= 3)                             && \
88
    (CYGNUM_UITRON_MEMPOOLVAR < 90)                             && \
89
    ( !defined(CYGPKG_UITRON_MEMPOOLVAR_CREATE_DELETE) ||          \
90
      CYGNUM_UITRON_MEMPOOLVAR_INITIALLY >= 3       )           && \
91
                                                                   \
92
    /* the end of the large #if statement */                       \
93
    1
94
 
95
// ============================ END ============================
96
 
97
 
98
 
99
#include <cyg/compat/uitron/uit_func.h> // uITRON
100
 
101
externC void
102
cyg_package_start( void )
103
{
104
    CYG_TEST_INIT();
105
    CYG_TEST_INFO( "Calling cyg_uitron_start()" );
106
    cyg_uitron_start();
107
}
108
 
109
VP vp;
110
 
111
T_CMPL t_cmpl = { NULL, 0, 1000 };
112
T_RMPL t_rmpl;
113
T_CMPF t_cmpf = { NULL, 0, 10, 100 };
114
T_RMPF t_rmpf;
115
 
116
 
117
void task1( unsigned int arg )
118
{
119
    ER ercd;
120
    int tests = 0;
121
 
122
    CYG_TEST_INFO( "Task 1 running" );
123
 
124
    ercd = dis_dsp();
125
    CYG_TEST_CHECK( E_OK == ercd, "dis_dsp bad ercd" );
126
    ercd = sta_tsk( 2, 22222 );
127
    CYG_TEST_CHECK( E_OK == ercd, "sta_tsk bad ercd" );
128
    ercd = chg_pri( 2, 5 );
129
    CYG_TEST_CHECK( E_OK == ercd, "chg_pri bad ercd" );
130
    ercd = ena_dsp();
131
    CYG_TEST_CHECK( E_OK == ercd, "ena_dsp bad ercd" );
132
    ercd = dly_tsk( 10 );
133
    CYG_TEST_CHECK( E_OK == ercd, "dly_tsk bad ercd" );
134
 
135
#ifdef CYGPKG_UITRON_MEMPOOLFIXED_CREATE_DELETE
136
    tests++;
137
#ifdef CYGSEM_UITRON_BAD_PARAMS_RETURN_ERRORS
138
    ercd = del_mpf( -6 );
139
    CYG_TEST_CHECK( E_ID == ercd, "del_mpf bad ercd !E_ID" );
140
    ercd = del_mpf( 99 );
141
    CYG_TEST_CHECK( E_ID == ercd, "del_mpf bad ercd !E_ID" );
142
    ercd = cre_mpf( -6, &t_cmpf );
143
    CYG_TEST_CHECK( E_ID == ercd, "cre_mpf bad ercd !E_ID" );
144
    ercd = cre_mpf( 99, &t_cmpf );
145
    CYG_TEST_CHECK( E_ID == ercd, "cre_mpf bad ercd !E_ID" );
146
#endif // we can test bad param error returns
147
    // try a pre-existing object
148
    // [first get a valid block from it for the freeing test later]
149
    ercd = pget_blf( &vp, 3 );
150
    CYG_TEST_CHECK( E_OK == ercd, "pget_blf bad ercd" );
151
    ercd = cre_mpf( 3, &t_cmpf );
152
    CYG_TEST_CHECK( E_OBJ == ercd, "cre_mpf bad ercd !E_OBJ" );
153
    // delete it so we can play
154
    ercd = del_mpf( 3 );
155
    CYG_TEST_CHECK( E_OK == ercd, "del_mpf bad ercd" );
156
    // check it is deleted
157
    ercd = rel_blf( 3, vp );            // vp did come from this pool
158
    CYG_TEST_CHECK( E_NOEXS == ercd, "rel_blf bad ercd !E_NOEXS" );
159
    ercd = pget_blf( &vp, 3 );
160
    CYG_TEST_CHECK( E_NOEXS == ercd, "pget_blf bad ercd !E_NOEXS" );
161
    ercd = tget_blf( &vp, 3, 10 );
162
    CYG_TEST_CHECK( E_NOEXS == ercd, "tget_blf bad ercd !E_NOEXS" );
163
    ercd = get_blf( &vp, 3 );
164
    CYG_TEST_CHECK( E_NOEXS == ercd, "get_blf bad ercd !E_NOEXS" );
165
    ercd = ref_mpf( &t_rmpf, 3 );
166
    CYG_TEST_CHECK( E_NOEXS == ercd, "ref_mpf bad ercd !E_NOEXS" );
167
#ifdef CYGSEM_UITRON_BAD_PARAMS_RETURN_ERRORS
168
    // now try creating it (badly)
169
#ifndef CYGSEM_UITRON_PARAMS_NULL_IS_GOOD_PTR
170
    ercd = cre_mpf( 3, NULL );
171
    CYG_TEST_CHECK( E_PAR == ercd, "cre_mpf bad ercd !E_PAR" );
172
#endif
173
    ercd = cre_mpf( 3, NADR );
174
    CYG_TEST_CHECK( E_PAR == ercd, "cre_mpf bad ercd !E_PAR" );
175
    t_cmpf.mpfatr = 0xfff;
176
    ercd = cre_mpf( 3, &t_cmpf );
177
    CYG_TEST_CHECK( E_RSATR == ercd, "cre_mpf bad ercd !E_RSATR" );
178
#endif // we can test bad param error returns
179
    t_cmpf.mpfatr = 0;
180
    t_cmpf.mpfcnt = 10000;
181
    t_cmpf.blfsz = 100;
182
    ercd = cre_mpf( 3, &t_cmpf );
183
    CYG_TEST_CHECK( E_NOMEM == ercd, "cre_mpf bad ercd" );
184
    t_cmpf.mpfcnt = 100;
185
    t_cmpf.blfsz = 100000;
186
    ercd = cre_mpf( 3, &t_cmpf );
187
    CYG_TEST_CHECK( E_NOMEM == ercd, "cre_mpf bad ercd" );
188
    // now create it well
189
    t_cmpf.mpfatr = 0;
190
    t_cmpf.mpfcnt = 10;
191
    t_cmpf.blfsz = 100;
192
    ercd = cre_mpf( 3, &t_cmpf );
193
    CYG_TEST_CHECK( E_OK == ercd, "cre_mpf bad ercd" );
194
    // and check we can use it
195
    ercd = pget_blf( &vp, 3 );
196
    CYG_TEST_CHECK( E_OK == ercd, "pget_blf bad ercd" );
197
    ercd = tget_blf( &vp, 3, 10 );
198
    CYG_TEST_CHECK( E_OK == ercd, "tget_blf bad ercd" );
199
    ercd = get_blf( &vp, 3 );
200
    CYG_TEST_CHECK( E_OK == ercd, "get_blf bad ercd" );
201
    ercd = rel_blf( 3, vp );            // vp did come from new pool
202
    CYG_TEST_CHECK( E_OK == ercd, "rel_blf bad ercd" );
203
    ercd = rel_blf( 3, vp );            // vp already freed
204
    CYG_TEST_CHECK( E_PAR == ercd, "rel_blf bad ercd !E_PAR" );
205
    ercd = ref_mpf( &t_rmpf, 3 );
206
    CYG_TEST_CHECK( E_OK == ercd, "ref_mpf bad ercd" );
207
 
208
    // In order to wait on the pools, we must first consume all they have:
209
    while ( E_OK == (ercd = pget_blf( &vp, 1 )) ) /* nothing */;
210
    CYG_TEST_CHECK( E_TMOUT == ercd, "pget_blf bad ercd !E_TMOUT" );
211
    while ( E_OK == (ercd = tget_blf( &vp, 2, 1 )) ) /* nothing */;
212
    CYG_TEST_CHECK( E_TMOUT == ercd, "tget_blf bad ercd !E_TMOUT" );
213
    // now wait while task 2 deletes the wait objects
214
    ercd = wup_tsk( 2 );
215
    CYG_TEST_CHECK( E_OK == ercd, "wup_tsk bad ercd" );
216
    ercd = get_blf( &vp, 1 );
217
    CYG_TEST_CHECK( E_DLT == ercd, "get_blf bad ercd !E_DLT" );
218
    ercd = wup_tsk( 2 );
219
    CYG_TEST_CHECK( E_OK == ercd, "wup_tsk bad ercd" );
220
    ercd = tget_blf( &vp, 2, 20 );
221
    CYG_TEST_CHECK( E_DLT == ercd, "tget_blf bad ercd !E_DLT" );
222
    // check they are deleted
223
    ercd = get_blf( &vp, 1 );
224
    CYG_TEST_CHECK( E_NOEXS == ercd, "get_blf bad ercd !E_NOEXS" );
225
    ercd = pget_blf( &vp, 2 );
226
    CYG_TEST_CHECK( E_NOEXS == ercd, "pget_blf bad ercd !E_NOEXS" );
227
 
228
    // re-create and do it again
229
    t_cmpf.mpfcnt = 90;
230
    t_cmpf.blfsz = 20;
231
    ercd = cre_mpf( 1, &t_cmpf );
232
    CYG_TEST_CHECK( E_OK == ercd, "cre_mpf bad ercd" );
233
    t_cmpf.mpfcnt = 5;
234
    t_cmpf.blfsz = 200;
235
    ercd = cre_mpf( 2, &t_cmpf );
236
    CYG_TEST_CHECK( E_OK == ercd, "cre_mpf bad ercd" );
237
 
238
    // In order to wait on the pools, we must first consume all they have:
239
    while ( E_OK == (ercd = pget_blf( &vp, 1 )) ) /* nothing */;
240
    CYG_TEST_CHECK( E_TMOUT == ercd, "pget_blf bad ercd !E_TMOUT" );
241
    while ( E_OK == (ercd = tget_blf( &vp, 2, 1 )) ) /* nothing */;
242
    CYG_TEST_CHECK( E_TMOUT == ercd, "tget_blf bad ercd !E_TMOUT" );
243
    // now wait while task 2 deletes the wait objects
244
    ercd = wup_tsk( 2 );
245
    CYG_TEST_CHECK( E_OK == ercd, "wup_tsk bad ercd" );
246
    ercd = get_blf( &vp, 1 );
247
    CYG_TEST_CHECK( E_DLT == ercd, "get_blf bad ercd !E_DLT" );
248
    ercd = wup_tsk( 2 );
249
    CYG_TEST_CHECK( E_OK == ercd, "wup_tsk bad ercd" );
250
    ercd = tget_blf( &vp, 2, 10 );
251
    CYG_TEST_CHECK( E_DLT == ercd, "tget_blf bad ercd !E_DLT" );
252
    // check they are deleted
253
    ercd = tget_blf( &vp, 1, 1 );
254
    CYG_TEST_CHECK( E_NOEXS == ercd, "get_blf bad ercd !E_NOEXS" );
255
    ercd = get_blf( &vp, 2 );
256
    CYG_TEST_CHECK( E_NOEXS == ercd, "pget_blf bad ercd !E_NOEXS" );
257
 
258
    CYG_TEST_PASS("create/delete fixed mempools");
259
#endif // CYGPKG_UITRON_MEMPOOLFIXED_CREATE_DELETE
260
 
261
#ifdef CYGPKG_UITRON_MEMPOOLVAR_CREATE_DELETE
262
    tests++;
263
#ifdef CYGSEM_UITRON_BAD_PARAMS_RETURN_ERRORS
264
    ercd = del_mpl( -6 );
265
    CYG_TEST_CHECK( E_ID == ercd, "del_mpl bad ercd !E_ID" );
266
    ercd = del_mpl( 99 );
267
    CYG_TEST_CHECK( E_ID == ercd, "del_mpl bad ercd !E_ID" );
268
    ercd = cre_mpl( -6, &t_cmpl );
269
    CYG_TEST_CHECK( E_ID == ercd, "cre_mpl bad ercd !E_ID" );
270
    ercd = cre_mpl( 99, &t_cmpl );
271
    CYG_TEST_CHECK( E_ID == ercd, "cre_mpl bad ercd !E_ID" );
272
#endif // we can test bad param error returns
273
    // try a pre-existing object
274
    // [first get a valid block from it for the freeing test later]
275
    ercd = pget_blk( &vp, 3, 100 );
276
    CYG_TEST_CHECK( E_OK == ercd, "pget_blk bad ercd" );
277
    ercd = cre_mpl( 3, &t_cmpl );
278
    CYG_TEST_CHECK( E_OBJ == ercd, "cre_mpl bad ercd !E_OBJ" );
279
    // delete it so we can play
280
    ercd = del_mpl( 3 );
281
    CYG_TEST_CHECK( E_OK == ercd, "del_mpl bad ercd" );
282
    // check it is deleted
283
    ercd = rel_blk( 3, vp );            // vp did come from this pool
284
    CYG_TEST_CHECK( E_NOEXS == ercd, "rel_blk bad ercd !E_NOEXS" );
285
    ercd = pget_blk( &vp, 3, 100 );
286
    CYG_TEST_CHECK( E_NOEXS == ercd, "pget_blk bad ercd !E_NOEXS" );
287
    ercd = tget_blk( &vp, 3, 100, 10 );
288
    CYG_TEST_CHECK( E_NOEXS == ercd, "tget_blk bad ercd !E_NOEXS" );
289
    ercd = get_blk( &vp, 3, 100 );
290
    CYG_TEST_CHECK( E_NOEXS == ercd, "get_blk bad ercd !E_NOEXS" );
291
    ercd = ref_mpl( &t_rmpl, 3 );
292
    CYG_TEST_CHECK( E_NOEXS == ercd, "ref_mpl bad ercd !E_NOEXS" );
293
#ifdef CYGSEM_UITRON_BAD_PARAMS_RETURN_ERRORS
294
    // now try creating it (badly)
295
#ifndef CYGSEM_UITRON_PARAMS_NULL_IS_GOOD_PTR
296
    ercd = cre_mpl( 3, NULL );
297
    CYG_TEST_CHECK( E_PAR == ercd, "cre_mpl bad ercd !E_PAR" );
298
#endif
299
    ercd = cre_mpl( 3, NADR );
300
    CYG_TEST_CHECK( E_PAR == ercd, "cre_mpl bad ercd !E_PAR" );
301
    t_cmpl.mplatr = 0xfff;
302
    ercd = cre_mpl( 3, &t_cmpl );
303
    CYG_TEST_CHECK( E_RSATR == ercd, "cre_mpl bad ercd !E_RSATR" );
304
#endif // we can test bad param error returns
305
    t_cmpl.mplatr = 0;
306
    t_cmpl.mplsz = 100000000;
307
    ercd = cre_mpl( 3, &t_cmpl );
308
    CYG_TEST_CHECK( E_NOMEM == ercd, "cre_mpl bad ercd" );
309
    // now create it well
310
    t_cmpl.mplatr = 0;
311
    t_cmpl.mplsz = 1000;
312
    ercd = cre_mpl( 3, &t_cmpl );
313
    CYG_TEST_CHECK( E_OK == ercd, "cre_mpl bad ercd" );
314
    // and check we can use it
315
    ercd = pget_blk( &vp, 3, 100 );
316
    CYG_TEST_CHECK( E_OK == ercd, "pget_blk bad ercd" );
317
    ercd = pget_blk( &vp, 3, 100000000 ); // way too large
318
    CYG_TEST_CHECK( E_TMOUT == ercd, "pget_blk bad ercd !E_TMOUT" );
319
    ercd = tget_blk( &vp, 3, 100, 10 );
320
    CYG_TEST_CHECK( E_OK == ercd, "tget_blk bad ercd" );
321
    ercd = get_blk( &vp, 3, 100 );
322
    CYG_TEST_CHECK( E_OK == ercd, "get_blk bad ercd" );
323
    ercd = rel_blk( 3, vp );            // vp did come from new pool
324
    CYG_TEST_CHECK( E_OK == ercd, "rel_blk bad ercd" );
325
    ercd = rel_blk( 3, vp );            // vp already freed
326
    CYG_TEST_CHECK( E_PAR == ercd, "rel_blk bad ercd !E_PAR" );
327
    ercd = ref_mpl( &t_rmpl, 3 );
328
    CYG_TEST_CHECK( E_OK == ercd, "ref_mpl bad ercd" );
329
 
330
    // In order to wait on the pools, we must first consume all they have:
331
    while ( E_OK == (ercd = pget_blk( &vp, 1, 100 )) ) /* nothing */;
332
    CYG_TEST_CHECK( E_TMOUT == ercd, "pget_blk bad ercd !E_TMOUT" );
333
    while ( E_OK == (ercd = tget_blk( &vp, 2, 100, 1 )) ) /* nothing */;
334
    CYG_TEST_CHECK( E_TMOUT == ercd, "tget_blk bad ercd !E_TMOUT" );
335
    // now wait while task 2 deletes the wait objects
336
    ercd = wup_tsk( 2 );
337
    CYG_TEST_CHECK( E_OK == ercd, "wup_tsk bad ercd" );
338
    ercd = get_blk( &vp, 1, 200 );
339
    CYG_TEST_CHECK( E_DLT == ercd, "get_blk bad ercd !E_DLT" );
340
    ercd = wup_tsk( 2 );
341
    CYG_TEST_CHECK( E_OK == ercd, "wup_tsk bad ercd" );
342
    ercd = tget_blk( &vp, 2, 100, 20 );
343
    CYG_TEST_CHECK( E_DLT == ercd, "tget_blk bad ercd !E_DLT" );
344
    // check they are deleted
345
    ercd = get_blk( &vp, 1, 200 );
346
    CYG_TEST_CHECK( E_NOEXS == ercd, "get_blk bad ercd !E_NOEXS" );
347
    ercd = pget_blk( &vp, 2, 20 );
348
    CYG_TEST_CHECK( E_NOEXS == ercd, "pget_blk bad ercd !E_NOEXS" );
349
 
350
    // re-create and do it again
351
    ercd = cre_mpl( 1, &t_cmpl );
352
    CYG_TEST_CHECK( E_OK == ercd, "cre_mpl bad ercd" );
353
    ercd = cre_mpl( 2, &t_cmpl );
354
    CYG_TEST_CHECK( E_OK == ercd, "cre_mpl bad ercd" );
355
 
356
    // In order to wait on the pools, we must first consume all they have:
357
    while ( E_OK == (ercd = pget_blk( &vp, 1, 20 )) ) /* nothing */;
358
    CYG_TEST_CHECK( E_TMOUT == ercd, "pget_blk bad ercd !E_TMOUT" );
359
    while ( E_OK == (ercd = tget_blk( &vp, 2, 400, 1 )) ) /* nothing */;
360
    CYG_TEST_CHECK( E_TMOUT == ercd, "tget_blk bad ercd !E_TMOUT" );
361
    // now wait while task 2 deletes the wait objects
362
    ercd = wup_tsk( 2 );
363
    CYG_TEST_CHECK( E_OK == ercd, "wup_tsk bad ercd" );
364
    ercd = get_blk( &vp, 1, 200 );
365
    CYG_TEST_CHECK( E_DLT == ercd, "get_blk bad ercd !E_DLT" );
366
    ercd = wup_tsk( 2 );
367
    CYG_TEST_CHECK( E_OK == ercd, "wup_tsk bad ercd" );
368
    ercd = tget_blk( &vp, 2, 500, 20 );
369
    CYG_TEST_CHECK( E_DLT == ercd, "tget_blk bad ercd !E_DLT" );
370
    // check they are deleted
371
    ercd = tget_blk( &vp, 1, 200, 1 );
372
    CYG_TEST_CHECK( E_NOEXS == ercd, "get_blk bad ercd !E_NOEXS" );
373
    ercd = get_blk( &vp, 2, 20 );
374
    CYG_TEST_CHECK( E_NOEXS == ercd, "pget_blk bad ercd !E_NOEXS" );
375
 
376
    CYG_TEST_PASS("create/delete variable mempools");
377
#endif // CYGPKG_UITRON_MEMPOOLVAR_CREATE_DELETE
378
 
379
    ercd = ter_tsk( 2 );
380
    CYG_TEST_CHECK( E_OK == ercd, "ter_tsk bad ercd" );
381
    ercd = dly_tsk( 5 );
382
    CYG_TEST_CHECK( E_OK == ercd, "dly_tsk bad ercd" );
383
 
384
    // all done
385
    if ( 0 == tests ) {
386
        CYG_TEST_NA( "No objects have create/delete enabled" );
387
    }
388
    else {
389
        CYG_TEST_EXIT( "All done" );
390
    }
391
    ext_tsk();
392
}
393
 
394
 
395
 
396
void task2( unsigned int arg )
397
{
398
    ER ercd;
399
    int i;
400
    CYG_TEST_INFO( "Task 2 running" );
401
    ercd = get_tid( &i );
402
    CYG_TEST_CHECK( E_OK == ercd, "get_tid bad ercd" );
403
    CYG_TEST_CHECK( 2 == i, "tid not 2" );
404
    if ( 22222 != arg )
405
        CYG_TEST_FAIL( "Task 2 arg not 22222" );
406
 
407
    ercd = slp_tsk();
408
    CYG_TEST_CHECK( E_OK == ercd, "slp_tsk bad ercd" );
409
 
410
#ifdef CYGPKG_UITRON_MEMPOOLFIXED_CREATE_DELETE
411
    ercd = del_mpf( 1 );
412
    CYG_TEST_CHECK( E_OK == ercd, "del_mpf bad ercd" );
413
    ercd = slp_tsk();
414
    CYG_TEST_CHECK( E_OK == ercd, "slp_tsk bad ercd" );
415
    ercd = del_mpf( 2 );
416
    CYG_TEST_CHECK( E_OK == ercd, "del_mpf bad ercd" );
417
    ercd = slp_tsk();
418
    CYG_TEST_CHECK( E_OK == ercd, "slp_tsk bad ercd" );
419
    ercd = del_mpf( 1 );
420
    CYG_TEST_CHECK( E_OK == ercd, "del_mpf bad ercd" );
421
    ercd = slp_tsk();
422
    CYG_TEST_CHECK( E_OK == ercd, "slp_tsk bad ercd" );
423
    ercd = del_mpf( 2 );
424
    CYG_TEST_CHECK( E_OK == ercd, "del_mpf bad ercd" );
425
    ercd = slp_tsk();
426
    CYG_TEST_CHECK( E_OK == ercd, "slp_tsk bad ercd" );
427
#endif // CYGPKG_UITRON_MEMPOOLFIXED_CREATE_DELETE
428
 
429
#ifdef CYGPKG_UITRON_MEMPOOLVAR_CREATE_DELETE
430
    ercd = del_mpl( 1 );
431
    CYG_TEST_CHECK( E_OK == ercd, "del_mpl bad ercd" );
432
    ercd = slp_tsk();
433
    CYG_TEST_CHECK( E_OK == ercd, "slp_tsk bad ercd" );
434
    ercd = del_mpl( 2 );
435
    CYG_TEST_CHECK( E_OK == ercd, "del_mpl bad ercd" );
436
    ercd = slp_tsk();
437
    CYG_TEST_CHECK( E_OK == ercd, "slp_tsk bad ercd" );
438
    ercd = del_mpl( 1 );
439
    CYG_TEST_CHECK( E_OK == ercd, "del_mpl bad ercd" );
440
    ercd = slp_tsk();
441
    CYG_TEST_CHECK( E_OK == ercd, "slp_tsk bad ercd" );
442
    ercd = del_mpl( 2 );
443
    CYG_TEST_CHECK( E_OK == ercd, "del_mpl bad ercd" );
444
    ercd = slp_tsk();
445
    CYG_TEST_CHECK( E_OK == ercd, "slp_tsk bad ercd" );
446
#endif // CYGPKG_UITRON_MEMPOOLVAR_CREATE_DELETE
447
 
448
    // we expect task2 to be killed here
449
    CYG_TEST_FAIL( "Task 2 ran to completion!" );
450
}
451
 
452
void task3( unsigned int arg )
453
{
454
}
455
 
456
void task4( unsigned int arg )
457
{
458
}
459
 
460
#else // not enough (or too many) uITRON objects configured in
461
#define N_A_MSG "not enough uITRON objects to run test"
462
#endif // not enough (or too many) uITRON objects configured in
463
#else  // not C++ and some C++ specific options enabled
464
#define N_A_MSG "C++ specific options selected but this is C"
465
#endif  // not C++ and some C++ specific options enabled
466
#else // ! CYGVAR_KERNEL_COUNTERS_CLOCK   - can't test without it
467
#define N_A_MSG "no CYGVAR_KERNEL_COUNTERS_CLOCK"
468
#endif // ! CYGVAR_KERNEL_COUNTERS_CLOCK  - can't test without it
469
#else  // ! CYGFUN_KERNEL_THREADS_TIMER   - can't test without it
470
#define N_A_MSG "no CYGFUN_KERNEL_THREADS_TIMER"
471
#endif // ! CYGFUN_KERNEL_THREADS_TIMER   - can't test without it
472
#else  // ! CYGIMP_THREAD_PRIORITY        - can't test without it
473
#define N_A_MSG "no CYGSEM_KERNEL_SCHED_MLQUEUE"
474
#endif // ! CYGSEM_KERNEL_SCHED_MLQUEUE   - can't test without it
475
#else  // ! CYGPKG_UITRON
476
#define N_A_MSG "uITRON Compatibility layer disabled"
477
#endif // CYGPKG_UITRON
478
 
479
#ifdef N_A_MSG
480
void
481
cyg_start( void )
482
{
483
    CYG_TEST_INIT();
484
    CYG_TEST_NA( N_A_MSG );
485
}
486
#endif // N_A_MSG defined ie. we are N/A.
487
 
488
// EOF test9.c

powered by: WebSVN 2.1.0

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