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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-3.0/] [packages/] [compat/] [uitron/] [current/] [include/] [uit_func.h] - Blame information for rev 786

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 786 skrzyp
#ifndef CYGONCE_COMPAT_UITRON_UIT_FUNC_H
2
#define CYGONCE_COMPAT_UITRON_UIT_FUNC_H
3
//===========================================================================
4
//
5
//      uit_func.h
6
//
7
//      uITRON compatibility functions
8
//
9
//===========================================================================
10
// ####ECOSGPLCOPYRIGHTBEGIN####                                            
11
// -------------------------------------------                              
12
// This file is part of eCos, the Embedded Configurable Operating System.   
13
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
14
//
15
// eCos is free software; you can redistribute it and/or modify it under    
16
// the terms of the GNU General Public License as published by the Free     
17
// Software Foundation; either version 2 or (at your option) any later      
18
// version.                                                                 
19
//
20
// eCos is distributed in the hope that it will be useful, but WITHOUT      
21
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or    
22
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License    
23
// for more details.                                                        
24
//
25
// You should have received a copy of the GNU General Public License        
26
// along with eCos; if not, write to the Free Software Foundation, Inc.,    
27
// 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.            
28
//
29
// As a special exception, if other files instantiate templates or use      
30
// macros or inline functions from this file, or you compile this file      
31
// and link it with other works to produce a work based on this file,       
32
// this file does not by itself cause the resulting work to be covered by   
33
// the GNU General Public License. However the source code for this file    
34
// must still be made available in accordance with section (3) of the GNU   
35
// General Public License v2.                                               
36
//
37
// This exception does not invalidate any other reasons why a work based    
38
// on this file might be covered by the GNU General Public License.         
39
// -------------------------------------------                              
40
// ####ECOSGPLCOPYRIGHTEND####                                              
41
//===========================================================================
42
//#####DESCRIPTIONBEGIN####
43
//
44
// Author(s):   hmt
45
// Contributors:        hmt
46
// Date:        1998-03-13
47
// Purpose:     uITRON compatibility functions
48
// Description: 
49
//
50
//####DESCRIPTIONEND####
51
//
52
//===========================================================================
53
 
54
// ------------------------------------------------------------------------
55
// Source Code Organization
56
//
57
// First, see pkgconf/uitron.h for details of applicable configuration
58
// options.
59
//
60
// This file uit_func.h provides prototypes for the uITRON API.  All the
61
// uITRON functions are listed here.  The prototypes are configurable
62
// either to have C or C++ linkage, and if being compiled in a C++
63
// environment, to be inline.
64
//
65
// The function prototypes are all in terms of uITRON type definitions from
66
// uit_type.h, which is included at the head of uit_func.h.
67
//
68
// The implementations of the uITRON functions are in uit_func.inl, which
69
// is either included at the end of uit_func.h (if functions are inline) or
70
// in uit_func.cxx (if outline).
71
// 
72
// uit_func.cxx provides some startup functions plus, if the uITRON
73
// functions are out of line, uit_func.inl is included to instantiate those
74
// functions.
75
// 
76
// uITRON system objects (tasks, semaphores...) are described in
77
// uit_obj.hxx.  This is a C++ file and is used by the implementation of
78
// the uITRON functions.
79
// 
80
// The uITRON system objects are instantiated in uit_obj.cxx, which uses
81
// uit_obj.hxx to define the objects, and the configuration file
82
// pkgconf/uitron.h to construct them as required.
83
//
84
// The include graph from an application, which should only include
85
// uit_func.h, is similar to the following:
86
//
87
// 
88
// [inline uITRON functions:]
89
//
90
//    <your_app.c>
91
//    .       uit_func.h                       ; prototypes for funcs
92
//    .       .       pkgconf/uitron.h         ; configuration info
93
//    .       .       uit_type.h               ; typedefs for func args
94
//    .       (function prototypes)
95
//    .       .       uit_func.inl             ; full function bodies
96
//    .       .       .       uit_objs.hxx     ; defs of uITRON data
97
//    .       .       (function implementations)
98
//    
99
//
100
// [out-of-line uITRON functions:]
101
//
102
//    <your_app.c>
103
//    .       uit_func.h                       ; prototypes for funcs
104
//    .       .       pkgconf/uitron.h         ; configuration info
105
//    .       .       uit_type.h               ; typedefs for func args
106
//    .       (function prototypes)
107
//    
108
//
109
// [other uITRON compilation units:]
110
//
111
//    uit_func.cxx                             ; out-of-line functions
112
//    .       pkgconf/uitron.h                 ; configuration info
113
//    .       uit_func.h                       ; prototypes for funcs
114
//    .       .       uit_type.h               ; typedefs for func args
115
//    .       (function prototypes)
116
//    .       .       uit_func.inl             ; full function bodies
117
//    .       .       .       uit_objs.hxx     ; defs of uITRON data
118
//    .       .       (function implementations)
119
// 
120
//
121
//    uit_objs.cxx                             ; static uITRON data objects
122
//    .       pkgconf/uitron.h                 ; configuration info
123
//    .       uit_objs.hxx                     ; defs of uITRON data
124
//    (static uITRON system objects)
125
//
126
// 
127
// The various include files are protected against multiple inclusion and
128
// so may be safely re-included as convenient.
129
// 
130
// ------------------------------------------------------------------------
131
 
