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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-3.0/] [packages/] [compat/] [uitron/] [current/] [src/] [uit_objs.cxx] - 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
//      uit_objs.cxx
4
//
5
//      uITRON static objects
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-03-13
45
// Purpose:     uITRON static system objects
46
// Description: 
47
//
48
//####DESCRIPTIONEND####
49
//
50
//===========================================================================
51
 
52
#include <pkgconf/uitron.h>             // uITRON setup CYGNUM_UITRON_SEMAS
53
                                        // CYGPKG_UITRON et al
54
 
55
#ifdef CYGPKG_UITRON
56
 
57
#include <cyg/compat/uitron/uit_objs.hxx>
58
                                        // declarations of the objects
59
                                        // we define below, and everything
60
                                        // we need to specify them.
61
 
62
#include <cyg/hal/hal_arch.h>           // for CYGNUM_HAL_STACK_SIZE_MINIMUM
63
 
64
// ------------------------------------------------------------------------
65
// Mboxes have no initializer.
66
#ifdef CYGPKG_UITRON_MBOXES
67
#if 0 < CYGNUM_UITRON_MBOXES
68
Cyg_Mbox                CYG_UITRON_DECL( MBOXES );
69
#ifdef CYGPKG_UITRON_MBOXES_CREATE_DELETE
70
Cyg_Mbox                *CYG_UITRON_DECL_PTRS( MBOXES );
71
#endif
72
#endif
73
#endif // CYGPKG_UITRON_MBOXES
74
 
75
// ------------------------------------------------------------------------
76
// Flags have no initializer.
77
#ifdef CYGPKG_UITRON_FLAGS
78
#if 0 < CYGNUM_UITRON_FLAGS
79
Cyg_Flag                CYG_UITRON_DECL( FLAGS );
80
#ifdef CYGPKG_UITRON_FLAGS_CREATE_DELETE
81
Cyg_Flag                *CYG_UITRON_DECL_PTRS( FLAGS );
82
#endif
83
#endif
84
#endif // CYGPKG_UITRON_FLAGS
85
 
86
// ------------------------------------------------------------------------
87
// Semaphores have an optional initializer.
88
#ifdef CYGPKG_UITRON_SEMAS
89
#if (0 < CYGNUM_UITRON_SEMAS) || \
90
    defined( CYGDAT_UITRON_SEMA_INITIALIZERS )
91
 
92
#ifndef CYGNUM_UITRON_SEMAS
93
#error You must define CYGNUM_UITRON_SEMAS
94
#endif
95
 
96
Cyg_Counting_Semaphore2 CYG_UITRON_DECL( SEMAS )
97
 
98
#ifdef CYGDAT_UITRON_SEMA_INITIALIZERS
99
// a Macro to ease the construction:
100
#define CYG_UIT_SEMA( _count_  ) Cyg_Counting_Semaphore2( (cyg_count32)(_count_) )
101
#ifdef CYGPKG_UITRON_SEMAS_CREATE_DELETE
102
#define CYG_UIT_SEMA_NOEXS       Cyg_Counting_Semaphore2( (cyg_count32)    0     )
103
#endif
104
 = {
105
    CYGDAT_UITRON_SEMA_INITIALIZERS
106
}
107
#undef CYG_UIT_SEMA
108
#ifdef CYGPKG_UITRON_SEMAS_CREATE_DELETE
109
#undef CYG_UIT_SEMA_NOEXS
110
#endif
111
#endif // do we have initializers?
112
; // the end of the declaration, with or without initializer
113
 
114
#ifdef CYGPKG_UITRON_SEMAS_CREATE_DELETE
115
Cyg_Counting_Semaphore2 *CYG_UITRON_DECL_PTRS( SEMAS );
116
#endif
117
#endif
118
#endif // CYGPKG_UITRON_SEMAS
119
 
120
// ------------------------------------------------------------------------
121
// tasks MUST be initialized, you must have some.
122
#ifndef CYGDAT_UITRON_TASK_EXTERNS
123
#error You must define CYGDAT_UITRON_TASK_EXTERNS
124
#endif
125
#ifndef CYGDAT_UITRON_TASK_INITIALIZERS
126
#error You must define CYGDAT_UITRON_TASK_INITIALIZERS
127
#endif
128
#ifndef CYGNUM_UITRON_TASKS
129
#error You must define CYGNUM_UITRON_TASKS
130
#endif
131
 
