1 |
786 |
skrzyp |
#ifndef CYGONCE_COMPAT_UITRON_UIT_IFNC_H
|
2 |
|
|
#define CYGONCE_COMPAT_UITRON_UIT_IFNC_H
|
3 |
|
|
//===========================================================================
|
4 |
|
|
//
|
5 |
|
|
// uit_ifnc.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: 1999-08-16
|
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_ifnc.h provides prototypes for the task-independent parts
|
61 |
|
|
// of the uITRON API, that is functions named ixxx_yyy() for calling in
|
62 |
|
|
// ISRs. We also define the uitron helper DSR that is needed to despool
|
63 |
|
|
// stored up requests.
|
64 |
|
|
// ------------------------------------------------------------------------
|
65 |
|
|
|
66 |
|
|
#include <pkgconf/uitron.h> // uITRON setup CYGNUM_UITRON_SEMAS
|
67 |
|
|
// CYGPKG_UITRON et al
|
68 |
|
|
|
69 |
|
|
#ifdef CYGPKG_UITRON
|
70 |
|
|
|
71 |
|
|
#include <cyg/infra/cyg_type.h> // types; cyg_int32, CYG_ADDRWORD
|
72 |
|
|
|
73 |
|
|
#include <cyg/compat/uitron/uit_type.h> // uITRON types; ER ID TMO T_MSG
|
74 |
|
|
#include <cyg/compat/uitron/uit_func.h> // uITRON funcs and control macros.
|
75 |
|
|
|
76 |
|
|
// ========================================================================
|
77 |
|
|
// u I T R O N F U N C T I O N S
|
78 |
|
|
// The function declarations themselves:
|
79 |
|
|
|
80 |
|
|
// ------------------- These functions can be inline if so configured
|
81 |
|
|
CYG_UIT_FUNC_EXTERN_BEGIN
|
82 |
|
|
|
83 |
|
|
// ******************************************************
|
84 |
|
|
// *** 6.5 C Language Interfaces ***
|
85 |
|
|
// ******************************************************
|
86 |
|
|
|
87 |
|
|
// - Task Management Functions
|
88 |
|
|
|
89 |
|
|
// (None)
|
90 |
|
|
|
91 |
|
|
// - Task-Dependent Synchronization Functions
|
92 |
|
|
|
93 |
|
|
//ER irsm_tsk ( ID tskid );
|
94 |
|
|
//ER ifrsm_tsk ( ID tskid );
|
95 |
|
|
|
96 |
|
|
ER iwup_tsk ( ID tskid );
|
97 |
|
|
|
98 |
|
|
// - Synchronization and Communication Functions
|
99 |
|
|
|
100 |
|
|
ER isig_sem ( ID semid );
|
101 |
|
|
|
102 |
|
|
ER iset_flg ( ID flgid, UINT setptn );
|
103 |
|
|
|
104 |
|
|
ER isnd_msg ( ID mbxid, T_MSG *pk_msg );
|
105 |
|
|
|
106 |
|
|
// - Extended Synchronization and Communication Functions
|
107 |
|
|
|
108 |
|
|
// - Interrupt Management Functions
|
109 |
|
|
|
110 |
|
|
// (None)
|
111 |
|
|
|
112 |
|
|
// ---------------------------------------------------------------
|
113 |
|
|
|
114 |
|
|
#define CYGPRI_UITRON_SET_RETCODE( _z_ ) do { \
|
115 |
|
|
extern volatile int cyg_uit_dsr_actions_head; \
|
116 |
|
|
extern volatile int cyg_uit_dsr_actions_tail; \
|
117 |
|
|
(_z_) = (cyg_uit_dsr_actions_head == cyg_uit_dsr_actions_tail) ? 1 : 3; \
|
118 |
|
|
} while ( 0 )
|
119 |
|
|
|
120 |
|
|
//void ret_wup ( ID tskid );
|
121 |
|
|
// Awaken the task (safely) and return Cyg_Interrupt::CALL_DSR
|
122 |
|
|
#define ret_wup( _id_ ) do { \
|
123 |
|
|
register int retcode; \
|
124 |
|
|
(void)iwup_tsk( (_id_) ); \
|
125 |
|
|
CYGPRI_UITRON_SET_RETCODE( retcode ); \
|
126 |
|
|
return retcode; \
|
127 |
|
|
} while ( 0 )
|
128 |
|
|
|
129 |
|
|
// Subsitute a version of ret_int that returns Cyg_Interrupt::CALL_DSR
|
130 |
|
|
#undef ret_int
|
131 |
|
|
#define ret_int() do { \
|
132 |
|
|
register int retcode; \
|
133 |
|
|
CYGPRI_UITRON_SET_RETCODE( retcode ); \
|
134 |
|
|
return retcode; \
|
135 |
|
|
} while ( 0 )
|
136 |
|
|
|
137 |
|
|
|
138 |
|
|
// - Memorypool Management Functions
|
139 |
|
|
|
140 |
|
|
// (None)
|
141 |
|
|
|
142 |
|
|
// - Time Management Functions
|
143 |
|
|
|
144 |
|
|
// (None)
|
145 |
|
|
|
146 |
|
|
// - System Management Functions
|
147 |
|
|
|
148 |
|
|
// (None)
|
149 |
|
|
|
150 |
|
|
// - Network Support Functions
|
151 |
|
|
|
152 |
|
|
// (None)
|
153 |
|
|
|
154 |
|
|
CYG_UIT_FUNC_EXTERN_END
|
155 |
|
|
// ------------------- End of functions that can be inlined
|
156 |
|
|
|
157 |
|
|
|
158 |
|
|
// ========================================================================
|
159 |
|
|
// DSR: use this DSR with the uITRON-type ISR that uses the functions above
|
160 |
|
|
// to get delayed/safe execution of the wakeup-type functions above.
|
161 |
|
|
|
162 |
|
|
#ifdef __cplusplus
|
163 |
|
|
extern "C"
|
164 |
|
|
#endif
|
165 |
|
|
void cyg_uitron_dsr( unsigned int vector, unsigned int count, unsigned int data );
|
166 |
|
|
|
167 |
|
|
|
168 |
|
|
// ========================================================================
|
169 |
|
|
|
170 |
|
|
#ifdef CYGPRI_UITRON_FUNCS_HERE_AND_NOW
|
171 |
|
|
// functions are inline OR we are in the outline implementation, so define
|
172 |
|
|
// the functions as inlines or plain functions depending on the value of
|
173 |
|
|
// CYG_UIT_FUNC_INLINE from above.
|
174 |
|
|
#include <cyg/compat/uitron/uit_ifnc.inl>
|
175 |
|
|
#endif // CYGPRI_UITRON_FUNCS_HERE_AND_NOW
|
176 |
|
|
|
177 |
|
|
// ------------------------------------------------------------------------
|
178 |
|
|
#endif // CYGPKG_UITRON
|
179 |
|
|
|
180 |
|
|
#endif // CYGONCE_COMPAT_UITRON_UIT_IFNC_H
|
181 |
|
|
// EOF uit_ifnc.h
|