132
#include <pkgconf/uitron.h>             // uITRON setup CYGNUM_UITRON_SEMAS
133
                                        // CYGPKG_UITRON et al
134
 
135
#ifdef CYGPKG_UITRON
136
 
137
#include <cyg/infra/cyg_type.h>         // types; cyg_int32, CYG_ADDRWORD
138
 
139
#include <cyg/compat/uitron/uit_type.h> // uITRON types; ER ID TMO T_MSG
140
 
141
// ------------------------------------------------------------------------
142
// Object operations:
143
//
144
// The functions can be inlined in C compiled by C++, or C++ of course,
145
// and also outlined in extern "C" functions, eg. for taking the address
146
// of, or for use by a pure C program, or of course outlined in C++ for
147
// Code size reasons.
148
//
149
//
150
// Summary:
151
//
152
// IF compiling in C
153
// THEN functions must be C linkage and out of line:
154
//      do NOT specify CYGIMP_UITRON_INLINE_FUNCS nor
155
//                     CYGIMP_UITRON_CPP_OUTLINE_FUNCS.
156
// IF compiling in C++
157
// THEN functions can be inline: specify CYGIMP_UITRON_INLINE_FUNCS
158
//   OR by default, functions are out of line:
159
//       outline functions can have C++ linkage:
160
//                 specify CYGIMP_UITRON_CPP_OUTLINE_FUNCS
161
//       OR by default, outline functions have C linkage.
162
 
163
 
164
#ifdef __cplusplus
165
// C++ environment; functions can be inline or not as we please.
166
// If not inline they might as well be "C" linkage for sharing with
167
// any pure "C" code present.
168
 
169
#ifdef CYGIMP_UITRON_INLINE_FUNCS
170
 
171
#define CYG_UIT_FUNC_EXTERN_BEGIN
172
#define CYG_UIT_FUNC_EXTERN_END
173
#define CYG_UIT_FUNC_INLINE             inline
174
#ifndef CYGPRI_UITRON_FUNCS_HERE_AND_NOW
175
#define CYGPRI_UITRON_FUNCS_HERE_AND_NOW
176
#endif
177
 
178
#else
179
 
180
#ifdef CYGIMP_UITRON_CPP_OUTLINE_FUNCS
181
#define CYG_UIT_FUNC_EXTERN_BEGIN       extern "C++" {
182
#define CYG_UIT_FUNC_EXTERN_END         }
183
#else
184
#define CYG_UIT_FUNC_EXTERN_BEGIN       extern "C" {
185
#define CYG_UIT_FUNC_EXTERN_END         }
186
#endif
187
 
188
#define CYG_UIT_FUNC_INLINE
189
#endif
190
 
191
#else // !__cplusplus
192
// Vanilla "C" environment; external "C" linkage, no inline functions
193
 
194
#ifdef CYGIMP_UITRON_INLINE_FUNCS
195
#error "Cannot inline uITRON functions in pure C environment"
196
#endif
197
#ifdef CYGIMP_UITRON_CPP_OUTLINE_FUNCS
198
#error "Cannot use C++ linkage of outline fns in pure C environment"
199
#endif
200
 
201
#define CYG_UIT_FUNC_EXTERN_BEGIN
202
#define CYG_UIT_FUNC_EXTERN_END
203
#define CYG_UIT_FUNC_INLINE             
204
 
205
#endif // !__cplusplus
206
 
207
// ========================================================================
208
//         u I T R O N   F U N C T I O N S
209
// The function declarations themselves:
210
 
211
CYG_UIT_FUNC_EXTERN_BEGIN
212
 
213
// this routine is outside the uITRON specification; call it from main() to
214
// start the uITRON tasks and scheduler.  It does not return.
215
 
216
#ifdef CYGNUM_UITRON_START_TASKS
217
void cyg_uitron_start( void );
218
#endif
219
 
220
// ******************************************************
221
// ***    6.5 C Language Interfaces                   ***
222
// ******************************************************
223
 
224
// - Task Management Functions
225
 
