]> git.karo-electronics.de Git - karo-tx-redboot.git/blob - packages/compat/uitron/v2_0/include/uit_ifnc.h
Initial revision
[karo-tx-redboot.git] / packages / compat / uitron / v2_0 / include / uit_ifnc.h
1 #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 Red Hat, 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 version.
18 //
19 // eCos is distributed in the hope that it will be useful, but WITHOUT ANY
20 // WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 // FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
22 // for more details.
23 //
24 // You should have received a copy of the GNU General Public License along
25 // with eCos; if not, write to the Free Software Foundation, Inc.,
26 // 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
27 //
28 // As a special exception, if other files instantiate templates or use macros
29 // or inline functions from this file, or you compile this file and link it
30 // with other works to produce a work based on this file, this file does not
31 // by itself cause the resulting work to be covered by the GNU General Public
32 // License. However the source code for this file must still be made available
33 // in accordance with section (3) of the GNU General Public License.
34 //
35 // This exception does not invalidate any other reasons why a work based on
36 // this file might be covered by the GNU General Public License.
37 //
38 // Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
39 // at http://sources.redhat.com/ecos/ecos-license/
40 // -------------------------------------------
41 //####ECOSGPLCOPYRIGHTEND####
42 //===========================================================================
43 //#####DESCRIPTIONBEGIN####
44 //
45 // Author(s):   hmt
46 // Contributors:        hmt
47 // Date:        1999-08-16
48 // Purpose:     uITRON compatibility functions
49 // Description: 
50 //
51 //####DESCRIPTIONEND####
52 //
53 //===========================================================================
54
55 // ------------------------------------------------------------------------
56 // Source Code Organization
57 //
58 // First, see pkgconf/uitron.h for details of applicable configuration
59 // options.
60 //
61 // This file uit_ifnc.h provides prototypes for the task-independent parts
62 // of the uITRON API, that is functions named ixxx_yyy() for calling in
63 // ISRs.  We also define the uitron helper DSR that is needed to despool
64 // stored up requests.
65 // ------------------------------------------------------------------------
66
67 #include <pkgconf/uitron.h>             // uITRON setup CYGNUM_UITRON_SEMAS
68                                         // CYGPKG_UITRON et al
69
70 #ifdef CYGPKG_UITRON
71
72 #include <cyg/infra/cyg_type.h>         // types; cyg_int32, CYG_ADDRWORD
73
74 #include <cyg/compat/uitron/uit_type.h> // uITRON types; ER ID TMO T_MSG
75 #include <cyg/compat/uitron/uit_func.h> // uITRON funcs and control macros.
76
77 // ========================================================================
78 //         u I T R O N   F U N C T I O N S
79 // The function declarations themselves:
80
81 // ------------------- These functions can be inline if so configured
82 CYG_UIT_FUNC_EXTERN_BEGIN
83
84 // ******************************************************
85 // ***    6.5 C Language Interfaces                   ***
86 // ******************************************************
87
88 // - Task Management Functions
89
90 // (None)
91         
92 // - Task-Dependent Synchronization Functions
93         
94 //ER      irsm_tsk ( ID tskid );
95 //ER      ifrsm_tsk ( ID tskid );
96
97 ER      iwup_tsk ( ID tskid );
98         
99 // - Synchronization and Communication Functions
100         
101 ER      isig_sem ( ID semid );
102
103 ER      iset_flg ( ID flgid, UINT setptn );
104
105 ER      isnd_msg ( ID mbxid, T_MSG *pk_msg );
106         
107 // - Extended Synchronization and Communication Functions
108         
109 // - Interrupt Management Functions
110         
111 // (None)
112    
113 // ---------------------------------------------------------------
114
115 #define CYGPRI_UITRON_SET_RETCODE( _z_ ) do {                                   \
116     extern volatile int cyg_uit_dsr_actions_head;                               \
117     extern volatile int cyg_uit_dsr_actions_tail;                               \
118     (_z_) = (cyg_uit_dsr_actions_head == cyg_uit_dsr_actions_tail) ? 1 : 3;     \
119 } while ( 0 )
120
121 //void    ret_wup ( ID tskid );
122 // Awaken the task (safely) and return Cyg_Interrupt::CALL_DSR
123 #define ret_wup( _id_ ) do {                    \
124     register int retcode;                       \
125     (void)iwup_tsk( (_id_) );                   \
126     CYGPRI_UITRON_SET_RETCODE( retcode );       \
127     return retcode;                             \
128 } while ( 0 )
129
130 // Subsitute a version of ret_int that returns Cyg_Interrupt::CALL_DSR
131 #undef ret_int
132 #define ret_int()  do {                         \
133     register int retcode;                       \
134     CYGPRI_UITRON_SET_RETCODE( retcode );       \
135     return retcode;                             \
136 } while ( 0 )
137
138
139 // - Memorypool Management Functions
140
141 // (None)
142         
143 // - Time Management Functions
144         
145 // (None)
146         
147 // - System Management Functions
148         
149 // (None)
150         
151 // - Network Support Functions
152         
153 // (None)
154         
155 CYG_UIT_FUNC_EXTERN_END
156 // ------------------- End of functions that can be inlined
157
158
159 // ========================================================================
160 // DSR: use this DSR with the uITRON-type ISR that uses the functions above
161 // to get delayed/safe execution of the wakeup-type functions above.
162
163 #ifdef __cplusplus
164 extern "C"
165 #endif
166 void cyg_uitron_dsr( unsigned int vector, unsigned int count, unsigned int data );
167
168
169 // ========================================================================
170
171 #ifdef CYGPRI_UITRON_FUNCS_HERE_AND_NOW
172 // functions are inline OR we are in the outline implementation, so define
173 // the functions as inlines or plain functions depending on the value of
174 // CYG_UIT_FUNC_INLINE from above.
175 #include <cyg/compat/uitron/uit_ifnc.inl>
176 #endif // CYGPRI_UITRON_FUNCS_HERE_AND_NOW
177
178 // ------------------------------------------------------------------------
179 #endif // CYGPKG_UITRON
180
181 #endif // CYGONCE_COMPAT_UITRON_UIT_IFNC_H
182 // EOF uit_ifnc.h