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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [ecos-2.0/] [packages/] [compat/] [uitron/] [v2_0/] [src/] [uit_objs.cxx] - Blame information for rev 1773

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

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

powered by: WebSVN 2.1.0

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