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 DWORD m_dwSec; 144 DWORD 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) ((((DWORD)(ver)) & 0xFF)|((((DWORD)(rev))&0xFF)<<8)|(((DWORD)(rel))<<16)) 158 #define EPL_OBJ1018_VERSION(ver,rev,rel) ((((DWORD)(ver))<<16) |(((DWORD)(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 // const defines 241 //--------------------------------------------------------------------------- 242 243 // definitions for DLL export 244 #if ((DEV_SYSTEM == _DEV_WIN32_) || (DEV_SYSTEM == _DEV_WIN_CE_)) && defined (COP_LIB) 245 246 #define EPLDLLEXPORT __declspec (dllexport) 247 248 #else 249 250 #define EPLDLLEXPORT 251 252 #endif 253 254 // ============================================================================ 255 // common debug macros 256 // ============================================================================ 257 // for using macro DEBUG_TRACEx() 258 // 259 // Example: 260 // DEBUG_TRACE1 (EPL_DBGLVL_OBD, "Value is %d\n" , wObjectIndex); 261 // 262 // This message only will be printed if: 263 // - NDEBUG is not defined AND !!! 264 // - flag 0x00000004L is set in DEF_DEBUG_LVL (can be defined in copcfg.h) 265 // 266 // default level is defined in copdef.h 267 268 // debug-level and TRACE-macros // standard-level // flags for DEF_DEBUG_LVL 269 #define EPL_DBGLVL_EDRV DEBUG_LVL_01 // 0x00000001L 270 #define EPL_DBGLVL_EDRV_TRACE0 DEBUG_LVL_01_TRACE0 271 #define EPL_DBGLVL_EDRV_TRACE1 DEBUG_LVL_01_TRACE1 272 #define EPL_DBGLVL_EDRV_TRACE2 DEBUG_LVL_01_TRACE2 273 #define EPL_DBGLVL_EDRV_TRACE3 DEBUG_LVL_01_TRACE3 274 #define EPL_DBGLVL_EDRV_TRACE4 DEBUG_LVL_01_TRACE4 275 276 #define EPL_DBGLVL_DLL DEBUG_LVL_02 // 0x00000002L 277 #define EPL_DBGLVL_DLL_TRACE0 DEBUG_LVL_02_TRACE0 278 #define EPL_DBGLVL_DLL_TRACE1 DEBUG_LVL_02_TRACE1 279 #define EPL_DBGLVL_DLL_TRACE2 DEBUG_LVL_02_TRACE2 280 #define EPL_DBGLVL_DLL_TRACE3 DEBUG_LVL_02_TRACE3 281 #define EPL_DBGLVL_DLL_TRACE4 DEBUG_LVL_02_TRACE4 282 283 #define EPL_DBGLVL_OBD DEBUG_LVL_03 // 0x00000004L 284 #define EPL_DBGLVL_OBD_TRACE0 DEBUG_LVL_03_TRACE0 285 #define EPL_DBGLVL_OBD_TRACE1 DEBUG_LVL_03_TRACE1 286 #define EPL_DBGLVL_OBD_TRACE2 DEBUG_LVL_03_TRACE2 287 #define EPL_DBGLVL_OBD_TRACE3 DEBUG_LVL_03_TRACE3 288 #define EPL_DBGLVL_OBD_TRACE4 DEBUG_LVL_03_TRACE4 289 290 #define EPL_DBGLVL_NMTK DEBUG_LVL_04 // 0x00000008L 291 #define EPL_DBGLVL_NMTK_TRACE0 DEBUG_LVL_04_TRACE0 292 #define EPL_DBGLVL_NMTK_TRACE1 DEBUG_LVL_04_TRACE1 293 #define EPL_DBGLVL_NMTK_TRACE2 DEBUG_LVL_04_TRACE2 294 #define EPL_DBGLVL_NMTK_TRACE3 DEBUG_LVL_04_TRACE3 295 #define EPL_DBGLVL_NMTK_TRACE4 DEBUG_LVL_04_TRACE4 296 297 #define EPL_DBGLVL_NMTCN DEBUG_LVL_05 // 0x00000010L 298 #define EPL_DBGLVL_NMTCN_TRACE0 DEBUG_LVL_05_TRACE0 299 #define EPL_DBGLVL_NMTCN_TRACE1 DEBUG_LVL_05_TRACE1 300 #define EPL_DBGLVL_NMTCN_TRACE2 DEBUG_LVL_05_TRACE2 301 #define EPL_DBGLVL_NMTCN_TRACE3 DEBUG_LVL_05_TRACE3 302 #define EPL_DBGLVL_NMTCN_TRACE4 DEBUG_LVL_05_TRACE4 303 304 #define EPL_DBGLVL_NMTU DEBUG_LVL_06 // 0x00000020L 305 #define EPL_DBGLVL_NMTU_TRACE0 DEBUG_LVL_06_TRACE0 306 #define EPL_DBGLVL_NMTU_TRACE1 DEBUG_LVL_06_TRACE1 307 #define EPL_DBGLVL_NMTU_TRACE2 DEBUG_LVL_06_TRACE2 308 #define EPL_DBGLVL_NMTU_TRACE3 DEBUG_LVL_06_TRACE3 309 #define EPL_DBGLVL_NMTU_TRACE4 DEBUG_LVL_06_TRACE4 310 311 #define EPL_DBGLVL_NMTMN DEBUG_LVL_07 // 0x00000040L 312 #define EPL_DBGLVL_NMTMN_TRACE0 DEBUG_LVL_07_TRACE0 313 #define EPL_DBGLVL_NMTMN_TRACE1 DEBUG_LVL_07_TRACE1 314 #define EPL_DBGLVL_NMTMN_TRACE2 DEBUG_LVL_07_TRACE2 315 #define EPL_DBGLVL_NMTMN_TRACE3 DEBUG_LVL_07_TRACE3 316 #define EPL_DBGLVL_NMTMN_TRACE4 DEBUG_LVL_07_TRACE4 317 318 //... 319 320 #define EPL_DBGLVL_SDO DEBUG_LVL_25 // 0x01000000 321 #define EPL_DBGLVL_SDO_TRACE0 DEBUG_LVL_25_TRACE0 322 #define EPL_DBGLVL_SDO_TRACE1 DEBUG_LVL_25_TRACE1 323 #define EPL_DBGLVL_SDO_TRACE2 DEBUG_LVL_25_TRACE2 324 #define EPL_DBGLVL_SDO_TRACE3 DEBUG_LVL_25_TRACE3 325 #define EPL_DBGLVL_SDO_TRACE4 DEBUG_LVL_25_TRACE4 326 327 #define EPL_DBGLVL_VETH DEBUG_LVL_26 // 0x02000000 328 #define EPL_DBGLVL_VETH_TRACE0 DEBUG_LVL_26_TRACE0 329 #define EPL_DBGLVL_VETH_TRACE1 DEBUG_LVL_26_TRACE1 330 #define EPL_DBGLVL_VETH_TRACE2 DEBUG_LVL_26_TRACE2 331 #define EPL_DBGLVL_VETH_TRACE3 DEBUG_LVL_26_TRACE3 332 #define EPL_DBGLVL_VETH_TRACE4 DEBUG_LVL_26_TRACE4 333 334 #define EPL_DBGLVL_EVENTK DEBUG_LVL_27 // 0x04000000 335 #define EPL_DBGLVL_EVENTK_TRACE0 DEBUG_LVL_27_TRACE0 336 #define EPL_DBGLVL_EVENTK_TRACE1 DEBUG_LVL_27_TRACE1 337 #define EPL_DBGLVL_EVENTK_TRACE2 DEBUG_LVL_27_TRACE2 338 #define EPL_DBGLVL_EVENTK_TRACE3 DEBUG_LVL_27_TRACE3 339 #define EPL_DBGLVL_EVENTK_TRACE4 DEBUG_LVL_27_TRACE4 340 341 #define EPL_DBGLVL_EVENTU DEBUG_LVL_28 // 0x08000000 342 #define EPL_DBGLVL_EVENTU_TRACE0 DEBUG_LVL_28_TRACE0 343 #define EPL_DBGLVL_EVENTU_TRACE1 DEBUG_LVL_28_TRACE1 344 #define EPL_DBGLVL_EVENTU_TRACE2 DEBUG_LVL_28_TRACE2 345 #define EPL_DBGLVL_EVENTU_TRACE3 DEBUG_LVL_28_TRACE3 346 #define EPL_DBGLVL_EVENTU_TRACE4 DEBUG_LVL_28_TRACE4 347 348 // SharedBuff 349 #define EPL_DBGLVL_SHB DEBUG_LVL_29 // 0x10000000 350 #define EPL_DBGLVL_SHB_TRACE0 DEBUG_LVL_29_TRACE0 351 #define EPL_DBGLVL_SHB_TRACE1 DEBUG_LVL_29_TRACE1 352 #define EPL_DBGLVL_SHB_TRACE2 DEBUG_LVL_29_TRACE2 353 #define EPL_DBGLVL_SHB_TRACE3 DEBUG_LVL_29_TRACE3 354 #define EPL_DBGLVL_SHB_TRACE4 DEBUG_LVL_29_TRACE4 355 356 #define EPL_DBGLVL_ASSERT DEBUG_LVL_ASSERT // 0x20000000L 357 #define EPL_DBGLVL_ASSERT_TRACE0 DEBUG_LVL_ASSERT_TRACE0 358 #define EPL_DBGLVL_ASSERT_TRACE1 DEBUG_LVL_ASSERT_TRACE1 359 #define EPL_DBGLVL_ASSERT_TRACE2 DEBUG_LVL_ASSERT_TRACE2 360 #define EPL_DBGLVL_ASSERT_TRACE3 DEBUG_LVL_ASSERT_TRACE3 361 #define EPL_DBGLVL_ASSERT_TRACE4 DEBUG_LVL_ASSERT_TRACE4 362 363 #define EPL_DBGLVL_ERROR DEBUG_LVL_ERROR // 0x40000000L 364 #define EPL_DBGLVL_ERROR_TRACE0 DEBUG_LVL_ERROR_TRACE0 365 #define EPL_DBGLVL_ERROR_TRACE1 DEBUG_LVL_ERROR_TRACE1 366 #define EPL_DBGLVL_ERROR_TRACE2 DEBUG_LVL_ERROR_TRACE2 367 #define EPL_DBGLVL_ERROR_TRACE3 DEBUG_LVL_ERROR_TRACE3 368 #define EPL_DBGLVL_ERROR_TRACE4 DEBUG_LVL_ERROR_TRACE4 369 370 #define EPL_DBGLVL_ALWAYS DEBUG_LVL_ALWAYS // 0x80000000L 371 #define EPL_DBGLVL_ALWAYS_TRACE0 DEBUG_LVL_ALWAYS_TRACE0 372 #define EPL_DBGLVL_ALWAYS_TRACE1 DEBUG_LVL_ALWAYS_TRACE1 373 #define EPL_DBGLVL_ALWAYS_TRACE2 DEBUG_LVL_ALWAYS_TRACE2 374 #define EPL_DBGLVL_ALWAYS_TRACE3 DEBUG_LVL_ALWAYS_TRACE3 375 #define EPL_DBGLVL_ALWAYS_TRACE4 DEBUG_LVL_ALWAYS_TRACE4 376 377 //--------------------------------------------------------------------------- 378 // typedef 379 //--------------------------------------------------------------------------- 380 381 //--------------------------------------------------------------------------- 382 // function prototypes 383 //--------------------------------------------------------------------------- 384 385 #endif // #ifndef _EPL_INC_H_ 386