132
// a Macro to ease the construction:
133
//      "name", priority, proc, stackbase, stacksize
134
#define CYG_UIT_TASK( _name_, _prio_, _func_, _sb_, _ss_ ) \
135
  Cyg_Thread(                           \
136
        (CYG_ADDRWORD)(_prio_),         \
137
        (_func_),                       \
138
        (CYG_ADDRWORD)0,                \
139
        _name_,                         \
140
        (CYG_ADDRESS)(_sb_),            \
141
        (cyg_ucount32)(_ss_) )
142
 
143
#ifdef CYGPKG_UITRON_TASKS_CREATE_DELETE
144
#define CYG_UIT_TASK_NOEXS( _name_, _sb_, _ss_ ) \
145
  Cyg_Thread(                           \
146
        (CYG_ADDRWORD)(CYG_SCHED_DEFAULT_INFO), \
147
        (cyg_thread_entry *)(0),        \
148
        (CYG_ADDRWORD)0,                \
149
        _name_,                         \
150
        (CYG_ADDRESS)(_sb_),            \
151
        (cyg_ucount32)(_ss_) )
152
#endif
153
 
154
// FIXME: Xscale tools currently in use have a preprocessor bug causing
155
// the below #ifs to be misinterpreted. Therefore a *temporary*
156
// workaround is included to define a MAX macro, and change
157
// CYGDAT_UITRON_TASK_EXTERNS and CYGDAT_UITRON_TASK_INITIALISERS in
158
// the CDL to use it.
159
#ifdef XSCALECPPFIXEDSOMETIME
160
 
161
#ifdef CYGNUM_HAL_STACK_SIZE_MINIMUM
162
# ifdef CYGNUM_UITRON_STACK_SIZE
163
#  if CYGNUM_UITRON_STACK_SIZE < CYGNUM_HAL_STACK_SIZE_MINIMUM
164
 
165
// then override the configured stack size
166
#   undef CYGNUM_UITRON_STACK_SIZE
167
#   define CYGNUM_UITRON_STACK_SIZE CYGNUM_HAL_STACK_SIZE_MINIMUM
168
 
169
#  endif // CYGNUM_UITRON_STACK_SIZE < CYGNUM_HAL_STACK_SIZE_MINIMUM
170
# endif // CYGNUM_UITRON_STACK_SIZE
171
#endif // CYGNUM_HAL_STACK_SIZE_MINIMUM
172
 
173
#else
174
#define MAX(_x_,_y_) ((_x_) > (_y_) ? (_x_) : (_y_))
175
#endif
176
 
177
// declare the symbols used in the initializer
178
CYGDAT_UITRON_TASK_EXTERNS
179
 
180
Cyg_Thread      CYG_UITRON_DECL( TASKS ) =
181
{
182
    CYGDAT_UITRON_TASK_INITIALIZERS
183
};
184
 
185
#undef CYG_UIT_TASK
186
#ifdef CYGPKG_UITRON_TASKS_CREATE_DELETE
187
#undef CYG_UIT_TASK_NOEXS
188
#endif
189
 
190
#ifdef CYGIMP_THREAD_PRIORITY
191
// An ancillary array of priorities, for managing the "original" prio
192
cyg_priority
193
cyg_uitron_task_initial_priorities[ CYG_UITRON_NUM( TASKS ) ];
194
#endif
195
 
196
#ifdef CYGPKG_UITRON_TASKS_CREATE_DELETE
197
Cyg_Thread              *CYG_UITRON_DECL_PTRS( TASKS );
198
#endif
199
 
200
// ------------------------------------------------------------------------
201
// fixed memory pools MUST be initialized, IF you have some.
202
#ifdef CYGPKG_UITRON_MEMPOOLFIXED
203
#if (0 < CYGNUM_UITRON_MEMPOOLFIXED) || \
204
    defined (CYGDAT_UITRON_MEMPOOLFIXED_INITIALIZERS) || \
205
    defined (CYGDAT_UITRON_MEMPOOLFIXED_EXTERNS)
206
 
207
#ifndef CYGDAT_UITRON_MEMPOOLFIXED_EXTERNS
208
#error You must define CYGDAT_UITRON_MEMPOOLFIXED_EXTERNS
209
#endif
210
#ifndef CYGDAT_UITRON_MEMPOOLFIXED_INITIALIZERS
211
#error You must define CYGDAT_UITRON_MEMPOOLFIXED_INITIALIZERS
212
#endif
213
#ifndef CYGNUM_UITRON_MEMPOOLFIXED
214
#error You must define CYGNUM_UITRON_MEMPOOLFIXED
215
#endif
216
 