226
ER      cre_tsk ( ID tskid, T_CTSK *pk_ctsk );
227
ER      del_tsk ( ID tskid );
228
ER      sta_tsk ( ID tskid, INT stacd );
229
void    ext_tsk ( void );
230
void    exd_tsk ( void );
231
ER      ter_tsk ( ID tskid );
232
 
233
ER      dis_dsp ( void );
234
ER      ena_dsp ( void );
235
ER      chg_pri ( ID tskid, PRI tskpri );
236
ER      rot_rdq ( PRI tskpri );
237
ER      rel_wai ( ID tskid );
238
ER      get_tid ( ID *p_tskid );
239
ER      ref_tsk ( T_RTSK *pk_rtsk, ID tskid );
240
 
241
// - Task-Dependent Synchronization Functions
242
 
243
ER      sus_tsk ( ID tskid );
244
ER      rsm_tsk ( ID tskid );
245
ER      frsm_tsk ( ID tskid );
246
ER      slp_tsk ( void );
247
ER      tslp_tsk ( TMO tmout );
248
ER      wup_tsk ( ID tskid );
249
ER      can_wup ( INT *p_wupcnt, ID tskid );
250
 
251
// - Synchronization and Communication Functions
252
 
253
ER      cre_sem ( ID semid, T_CSEM *pk_csem );
254
ER      del_sem ( ID semid );
255
ER      sig_sem ( ID semid );
256
ER      wai_sem ( ID semid );
257
ER      preq_sem ( ID semid );
258
ER      twai_sem ( ID semid, TMO tmout );
259
ER      ref_sem ( T_RSEM *pk_rsem, ID semid );
260
 
261
ER      cre_flg ( ID flgid, T_CFLG *pk_cflg );
262
ER      del_flg ( ID flgid );
263
ER      set_flg ( ID flgid, UINT setptn );
264
ER      clr_flg ( ID flgid, UINT clrptn );
265
ER      wai_flg ( UINT *p_flgptn, ID flgid, UINT waiptn, UINT wfmode );
266
ER      pol_flg ( UINT *p_flgptn, ID flgid, UINT waiptn, UINT wfmode );
267
ER      twai_flg ( UINT *p_flgptn, ID flgid, UINT waiptn, UINT wfmode,
268
              TMO tmout );
269
ER      ref_flg ( T_RFLG *pk_rflg, ID flgid );
270
 
271
ER      cre_mbx ( ID mbxid, T_CMBX* pk_cmbx );
272
ER      del_mbx ( ID mbxid );
273
ER      snd_msg ( ID mbxid, T_MSG *pk_msg );
274
ER      rcv_msg ( T_MSG **ppk_msg, ID mbxid );
275
ER      prcv_msg ( T_MSG **ppk_msg, ID mbxid );
276
ER      trcv_msg ( T_MSG **ppk_msg, ID mbxid, TMO tmout );
277
ER      ref_mbx ( T_RMBX *pk_rmbx, ID mbxid );
278
 
279
// - Extended Synchronization and Communication Functions
280
 
281
#if 0 // NOT SUPPORTED
282
ER      cre_mbf ( ID mbfid, T_CMBF *pk_cmbf );
283
ER      del_mbf ( ID mbfid );
284
ER      snd_mbf ( ID mbfid, VP msg, INT msgsz );
285
ER      psnd_mbf ( ID mbfid, VP msg, INT msgsz );
286
ER      tsnd_mbf ( ID mbfid, VP msg, INT msgsz, TMO tmout );
287
ER      rcv_mbf ( VP msg, INT *p_msgsz, ID mbfid );
288
ER      prcv_mbf ( VP msg, INT *p_msgsz, ID mbfid );
289
ER      trcv_mbf ( VP msg, INT *p_msgsz, ID mbfid, TMO tmout );
290
ER      ref_mbf ( T_RMBF *pk_rmbf, ID mbfid );
291
ER      cre_por ( ID porid, T_CPOR *pk_cpor );
292
ER      del_por ( ID porid );
293
ER      cal_por ( VP msg, INT *p_rmsgsz, ID porid, UINT calptn, INT
294
              cmsgsz );
295
ER      pcal_por ( VP msg, INT *p_rmsgsz, ID porid, UINT calptn, INT
296
              cmsgsz );
297
ER      tcal_por ( VP msg, INT *p_rmsgsz, ID porid, UINT calptn, INT
298
              cmsgsz, TMO tmout );
299
ER      acp_por ( RNO *p_rdvno, VP msg, INT *p_cmsgsz, ID porid, UINT
300
              acpptn );
301
ER      pacp_por ( RNO *p_rdvno, VP msg, INT *p_cmsgsz, ID porid, UINT
302
              acpptn );
303
ER      tacp_por ( RNO *p_rdvno, VP msg, INT *p_cmsgsz, ID porid, UINT
304
              acpptn, TMO tmout );
