ACPICA: Fix a few warnings for gcc 3.4.4
[linux-2.6] / drivers / staging / epl / EplInc.h
1 /****************************************************************************
2
3   (c) SYSTEC electronic GmbH, D-07973 Greiz, August-Bebel-Str. 29
4       www.systec-electronic.com
5
6   Project:      openPOWERLINK
7
8   Description:  basic include file for internal EPL stack modules
9
10   License:
11
12     Redistribution and use in source and binary forms, with or without
13     modification, are permitted provided that the following conditions
14     are met:
15
16     1. Redistributions of source code must retain the above copyright
17        notice, this list of conditions and the following disclaimer.
18
19     2. Redistributions in binary form must reproduce the above copyright
20        notice, this list of conditions and the following disclaimer in the
21        documentation and/or other materials provided with the distribution.
22
23     3. Neither the name of SYSTEC electronic GmbH nor the names of its
24        contributors may be used to endorse or promote products derived
25        from this software without prior written permission. For written
26        permission, please contact info@systec-electronic.com.
27
28     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29     "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30     LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
31     FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
32     COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
33     INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
34     BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
35     LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
36     CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
37     LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
38     ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
39     POSSIBILITY OF SUCH DAMAGE.
40
41     Severability Clause:
42
43         If a provision of this License is or becomes illegal, invalid or
44         unenforceable in any jurisdiction, that shall not affect:
45         1. the validity or enforceability in that jurisdiction of any other
46            provision of this License; or
47         2. the validity or enforceability in other jurisdictions of that or
48            any other provision of this License.
49
50   -------------------------------------------------------------------------
51
52                 $RCSfile: EplInc.h,v $
53
54                 $Author: D.Krueger $
55
56                 $Revision: 1.8 $  $Date: 2008/11/17 16:40:39 $
57
58                 $State: Exp $
59
60                 Build Environment:
61                     GCC V3.4
62
63   -------------------------------------------------------------------------
64
65   Revision History:
66
67   2006/05/22 d.k.:   start of the implementation, version 1.00
68
69 ****************************************************************************/
70
71 #ifndef _EPL_INC_H_
72 #define _EPL_INC_H_
73
74 // ============================================================================
75 // include files
76 // ============================================================================
77 #if defined(WIN32) || defined(_WIN32)
78
79 #ifdef UNDER_RTSS
80         // RTX header
81 #include <windows.h>
82 #include <process.h>
83 #include <rtapi.h>
84
85 #elif __BORLANDC__
86         // borland C header
87 #include <windows.h>
88 #include <process.h>
89
90 #elif WINCE
91 #include <windows.h>
92
93 #else
94         // MSVC needs to include windows.h at first
95         // the following defines ar necessary for function prototypes for waitable timers
96 #define _WIN32_WINDOWS 0x0401
97 #define _WIN32_WINNT   0x0400
98 #include <windows.h>
99 #include <process.h>
100 #endif
101
102 #endif
103
104 // defines for module integration
105 // possible other include file needed
106 // These constants defines modules which can be included in the Epl application.
107 // Use this constants for define EPL_MODULE_INTEGRATION in file EplCfg.h.
108 #define EPL_MODULE_OBDK        0x00000001L      // OBD kernel part module
109 #define EPL_MODULE_PDOK        0x00000002L      // PDO kernel part module
110 #define EPL_MODULE_NMT_MN      0x00000004L      // NMT MN module
111 #define EPL_MODULE_SDOS        0x00000008L      // SDO Server module
112 #define EPL_MODULE_SDOC        0x00000010L      // SDO Client module
113 #define EPL_MODULE_SDO_ASND    0x00000020L      // SDO over Asnd module
114 #define EPL_MODULE_SDO_UDP     0x00000040L      // SDO over UDP module
115 #define EPL_MODULE_SDO_PDO     0x00000080L      // SDO in PDO module
116 #define EPL_MODULE_NMT_CN      0x00000100L      // NMT CN module
117 #define EPL_MODULE_NMTU        0x00000200L      // NMT user part module
118 #define EPL_MODULE_NMTK        0x00000400L      // NMT kernel part module
119 #define EPL_MODULE_DLLK        0x00000800L      // DLL kernel part module
120 #define EPL_MODULE_DLLU        0x00001000L      // DLL user part module
121 #define EPL_MODULE_OBDU        0x00002000L      // OBD user part module
122 #define EPL_MODULE_CFGMA       0x00004000L      // Configuartioan Manager module
123 #define EPL_MODULE_VETH        0x00008000L      // virtual ethernet driver module
124 #define EPL_MODULE_PDOU        0x00010000L      // PDO user part module
125 #define EPL_MODULE_LEDU        0x00020000L      // LED user part module
126
127 #include "EplCfg.h"             // EPL configuration file (configuration from application)
128
129 #include "global.h"             // global definitions
130
131 #include "EplDef.h"             // EPL configuration file (default configuration)
132 #include "EplInstDef.h"         // defines macros for instance types and table
133 #include "Debug.h"              // debug definitions
134
135 #include "EplErrDef.h"          // EPL error codes for API funtions
136
137 //---------------------------------------------------------------------------
138 // typedef
139 //---------------------------------------------------------------------------
140
141 // IEEE 1588 conformant net time structure
142 typedef struct {
143         u32 m_dwSec;
144         u32 m_dwNanoSec;
145
146 } tEplNetTime;
147
148 #include "EplTarget.h"          // target specific functions and definitions
149
150 #include "EplAmi.h"
151
152 // -------------------------------------------------------------------------
153 // macros
154 // -------------------------------------------------------------------------
155
156 #define EPL_SPEC_VERSION                    0x20        // ETHERNET Powerlink V. 2.0
157 #define EPL_STACK_VERSION(ver,rev,rel)      ((((u32)(ver)) & 0xFF)|((((u32)(rev))&0xFF)<<8)|(((u32)(rel))<<16))
158 #define EPL_OBJ1018_VERSION(ver,rev,rel)    ((((u32)(ver))<<16) |(((u32)(rev))&0xFFFF))
159 #define EPL_STRING_VERSION(ver,rev,rel)     "V" #ver "." #rev " r" #rel
160
161 #include "EplVersion.h"
162
163 // defines for EPL FeatureFlags
164 #define EPL_FEATURE_ISOCHR          0x00000001
165 #define EPL_FEATURE_SDO_UDP         0x00000002
166 #define EPL_FEATURE_SDO_ASND        0x00000004
167 #define EPL_FEATURE_SDO_PDO         0x00000008
168 #define EPL_FEATURE_NMT_INFO        0x00000010
169 #define EPL_FEATURE_NMT_EXT         0x00000020
170 #define EPL_FEATURE_PDO_DYN         0x00000040
171 #define EPL_FEATURE_NMT_UDP         0x00000080
172 #define EPL_FEATURE_CFGMA           0x00000100
173 #define EPL_FEATURE_DLL_MULTIPLEX   0x00000200
174 #define EPL_FEATURE_NODEID_SW       0x00000400
175 #define EPL_FEATURE_NMT_BASICETH    0x00000800
176 #define EPL_FEATURE_RT1             0x00001000
177 #define EPL_FEATURE_RT2             0x00002000
178
179 // generate EPL NMT_FeatureFlags_U32
180 #ifndef EPL_DEF_FEATURE_ISOCHR
181 #if (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_DLLK)) != 0)
182 #define EPL_DEF_FEATURE_ISOCHR          (EPL_FEATURE_ISOCHR)
183 #else
184 #define EPL_DEF_FEATURE_ISOCHR          0
185 #endif
186 #endif
187
188 #ifndef EPL_DEF_FEATURE_SDO_ASND
189 #if (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_SDO_ASND)) != 0)
190 #define EPL_DEF_FEATURE_SDO_ASND        (EPL_FEATURE_SDO_ASND)
191 #else
192 #define EPL_DEF_FEATURE_SDO_ASND        0
193 #endif
194 #endif
195
196 #ifndef EPL_DEF_FEATURE_SDO_UDP
197 #if (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_SDO_UDP)) != 0)
198 #define EPL_DEF_FEATURE_SDO_UDP         (EPL_FEATURE_SDO_UDP)
199 #else
200 #define EPL_DEF_FEATURE_SDO_UDP         0
201 #endif
202 #endif
203
204 #ifndef EPL_DEF_FEATURE_SDO_PDO
205 #if (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_SDO_PDO)) != 0)
206 #define EPL_DEF_FEATURE_SDO_PDO         (EPL_FEATURE_SDO_PDO)
207 #else
208 #define EPL_DEF_FEATURE_SDO_PDO         0
209 #endif
210 #endif
211
212 #ifndef EPL_DEF_FEATURE_PDO_DYN
213 #if (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_PDOK)) != 0)
214 #define EPL_DEF_FEATURE_PDO_DYN         (EPL_FEATURE_PDO_DYN)
215 #else
216 #define EPL_DEF_FEATURE_PDO_DYN         0
217 #endif
218 #endif
219
220 #ifndef EPL_DEF_FEATURE_CFGMA
221 #if (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_CFGMA)) != 0)
222 #define EPL_DEF_FEATURE_CFGMA           (EPL_FEATURE_CFGMA)
223 #else
224 #define EPL_DEF_FEATURE_CFGMA           0
225 #endif
226 #endif
227
228 #define EPL_DEF_FEATURE_FLAGS                   (EPL_DEF_FEATURE_ISOCHR \
229                                                 | EPL_DEF_FEATURE_SDO_ASND \
230                                                 | EPL_DEF_FEATURE_SDO_UDP \
231                                                 | EPL_DEF_FEATURE_SDO_PDO \
232                                                 | EPL_DEF_FEATURE_PDO_DYN \
233                                                 | EPL_DEF_FEATURE_CFGMA)
234
235 #ifndef tabentries
236 #define tabentries(a)   (sizeof(a)/sizeof(*(a)))
237 #endif
238
239 // ============================================================================
240 // common debug macros
241 // ============================================================================
242 // for using macro DEBUG_TRACEx()
243 //
244 // Example:
245 //      DEBUG_TRACE1 (EPL_DBGLVL_OBD, "Value is %d\n" , wObjectIndex);
246 //
247 // This message only will be printed if:
248 //      - NDEBUG is not defined     AND !!!
249 //      - flag 0x00000004L is set in DEF_DEBUG_LVL (can be defined in copcfg.h)
250 //
251 // default level is defined in copdef.h
252
253 // debug-level and TRACE-macros         // standard-level   // flags for DEF_DEBUG_LVL
254 #define EPL_DBGLVL_EDRV                 DEBUG_LVL_01    // 0x00000001L
255 #define EPL_DBGLVL_EDRV_TRACE0          DEBUG_LVL_01_TRACE0
256 #define EPL_DBGLVL_EDRV_TRACE1          DEBUG_LVL_01_TRACE1
257 #define EPL_DBGLVL_EDRV_TRACE2          DEBUG_LVL_01_TRACE2
258 #define EPL_DBGLVL_EDRV_TRACE3          DEBUG_LVL_01_TRACE3
259 #define EPL_DBGLVL_EDRV_TRACE4          DEBUG_LVL_01_TRACE4
260
261 #define EPL_DBGLVL_DLL                  DEBUG_LVL_02    // 0x00000002L
262 #define EPL_DBGLVL_DLL_TRACE0           DEBUG_LVL_02_TRACE0
263 #define EPL_DBGLVL_DLL_TRACE1           DEBUG_LVL_02_TRACE1
264 #define EPL_DBGLVL_DLL_TRACE2           DEBUG_LVL_02_TRACE2
265 #define EPL_DBGLVL_DLL_TRACE3           DEBUG_LVL_02_TRACE3
266 #define EPL_DBGLVL_DLL_TRACE4           DEBUG_LVL_02_TRACE4
267
268 #define EPL_DBGLVL_OBD                  DEBUG_LVL_03    // 0x00000004L
269 #define EPL_DBGLVL_OBD_TRACE0           DEBUG_LVL_03_TRACE0
270 #define EPL_DBGLVL_OBD_TRACE1           DEBUG_LVL_03_TRACE1
271 #define EPL_DBGLVL_OBD_TRACE2           DEBUG_LVL_03_TRACE2
272 #define EPL_DBGLVL_OBD_TRACE3           DEBUG_LVL_03_TRACE3
273 #define EPL_DBGLVL_OBD_TRACE4           DEBUG_LVL_03_TRACE4
274
275 #define EPL_DBGLVL_NMTK                 DEBUG_LVL_04    // 0x00000008L
276 #define EPL_DBGLVL_NMTK_TRACE0          DEBUG_LVL_04_TRACE0
277 #define EPL_DBGLVL_NMTK_TRACE1          DEBUG_LVL_04_TRACE1
278 #define EPL_DBGLVL_NMTK_TRACE2          DEBUG_LVL_04_TRACE2
279 #define EPL_DBGLVL_NMTK_TRACE3          DEBUG_LVL_04_TRACE3
280 #define EPL_DBGLVL_NMTK_TRACE4          DEBUG_LVL_04_TRACE4
281
282 #define EPL_DBGLVL_NMTCN                DEBUG_LVL_05    // 0x00000010L
283 #define EPL_DBGLVL_NMTCN_TRACE0         DEBUG_LVL_05_TRACE0
284 #define EPL_DBGLVL_NMTCN_TRACE1         DEBUG_LVL_05_TRACE1
285 #define EPL_DBGLVL_NMTCN_TRACE2         DEBUG_LVL_05_TRACE2
286 #define EPL_DBGLVL_NMTCN_TRACE3         DEBUG_LVL_05_TRACE3
287 #define EPL_DBGLVL_NMTCN_TRACE4         DEBUG_LVL_05_TRACE4
288
289 #define EPL_DBGLVL_NMTU                 DEBUG_LVL_06    // 0x00000020L
290 #define EPL_DBGLVL_NMTU_TRACE0          DEBUG_LVL_06_TRACE0
291 #define EPL_DBGLVL_NMTU_TRACE1          DEBUG_LVL_06_TRACE1
292 #define EPL_DBGLVL_NMTU_TRACE2          DEBUG_LVL_06_TRACE2
293 #define EPL_DBGLVL_NMTU_TRACE3          DEBUG_LVL_06_TRACE3
294 #define EPL_DBGLVL_NMTU_TRACE4          DEBUG_LVL_06_TRACE4
295
296 #define EPL_DBGLVL_NMTMN                DEBUG_LVL_07    // 0x00000040L
297 #define EPL_DBGLVL_NMTMN_TRACE0         DEBUG_LVL_07_TRACE0
298 #define EPL_DBGLVL_NMTMN_TRACE1         DEBUG_LVL_07_TRACE1
299 #define EPL_DBGLVL_NMTMN_TRACE2         DEBUG_LVL_07_TRACE2
300 #define EPL_DBGLVL_NMTMN_TRACE3         DEBUG_LVL_07_TRACE3
301 #define EPL_DBGLVL_NMTMN_TRACE4         DEBUG_LVL_07_TRACE4
302
303 //...
304
305 #define EPL_DBGLVL_SDO                  DEBUG_LVL_25    // 0x01000000
306 #define EPL_DBGLVL_SDO_TRACE0           DEBUG_LVL_25_TRACE0
307 #define EPL_DBGLVL_SDO_TRACE1           DEBUG_LVL_25_TRACE1
308 #define EPL_DBGLVL_SDO_TRACE2           DEBUG_LVL_25_TRACE2
309 #define EPL_DBGLVL_SDO_TRACE3           DEBUG_LVL_25_TRACE3
310 #define EPL_DBGLVL_SDO_TRACE4           DEBUG_LVL_25_TRACE4
311
312 #define EPL_DBGLVL_VETH                 DEBUG_LVL_26    // 0x02000000
313 #define EPL_DBGLVL_VETH_TRACE0          DEBUG_LVL_26_TRACE0
314 #define EPL_DBGLVL_VETH_TRACE1          DEBUG_LVL_26_TRACE1
315 #define EPL_DBGLVL_VETH_TRACE2          DEBUG_LVL_26_TRACE2
316 #define EPL_DBGLVL_VETH_TRACE3          DEBUG_LVL_26_TRACE3
317 #define EPL_DBGLVL_VETH_TRACE4          DEBUG_LVL_26_TRACE4
318
319 #define EPL_DBGLVL_EVENTK               DEBUG_LVL_27    // 0x04000000
320 #define EPL_DBGLVL_EVENTK_TRACE0        DEBUG_LVL_27_TRACE0
321 #define EPL_DBGLVL_EVENTK_TRACE1        DEBUG_LVL_27_TRACE1
322 #define EPL_DBGLVL_EVENTK_TRACE2        DEBUG_LVL_27_TRACE2
323 #define EPL_DBGLVL_EVENTK_TRACE3        DEBUG_LVL_27_TRACE3
324 #define EPL_DBGLVL_EVENTK_TRACE4        DEBUG_LVL_27_TRACE4
325
326 #define EPL_DBGLVL_EVENTU               DEBUG_LVL_28    // 0x08000000
327 #define EPL_DBGLVL_EVENTU_TRACE0        DEBUG_LVL_28_TRACE0
328 #define EPL_DBGLVL_EVENTU_TRACE1        DEBUG_LVL_28_TRACE1
329 #define EPL_DBGLVL_EVENTU_TRACE2        DEBUG_LVL_28_TRACE2
330 #define EPL_DBGLVL_EVENTU_TRACE3        DEBUG_LVL_28_TRACE3
331 #define EPL_DBGLVL_EVENTU_TRACE4        DEBUG_LVL_28_TRACE4
332
333 // SharedBuff
334 #define EPL_DBGLVL_SHB                  DEBUG_LVL_29    // 0x10000000
335 #define EPL_DBGLVL_SHB_TRACE0           DEBUG_LVL_29_TRACE0
336 #define EPL_DBGLVL_SHB_TRACE1           DEBUG_LVL_29_TRACE1
337 #define EPL_DBGLVL_SHB_TRACE2           DEBUG_LVL_29_TRACE2
338 #define EPL_DBGLVL_SHB_TRACE3           DEBUG_LVL_29_TRACE3
339 #define EPL_DBGLVL_SHB_TRACE4           DEBUG_LVL_29_TRACE4
340
341 #define EPL_DBGLVL_ASSERT               DEBUG_LVL_ASSERT        // 0x20000000L
342 #define EPL_DBGLVL_ASSERT_TRACE0        DEBUG_LVL_ASSERT_TRACE0
343 #define EPL_DBGLVL_ASSERT_TRACE1        DEBUG_LVL_ASSERT_TRACE1
344 #define EPL_DBGLVL_ASSERT_TRACE2        DEBUG_LVL_ASSERT_TRACE2
345 #define EPL_DBGLVL_ASSERT_TRACE3        DEBUG_LVL_ASSERT_TRACE3
346 #define EPL_DBGLVL_ASSERT_TRACE4        DEBUG_LVL_ASSERT_TRACE4
347
348 #define EPL_DBGLVL_ERROR                DEBUG_LVL_ERROR // 0x40000000L
349 #define EPL_DBGLVL_ERROR_TRACE0         DEBUG_LVL_ERROR_TRACE0
350 #define EPL_DBGLVL_ERROR_TRACE1         DEBUG_LVL_ERROR_TRACE1
351 #define EPL_DBGLVL_ERROR_TRACE2         DEBUG_LVL_ERROR_TRACE2
352 #define EPL_DBGLVL_ERROR_TRACE3         DEBUG_LVL_ERROR_TRACE3
353 #define EPL_DBGLVL_ERROR_TRACE4         DEBUG_LVL_ERROR_TRACE4
354
355 #define EPL_DBGLVL_ALWAYS               DEBUG_LVL_ALWAYS        // 0x80000000L
356 #define EPL_DBGLVL_ALWAYS_TRACE0        DEBUG_LVL_ALWAYS_TRACE0
357 #define EPL_DBGLVL_ALWAYS_TRACE1        DEBUG_LVL_ALWAYS_TRACE1
358 #define EPL_DBGLVL_ALWAYS_TRACE2        DEBUG_LVL_ALWAYS_TRACE2
359 #define EPL_DBGLVL_ALWAYS_TRACE3        DEBUG_LVL_ALWAYS_TRACE3
360 #define EPL_DBGLVL_ALWAYS_TRACE4        DEBUG_LVL_ALWAYS_TRACE4
361
362 //---------------------------------------------------------------------------
363 // typedef
364 //---------------------------------------------------------------------------
365
366 //---------------------------------------------------------------------------
367 // function prototypes
368 //---------------------------------------------------------------------------
369
370 #endif // #ifndef _EPL_INC_H_