217
// declare the symbols used in the initializer
218
CYGDAT_UITRON_MEMPOOLFIXED_EXTERNS
219
 
220
// a Macro to ease the construction: addr, size, blocksize
221
#define CYG_UIT_MEMPOOLFIXED( _a_, _s_, _bs_ ) Cyg_Mempool_Fixed( \
222
    (cyg_uint8 *)(_a_), (cyg_int32)(_s_), (CYG_ADDRWORD)(_bs_) )
223
#ifdef CYGPKG_UITRON_MEMPOOLFIXED_CREATE_DELETE
224
// note that this just picks a suitable size for the initialization, which
225
// should not be too inefficient
226
#define CYG_UIT_MEMPOOLFIXED_NOEXS( _a_, _s_ ) Cyg_Mempool_Fixed( \
227
    (cyg_uint8 *)(_a_), (cyg_int32)(_s_), (CYG_ADDRWORD) ((~7)&((_s_)/2)) )
228
#endif
229
 
230
Cyg_Mempool_Fixed       CYG_UITRON_DECL( MEMPOOLFIXED ) =
231
{
232
    CYGDAT_UITRON_MEMPOOLFIXED_INITIALIZERS
233
};
234
#undef CYG_UIT_MEMPOOLFIXED
235
#ifdef CYGPKG_UITRON_MEMPOOLFIXED_CREATE_DELETE
236
#undef CYG_UIT_MEMPOOLFIXED_NOEXS
237
#endif
238
 
239
#ifdef CYGPKG_UITRON_MEMPOOLFIXED_CREATE_DELETE
240
Cyg_Mempool_Fixed       *CYG_UITRON_DECL_PTRS( MEMPOOLFIXED );
241
#endif
242
#endif // do we have fixed memory pools at all?
243
#endif // CYGPKG_UITRON_MEMPOOLFIXED
244
 
245
// ------------------------------------------------------------------------
246
// variable memory pools MUST be initialized, IF you have some.
247
#ifdef CYGPKG_UITRON_MEMPOOLVAR
248
#if (0 < CYGNUM_UITRON_MEMPOOLVAR) || \
249
    defined (CYGDAT_UITRON_MEMPOOLVAR_INITIALIZERS) || \
250
    defined (CYGDAT_UITRON_MEMPOOLVAR_EXTERNS)
251
 
252
#ifndef CYGDAT_UITRON_MEMPOOLVAR_EXTERNS
253
#error You must define CYGDAT_UITRON_MEMPOOLVAR_EXTERNS
254
#endif
255
#ifndef CYGDAT_UITRON_MEMPOOLVAR_INITIALIZERS
256
#error You must define CYGDAT_UITRON_MEMPOOLVAR_INITIALIZERS
257
#endif
258
#ifndef CYGNUM_UITRON_MEMPOOLVAR
259
#error You must define CYGNUM_UITRON_MEMPOOLVAR
260
#endif
261
 
262
// declare the symbols used in the initializer
263
CYGDAT_UITRON_MEMPOOLVAR_EXTERNS
264
 
265
// a Macro to ease the construction: addr, size
266
#define CYG_UIT_MEMPOOLVAR( _a_, _s_ ) Cyg_Mempool_Variable( \
267
    (cyg_uint8 *)(_a_),(cyg_int32)(_s_))
268
#ifdef CYGPKG_UITRON_MEMPOOLFIXED_CREATE_DELETE
269
#define CYG_UIT_MEMPOOLVAR_NOEXS( _a_, _s_ ) Cyg_Mempool_Variable( \
270
    (cyg_uint8 *)(_a_),(cyg_int32)(_s_))
271
#endif
272
 
273
Cyg_Mempool_Variable CYG_UITRON_DECL( MEMPOOLVAR ) =
274
{
275
    CYGDAT_UITRON_MEMPOOLVAR_INITIALIZERS
276
};
277
#undef CYG_UIT_MEMPOOLVAR
278
#ifdef CYGPKG_UITRON_MEMPOOLFIXED_CREATE_DELETE
279
#undef CYG_UIT_MEMPOOLVAR_NOEXS
280
#endif
281
 
282
#ifdef CYGPKG_UITRON_MEMPOOLVAR_CREATE_DELETE
283
Cyg_Mempool_Variable    *CYG_UITRON_DECL_PTRS( MEMPOOLVAR );
284
#endif
285
#endif // do we have variable memory pools at all?
286
#endif // CYGPKG_UITRON_MEMPOOLVAR
287
 