305
ER      fwd_por ( ID porid, UINT calptn, RNO rdvno, VP msg, INT cmsgsz
306
              );
307
ER      rpl_rdv ( RNO rdvno, VP msg, INT rmsgsz );
308
ER      ref_por ( T_RPOR *pk_rpor, ID porid );
309
#endif
310
 
311
// - Interrupt Management Functions
312
 
313
#if 0 // NOT SUPPORTED
314
ER      def_int ( UINT dintno, T_DINT *pk_dint );
315
void    ret_wup ( ID tskid );
316
#endif
317
#if 0
318
void    ret_int ( void );
319
#endif
320
#define ret_int() return
321
ER      loc_cpu ( void );
322
ER      unl_cpu ( void );
323
 
324
ER      dis_int ( UINT eintno );
325
ER      ena_int ( UINT eintno );
326
 
327
#if 0 // NOT SUPPORTED
328
ER      chg_iXX ( UINT iXXXX );
329
ER      ref_iXX ( UINT *p_iXXXX );
330
#endif
331
 
332
// - Memorypool Management Functions
333
 
334
ER      cre_mpl ( ID mplid, T_CMPL *pk_cmpl );
335
ER      del_mpl ( ID mplid );
336
ER      get_blk ( VP *p_blk, ID mplid, INT blksz );
337
ER      pget_blk ( VP *p_blk, ID mplid, INT blksz );
338
ER      tget_blk ( VP *p_blk, ID mplid, INT blksz, TMO tmout );
339
ER      rel_blk ( ID mplid, VP blk );
340
ER      ref_mpl ( T_RMPL *pk_rmpl, ID mplid );
341
 
342
ER      cre_mpf ( ID mpfid, T_CMPF *pk_cmpf );
343
ER      del_mpf ( ID mpfid );
344
ER      get_blf ( VP *p_blf, ID mpfid );
345
ER      pget_blf ( VP *p_blf, ID mpfid );
346
ER      tget_blf ( VP *p_blf, ID mpfid, TMO tmout );
347
ER      rel_blf ( ID mpfid, VP blf );
348
ER      ref_mpf ( T_RMPF *pk_rmpf, ID mpfid );
349
 
350
// - Time Management Functions
351
 
352
ER      set_tim ( SYSTIME *pk_tim );
353
ER      get_tim ( SYSTIME *pk_tim );
354
ER      dly_tsk ( DLYTIME dlytim );
355
ER      def_cyc ( HNO cycno, T_DCYC *pk_dcyc );
356
ER      act_cyc ( HNO cycno, UINT cycact );
357
ER      ref_cyc ( T_RCYC *pk_rcyc, HNO cycno );
358
ER      def_alm ( HNO almno, T_DALM *pk_dalm );
359
ER      ref_alm ( T_RALM *pk_ralm, HNO almno );
360
#if 0
361
void    ret_tmr ( void );
362
#endif
363
#define ret_tmr() return
364
 
365
// - System Management Functions
366
 
367
ER      get_ver ( T_VER *pk_ver );
368
ER      ref_sys ( T_RSYS *pk_rsys );
369
ER      ref_cfg ( T_RCFG *pk_rcfg );
370
#if 0 // NOT SUPPORTED
371
ER      def_svc ( FN s_fncd, T_DSVC *pk_dsvc );
372
ER      def_exc ( UINT exckind, T_DEXC *pk_dexc );
373
#endif
374
 
375
// - Network Support Functions
376
 
377
#if 0 // NOT SUPPORTED
378
ER      nrea_dat ( INT *p_reasz, VP dstadr, NODE srcnode, VP srcadr,
379
               INT datsz );
380
ER      nwri_dat ( INT *p_wrisz, NODE dstnode, VP dstadr, VP srcadr,
381
               INT datsz );
382
ER      nget_nod ( NODE *p_node );
383
ER      nget_ver ( T_VER *pk_ver, NODE node );
384
#endif
385
 
386
CYG_UIT_FUNC_EXTERN_END
387
 
388
// ========================================================================
389
 
390
#ifdef CYGPRI_UITRON_FUNCS_HERE_AND_NOW
391
// functions are inline OR we are in the outline implementation, so define
392
// the functions as inlines or plain functions depending on the value of
393
// CYG_UIT_FUNC_INLINE from above.
394
#include <cyg/compat/uitron/uit_func.inl>
395
#endif // CYGPRI_UITRON_FUNCS_HERE_AND_NOW
396
 
397
// ------------------------------------------------------------------------
398
#endif // CYGPKG_UITRON
399
 
400
#endif // CYGONCE_COMPAT_UITRON_UIT_FUNC_H
401
// EOF uit_func.h

powered by: WebSVN 2.1.0

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