1 /****************************************************************************
3 (c) SYSTEC electronic GmbH, D-07973 Greiz, August-Bebel-Str. 29
4 www.systec-electronic.com
8 Description: basic include file for internal EPL stack modules
12 Redistribution and use in source and binary forms, with or without
13 modification, are permitted provided that the following conditions
16 1. Redistributions of source code must retain the above copyright
17 notice, this list of conditions and the following disclaimer.
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.
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.
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.
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.
50 -------------------------------------------------------------------------
52 $RCSfile: EplInc.h,v $
56 $Revision: 1.8 $ $Date: 2008/11/17 16:40:39 $
63 -------------------------------------------------------------------------
67 2006/05/22 d.k.: start of the implementation, version 1.00
69 ****************************************************************************/
74 // ============================================================================
76 // ============================================================================
77 #if defined(WIN32) || defined(_WIN32)
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
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
127 #include "EplCfg.h" // EPL configuration file (configuration from application)
129 #include "global.h" // global definitions
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
135 #include "EplErrDef.h" // EPL error codes for API funtions
137 //---------------------------------------------------------------------------
139 //---------------------------------------------------------------------------
141 // IEEE 1588 conformant net time structure
148 #include "EplTarget.h" // target specific functions and definitions
152 // -------------------------------------------------------------------------
154 // -------------------------------------------------------------------------
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
161 #include "EplVersion.h"
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
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)
184 #define EPL_DEF_FEATURE_ISOCHR 0
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)
192 #define EPL_DEF_FEATURE_SDO_ASND 0
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)
200 #define EPL_DEF_FEATURE_SDO_UDP 0
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)
208 #define EPL_DEF_FEATURE_SDO_PDO 0
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)
216 #define EPL_DEF_FEATURE_PDO_DYN 0
220 #ifndef EPL_DEF_FEATURE_CFGMA
221 #if (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_CFGMA)) != 0)
222 #define EPL_DEF_FEATURE_CFGMA (EPL_FEATURE_CFGMA)
224 #define EPL_DEF_FEATURE_CFGMA 0
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)
236 #define tabentries(a) (sizeof(a)/sizeof(*(a)))
239 // ============================================================================
240 // common debug macros
241 // ============================================================================
242 // for using macro DEBUG_TRACEx()
245 // DEBUG_TRACE1 (EPL_DBGLVL_OBD, "Value is %d\n" , wObjectIndex);
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)
251 // default level is defined in copdef.h
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
362 //---------------------------------------------------------------------------
364 //---------------------------------------------------------------------------
366 //---------------------------------------------------------------------------
367 // function prototypes
368 //---------------------------------------------------------------------------
370 #endif // #ifndef _EPL_INC_H_