288
// ------------------------------------------------------------------------
289
// Cyclic alarm handlers might be initialized, if you have some.
290
//
291
#ifdef CYGPKG_UITRON_CYCLICS
292
#if (0 < CYGNUM_UITRON_CYCLICS) || \
293
    defined( CYGDAT_UITRON_CYCLIC_EXTERNS ) || \
294
    defined( CYGDAT_UITRON_CYCLIC_INITIALIZERS )
295
 
296
#ifndef CYGNUM_UITRON_CYCLICS
297
#error You must define CYGNUM_UITRON_CYCLICS
298
#endif
299
 
300
#if defined( CYGDAT_UITRON_CYCLIC_INITIALIZERS ) || \
301
    defined( CYGDAT_UITRON_CYCLIC_EXTERNS )
302
 
303
#ifndef CYGDAT_UITRON_CYCLIC_INITIALIZERS
304
#error You must define CYGDAT_UITRON_CYCLIC_INITIALIZERS
305
#endif
306
#ifndef CYGDAT_UITRON_CYCLIC_EXTERNS
307
#error You must define CYGDAT_UITRON_CYCLIC_EXTERNS
308
#endif
309
 
310
// declare the symbols used in the initializer
311
CYGDAT_UITRON_CYCLIC_EXTERNS
312
 
313
#endif // have externs or initializers
314
 
315
Cyg_Timer               CYG_UITRON_DECL( CYCLICS )
316
 
317
#ifdef CYGDAT_UITRON_CYCLIC_INITIALIZERS
318
 
319
#error *** CYCLIC INITIALIZERS ARE NOT SUPPORTED IN THIS RELEASE***
320
 
321
// a Macro to ease the construction: proc, arg, time
322
#define CYG_UIT_CYCLIC( ... ) Cyg_Timer()
323
 = {
324
    CYGDAT_UITRON_CYCLIC_INITIALIZERS
325
}
326
#undef CYG_UIT_CYCLIC
327
#endif // do we have initializers?
328
; // the end of the declaration, with or without initializer
329
 
330
#endif // do we have cyclic alarms at all?
331
#endif // CYGPKG_UITRON_CYCLICS
332
 
333
// ------------------------------------------------------------------------
334
// Oneshot alarm handlers might be initialized, if you have some.
335
//
336
#ifdef CYGPKG_UITRON_ALARMS
337
#if (0 < CYGNUM_UITRON_ALARMS) || \
338
    defined( CYGDAT_UITRON_ALARM_EXTERNS ) || \
339
    defined( CYGDAT_UITRON_ALARM_INITIALIZERS )
340
 
341
#ifndef CYGNUM_UITRON_ALARMS
342
#error You must define CYGNUM_UITRON_ALARMS
343
#endif
344
 
345
#if defined( CYGDAT_UITRON_ALARM_INITIALIZERS ) || \
346
    defined( CYGDAT_UITRON_ALARM_EXTERNS )
347
 
348
#ifndef CYGDAT_UITRON_ALARM_INITIALIZERS
349
#error You must define CYGDAT_UITRON_ALARM_INITIALIZERS
350
#endif
351
#ifndef CYGDAT_UITRON_ALARM_EXTERNS
352
#error You must define CYGDAT_UITRON_ALARM_EXTERNS
353
#endif
354
 
355
// declare the symbols used in the initializer
356
CYGDAT_UITRON_ALARM_EXTERNS
357
 
358
#endif // have externs or initializers
359
 
360
Cyg_Timer               CYG_UITRON_DECL( ALARMS )
361
 
362
#ifdef CYGDAT_UITRON_ALARM_INITIALIZERS
363
 
364
#error *** ALARM INITIALIZERS ARE NOT SUPPORTED IN THIS RELEASE***
365
 
366
// a Macro to ease the construction: proc, arg, time
367
#define CYG_UIT_ALARM( ... ) Cyg_Timer()
368
 = {
369
    CYGDAT_UITRON_ALARM_INITIALIZERS
370
}
371
#undef CYG_UIT_ALARM
372
#endif // do we have initializers?
373
; // the end of the declaration, with or without initializer
374
 
375
#endif // do we have oneshot alarms at all?
376
#endif // CYGPKG_UITRON_ALARMS
377
 
378
// ------------------------------------------------------------------------
379
#endif // CYGPKG_UITRON
380
 
381
// EOF uit_objs.cxx

powered by: WebSVN 2.1.0

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