]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - apps/tidep0079.git/blob - EC_Master_SysBios_Am572x/SDK/INC/EcInterfaceCommon.h
Makefiles for linux - calls makefile EC ICSS lib
[apps/tidep0079.git] / EC_Master_SysBios_Am572x / SDK / INC / EcInterfaceCommon.h
1 /*-----------------------------------------------------------------------------
2  * EcInterfaceCommon.h
3  * Copyright                acontis technologies GmbH, Weingarten, Germany
4  * Response                 Stefan Zintgraf
5  * Description              EtherCAT Master common definitions for interfaces
6  *---------------------------------------------------------------------------*/
8 #ifndef INC_ECINTERFACECOMMON
9 #define INC_ECINTERFACECOMMON
11 /*-INCLUDES------------------------------------------------------------------*/
12 #ifndef INC_ECESCREG
13 #include "EcEscReg.h"
14 #endif
16 /*-COMPILER SETTINGS---------------------------------------------------------*/
17 #ifdef __cplusplus
18 extern "C"
19 {
20 #endif
22 /*-DEFINES/MACROS------------------------------------------------------------*/
23 /* configuration for OD */
24 #define ECAT_DEVICE_NAMESIZE            80
25 #define MAX_SLAVE_DEVICENAME            80                      /* 0x3xxx Slave Device name len */
26 #define EC_OD_MAX_DRIVER_IDENT_LEN      40                      /* maximum length of link layer name */
27 #define EC_CFG_SLAVE_PD_SECTIONS        ((EC_T_DWORD)4)         /* amount of recv/send entries per slave processdata */
29 #define HISTORY_OBJECT_DIAGELE_SIZE     ((EC_T_WORD)0x0100)     /* size in bytes */
30 #define MAX_DIAG_MSG                    200
31 #define MAX_NOTIFICATIONS               50                      /* maximum length of link layer name */
32 #define NOTIFICATION_MEMBER_COUNT       4                       /* maximum length of link layer name */
33 #define NOTIFICATION_TEXT_CODE          "Notification Message %03d - Code"  /* maximum length of link layer name */
34 #define NOTIFICATION_TEXT_COUNT         "Notification Message %03d - Count" /* maximum length of link layer name */
36 #define NOTIFICATION_FLAGS_CLEAR       0x1                      /* Diagnosis flag : Send as emergency*/
38 #define   DEFTYPE_BUSDIAGNOSTIC     0x0040
39 #define   DEFTYPE_MACADDRESS        0x0041
40 #define   DEFTYPE_MASTERINITPARM    0x0042
41 #define   DEFTYPE_SLAVECFGINFO      0x0043
42 #define   DEFTYPE_BUSLOADBASE       0x0044
43 #define   DEFTYPE_SLAVECFG          0x0045
44 #define   DEFTYPE_SLAVEINF          0x0046
45 #define   DEFTYPE_SLAVEDIAG         0x0047
46 #define   DEFTYPE_DEVICEPROFILE     0x0048
47 #define   DEFTYPE_DETECTMODCMD      0x0049
48 #define   DEFTYPE_CONFADDRLIST      0x0050
49 #define   DEFTYPE_CONNADDRLIST      0x0051
50 #define   DEFTYPE_REDUNDANCY        0x0052
51 #define   DEFTYPE_NOTIFY_COUNTER    0x0053
53 #define SETDIAGNUMBER(number) \
54     ((EC_T_DWORD)(((((EC_T_DWORD)(number))&0xFFF)|(0xE<<12)|((((((EC_T_DWORD)(number))>>12)==0)?1:((((EC_T_DWORD)(number))>>12)==0xFFFF)?0xFFFE:(((EC_T_DWORD)(number))>>12))<<16))))
56 #define DIAG_MSG_TYPE_MASK           0xF /* Diagnosis message type mask*/
57 #define DIAG_MSG_TYPE_INFO           0x0 /* Diagnosis message type info*/
58 #define DIAG_MSG_TYPE_WARNING        0x1 /* Diagnosis message type warning*/
59 #define DIAG_MSG_TYPE_ERROR          0x2 /* Diagnosis message type error*/
60 #define DIAGFLAGINFO            DIAG_MSG_TYPE_INFO
61 #define DIAGFLAGWARN            DIAG_MSG_TYPE_WARNING
62 #define DIAGFLAGERROR           DIAG_MSG_TYPE_ERROR
64 #define DIAG_MSG_PARAM_TYPE_MASK    0xF000 /* Diagnosis parameter type mask*/
65 #define DIAG_MSG_PARAM_TYPE_OFFSET  12 /* Diagnosis parameter type offset*/
66 #define DIAG_MSG_PARAM_TYPE_DATA    0x0 /* Diagnosis parameter type data*/
67 #define DIAG_MSG_PARAM_TYPE_B_ARRY  0x1 /* Diagnosis parameter type Byte Array*/
68 #define DIAG_MSG_PARAM_TYPE_ASCII   0x2 /* Diagnosis parameter type ASCII*/
69 #define DIAG_MSG_PARAM_TYPE_UNICODE 0x3 /* Diagnosis parameter type UNICODE*/
70 #define DIAG_MSG_PARAM_TYPE_TEXTID  0x4 /* Diagnosis parameter type Text ID */
71 /* this defines are only for compatibility reasons */
72 #define DIAGPARMTYPEDATATYPE    ((EC_T_WORD)(DIAG_MSG_PARAM_TYPE_DATA<<12))
73 #define DIAGPARMTYPEBYTEARRAY   ((EC_T_WORD)(DIAG_MSG_PARAM_TYPE_B_ARRY<<12))
74 #define DIAGPARMTYPEASCIISTRG   ((EC_T_WORD)(DIAG_MSG_PARAM_TYPE_ASCII<<12))
75 #define DIAGPARMTYPEUNICODESTRG ((EC_T_WORD)(DIAG_MSG_PARAM_TYPE_UNICODE<<12))
76 #define DIAGPARMTYPETEXTID      ((EC_T_WORD)(DIAG_MSG_PARAM_TYPE_TEXTID<<12))
78 /*0x1F03 SI5 flag values/masks*/
79 #define DIAG_SEND_AS_EMCY           0x1 /* Diagnosis flag : Send as emergency*/
80 #define DIAG_DISABLE_INFO_MSG       0x2 /* Diagnosis flag : Disable Info messages*/
81 #define DIAG_DISABLE_WARNING_MSG    0x4 /* Diagnosis flag : Disable Warning messages*/
82 #define DIAG_DISABLE_ERROR_MSG      0x8 /* Diagnosis flag : Disable Error messages*/
83 #define DIAG_OPERATION_MODE         0x10 /* Indicates the diagnosis history mode (0 "overwrite" Mode; 1 "acknowledge" Mode)*/
84 #define DIAG_OVERWRITE_DISCARD      0x20 /* Indicates if messages were overwritten ("overwrite" mode) or new messages were discard ("acknowledge" mode)*/
86 #define DIAG_MSG_DEFAULT_LEN        16   /* Default Length: DiagCode + Flags + TextID + TimeStamp*/
88 #define COEOBJID_0x800              ((EC_T_WORD)0x0800)
90 #define COEOBJID_HISTORY_OBJECT     ((EC_T_WORD)0x10F3)
92 #define COEOBJID_MAST_STATECHNG     ((EC_T_WORD)0x2000)
93 #define COEOBJID_MAST_STATESUMMARY  ((EC_T_WORD)0x2001)
94 #define COEOBJID_BUS_DIAGNOSIS      ((EC_T_WORD)0x2002)
95 #define COEOBJID_REDUNDANCY         ((EC_T_WORD)0x2003)
96 #define COEOBJID_NOTIFY_COUNTER     ((EC_T_WORD)0x2004)
97 #define COEOBJID_MAC_ADDRESS        ((EC_T_WORD)0x2005)
98 #define COEOBJID_DEBUG_REGISTER     ((EC_T_WORD)0x2010)
99 #define COEOBJID_MASTER_INIT_PARM   ((EC_T_WORD)0x2020)
100 #define COEOBJID_DC_DEVIATION_LIMIT ((EC_T_WORD)0x2100)
101 #define COEOBJID_DC_CURDEVIATION    ((EC_T_WORD)0x2101)
102 #define COEOBJID_DCM_BUSSHIFT       ((EC_T_WORD)0x2102)
105 #define COEOBJID_BUSLOAD_BASE       ((EC_T_WORD)0x2200)
106 #define COEOBJID_BUSLOAD_HIST       ((EC_T_WORD)0x2201)
108 #define COEOBJID_SLAVECFGINFOBASE   ((EC_T_WORD)0x3000)
110 #define COEOBJID_SLAVECFGBASE       ((EC_T_WORD)0x8000) /* configured slave -> "Modular Device Profiles" */
111 #define COEOBJID_SLAVEINFBASE       ((EC_T_WORD)0x9000) /* connected slave -> "Modular Device Profiles" */
112 #define COEOBJID_SLAVEDIAGBASE      ((EC_T_WORD)0xA000) /* diagnosis data -> "Modular Device Profiles" */
113 #define COEOBJID_DEVICEPROFILE      ((EC_T_WORD)0xF000) /* modular device profile -> "Modular Device Profiles" */
114 #define COEOBJID_DETECTMODCMD       ((EC_T_WORD)0xF002) /* detect modules command -> "Modular Device Profiles" */
115 #define COEOBJID_CONFADDRLISTBASE   ((EC_T_WORD)0xF020) /* configured address list -> "Modular Device Profiles" */
116 #define COEOBJID_CONNADDRLISTBASE   ((EC_T_WORD)0xF040) /* detected address list -> "Modular Device Profiles" */
119 #define DEVICETYPE_ETHERNET_GATEWAY     ((EC_T_WORD)1000)
120 #define DEVICETYPE_ETHERCAT_MASTER      ((EC_T_WORD)1100)
121 #define DEVICETYPE_ETHERCAT_SLAVE       ((EC_T_WORD)1110)
122 #define DEVICETYPE_KBUS_MASTER          ((EC_T_WORD)1120)
123 #define DEVICETYPE_PROFIBUS_MASTER      ((EC_T_WORD)3100)
124 #define DEVICETYPE_PROFIBUS_SLAVE       ((EC_T_WORD)3110)
125 #define DEVICETYPE_INTERBUS_MASTER      ((EC_T_WORD)4100)
126 #define DEVICETYPE_INTERBUS_SLAVE       ((EC_T_WORD)4110)
127 #define DEVICETYPE_CANOPEN_MASTER       ((EC_T_WORD)5100)
128 #define DEVICETYPE_CANOPEN_SLAVE        ((EC_T_WORD)5110)
129 #define DEVICETYPE_DEVICENET_MASTER     ((EC_T_WORD)5200)
130 #define DEVICETYPE_DEVICENET_SLAVE      ((EC_T_WORD)5210)
131 #define DEVICETYPE_ASI_MASTER           ((EC_T_WORD)6200)
132 #define DEVICETYPE_IOLINK_MASTER        ((EC_T_WORD)6220)
135 static EC_INLINESTART EC_T_VOID SAFE_STRCPY(EC_T_CHAR* szTargetString, EC_T_CHAR* szSourceString, EC_T_INT nMaxSize)
137     if (nMaxSize != 0)
138     {
139         OsMemset(szTargetString, 0, nMaxSize);
140         OsStrncpy(szTargetString, szSourceString, nMaxSize - 1);
141     }
142     else
143     {
144         szTargetString[0] = '\0';
145     }
146 } EC_INLINESTOP
148 #define MAX_ERRINFO_STRLEN  8   /* maximum length of error notification info strings */
149 #define MAX_SHORT_STRLEN    20  /* maximum length of short info string */
150 #define MAX_STD_STRLEN      80  /* maximum length of standard info string */
152 #define MAX_FILE_NAME_SIZE  32  /* maximum length of file name for FoE Download/Upload */
154 #define MASTER_SLAVE_ID     ((EC_T_DWORD)0x10000)
155 #define MASTER_RED_SLAVE_ID ((EC_T_DWORD)0x20000)
156 #define EL9010_SLAVE_ID     ((EC_T_DWORD)0x30000)
158 /* EtherCAT state */
159 typedef enum _EC_T_STATE
161     eEcatState_UNKNOWN  = 0,                        /*< unknown */
162     eEcatState_INIT     = 1,                        /*< init */
163     eEcatState_PREOP    = 2,                        /*< pre-operational */
164     eEcatState_SAFEOP   = 4,                        /*< safe operational */
165     eEcatState_OP       = 8,                        /*< operational */
167     eEcatState_BOOTSTRAP = 3,                       /*< BootStrap */
168     
169     /* Borland C++ datatype alignment correction */
170     eEcatState_BCppDummy   = 0xFFFFFFFF
171 } EC_T_STATE;
173 typedef enum _EC_T_STATEMACH_RES
175     eStateMachRes_Unknown   =   0,
176     eStateMachRes_Pending   =   1,
177     eStateMachRes_Done      =   2,
178     eStateMachRes_Error     =   4,
180     eStateMachRes_BCppDummy =   0xFFFFFFFF
181 }   EC_T_STATEMACH_RES;
183 typedef enum EC_MAILBOX_FLAG
185     EC_MAILBOX_FLAG_SDO_COMPLETE                        = 1,
186     
187     /* Borland C++ datatype alignment correction */
188     EC_MAILBOX_FLAG_BCppDummy                               = 0xFFFFFFFF
189 } EC_MAILBOX_FLAG;
191 /* EtherCat specific notify codes */
192 #define EC_NOTIFY_GENERIC                       0x00000000
193 #define EC_NOTIFY_ERROR                         0x00010000                  /* 0x00010000 ... 0x0001ffff */
195 #define EC_NOTIFY_MBOXRCV                       0x00020000
196 #define EC_SZTXT_NOTIFY_MBOXRCV                 "EC_NOTIFY_MBOXRCV"
198 #define EC_NOTIFY_SCANBUS                       0x00030000
199 #define EC_NOTIFY_HOTCONNECT                    0x00040000        
201 #define EC_NOTIFY_APP                           0x00080000                  /* application specific codes used by ecatNotifyApp() */
202 #define EC_NOTIFY_APP_MAX_CODE                  0x0000FFFF                  /* max number app notify codes */
204 #define ATEMRAS_NOTIFY_GENERIC                                  0x00100000
205 #define ATEMRAS_NOTIFY_ERROR                                    0x00110000
207 #define EC_NOTIFY_STATECHANGED                  (EC_NOTIFY_GENERIC | 1)     /* 0x00000001: EtherCAT operational state change */
208 #define EC_SZTXT_NOTIFY_STATECHANGED                    "EC_NOTIFY_STATECHANGED"
210 #define EC_NOTIFY_ETH_LINK_CONNECTED            (EC_NOTIFY_GENERIC | 2)     /* 0x00000002: Ethernet link (cable) connected */
211 #define EC_SZTXT_NOTIFY_ETH_LINK_CONNECTED              "EC_NOTIFY_ETH_LINK_CONNECTED"
213 #define EC_NOTIFY_SB_STATUS                     (EC_NOTIFY_GENERIC | 3)     /* 0x00000003: ScanBus finished */ 
214 #define EC_SZTXT_NOTIFY_SB_STATUS                       "EC_NOTIFY_SB_STATUS"
216 #define EC_NOTIFY_DC_STATUS                     (EC_NOTIFY_GENERIC | 4)     /* 0x00000004: Distributed clocks initialized */
217 #define EC_SZTXT_NOTIFY_DC_STATUS                           "EC_NOTIFY_DC_STATUS"
219 /* Distributed clocks (DC) */
220 #define EC_NOTIFY_DC_SLV_SYNC                   (EC_NOTIFY_GENERIC | 5)     /* 0x00000005: DC Slave Synchronization deviation notification */
221 #define EC_SZTXT_NOTIFY_DC_SLV_SYNC                     "EC_NOTIFY_DC_SLV_SYNC"
223 /* Distributed Clocks Latching (DCL) */
224 #define EC_NOTIFY_DCL_STATUS                    (EC_NOTIFY_GENERIC | 8)     /* 0x00000008: DCL initialized */
225 #define EC_SZTXT_NOTIFY_DCL_STATUS                      "EC_NOTIFY_DCL_STATUS"
227 /* Distributed clocks master sync (DCM) */
228 #define EC_NOTIFY_DCM_SYNC                      (EC_NOTIFY_GENERIC | 9)     /* 0x00000009: DCM InSync */
229 #define EC_SZTXT_NOTIFY_DCM_SYNC                    "EC_NOTIFY_DCM_SYNC"
231 #define EC_NOTIFY_SLAVE_STATECHANGED            (EC_NOTIFY_GENERIC | 21)    /* 0x00000015: Slave finished successfully state transition */
232 #define EC_SZTXT_NOTIFY_SLAVE_STATECHANGED      "EC_NOTIFY_SLAVE_STATECHANGED"
234 #define EC_NOTIFY_SLAVES_STATECHANGED           (EC_NOTIFY_GENERIC | 22)    /* 0x00000016: Slaves finished successfully state transition */
235 #define EC_SZTXT_NOTIFY_SLAVES_STATECHANGED     "EC_NOTIFY_SLAVES_STATECHANGED"
237 #define EC_NOTIFY_RAWCMD_DONE                   (EC_NOTIFY_GENERIC | 100)   /* 0x00000064: Queue Raw Command Response Notification */
238 #define EC_SZTXT_NOTIFY_RAWCMD_DONE                     "EC_NOTIFY_RAWCMD_DONE"
240 #define EC_NOTIFY_SLAVE_PRESENCE                (EC_NOTIFY_GENERIC | 101)   /* 0x00000065: Slave (dis)appeared */
241 #define EC_SZTXT_NOTIFY_SLAVE_PRESENCE          "EC_NOTIFY_SLAVE_PRESENCE"
243 #define EC_NOTIFY_SLAVES_PRESENCE               (EC_NOTIFY_GENERIC | 102)   /* 0x00000066: Slaves (dis)appeared */
244 #define EC_SZTXT_NOTIFY_SLAVES_PRESENCE         "EC_NOTIFY_SLAVES_PRESENCE"
246 #define EC_NOTIFY_REFCLOCK_PRESENCE             (EC_NOTIFY_GENERIC | 103)   /* 0x00000067: Reference clock (dis)appeared */
247 #define EC_SZTXT_NOTIFY_REFCLOCK_PRESENCE       "EC_NOTIFY_REFCLOCK_PRESENCE"
249 #ifdef INCLUDE_COE_PDO_SUPPORT
250 #define EC_NOTIFY_COE_TX_PDO                    (EC_NOTIFY_MBOXRCV | 1)     /* 0x00020001: TxPDO notification */
251 #define EC_SZTXT_NOTIFY_COE_TX_PDO                          "EC_NOTIFY_COE_TX_PDO"
252 #endif
254 #define EC_NOTIFY_RAWMBX_DONE                   (EC_NOTIFY_MBOXRCV | 2)     /* 0x00020002: Raw mailbox transfer response */
255 #define EC_SZTXT_NOTIFY_RAWMBX_DONE             "EC_NOTIFY_RAWMBX_DONE"
257 #define EC_NOTIFY_COE_INIT_CMD                  (EC_NOTIFY_MBOXRCV | 3)     /* 0x00020003: CoE init command */
258 #define EC_SZTXT_EC_NOTIFY_COE_INIT_CMD         "EC_NOTIFY_COE_INIT_CMD"
260 /* errors */
261 #define EC_NOTIFY_CYCCMD_WKC_ERROR              (EC_NOTIFY_ERROR | 1)       /* 0x00010001: cyclic command: working counter error */
262 #define EC_SZTXT_NOTIFY_CYCCMD_WKC_ERROR                "EC_NOTIFY_CYCCMD_WKC_ERROR"
264 #define EC_NOTIFY_MASTER_INITCMD_WKC_ERROR      (EC_NOTIFY_ERROR | 2)       /* 0x00010002: master init command: working counter error */
265 #define EC_SZTXT_NOTIFY_MASTER_INITCMD_WKC_ERROR "EC_NOTIFY_MASTER_INITCMD_WKC_ERROR"
267 #define EC_NOTIFY_SLAVE_INITCMD_WKC_ERROR       (EC_NOTIFY_ERROR | 3)       /* 0x00010003: slave init command: working counter error */
268 #define EC_SZTXT_NOTIFY_SLAVE_INITCMD_WKC_ERROR "EC_NOTIFY_SLAVE_INITCMD_WKC_ERROR"
270 #define EC_NOTIFY_EOE_MBXSND_WKC_ERROR          (EC_NOTIFY_ERROR | 7)       /* 0x00010007: EoE mbox send: working counter error */
271 #define EC_SZTXT_NOTIFY_EOE_MBXSND_WKC_ERROR    "EC_NOTIFY_EOE_MBXSND_WKC_ERROR"
273 #define EC_NOTIFY_COE_MBXSND_WKC_ERROR          (EC_NOTIFY_ERROR | 8)       /* 0x00010008: CoE mbox send: working counter error */
274 #define EC_SZTXT_NOTIFY_COE_MBXSND_WKC_ERROR    "EC_NOTIFY_COE_MBXSND_WKC_ERROR"
276 #define EC_NOTIFY_FOE_MBXSND_WKC_ERROR          (EC_NOTIFY_ERROR | 9)       /* 0x00010009: FoE mbox send: working counter error */
277 #define EC_SZTXT_NOTIFY_FOE_MBXSND_WKC_ERROR    "EC_NOTIFY_FOE_MBXSND_WKC_ERROR"
279 #define EC_NOTIFY_FRAME_RESPONSE_ERROR          (EC_NOTIFY_ERROR |10)       /* 0x0001000a: Got no response on a sent Ethernet frame */
280 #define EC_SZTXT_NOTIFY_FRAME_RESPONSE_ERROR    "EC_NOTIFY_FRAME_RESPONSE_ERROR"
282 #define EC_NOTIFY_SLAVE_INITCMD_RESPONSE_ERROR  (EC_NOTIFY_ERROR |11)       /* 0x0001000b: Got no or unexpected response on a sent ecat init command from slave */
283 #define EC_SZTXT_NOTIFY_SLAVE_INITCMD_RESPONSE_ERROR "EC_NOTIFY_SLAVE_INITCMD_RESPONSE_ERROR"
285 #define EC_NOTIFY_MASTER_INITCMD_RESPONSE_ERROR (EC_NOTIFY_ERROR |12)       /* 0x0001000c: Got no response on a sent ecat master init command */
286 #define EC_SZTXT_NOTIFY_MASTER_INITCMD_RESPONSE_ERROR "EC_NOTIFY_MASTER_INITCMD_RESPONSE_ERROR"
288 #define EC_NOTIFY_MBSLAVE_INITCMD_TIMEOUT       (EC_NOTIFY_ERROR |14)       /* 0x0001000e: Timeout when waiting for mailbox init command response */
289 #define EC_SZTXT_NOTIFY_MBSLAVE_INITCMD_TIMEOUT "EC_NOTIFY_MBSLAVE_INITCMD_TIMEOUT"
291 #define EC_NOTIFY_NOT_ALL_DEVICES_OPERATIONAL   (EC_NOTIFY_ERROR |15)       /* 0x0001000f: Not all slave devices are in operational state when receiving cyclic frames */
292 #define EC_SZTXT_NOTIFY_NOT_ALL_DEVICES_OPERATIONAL     "EC_NOTIFY_NOT_ALL_DEVICES_OPERATIONAL"
294 #define EC_NOTIFY_ETH_LINK_NOT_CONNECTED        (EC_NOTIFY_ERROR |16)       /* 0x00010010: Ethernet link (cable) not connected */
295 #define EC_SZTXT_NOTIFY_ETH_LINK_NOT_CONNECTED  "EC_NOTIFY_ETH_LINK_NOT_CONNECTED"
297 #define EC_NOTIFY_RED_LINEBRK                   (EC_NOTIFY_ERROR |18)       /* 0x00010012: Redundancy: line break detected */
298 #define EC_SZTXT_NOTIFY_RED_LINEBRK                 "EC_NOTIFY_RED_LINEBRK"
300 #define EC_NOTIFY_STATUS_SLAVE_ERROR            (EC_NOTIFY_ERROR |19)       /* 0x00010013: At least one slave is in error state when receiving cyclic frames (BRD AL-STATUS) */
301 #define EC_SZTXT_NOTIFY_STATUS_SLAVE_ERROR              "EC_NOTIFY_STATUS_SLAVE_ERROR"
303 #define EC_NOTIFY_SLAVE_ERROR_STATUS_INFO       (EC_NOTIFY_ERROR |20)       /* 0x00010014: Slave error (AL status code) */
304 #define EC_SZTXT_NOTIFY_SLAVE_ERROR_STATUS_INFO "EC_NOTIFY_SLAVE_ERROR_STATUS_INFO"
306 #define EC_NOTIFY_SLAVE_NOT_ADDRESSABLE         (EC_NOTIFY_ERROR |21)       /* 0x00010015: Station address lost (or slave missing) - FPRD to AL_STATUS failed  */
307 #define EC_SZTXT_NOTIFY_SLAVE_NOT_ADDRESSABLE   "EC_NOTIFY_SLAVE_NOT_ADDRESSABLE"
309 #define EC_NOTIFY_SOE_MBXSND_WKC_ERROR          (EC_NOTIFY_ERROR |23)       /* 0x00010017: SoE mbox send: working counter error */
310 #define EC_SZTXT_NOTIFY_SOE_MBXSND_WKC_ERROR    "EC_NOTIFY_SOE_MBXSND_WKC_ERROR"
312 #define EC_NOTIFY_SOE_WRITE_ERROR               (EC_NOTIFY_ERROR |24)       /* 0x00010018: SoE mbox write responded with an error */
313 #define EC_SZTXT_NOTIFY_SOE_WRITE_ERROR         "EC_NOTIFY_SOE_WRITE_ERROR"
315 #define EC_NOTIFY_MBSLAVE_COE_SDO_ABORT         (EC_NOTIFY_ERROR |25)       /* 0x00010019: CoE mbox SDO abort */
316 #define EC_SZTXT_NOTIFY_MBSLAVE_COE_SDO_ABORT   "EC_NOTIFY_MBSLAVE_COE_SDO_ABORT"
318 #define EC_NOTIFY_CLIENTREGISTRATION_DROPPED    (EC_NOTIFY_ERROR |26)       /* 0x0001001a: Client registration dropped, possibly call to ecatConfigureMaster by other thread (RAS) */
319 #define EC_SZTXT_NOTIFY_CLIENTREGISTRATION_DROPPED "EC_NOTIFY_CLIENTREGISTRATION_DROPPED"
321 #define EC_NOTIFY_RED_LINEFIXED                 (EC_NOTIFY_ERROR |27)       /* 0x0001001b: Redundancy: line is repaired */
322 #define EC_SZTXT_NOTIFY_RED_LINEFIXED           "EC_NOTIFY_RED_LINEFIXED"
324 #define EC_NOTIFY_FOE_MBSLAVE_ERROR             (EC_NOTIFY_ERROR |28)       /* 0x0001001c: FoE mbox abort */
325 #define EC_SZTXT_NOTIFY_FOE_MBSLAVE_ERROR               "EC_NOTIFY_FOE_MBSLAVE_ERROR"
327 #define EC_NOTIFY_MBXRCV_INVALID_DATA           (EC_NOTIFY_ERROR |29)       /* 0x0001001d: invalid mail box data received */
328 #define EC_SZTXT_NOTIFY_MBXRCV_INVALID_DATA             "EC_NOTIFY_MBXRCV_INVALID_DATA"
330 #define EC_NOTIFY_PDIWATCHDOG                   (EC_NOTIFY_ERROR |30)       /* 0x0001001e: PDI Watchdog expired on slave, thrown by IST */
331 #define EC_SZTXT_NOTIFY_PDIWATCHDOG                 "EC_NOTIFY_PDIWATCHDOG"
333 #define EC_NOTIFY_SLAVE_NOTSUPPORTED            (EC_NOTIFY_ERROR |31)       /* 0x0001001f: slave not supported (if redundancy is activated and slave doesn't fully support autoclose */
334 #define EC_SZTXT_NOTIFY_SLAVE_NOTSUPPORTED              "EC_NOTIFY_SLAVE_NOTSUPPORTED"
336 #define EC_NOTIFY_SLAVE_UNEXPECTED_STATE        (EC_NOTIFY_ERROR |32)       /* 0x00010020: slave in unexpected state */
337 #define EC_SZTXT_NOTIFY_SLAVE_UNEXPECTED_STATE  "EC_NOTIFY_SLAVE_UNEXPECTED_STATE"
339 #define EC_NOTIFY_ALL_DEVICES_OPERATIONAL       (EC_NOTIFY_ERROR |33)       /* 0x00010021: All slave devices are in operational state */
340 #define EC_SZTXT_NOTIFY_ALL_DEVICES_OPERATIONAL "EC_NOTIFY_ALL_DEVICES_OPERATIONAL"
342 #define EC_NOTIFY_VOE_MBXSND_WKC_ERROR          (EC_NOTIFY_ERROR |34)       /* 0x00010022: VOE mbox send: working counter error */
343 #define EC_SZTXT_NOTIFY_VOE_MBXSND_WKC_ERROR    "EC_NOTIFY_VOE_MBXSND_WKC_ERROR"
345 #define EC_NOTIFY_EEPROM_CHECKSUM_ERROR         (EC_NOTIFY_ERROR |35)       /* 0x00010023: EEPROM checksum error detected */
346 #define EC_SZTXT_NOTIFY_EEPROM_CHECKSUM_ERROR   "EC_NOTIFY_EEPROM_CHECKSUM_ERROR"
348 #define EC_NOTIFY_LINE_CROSSED                  (EC_NOTIFY_ERROR |36)       /* 0x00010024: Crossed lines detected */
349 #define EC_SZTXT_NOTIFY_LINE_CROSSED            "EC_NOTIFY_LINE_CROSSED"
351 #define EC_NOTIFY_JUNCTION_RED_CHANGE           (EC_NOTIFY_ERROR |37)       /* 0x00010025: Junction redundancy change */
352 #define EC_SZTXT_NOTIFY_JUNCTION_RED_CHANGE         "EC_NOTIFY_JUNCTION_RED_CHANGE"
354 #define EC_NOTIFY_SLAVES_UNEXPECTED_STATE       (EC_NOTIFY_ERROR |38)       /* 0x00010026: slaves in unexpected state */
355 #define EC_SZTXT_NOTIFY_SLAVES_UNEXPECTED_STATE "EC_NOTIFY_SLAVES_UNEXPECTED_STATE"
357 #define EC_NOTIFY_SLAVES_ERROR_STATUS           (EC_NOTIFY_ERROR |39)       /* 0x00010027: Slaves error (AL status code) */
358 #define EC_SZTXT_NOTIFY_SLAVES_ERROR_STATUS     "EC_NOTIFY_SLAVES_ERROR_STATUS"
360 #define EC_NUM_ERROR_NOTIFICATIONS                                39        /* number of error notifications in 0x00010000 ... 0x0001fff */
362 /* ScanBus Notification */
363 #define EC_NOTIFY_SB_MISMATCH                   (EC_NOTIFY_SCANBUS | 2)     /* 0x00030002: ScanBus mismatch */
364 #define EC_SZTXT_NOTIFY_SB_MISMATCH             "EC_NOTIFY_SB_MISMATCH"
366 #define EC_NOTIFY_SB_DUPLICATE_HC_NODE          (EC_NOTIFY_SCANBUS | 3)     /* 0x00030003: ScanBus mismatch. A duplicate HC group was detected equal product code, vendor id 
367                                                                                and alias address (or switch id)  */
368 #define EC_SZTXT_NOTIFY_SB_DUPLICATE_HC_NODE    "EC_NOTIFY_SB_DUPLICATE_HC_NODE"
371 /* Hot Connect Action Results */
372 /* #define EC_NOTIFY_HC_DETECTALLGROUPS         (EC_NOTIFY_HOTCONNECT | 1)   * 0x00040001: HC Detect All Groups done */
373 #define EC_NOTIFY_HC_DETECTADDGROUPS            (EC_NOTIFY_HOTCONNECT | 2)  /* 0x00040002: HC Enhance Detect All Groups done */
374 #define EC_SZTXT_NOTIFY_HC_DETECTADDGROUPS              "EC_NOTIFY_HC_DETECTADDGROUPS"
376 #define EC_NOTIFY_HC_PROBEALLGROUPS             (EC_NOTIFY_HOTCONNECT | 3)  /* 0x00040003: HC Probe All Groups done */
377 #define EC_SZTXT_NOTIFY_HC_PROBEALLGROUPS           "EC_NOTIFY_HC_PROBEALLGROUPS"
379 #define EC_NOTIFY_HC_TOPOCHGDONE                (EC_NOTIFY_HOTCONNECT | 4)  /* 0x00040004: HC Topology Change done */
380 #define EC_SZTXT_NOTIFY_HC_TOPOCHGDONE          "EC_NOTIFY_HC_TOPOCHGDONE"
382 /* Replaced by EC_NOTIFY_SLAVE_PRESENCE */
383 #define EC_NOTIFY_SLAVE_DISAPPEARS              (EC_NOTIFY_HOTCONNECT | 5)  /* 0x00040005: Slave disappears */
384 #define EC_NOTIFY_HC_SLAVE_PART EC_NOTIFY_SLAVE_DISAPPEARS
385 #define EC_SZTXT_NOTIFY_SLAVE_DISAPPEARS                "EC_NOTIFY_SLAVE_DISAPPEARS"
387 /* Replaced by EC_NOTIFY_SLAVE_PRESENCE */
388 #define EC_NOTIFY_SLAVE_APPEARS                 (EC_NOTIFY_HOTCONNECT | 6)  /* 0x00040006: Slave appears */
389 #define EC_NOTIFY_HC_SLAVE_JOIN EC_NOTIFY_SLAVE_APPEARS
390 #define EC_SZTXT_NOTIFY_SLAVE_APPEARS               "EC_NOTIFY_SLAVE_APPEARS"
392 /* Remote API */
393 #define ATEMRAS_NOTIFY_CONNECTION               (ATEMRAS_NOTIFY_GENERIC|0x0001) /* 0x00100001 */
394 #define EC_SZTXT_ATEMRAS_NOTIFY_CONNECTION          "ATEMRAS_NOTIFY_CONNECTION"
396 #define ATEMRAS_NOTIFY_REGISTER                 (ATEMRAS_NOTIFY_GENERIC|0x0002) /* 0x00100002 */
397 #define EC_SZTXT_ATEMRAS_NOTIFY_REGISTER            "ATEMRAS_NOTIFY_REGISTER"
399 #define ATEMRAS_NOTIFY_UNREGISTER               (ATEMRAS_NOTIFY_GENERIC|0x0003) /* 0x00100003 */
400 #define EC_SZTXT_ATEMRAS_NOTIFY_UNREGISTER          "ATEMRAS_NOTIFY_UNREGISTER"
402 #define ATEMRAS_NOTIFY_MARSHALERROR             (ATEMRAS_NOTIFY_ERROR  |0x0001) /* 0x00110001 */
403 #define EC_SZTXT_ATEMRAS_NOTIFY_MARSHALERROR    "ATEMRAS_NOTIFY_MARSHALERROR"
405 #define ATEMRAS_NOTIFY_ACKERROR                 (ATEMRAS_NOTIFY_ERROR  |0x0002) /* 0x00110002 */
406 #define EC_SZTXT_ATEMRAS_NOTIFY_ACKERROR            "ATEMRAS_NOTIFY_ACKERROR"
408 #define ATEMRAS_NOTIFY_NONOTIFYMEMORY           (ATEMRAS_NOTIFY_ERROR  |0x0003) /* 0x00110003 */
409 #define EC_SZTXT_ATEMRAS_NOTIFY_NONOTIFYMEMORY  "ATEMRAS_NOTIFY_NONOTIFYMEMORY"
411 #define ATEMRAS_NOTIFY_STDNOTIFYMEMORYSMALL     (ATEMRAS_NOTIFY_ERROR  |0x0004) /* 0x00110004 */
412 #define EC_SZTXT_ATEMRAS_NOTIFY_STDNOTIFYMEMORYSMALL    "ATEMRAS_NOTIFY_STDNOTIFYMEMORYSMALL"
414 #define ATEMRAS_NOTIFY_MBXNOTIFYMEMORYSMALL     (ATEMRAS_NOTIFY_ERROR  |0x0005) /* 0x00110005 */
415 #define EC_SZTXT_ATEMRAS_NOTIFY_MBXNOTIFYMEMORYSMALL    "ATEMRAS_NOTIFY_MBXNOTIFYMEMORYSMALL"
418 /* cyclic error notification bit masks */
419 #define EC_CYC_ERR_MASK_NOT_ALL_DEVICES_OPERATIONAL     0x00000001      /* mask for cyclic EC_NOTIFY_NOT_ALL_DEVICES_OPERATIONAL notifications */
420 #define EC_CYC_ERR_MASK_STATUS_SLAVE_ERROR              0x00000002      /* mask for cyclic EC_NOTIFY_STATUS_SLAVE_ERROR notifications */
421 #define EC_CYC_ERR_MASK_CYCCMD_WKC_ERROR                0x00000004      /* mask for cyclic EC_NOTIFY_CYCCMD_WKC_ERROR notifications */
422 #define EC_CYC_ERR_MASK_UNEXPECTED_FRAME_RESPONSE       0x00000008      /* mask for cyclic EC_NOTIFY_FRAME_RESPONSE_ERROR notifications with error type eRspErr_UNEXPECTED */
423 #define EC_CYC_ERR_MASK_NO_FRAME_RESPONSE_ERROR         0x00000010      /* mask for cyclic EC_NOTIFY_FRAME_RESPONSE_ERROR notifications with error type eRspErr_NO_RESPONSE */
424 #define EC_ERR_MASK_ETH_LINK_NOT_CONNECTED              0x00000020      /* mask for EC_NOTIFY_ETH_LINK_NOT_CONNECTED notifications */
425 #define EC_CYC_ERR_MASK_ALL                             0xFFFFFFFF      /* mask for all cyclic error notifications */
427 /* Supported mailbox protocols */
428 #define EC_MBX_PROTOCOL_AOE 0x01
429 #define EC_MBX_PROTOCOL_EOE 0x02
430 #define EC_MBX_PROTOCOL_COE 0x04
431 #define EC_MBX_PROTOCOL_FOE 0x08
432 #define EC_MBX_PROTOCOL_SOE 0x10
433 #define EC_MBX_PROTOCOL_VOE 0x20
435 /* CoE debug bit masks */
436 #define EC_COE_DBG_MASK_SDO_DOWNLOAD        0x00000001  /* mask for SDO download transfer debug support */
437 #define EC_COE_DBG_MASK_SDO_UPLOAD          0x00000002  /* mask for SDO upload transfer debug support */
438 #define EC_COE_DBG_MASK_GET_ODLIST          0x00000004  /* mask for CoE get object dictionary list transfer debug support */
439 #define EC_COE_DBG_MASK_GET_OBDESC          0x00000008  /* mask for CoE get object description transfer debug support */
440 #define EC_COE_DBG_MASK_GET_ENTRYDESC       0x00000010  /* mask for CoE get entry description transfer debug support */
441 #ifdef INCLUDE_COE_PDO_SUPPORT
442 #define EC_COE_DBG_MASK_RX_PDO              0x00000020  /* mask for RxPDO transfer debug support */
443 #define EC_COE_DBG_MASK_TX_PDO              0x00000040  /* mask for TxPDO transfer debug support */
444 #endif
445 #define EC_COE_DBG_MASK_ALL                 0x00000FFF  /* mask for all CoE transfers debug support */
447 /* FoE debug bit masks */
448 #define EC_FOE_DBG_MASK_FILE_DOWNLOAD       0x00001000  /* mask for FoE download transfer debug support */
449 #define EC_FOE_DBG_MASK_FILE_UPLOAD         0x00002000  /* mask for FoE download transfer debug support */
450 #define EC_FOE_DBG_MASK_ALL                 0x000FF000  /* mask for all FoE transfers debug support */
452 #define EC_MBX_DBG_MASK_ALL                 0x000FFFFF  /* mask for all CoE transfers debug support */
455 /* SoE debug bit masks */
456 #ifdef INCLUDE_SOE_SUPPORT
457 #define EC_SOE_DBG_MASK_IDN_WRITE        0x00000001  /* mask for SoE download transfer debug support */
458 #define EC_SOE_DBG_MASK_IDN_READ         0x00000002  /* mask for SoE upload transfer debug support */
459 #define EC_SOE_DBG_MASK_ALL              0x00000FFF  /* mask for all SoE transfers debug support */
460 #endif
462 /* VoE debug bit masks */
463 #ifdef INCLUDE_VOE_SUPPORT
464 #define EC_VOE_DBG_MASK_MBX_DOWNLOAD     0x00100000  /* mask for VoE write transfer debug support */
465 #define EC_VOE_DBG_MASK_MBX_UPLOAD       0x00200000  /* mask for VoE read transfer debug support */
466 #define EC_VOE_DBG_MASK_ALL              0x0FF00000  /* mask for all VoE transfers debug support */
467 #endif
469 #define MAX_PROCESS_VAR_NAME_LEN            ((EC_T_DWORD)72)  /* STD: Maximum length of a process variable name */
470 #define MAX_PROCESS_VAR_NAME_LEN_EX         ((EC_T_DWORD)128) /* EX:  Maximum length of a process variable name */
472 /* EtherCAT commands */
473 typedef enum 
475     EC_CMD_TYPE_NOP     = 0x00,
476     EC_CMD_TYPE_APRD    = 0x01,
477     EC_CMD_TYPE_APWR    = 0x02,
478     EC_CMD_TYPE_APRW    = 0x03,
479     EC_CMD_TYPE_FPRD    = 0x04,
480     EC_CMD_TYPE_FPWR    = 0x05,
481     EC_CMD_TYPE_FPRW    = 0x06,
482     EC_CMD_TYPE_BRD     = 0x07,
483     EC_CMD_TYPE_BWR     = 0x08,
484     EC_CMD_TYPE_BRW     = 0x09,
485     EC_CMD_TYPE_LRD     = 0x0A,
486     EC_CMD_TYPE_LWR     = 0x0B,
487     EC_CMD_TYPE_LRW     = 0x0C,
488     EC_CMD_TYPE_ARMW    = 0x0D,
489     EC_CMD_TYPE_FRMW    = 0x0E,
490     EC_CMD_TYPE_EXT     = 0xFF,
492     /* Borland C++ datatype alignment correction */
493     EC_CMD_TYPE_BCppDummy   = 0xFFFFFFFF
494 } EC_CMD_TYPE;
496 /* textual description of EtherCat commands */
497 #define EcatCmdShortText(byCmd)                     \
498     ((byCmd)==EC_CMD_TYPE_NOP?"NOP":                \
499      ((byCmd)==EC_CMD_TYPE_APRD?"APRD":             \
500       ((byCmd)==EC_CMD_TYPE_APWR?"APWR":            \
501        ((byCmd)==EC_CMD_TYPE_APRW?"APRW":           \
502         ((byCmd)==EC_CMD_TYPE_FPRD?"FPRD":          \
503          ((byCmd)==EC_CMD_TYPE_FPWR?"FPWR":         \
504           ((byCmd)==EC_CMD_TYPE_FPRW?"FPRW":        \
505            ((byCmd)==EC_CMD_TYPE_BRD?"BRD":         \
506             ((byCmd)==EC_CMD_TYPE_BWR?"BWR":        \
507              ((byCmd)==EC_CMD_TYPE_BRW?"BRW":       \
508               ((byCmd)==EC_CMD_TYPE_LRD?"LRD":      \
509                ((byCmd)==EC_CMD_TYPE_LWR?"LWR":     \
510                 ((byCmd)==EC_CMD_TYPE_LRW?"LRW":    \
511                  ((byCmd)==EC_CMD_TYPE_ARMW?"ARMW": \
512                   ((byCmd)==EC_CMD_TYPE_FRMW?"FRMW":\
513                   "INVALID ECAT CMD VALUE!!!"       \
514     )))))))))))))))
517 /*-TYPEDEFS------------------------------------------------------------------*/
518 #include EC_PACKED_INCLUDESTART(1)
519 /* Basic structure to handle message parameter */
520 typedef struct 
522    EC_T_WORD        wParamFlags;                    /* Parameter flags */
523    EC_T_BYTE        aData[4];                       /* Parameter buffer: length depending on parameters */
524 } EC_PACKED(1) EC_T_DIAGMSGPARAM;
526 /* Generic diagnosis message structure (0x10F3.SI6 : 0x10F3.MaxSubindex */
527 typedef struct _EC_T_OBJ10F3_DIAGMSG
529    EC_T_DWORD           dwDiagNumber;               /* Message code */
530    EC_T_WORD            wFlags;                     /* Message flags */
531    EC_T_WORD            wTextId;                    /* Text ID */
532    EC_T_UINT64          qwTimeStamp;                /* 0x08 */
533    EC_T_DIAGMSGPARAM    oParameter;                 /* Handler of the first parameter */
534 } EC_PACKED(1) EC_T_OBJ10F3_DIAGMSG;
536 typedef struct _EC_T_OBJ10F3
538     EC_T_WORD               wSubIndex0;             /* Subindex 000 */
539     EC_T_BYTE               byMaxDiagMessages;      /* Subindex 001 */
540     EC_T_BYTE               byNewestMessage;        /* Subindex 002 */
541     EC_T_BYTE               byNewestAckMessage;     /* Subindex 003 */
542     EC_T_BYTE               byNewDiagMessages;          /* Subindex 004 */
543     EC_T_WORD               wFlags;                 /* Subindex 005 */
544     /* EC_T_DIAGMESSAGE */                          /* Subindex 006ff */
545 } EC_PACKED(1) EC_T_OBJ10F3;
548 typedef enum _EC_T_OBJ2000_VALUES
550     eMastStChng_init        = 1,
551     eMastStChng_preop       = 2,
552     eMastStChng_safeop      = 4,
553     eMastStChng_op          = 8,
555     /* Borland C++ datatype alignment correction */
556     eMastStChng_BCppDummy   = 0xFFFFFFFF
557 } EC_T_OBJ2000_VALUES;
559 /* 0x2001: Master State Summary (EC_T_DWORD) */
560 #define OBJ2001_STATE_SUM_MASTER_OK    0x00000001      /* Bit 0: = 1 Master o.k. */
561                                                        /* Bit 1-3: Reserved */
562 #define OBJ2001_STATE_SUM_MASTER_STATE 0x000000F0      /* Bit 4-7: Master State */
563 #define OBJ2001_STATE_SUM_SLAVE_REQ    0x00000100      /* Bit 8: Slaves in requested State */
564 #define OBJ2001_STATE_SUM_MASTER_REQ   0x00000200      /* Bit 9: Master in requested State */
565 #define OBJ2001_STATE_SUM_BUS_MATCH    0x00000400      /* Bit 10: Bus Scan Match */
566 #define OBJ2001_STATE_SUM_RES11        0x00000800      /* Bit 11: Reserved */
567 #define OBJ2001_STATE_SUM_DC_ENA       0x00001000      /* Bit 12: DC is enabled */
568 #define OBJ2001_STATE_SUM_DC_SYNC      0x00002000      /* Bit 13: DC In-Sync */
569 #define OBJ2001_STATE_SUM_DC_BUSY      0x00004000      /* Bit 14: DC Busy */
570 #define OBJ2001_STATE_SUM_RES15        0x00008000      /* Bit 15: Reserved */
571 #define OBJ2001_STATE_SUM_LINK_UP      0x00010000      /* Bit 16: Link Up  */
572                                                        /* Bit 17-31: Reserved */
574                                                              /* dword : .... .... .... ...L  .bID .BMS ssss ...O */
575 #define OBJ2001_STATE_SUM_MASK1  ((EC_T_DWORD)0x000107f0)    /* mask  : 0000 0000 0000 0001  0000 0111 1111 0000 */
576 #define OBJ2001_STATE_SUM_VALUE1 ((EC_T_DWORD)0x00010780)    /* value : 0000 0000 0000 0001  0000 0111 1000 0000 */
577 #define OBJ2001_STATE_SUM_MASK2  ((EC_T_DWORD)0x00007000)    /* mask2 : 0000 0000 0000 0000  0111 0000 0000 0000 */
578 #define OBJ2001_STATE_SUM_VALUE2 ((EC_T_DWORD)0x00003000)    /* value : 0000 0000 0000 0000  0011 0000 0000 0000 */
580 /* 0x2002: Bus Diagnosis Object */
581 #define OBJ2002_TXFRM_OFFSET    0x18
582 #define OBJ2002_RXFRM_OFFSET    0x1C
583 #define OBJ2002_LOSFRM_OFFSET   0x20
584 #define OBJ2002_CYCFRM_OFFSET   0x24
585 #define OBJ2002_CYCDGR_OFFSET   0x28
586 #define OBJ2002_ACYCFRM_OFFSET  0x2C
587 #define OBJ2002_ACYCDGR_OFFSET  0x30
589 typedef struct _EC_T_OBJ2002
591     EC_T_WORD               wSubIndex0;             /* 0x00 */  /* Subindex 000 */
592     EC_T_WORD               wReserved;              /* 0x02 */  /* Subindex 001 */
593     EC_T_DWORD              dwCRC32ConfigCheckSum;  /* 0x04 */  /* Subindex 002 */
594     EC_T_DWORD              dwNumSlavesFound;       /* 0x08 */  /* Subindex 003 */
595     EC_T_DWORD              dwNumDCSlavesFound;     /* 0x0C */  /* Subindex 004 */
596     EC_T_DWORD              dwNumCfgSlaves;         /* 0x10 */  /* Subindex 005 */
597     EC_T_DWORD              dwNumMbxSlaves;         /* 0x14 */  /* Subindex 006 */
598     
599     EC_T_DWORD              dwTXFrames;             /* 0x18 */  /* Subindex 007 */
600     EC_T_DWORD              dwRXFrames;             /* 0x1C */  /* Subindex 008 */
601     EC_T_DWORD              dwLostFrames;           /* 0x20 */  /* Subindex 009 */
602     
603     EC_T_DWORD              dwCyclicFrames;         /* 0x24 */  /* Subindex 010 */
604     EC_T_DWORD              dwCyclicDatagrams;      /* 0x28 */  /* Subindex 011 */
605     EC_T_DWORD              dwAcyclicFrames;        /* 0x2C */  /* Subindex 012 */
606     EC_T_DWORD              dwAcyclicDatagrams;     /* 0x30 */  /* Subindex 013 */
607     EC_T_DWORD              dwClearCounters;        /* 0x34 */  /* Subindex 014 */
608 } EC_PACKED(1) EC_T_OBJ2002;
610 typedef struct _EC_T_OBJ2003
612     EC_T_WORD               wSubIndex0;             /* 0x00 */  /* Subindex 000 */
613     EC_T_BYTE               byRedEnabled;           /* 0x01 */  /* Subindex 001 */
614     EC_T_WORD               wNumOfMainSlaves;       /* 0x03 */  /* Subindex 002 */
615     EC_T_WORD               wNumOfRedSlaves;        /* 0x05 */  /* Subindex 003 */
616     EC_T_BYTE               byLineBreak;            /* 0x06 */  /* Subindex 004 */
617 } EC_PACKED(1) EC_T_OBJ2003;
619 typedef struct _EC_T_OBJ2004_NOTIFYMSG
621   EC_T_DWORD              dwCode;
622   EC_T_DWORD              dwCount;
623 } EC_PACKED(1) EC_T_OBJ2004_NOTIFYMSG; 
625 typedef struct _EC_T_OBJ2004
627   EC_T_WORD               wSubIndex0;               /* Subindex 000 */
628   EC_T_BYTE               byMaxMessages;            /* Subindex 001 */
629   EC_T_BYTE               byMessageCount;           /* Subindex 002 */
630   EC_T_BYTE               byFlags;                  /* Subindex 003 */
631   /* EC_T_OBJ2004_NOTIFYMSG */                      /* Subindex 004ff */
632 } EC_PACKED(1) EC_T_OBJ2004;
634 typedef struct _EC_T_OBJ2005
636     EC_T_WORD               wSubIndex0;             /* Subindex 000 */
637     EC_T_BYTE               abyHardware[6];         /* Subindex 001 */
638     EC_T_BYTE               abyRedHardware[6];      /* Subindex 002 */
639     EC_T_BYTE               abyCfgSource[6];        /* Subindex 003 */
640     EC_T_BYTE               abyCfgDestination[6];   /* Subindex 004 */
641 } EC_PACKED(1) EC_T_OBJ2005;
643 typedef struct _EC_T_OBJ2020
645     EC_T_WORD               wSubIndex0;             /* Subindex 000 */
646     EC_T_DWORD              dwApplicationVersion;   /* Subindex 001 */
647     EC_T_DWORD              dwMasterVersion;        /* Subindex 002 */
648     EC_T_DWORD              dwMaxSlavesProcessedPerCycle; /* Subindex 003 */
649     EC_T_DWORD              dwEcatCmdTimeout;       /* Subindex 004 */
650     EC_T_DWORD              dwEcatCmdMaxRetries;    /* Subindex 005 */
651     EC_T_DWORD              dwBusCycleTimeUsec;     /* Subindex 006 */
652     EC_T_DWORD              dwEoeTimeout;           /* Subindex 007 */
653     EC_T_DWORD              dwFoeBusyTimeout;       /* Subindex 008. Obsolete. */
654     EC_T_DWORD              dwMaxQueuedEthFrames;   /* Subindex 009 */
655     EC_T_DWORD              dwMaxSlaveCmdPerFrame;  /* Subindex 010 */
656     EC_T_DWORD              dwMaxBusSlave;          /* Subindex 011 */
657     EC_T_DWORD              dwReserved2;            /* Subindex 012 */
658     EC_T_DWORD              dwStateChangeDebug;     /* Subindex 013 */
659     EC_T_CHAR               szDriverIdent[EC_OD_MAX_DRIVER_IDENT_LEN];
660                                                     /* Subindex 014 */
661     EC_T_BOOL               bPollingModeActive;     /* Subindex 015 */
662     EC_T_BOOL               bAllocSendFrameActive;  /* Subindex 016 */
663 } EC_PACKED(1) EC_T_OBJ2020;
665 typedef struct _EC_T_OBJ2102
667     EC_T_WORD               wSubIndex0;             /* Subindex 000 */
668     EC_T_DWORD              dwErrorCode;            /* Subindex 001: Error Code */
669     EC_T_BOOL               bDcInSync;              /* Subindex 002: DC synchronized */
670     EC_T_BOOL               bDcmInSync;             /* Subindex 003: DCM controller synchronized */
671     EC_T_INT                nCtlSetVal;             /* Subindex 004: Controller Set Value [nsec] */
672     EC_T_INT                nCtlErrorFilt;          /* Subindex 005: Controller Error Filtered [nsec] */
673     EC_T_INT                nCtlErrorAvg;           /* Subindex 006: Controller Error Average [nsec] */
674     EC_T_INT                nCtlErrorMax;           /* Subindex 007: Controller Error Maximum [nsec] */
675 } EC_PACKED(1) EC_T_OBJ2102;
677 typedef struct _EC_T_OBJ2200
679     EC_T_WORD               wSubIndex0;             /* Subindex 000 */
681     EC_T_DWORD              dwBytesPerSecondAct;    /* Subindex 001: TX bytes/second actual value */
682     EC_T_DWORD              dwBytesPerSecondMin;    /* Subindex 002: TX bytes/second min. value   */
683     EC_T_DWORD              dwBytesPerSecondMax;    /* Subindex 003: TX bytes/second max. value   */
685     EC_T_DWORD              dwBytesPerCycleAct;     /* Subindex 004: TX bytes/cycle actual value  */
686     EC_T_DWORD              dwBytesPerCycleMin;     /* Subindex 005: TX bytes/cycle min. value    */
687     EC_T_DWORD              dwBytesPerCycleMax;     /* Subindex 006: TX bytes/cycle max. value    */
688 } EC_PACKED(1) EC_T_OBJ2200;
690 typedef struct _EC_T_OBJ3XXX
692     EC_T_WORD               wSubIndex0;                         /* Subindex 000: (Offset   0) */
693     EC_T_BOOL               bEntryValid;                        /* Subindex 001: (Offset   2) */
694     EC_T_DWORD              dwVendorID;                         /* Subindex 002: (Offset   6) */
695     EC_T_DWORD              dwProductCode;                      /* Subindex 003: (Offset  10) */
696     EC_T_DWORD              dwRevisionNo;                       /* Subindex 004: (Offset  14) */
697     EC_T_DWORD              dwSerialNo;                         /* Subindex 005: (Offset  18) */
699     EC_T_CHAR               szDeviceName[MAX_SLAVE_DEVICENAME]; /* Subindex 006: (Offset  22) */
700     EC_T_WORD               wAutoIncAddr;                       /* Subindex 007: (Offset 102) */
701     EC_T_WORD               wPhysAddr;                          /* Subindex 008: (Offset 104) */
702     EC_T_WORD               wConfigPhysAddr;                    /* Subindex 009: (Offset 106) */
703     EC_T_WORD               wAliasAddr;                         /* Subindex 010: (Offset 108) */
704     EC_T_WORD               wPortState;                         /* Subindex 011: (Offset 110) */
705     EC_T_BOOL               bDCSupport;                         /* Subindex 012: (Offset 112) */
706     EC_T_BOOL               bDC64Support;                       /* Subindex 013: (Offset 116) */
708     EC_T_BOOL               bMailboxSupport;                    /* Subindex 014: (Offset 120) */
709     EC_T_DWORD              dwReqState;                         /* Subindex 015: (Offset 124) */
710     EC_T_DWORD              dwCurState;                         /* Subindex 016: (Offset 128) */
711     EC_T_BOOL               bErrFlagSet;                        /* Subindex 017: (Offset 132) */
712     EC_T_BOOL               bEnableLinkMsgs;                    /* Subindex 018: (Offset 136) */
713     EC_T_DWORD              dwErrorCode;                        /* Subindex 019: (Offset 140) */
714     EC_T_BOOL               bSyncPulseActive;                   /* Subindex 020: (Offset 144) */
715     EC_T_DWORD              dwDCSync0Period;                    /* Subindex 021: (Offset 148) */
716     EC_T_DWORD              dwDCSync1Period;                    /* Subindex 022: (Offset 152) */
717     EC_T_DWORD              dwSBErrorCode;                      /* Subindex 023: (Offset 156) */
719     EC_T_WORD               wRxErrorCounter0;                   /* Subindex 024: (Offset 160) */
720     EC_T_WORD               wRxErrorCounter1;                   /* Subindex 025: (Offset 162) */
721     EC_T_WORD               wRxErrorCounter2;                   /* Subindex 026: (Offset 164) */
722     EC_T_WORD               wRxErrorCounter3;                   /* Subindex 027: (Offset 166) */
723     EC_T_BYTE               byFwdRxErrorCounter0;               /* Subindex 028: (Offset 168) */
724     EC_T_BYTE               byFwdRxErrorCounter1;               /* Subindex 029: (Offset 169) */
725     EC_T_BYTE               byFwdRxErrorCounter2;               /* Subindex 030: (Offset 170) */
726     EC_T_BYTE               byFwdRxErrorCounter3;               /* Subindex 031: (Offset 171) */
727     
728     EC_T_BYTE               byEcatProcUnitErrorCounter;         /* Subindex 032: (Offset 172) */
729     EC_T_BYTE               byPDIErrorCounter;                  /* Subindex 033: (Offset 173) */
730     EC_T_WORD               wMbxSupportedProtocols;             /* Subindex 034: (Offset 174) */
731     EC_T_BYTE               byLostLinkCounter0;                 /* Subindex 035: (Offset 176) */
732     EC_T_BYTE               byLostLinkCounter1;                 /* Subindex 036: (Offset 177) */
733     EC_T_BYTE               byLostLinkCounter2;                 /* Subindex 037: (Offset 178) */
734     EC_T_BYTE               byLostLinkCounter3;                 /* Subindex 038: (Offset 179) */
735     EC_T_BYTE               byFmmusSupported;                   /* Subindex 039: (Offset 180) */
736     EC_T_BYTE               bySyncManagersSupported;            /* Subindex 040: (Offset 181) */
737     EC_T_BYTE               byRamSizeKb;                        /* Subindex 041: (Offset 182) */
738     EC_T_BYTE               byPortDescriptor;                   /* Subindex 042: (Offset 183) */
740     EC_T_BYTE               byESCType;                          /* Subindex 043: (Offset 184) */
741     
742     EC_T_BOOL               bSlaveIsOptional;                   /* Subindex 044: (Offset 185) */
743     EC_T_BOOL               bSlaveIsPresent;                    /* Subindex 045: (Offset 189) */
744     EC_T_DWORD              dwHotConnectGroupId;                /* Subindex 046: (Offset 193) */
745     EC_T_DWORD              dwSystemTimeDifference;             /* Subindex 047: (Offset 197) */
746     EC_T_DWORD              dwPdOffsIn;                         /* Subindex 048: (Offset 201) Process data offset of input data (in Bits) */
747     EC_T_DWORD              dwPdSizeIn;                         /* Subindex 049: (Offset 205) Process data size of input data (in Bits) */
748     EC_T_DWORD              dwPdOffsOut;                        /* Subindex 050: (Offset 209) Process data offset of output data (in Bits) */
749     EC_T_DWORD              dwPdSizeOut;                        /* Subindex 051: (Offset 213) Process data size of output data (in Bits) */
750 } EC_PACKED(1) EC_T_OBJ3XXX;
752 /* Modular Device Profiles: EtherCAT Master  - internal slave object element (configured slaves ) */
753 typedef struct _EC_T_OBJ8XXX
755     EC_T_WORD               wSubIndex0;                         /*   0 */       /* Subindex 000 */
756     EC_T_WORD               wFixedStationAddr;                  /*   2 */       /* Subindex 001: Station Address of the first EtherCAT Slave (same value as 0xF020:01) */
757     EC_T_CHAR               szType[64];                         /*   4 */       /* Subindex 002: Type of the first EtherCAT Slave configured */
758     EC_T_CHAR               szName[64];                         /*  68 */       /* Subindex 003: Name of the first EtherCAT Slave configured (object 0x1008 of the EtherCAT slave) */
759     EC_T_DWORD              dwDeviceType;                       /* 132 */       /* Subindex 004: Device Type of the first EtherCAT Slave configured (object 0x1000 of the EtherCAT slave) */
760     EC_T_DWORD              dwVendorID;                         /* 136 */       /* Subindex 005: Vendor ID of the first EtherCAT Slave configured (entry 0x1018:01 of the EtherCAT slave) */
761     EC_T_DWORD              dwProductCode;                      /* 140 */       /* Subindex 006: Product Code of the first EtherCAT Slave configured (entry 0x1018:02 of the EtherCAT slave) */
762     EC_T_DWORD              dwRevision;                         /* 144 */       /* Subindex 007: Revision of the first EtherCAT Slave configured (entry 0x1018:03 of the EtherCAT slave) */
763     EC_T_DWORD              dwSerial;                           /* 148 */       /* Subindex 008: Serial No of the first EtherCAT Slave configured (entry 0x1018:04 of the EtherCAT slave) */
764     EC_T_WORD               wMailboxOutSize;                    /* 152 */       /* Subindex 033: Mailbox Write Size (SM0) of the first EtherCAT Slave configured */
765     EC_T_WORD               wMailboxInSize;                     /* 154 */       /* Subindex 034: Mailbox Read Size (SM1) of the first EtherCAT Slave configured */
766 } EC_PACKED(1) EC_T_OBJ8XXX;              
768 /* Modular Device Profiles: EtherCAT Master  - internal slave object element (connected slaves) */
769 typedef struct _EC_T_OBJ9XXX
771     EC_T_WORD               wSubIndex0;                         /*   0 */       /* Subindex 000 */
772     EC_T_WORD               wFixedStationAddr;                  /*   2 */       /* Subindex 001: Fixed Station Address of the first EtherCAT Slave (same value as 0xF020:01) */
773     EC_T_DWORD              dwVendorID;                         /*   4 */       /* Subindex 005: Vendor ID of the first EtherCAT Slave configured (entry 0x1018:01 of the EtherCAT slave) */
774     EC_T_DWORD              dwProductCode;                      /*   8 */       /* Subindex 006: Product Code of the first EtherCAT Slave configured (entry 0x1018:02 of the EtherCAT slave) */
775     EC_T_DWORD              dwRevision;                         /*  12 */       /* Subindex 007: Revision of the first EtherCAT Slave configured (entry 0x1018:03 of the EtherCAT slave) */
776     EC_T_DWORD              dwSerial;                           /*  16 */       /* Subindex 008: Serial No. of the first EtherCAT Slave configured (entry 0x1018:04 of the EtherCAT slave) */
777     EC_T_WORD               wDLStatus;                          /*  20 */       /* Subindex 032: DL Status (Register 0x110-0x111) of the first EtherCAT found */
778 } EC_PACKED(1) EC_T_OBJ9XXX;              
780 /* Modular Device Profiles: EtherCAT Master  - internal slave object element (slave diagnosis) */
781 typedef struct _EC_T_OBJAXXX
783     EC_T_WORD               wSubIndex0;                         /*   0 */       /* Subindex 000 */
784     EC_T_WORD               wALStatus;                          /*   2 */       /* Subindex 001: AL Status (Register 0x130-0x131) of the first EtherCAT slave configured */
785     EC_T_WORD               wALControl;                         /*   4 */       /* Subindex 002: AL Control (Register 0x120-0x121) of the first EtherCAT slave configured */
786 } EC_PACKED(1) EC_T_OBJAXXX;              
788 /* Modular Device Profiles: EtherCAT Master  - modular device profile */
789 typedef struct _EC_T_OBJF000
791     EC_T_WORD               wSubIndex0;                         /*   0 */       /* Subindex 000 */
792     EC_T_WORD               wIndexDistance;                     /*   2 */       /* Subindex 001: Index distance between two modules = 0x01 */
793     EC_T_WORD               wMaxModuleCnt;                      /*   4 */       /* Subindex 002: Maximum number of EtherCAT Slaves connected to the EtherCAT Master = 4080 */
794     EC_T_DWORD              dwGeneralCfg;                       /*   8 */       /* Subindex 003: Available entries in objects 0x8nn0 = 0x000000FF */
795     EC_T_DWORD              dwGeneralInfo;                      /*  12 */       /* Subindex 004: Available entries in objects 0x9nn0 = 0x000000F1 (if information data supported) or 0x00000000 (if information data not supported) */
796 } EC_PACKED(1) EC_T_OBJF000;              
798 /* Modular Device Profiles: EtherCAT Master  - detect modules command */
799 typedef struct _EC_T_OBJF002
801     EC_T_WORD               wSubIndex0;                         /*   0 */       /* Subindex 000 */
802     EC_T_BYTE               abyCmdRequest[2];                   /*   1 */       /* Subindex 001: When this subindex is written, the EtherCAT Master shall scan the EtherCAT bus and update the objects 0xF04x and 0x9nnn */
803     EC_T_BYTE               byCmdStatus;                        /*   3 */       /* Subindex 002: 1: command is finished, no error
804                                                                                                  3: command is finished, error
805                                                                                            100-199: 0-99% of the command is done
806                                                                                                255: command is executing */
807     EC_T_BYTE               abyCmdResponse[6];                  /*   4 */       /* Subindex 003: Byte 0: like Subindex 2
808                                                                                                  Byte 1: always 0
809                                                                                                  Byte 2-3: 0: no error, > 0: vendor specific error code
810                                                                                                  Byte 4-5: number of EtherCAT slaves found */
811 } EC_PACKED(1) EC_T_OBJF002;              
813 /* Modular Device Profiles: EtherCAT Master  - configured address list */
814 typedef struct _EC_T_OBJF02X
816     EC_T_WORD               wSubIndex0;                         /*   0 */       /* Subindex 000 */
817     EC_T_WORD               wStationAddr[255];                  /*   2 */       /* Subindex 001 - 255 */
818 } EC_PACKED(1) EC_T_OBJF02X;              
820 /* Modular Device Profiles: EtherCAT Master  - detected address list */
821 typedef struct _EC_T_OBJF04X
823     EC_T_WORD               wSubIndex0;                         /*   0 */       /* Subindex 000 */
824     EC_T_WORD               wStationAddr[255];                  /*   2 */       /* Subindex 001 - 255 */
825 } EC_PACKED(1) EC_T_OBJF04X; 
826 #include EC_PACKED_INCLUDESTOP
828 #include EC_PACKED_INCLUDESTART(4)
830 /* EtherCAT slave properties */
831 typedef struct _EC_T_SLAVE_PROP
833     EC_T_WORD   wStationAddress;        /*< station address, 
834                                          *  set by XML configuration file (Config/Slave/Info/PhysAddr) */
835     EC_T_WORD   wAutoIncAddr;           /*< auto increment address */
836     EC_T_CHAR   achName[MAX_STD_STRLEN];/*< device name */
837 } EC_PACKED(4) EC_T_SLAVE_PROP;
840 /* EtherCAT notify parameters */
841 typedef struct _EC_T_NOTIFYPARMS
843     EC_T_VOID*      pCallerData;        /*< in  caller data */
844     EC_T_BYTE*      pbyInBuf;           /*< in  input data buffer */
845     EC_T_DWORD      dwInBufSize;        /*< in  size of input data buffer in byte */
846     EC_T_BYTE*      pbyOutBuf;          /*< out output data buffer */
847     EC_T_DWORD      dwOutBufSize;       /*< in  size of output data buffer in byte */
848     EC_T_DWORD*     pdwNumOutData;      /*< out number of output data bytes stored in output data buffer */
849 } EC_PACKED(4) EC_T_NOTIFYPARMS, *PEC_T_NOTIFYPARMS;
851 /* EtherCAT command WKC error descriptor */
852 typedef struct _EC_T_WKCERR_DESC
854     EC_T_SLAVE_PROP SlaveProp;          /*< slave properties if applicable */
855     EC_T_BYTE       byCmd;              /*< EtherCAT command where the error occured */
856     EC_T_BYTE       byRsvd[3];          /*< Alignment */
857     EC_T_DWORD      dwAddr;             /*< logical or physical (adp/ado) address */
858     EC_T_WORD       wWkcSet;            /*< working counter set value */
859     EC_T_WORD       wWkcAct;            /*< working counter actual value */
860 } EC_PACKED(4) EC_T_WKCERR_DESC;
862 /* EtherCAT frame response error descriptor */
863 typedef enum _EC_T_FRAME_RSPERR_TYPE
865     eRspErr_UNDEFINED       = 0,        /*< undefined */
866     eRspErr_NO_RESPONSE     = 1,        /*< no response (timeout)            obsolete for acyclic frames*/
867     eRspErr_WRONG_IDX       = 2,        /*< frame with wrong IDX received    obsolete for acyclic frames*/
868     eRspErr_UNEXPECTED      = 3,        /*< unexpected frame received */
869     eRspErr_FRAME_RETRY     = 4,        /*< ethernet frame has to be re-sent due to an timeout (only acyclic frames)  obsolete*/
870     eRspErr_RETRY_FAIL      = 5,        /*< all retry mechanism fails to re-sent acyclic frames*/
871     /* Borland C++ datatype alignment correction */
872     eRspErr_BCppDummy   = 0xFFFFFFFF
873 } EC_T_FRAME_RSPERR_TYPE;
875 typedef struct _EC_T_FRAME_RSPERR_DESC
877     EC_T_BOOL               bIsCyclicFrame;         /*< EC_TRUE if it is a frame containing cyclic commands */
878     EC_T_FRAME_RSPERR_TYPE  EErrorType;             /*< type of error */
879     EC_T_BYTE               byEcCmdHeaderIdxSet;    /*< Expected index value */
880     EC_T_BYTE               byEcCmdHeaderIdxAct;    /*< Actual index value */
881 } EC_PACKED(4) EC_T_FRAME_RSPERR_DESC;
883 /* EtherCAT init command response error descriptor */
884 typedef enum _EC_T_INITCMD_ERR_TYPE
886     eInitCmdErr_UNDEFINED        = 0,    /*< undefined */
887     eInitCmdErr_NO_RESPONSE      = 1,    /*< no response */
888     eInitCmdErr_VALIDATION_ERR   = 2,    /*< validation error */
889     eInitCmdErr_FAILED           = 3,    /*< init command failed, requested state could not be reached */
891     /* Borland C++ datatype alignment correction */
892     eInitCmdErr_BCppDummy       = 0xFFFFFFFF
893 } EC_T_INITCMD_ERR_TYPE;
895 typedef struct _EC_T_INITCMD_ERR_DESC
897     EC_T_SLAVE_PROP       SlaveProp;                              /*< slave properties */
898     EC_T_CHAR             achStateChangeName[MAX_SHORT_STRLEN];   /*< description of the current ecat state change */
899     EC_T_INITCMD_ERR_TYPE EErrorType;                             /*< type of error */
900     EC_T_CHAR             szComment[MAX_STD_STRLEN];              /*< comment (ENI) */
901 } EC_PACKED(4) EC_T_INITCMD_ERR_DESC;
903 /* EtherCAT missing command descriptor */
904 typedef struct _EC_T_MISSCMD_DESC
906     EC_T_SLAVE_PROP SlaveProp;          /*< slave properties */
907     EC_T_DWORD      dwCmdIndex;         /*< ethercat command/telegram index in ethernet frame that is missing */
908     EC_T_BOOL       bMasterCmd;         /*< EC_TRUE if it is a master command or EC_FALSE if it is a slave command */
909 } EC_PACKED(4) EC_T_MISSCMD_DESC;
911 /* EtherCAT Slave error status info descriptor */
912 typedef struct _EC_T_SLAVE_ERROR_INFO_DESC
914     EC_T_SLAVE_PROP SlaveProp;          /*< slave properties */
915     EC_T_WORD       wStatus;            /*< Slave Status (AL Status) */
916     EC_T_WORD       wStatusCode;        /*< Error status code (AL Control Status) */
917 } EC_PACKED(4) EC_T_SLAVE_ERROR_INFO_DESC;
919 /* Slaves error status descriptor */
920 #ifndef MAX_SLAVES_ERROR_NTFY_ENTRIES
921 #define MAX_SLAVES_ERROR_NTFY_ENTRIES 128
922 #endif
923 typedef struct _EC_T_SLAVES_ERROR_DESC_ENTRY
925     EC_T_WORD wStationAddress;
926     EC_T_WORD wStatus;                /*< Slave Status (AL Status) */
927     EC_T_WORD wStatusCode;            /*< Error status code (AL Control Status) */
928     EC_T_WORD wRes;
929 } EC_PACKED(4) EC_T_SLAVES_ERROR_DESC_ENTRY;
930 typedef struct _EC_T_SLAVES_ERROR_DESC
932     EC_T_WORD wCount;
933     EC_T_WORD wRes;
934     EC_T_SLAVES_ERROR_DESC_ENTRY SlaveError[MAX_SLAVES_ERROR_NTFY_ENTRIES];
935 } EC_PACKED(4) EC_T_SLAVES_ERROR_DESC;
937 /* EtherCAT Sdo abort */
938 typedef struct _EC_T_MBOX_SDO_ABORT_DESC
940     EC_T_SLAVE_PROP SlaveProp;          /*< slave properties */
941     EC_T_DWORD      dwErrorCode;        /*< error code EC_E_ */
942     EC_T_WORD       wObjIndex;          /*< SDO object index */
943     EC_T_BYTE       bySubIndex;         /*< SDO object sub index */
944 } EC_PACKED(4) EC_T_MBOX_SDO_ABORT_DESC;
946 /* EtherCAT FoE error */
947 typedef struct _EC_T_MBOX_FOE_ABORT_DESC
949     EC_T_SLAVE_PROP SlaveProp;          /*< slave properties */
950     EC_T_DWORD      dwErrorCode;        /*< error code EC_E_ */
951     EC_T_CHAR       achErrorString[MAX_STD_STRLEN];   /*< FoE error string */
952 } EC_PACKED(4) EC_T_MBOX_FOE_ABORT_DESC;
954 /* Invalid mailbox data received error */
955 typedef struct _EC_T_MBXRCV_INVALID_DATA_DESC
957     EC_T_SLAVE_PROP SlaveProp;          /*< slave properties */
958 } EC_PACKED(4) EC_T_MBXRCV_INVALID_DATA_DESC;
960 /* PDI Watchdog expired */
961 typedef struct _EC_T_PDIWATCHDOG_DESC
963     EC_T_SLAVE_PROP SlaveProp;          /*< slave properties */
964 } EC_PACKED(4) EC_T_PDIWATCHDOG_DESC;
966 /* Slave not supported */
967 typedef struct _EC_T_SLAVE_NOTSUPPORTED_DESC
969     EC_T_SLAVE_PROP SlaveProp;          /*< slave properties */
970 } EC_PACKED(4) EC_T_SLAVE_NOTSUPPORTED_DESC;
972 /* Slave in unexpected state descriptor */
973 typedef struct _EC_T_SLAVE_UNEXPECTED_STATE_DESC
975     EC_T_SLAVE_PROP SlaveProp;          /*< slave properties */
976     EC_T_STATE      curState;
977     EC_T_STATE      expState;
978 } EC_PACKED(4) EC_T_SLAVE_UNEXPECTED_STATE_DESC;
980 /* Slaves in unexpected state descriptor */ 
981 #ifndef MAX_SLAVES_UNEXPECTED_STATE_NTFY_ENTRIES
982 #define MAX_SLAVES_UNEXPECTED_STATE_NTFY_ENTRIES 128
983 #endif
984 typedef struct _EC_T_SLAVES_UNEXPECTED_STATE_DESC_ENTRY
986     EC_T_WORD  wStationAddress;
987     EC_T_STATE curState;
988     EC_T_STATE expState;
989 } EC_PACKED(4) EC_T_SLAVES_UNEXPECTED_STATE_DESC_ENTRY;
990 typedef struct _EC_T_SLAVES_UNEXPECTED_STATE_DESC
992     EC_T_WORD wCount;
993     EC_T_WORD wRes;
994     EC_T_SLAVES_UNEXPECTED_STATE_DESC_ENTRY SlaveStates[MAX_SLAVES_UNEXPECTED_STATE_NTFY_ENTRIES];
995 } EC_PACKED(4) EC_T_SLAVES_UNEXPECTED_STATE_DESC;
997 /* Slave EEPROM checksum error */
998 typedef struct _EC_T_EEPROM_CHECKSUM_ERROR_DESC
1000     EC_T_SLAVE_PROP SlaveProp;          /*< slave properties */
1001 } EC_PACKED(4) EC_T_EEPROM_CHECKSUM_ERROR_DESC;
1003 /* Redundancy break/fixed notification */
1004 typedef struct _EC_T_RED_CHANGE_DESC
1006     EC_T_WORD       wNumOfSlavesMain;    /*< Number of Slaves on Main Line */
1007     EC_T_WORD       wNumOfSlavesRed;     /*< Number of Slaves on Red Line  */
1008 } EC_PACKED(4) EC_T_RED_CHANGE_DESC;
1010 typedef struct _EC_T_JUNCTION_RED_CHANGE_DESC
1012     EC_T_SLAVE_PROP SlaveProp;          /*< slave properties of the slave with disconnected port 0 */
1013     EC_T_BOOL       bLineBreak;         /*< EC_TRUE for line break, EC_FALSE for line fixed */
1014 } EC_PACKED(4) EC_T_JUNCTION_RED_CHANGE_DESC;
1016 /* Distributed clocks (DC) Reference Clock Presence */
1017 typedef struct _EC_T_REFCLOCK_PRESENCE_NTFY_DESC
1019     EC_T_BOOL  bPresent;
1020     EC_T_SLAVE_PROP SlaveProp;          /*< slave properties if present */
1021 } EC_PACKED(4) EC_T_REFCLOCK_PRESENCE_NTFY_DESC;
1023 /* Distributed clocks (DC) */
1024 typedef struct _EC_T_DC_SYNC_NTFY_DESC
1026     EC_T_DWORD      IsInSync;           /*< EC_TRUE if all meant objects are in defined sync range, EC_FALSE otherwise */
1027     EC_T_DWORD      IsNegative;         /*< Deviation value is a negative value */
1028     EC_T_DWORD      dwDeviation;        /*< absolute deviation in nsecs (depending on notification nsec / wire or'ed value */
1029     EC_T_SLAVE_PROP SlaveProp;          /*< slave properties in case of "not in sync" */
1030 } EC_PACKED(4) EC_T_DC_SYNC_NTFY_DESC;
1032 /* Distributed clocks master sync (DCM) */
1033 typedef struct _EC_T_DCM_SYNC_NTFY_DESC
1035     EC_T_DWORD      IsInSync;           /*< EC_TRUE if time of master and reference clock are in sync */
1036     EC_T_INT        nCtlErrorNsecCur;   /*< current DCM controller error in nsec */
1037     EC_T_INT        nCtlErrorNsecAvg;   /*< average DCM controller error in nsec */
1038     EC_T_INT        nCtlErrorNsecMax;   /*< maximum DCM controller error in nsec */
1039 } EC_PACKED(4) EC_T_DCM_SYNC_NTFY_DESC;
1041 /* Slave state change descriptor */
1042 typedef struct _EC_T_SLAVE_STATECHANGED_NTFY_DESC
1044     EC_T_SLAVE_PROP SlaveProp;          /*< slave properties */
1045     EC_T_STATE      newState;           /*< new state */
1046 } EC_PACKED(4) EC_T_SLAVE_STATECHANGED_NTFY_DESC;
1048 #include EC_PACKED_INCLUDESTOP
1050 #include EC_PACKED_INCLUDESTART(2)
1051 /* Slaves state change descriptor */
1052 #ifndef MAX_SLAVES_STATECHANGED_NTFY_ENTRIES
1053 #define MAX_SLAVES_STATECHANGED_NTFY_ENTRIES 128
1054 #endif
1055 typedef struct _EC_T_SLAVES_STATECHANGED_NTFY_DESC_ENTRY
1057     EC_T_WORD  wStationAddress;
1058     EC_T_BYTE  byState;
1059 } EC_PACKED(2) EC_T_SLAVES_STATECHANGED_NTFY_DESC_ENTRY;
1061 typedef struct _EC_T_SLAVES_STATECHANGED_NTFY_DESC
1063     EC_T_WORD wCount;
1064     EC_T_SLAVES_STATECHANGED_NTFY_DESC_ENTRY SlaveStates[MAX_SLAVES_STATECHANGED_NTFY_ENTRIES];
1065 } EC_PACKED(2) EC_T_SLAVES_STATECHANGED_NTFY_DESC;
1066 #define SIZEOF_EC_T_SLAVES_STATECHANGED_NTFY_DESC(wCount) (sizeof(EC_T_WORD)+wCount*sizeof(EC_T_SLAVES_STATECHANGED_NTFY_DESC_ENTRY))
1067 #include EC_PACKED_INCLUDESTOP
1069 #include EC_PACKED_INCLUDESTART(4)
1071 typedef struct _EC_T_DC_BURSTCONFIG_REQ
1073     EC_T_DWORD  dwTotalBurstLength;
1074     EC_T_DWORD  dwBurstBulk;
1075 } EC_PACKED(4) EC_T_DC_BURSTCONFIG_REQ;
1077 typedef struct _EC_T_DC_SHIFTSYSTIME_DESC
1079     EC_T_DWORD      dwCyclesToShift;    /*< Amount of cycles to apply shift */
1080     EC_T_INT        nShiftTime;         /*< Shift Time in nsecs (signed) */
1081 } EC_PACKED(4) EC_T_DC_SHIFTSYSTIME_DESC;
1083 typedef  struct _EC_T_DC_STARTCYCSAFETY_DESC    /*< Start SYNC Cyc Safety in nsec (64Bit)*/
1085     EC_T_DWORD      dwStartCycSafetyLo;
1086     EC_T_DWORD      dwStartCycSafetyHi;
1087 }   EC_T_DC_STARTCYCSAFETY_DESC;
1088            
1089 typedef struct _EC_T_SB_STATUS_NTFY_DESC
1091     EC_T_DWORD      dwResultCode;       /*< Result of scanbus */
1092     EC_T_DWORD      dwSlaveCount;       /*< Number of slaves handles during scanbus */
1093 } EC_PACKED(4) EC_T_SB_STATUS_NTFY_DESC;
1095 typedef struct _EC_T_SB_MISMATCH_DESC
1097     /* Location of the mismatch */
1098     EC_T_WORD           wPrevFixedAddress;      /*< Previous fixed address */
1099     EC_T_WORD           wPrevPort;              /*< Previous port */
1100     EC_T_WORD           wPrevAIncAddress;       /*< Previous Auto-Inc address */
1102     /* Unexpected bus slave */
1103     EC_T_WORD           wBusAIncAddress;        /*< Bus Auto-Inc address */
1104     EC_T_DWORD          dwBusVendorId;          /*< Bus Vendor ID */
1105     EC_T_DWORD          dwBusProdCode;          /*< Bus Product code */
1106     EC_T_DWORD          dwBusRevisionNo;        /*< Bus Revision Number */
1107     EC_T_DWORD          dwBusSerialNo;          /*< Bus Serial Number */
1108     EC_T_WORD           wBusFixedAddress;       /*< Bus Station Address */
1109     EC_T_WORD           wIdentificationVal;     /*< Bus Last read identification value */
1111     /* Missing config slave */
1112     EC_T_WORD           wCfgFixedAddress;       /*< Config Station Address */
1113     EC_T_WORD           wCfgAIncAddress;        /*< Config Auto-Increment Address */
1114     EC_T_DWORD          dwCfgVendorId;          /*< Config Vendor ID */
1115     EC_T_DWORD          dwCfgProdCode;          /*< Config Product code */
1116     EC_T_DWORD          dwCfgRevisionNo;        /*< Config Revision Number */
1117     EC_T_DWORD          dwCfgSerialNo;          /*< Config Serial Number */
1119     /* Hot connect */
1120     EC_T_BOOL           bIdentValidationError;  /*< HotConnect Identification command validation error */
1121     EC_T_WORD           oIdentCmdHdr[5];        /*< HotConnect Identification command header (if bIdentValidationError) */
1122     EC_T_DWORD          dwCmdData;              /*< First DWORD of Data portion in identify command (received data) */
1123     EC_T_DWORD          dwCmdVMask;             /*< First DWORD of Validation mask in identify command */
1124     EC_T_DWORD          dwCmdVData;             /*< First DWORD of Validation data in identify command (expected data) */
1125 } EC_PACKED(4) EC_T_SB_MISMATCH_DESC;
1127 typedef struct _EC_T_LINE_CROSSED_DESC
1129     EC_T_SLAVE_PROP     SlaveProp;       /*< slave properties */
1130     EC_T_WORD           wInputPort;      /*< port where frame was received */
1131 } EC_PACKED(4) EC_T_LINE_CROSSED_DESC;
1133 typedef struct _EC_T_HC_DETECTALLGROUP_NTFY_DESC
1135     EC_T_DWORD  dwResultCode;       /*< Result of Group detection */
1136     EC_T_DWORD  dwGroupCount;       /*< Number of Groups */
1137     EC_T_DWORD  dwGroupsPresent;    /*< Number of connected groups */
1138     EC_T_DWORD  dwGroupMask;        /*< Bitmask of first 32   Groups 1 = present, 0 = absent */
1139     EC_T_DWORD  adwGroupMask[100];  /*< Bitmask of first 3200 Groups */
1140 } EC_PACKED(4) EC_T_HC_DETECTALLGROUP_NTFY_DESC;
1142 typedef struct _EC_T_RAWCMDRESPONSE_NTFY_DESC
1144     EC_T_DWORD  dwInvokeId;
1145     EC_T_DWORD  dwResult;
1146     EC_T_DWORD  dwWkc;
1147     EC_T_DWORD  dwCmdIdx;
1148     EC_T_DWORD  dwAddr;
1149     EC_T_DWORD  dwLength;
1150     EC_T_BYTE*  pbyData;
1151 } EC_PACKED(4) EC_T_RAWCMDRESPONSE_NTFY_DESC;
1152                                                    
1153 #ifdef INCLUDE_COE_PDO_SUPPORT
1154 typedef struct _EC_T_TX_PDO_NTFY_DESC
1156     EC_T_DWORD  wPhysAddr;          /* station address */
1157     EC_T_DWORD  dwNumber;           /* PDO number */
1158     EC_T_DWORD  wLen;               /* PDO size */
1159     EC_T_BYTE*  pbyData;
1160 } EC_PACKED(4) EC_T_TX_PDO_NTFY_DESC;
1161 #endif
1163 typedef struct _EC_T_SLAVE_LINKMSG_DESC
1165     EC_T_DWORD  dwSlaveId;          /* Slave Id */
1166     EC_T_BOOL   bEnableLogging;     /* EC_TRUE=> Enable LinkMsgs, EC_FALSE=> Disable */
1167 } EC_PACKED(4) EC_T_SLAVE_LINKMSG_DESC;
1168                                       
1170 /* EtherCAT state change */                         
1171 typedef struct _EC_T_STATECHANGE                    
1172 {                                                   
1173     EC_T_STATE    oldState;                         /*< old state */
1174     EC_T_STATE    newState;                         /*< new state */
1175 } EC_PACKED(4) EC_T_STATECHANGE;                                 
1177 typedef struct _EC_T_HC_SLAVE_CHANGE_DESC
1179     EC_T_SLAVE_PROP     SlaveProp;
1180 } EC_PACKED(4) EC_T_HC_SLAVE_CHANGE_DESC;
1182 #include EC_PACKED_INCLUDESTOP
1184 #include EC_PACKED_INCLUDESTART(2)
1185 /* Slaves presence descriptor */
1186 #ifndef MAX_SLAVES_PRESENCE_NTFY_ENTRIES
1187 #define MAX_SLAVES_PRESENCE_NTFY_ENTRIES 128
1188 #endif
1189 typedef struct _EC_T_SLAVE_PRESENCE_NTFY_DESC
1191     EC_T_WORD  wStationAddress;
1192     EC_T_BYTE  bPresent;
1193 } EC_PACKED(2) EC_T_SLAVE_PRESENCE_NTFY_DESC;
1194 typedef struct _EC_T_SLAVES_PRESENCE_NTFY_DESC
1196     EC_T_WORD wCount;
1197     EC_T_SLAVE_PRESENCE_NTFY_DESC SlavePresence[MAX_SLAVES_PRESENCE_NTFY_ENTRIES];
1198 } EC_PACKED(2) EC_T_SLAVES_PRESENCE_NTFY_DESC;
1199 #define SIZEOF_EC_T_SLAVES_PRESENCE_NTFY_DESC(wCount) (sizeof(EC_T_WORD)+wCount*sizeof(EC_T_SLAVE_PRESENCE_NTFY_DESC))
1200 #include EC_PACKED_INCLUDESTOP
1202 #include EC_PACKED_INCLUDESTART(4)
1204 /* EtherCAT notification descriptor */
1205 typedef struct _EC_T_NOTIFICATION_DESC
1207     union _EC_T_NOTIFICATION_PARM
1208     {                
1209         EC_T_DWORD                          StatusCode;             /* Generic status code only notification */
1210         EC_T_REFCLOCK_PRESENCE_NTFY_DESC    RefClockPresenceNtfyDesc; /* DC Reference Clock Presence Notification descriptor */
1211         EC_T_DC_SYNC_NTFY_DESC              SyncNtfyDesc;           /* DC Master / Slave Sync Notification descriptor */
1212         EC_T_RAWCMDRESPONSE_NTFY_DESC       RawCmdRespNtfyDesc;     /* Queue Raw Cmd Response notification descriptor */
1213         EC_T_SB_STATUS_NTFY_DESC            ScanBusNtfyDesc;        /* Scanbus Result notification descriptor */
1214         EC_T_SB_MISMATCH_DESC               ScanBusMismatch;        /* Scan Bus Mismatch notification descriptor */
1215         EC_T_STATECHANGE                    StatusChngNtfyDesc;     /* Master EtherCAT State changed notification */
1216 #ifdef INCLUDE_COE_PDO_SUPPORT
1217         EC_T_TX_PDO_NTFY_DESC               TxPdoNtfyDesc;          /* TxPDO transfer notification */
1218 #endif
1219 #if (defined INCLUDE_HOTCONNECT)
1220         EC_T_HC_DETECTALLGROUP_NTFY_DESC    HCDetAllGrps;           /* HC Group Detection */
1221         EC_T_HC_SLAVE_CHANGE_DESC           HCSlvChgDesc;           /* HotConnect Slave State Change. Obsolete, see SlavePresenceDesc. */
1222 #endif
1223         EC_T_SLAVE_PRESENCE_NTFY_DESC       SlavePresenceDesc;      /* Slave (dis-)appeared */
1224         EC_T_SLAVES_PRESENCE_NTFY_DESC      SlavesPresenceDesc;     /* Slaves (dis-)appeared */
1225         EC_T_LINE_CROSSED_DESC              CrossedLineDesc;        /* Line crossed */
1226         EC_T_DCM_SYNC_NTFY_DESC             DcmInSyncDesc;
1227         EC_T_SLAVE_STATECHANGED_NTFY_DESC   SlaveStateChangedDesc;  /* Slave finished successfully state transition descriptor */
1228         EC_T_SLAVES_STATECHANGED_NTFY_DESC  SlavesStateChangedDesc; /* Slaves finished successfully state transition descriptor */
1229     } EC_PACKED(4) desc;
1230 } EC_PACKED(4) EC_T_NOTIFICATION_DESC;
1232 /* EtherCAT error notification descriptor */
1233 typedef struct _EC_T_ERROR_NOTIFICATION_DESC
1235     EC_T_DWORD  dwNotifyErrorCode;                  /* notification code */
1236     EC_T_CHAR   achErrorInfo[MAX_ERRINFO_STRLEN];   /* additional error information string (NULL terminated) */
1237     union _EC_T_ERROR_NOTIFICATION_PARM
1238     {
1239         EC_T_WKCERR_DESC                        WkcErrDesc;                 /* WKC error descriptor */
1240         EC_T_FRAME_RSPERR_DESC                  FrameRspErrDesc;            /* Frame response error descriptor */
1241         EC_T_INITCMD_ERR_DESC                   InitCmdErrDesc;             /* Master/Slave init command error descriptor */
1242         EC_T_MISSCMD_DESC                       MissCmdDesc;                /* EtherCAT missing command descriptor */
1243         EC_T_SLAVE_ERROR_INFO_DESC              SlaveErrInfoDesc;           /* Slave Error Info Descriptor */
1244         EC_T_SLAVES_ERROR_DESC                  SlavesErrDesc;              /* Slaves Error Descriptor */
1245         EC_T_MBOX_SDO_ABORT_DESC                SdoAbortDesc;               /* SDO Abort */
1246         EC_T_RED_CHANGE_DESC                    RedChangeDesc;              /* Redundancy Descriptor */
1247         EC_T_MBOX_FOE_ABORT_DESC                FoeErrorDesc;               /* FoE error code and string */
1248         EC_T_MBXRCV_INVALID_DATA_DESC           MbxRcvInvalidDataDesc;      /* Invalid mailbox data received descriptor */
1249         EC_T_PDIWATCHDOG_DESC                   PdiWatchdogDesc;            /* PDI Watchodg expired */
1250         EC_T_SLAVE_NOTSUPPORTED_DESC            SlaveNotSupportedDesc;      /* Slave not supported */
1251         EC_T_SLAVE_UNEXPECTED_STATE_DESC        SlaveUnexpectedStateDesc;   /* Slave in unexpected state */
1252         EC_T_SLAVES_UNEXPECTED_STATE_DESC       SlavesUnexpectedStateDesc;  /* Slaves in unexpected state */
1253         EC_T_EEPROM_CHECKSUM_ERROR_DESC         EEPROMChecksumErrorDesc;    /* EEPROM checksum error */
1254         EC_T_JUNCTION_RED_CHANGE_DESC           JunctionRedChangeDesc;      /* Junction redundancy change descriptor */
1255     } EC_PACKED(4) desc;
1256 } EC_PACKED(4) EC_T_ERROR_NOTIFICATION_DESC;
1258 #define SIZEOF_EC_T_ERROR_NOTIFICATION_HEADER (sizeof(EC_T_DWORD)/*dwNotifyErrorCode*/+8/*achErrorInfo*/)
1260 #define SIZEOF_EC_T_ERROR_NOTIFICATION_WKCERR                       (SIZEOF_EC_T_ERROR_NOTIFICATION_HEADER+sizeof(EC_T_WKCERR_DESC))
1261 #define SIZEOF_EC_T_ERROR_NOTIFICATION_FRAME_RSPERR                 (SIZEOF_EC_T_ERROR_NOTIFICATION_HEADER+sizeof(EC_T_FRAME_RSPERR_DESC))
1262 #define SIZEOF_EC_T_ERROR_NOTIFICATION_SLAVE_INITCMD_RESPONSE_ERROR (SIZEOF_EC_T_ERROR_NOTIFICATION_HEADER+sizeof(EC_T_INITCMD_ERR_DESC))
1263 #define SIZEOF_EC_T_ERROR_NOTIFICATION_MISSCMD                      (SIZEOF_EC_T_ERROR_NOTIFICATION_HEADER+sizeof(EC_T_MISSCMD_DESC))
1264 #define SIZEOF_EC_T_ERROR_NOTIFICATION_SLAVE_ERROR_INFO             (SIZEOF_EC_T_ERROR_NOTIFICATION_HEADER+sizeof(EC_T_SLAVE_ERROR_INFO_DESC))
1265 #define SIZEOF_EC_T_ERROR_NOTIFICATION_MBOX_SDO_ABORT               (SIZEOF_EC_T_ERROR_NOTIFICATION_HEADER+sizeof(EC_T_MBOX_SDO_ABORT_DESC))
1266 #define SIZEOF_EC_T_ERROR_NOTIFICATION_RED_CHANGE                   (SIZEOF_EC_T_ERROR_NOTIFICATION_HEADER+sizeof(EC_T_RED_CHANGE_DESC))
1267 #define SIZEOF_EC_T_ERROR_NOTIFICATION_MBOX_FOE_ABORT               (SIZEOF_EC_T_ERROR_NOTIFICATION_HEADER+sizeof(EC_T_MBOX_FOE_ABORT_DESC))
1268 #define SIZEOF_EC_T_ERROR_NOTIFICATION_MBXRCV_INVALID_DATA          (SIZEOF_EC_T_ERROR_NOTIFICATION_HEADER+sizeof(EC_T_MBXRCV_INVALID_DATA_DESC))
1269 #define SIZEOF_EC_T_ERROR_NOTIFICATION_PDIWATCHDOG                  (SIZEOF_EC_T_ERROR_NOTIFICATION_HEADER+sizeof(EC_T_PDIWATCHDOG_DESC))
1270 #define SIZEOF_EC_T_ERROR_NOTIFICATION_SLAVE_NOTSUPPORTED           (SIZEOF_EC_T_ERROR_NOTIFICATION_HEADER+sizeof(EC_T_SLAVE_NOTSUPPORTED_DESC))
1271 #define SIZEOF_EC_T_ERROR_NOTIFICATION_SLAVE_UNEXPECTED_STATE       (SIZEOF_EC_T_ERROR_NOTIFICATION_HEADER+sizeof(EC_T_SLAVE_UNEXPECTED_STATE_DESC))
1272 #define SIZEOF_EC_T_ERROR_NOTIFICATION_EEPROM_CHECKSUM_ERROR        (SIZEOF_EC_T_ERROR_NOTIFICATION_HEADER+sizeof(EC_T_EEPROM_CHECKSUM_ERROR_DESC))
1273 #define SIZEOF_EC_T_ERROR_NOTIFICATION_JUNCTION_RED_CHANGE          (SIZEOF_EC_T_ERROR_NOTIFICATION_HEADER+sizeof(EC_T_JUNCTION_RED_CHANGE_DESC))
1276 #define SIZEOF_EC_T_ERROR_NOTIFICATION_SLAVES_UNEXPECTED_STATE_DESC(wCount) \
1277     (SIZEOF_EC_T_ERROR_NOTIFICATION_HEADER+sizeof(EC_T_WORD)/*wCount*/+sizeof(EC_T_WORD)/*wRes*/+wCount*sizeof(EC_T_SLAVES_UNEXPECTED_STATE_DESC_ENTRY))
1279 #define SIZEOF_EC_T_ERROR_NOTIFICATION_SLAVES_ERROR_DESC(wCount) \
1280     (SIZEOF_EC_T_ERROR_NOTIFICATION_HEADER+sizeof(EC_T_WORD)/*wCount*/+sizeof(EC_T_WORD)/*wRes*/+wCount*sizeof(EC_T_SLAVES_ERROR_DESC_ENTRY))
1282 typedef enum _EC_T_CNF_TYPE
1284     eCnfType_Unknown            = 0,
1285     eCnfType_Filename           = 1,
1286     eCnfType_Data               = 2,
1287     eCnfType_Datadiag           = 3,                /* only for diagnosis. ENI data is not stored */
1288     eCnfType_GenPreopENI        = 4,                /* generate mini ENI based on bus-scan result to get into preop state */
1289     eCnfType_GenPreopENIWithCRC = 5,                /* same as eCnfType_GenPreopENI, but also generates CRC */
1290     eCnfType_GenOpENI           = 6,                /* generate ENI based on bus-scan result to get into op state */
1291     eCnfType_None               = 7,                /* no configuration used */
1292     eCnfType_ConfigData         = 8,
1294     /* Borland C++ datatype alignment correction */
1295     eCnfType_BCppDummy   = 0xFFFFFFFF
1296 } EC_T_CNF_TYPE;
1298 typedef EC_T_VOID (*EC_T_PFMEMREQ)(EC_T_PVOID pvContext, EC_T_PBYTE* ppbyPDData);
1299 typedef EC_T_VOID (*EC_T_PFMEMREL)(EC_T_PVOID pvContext);
1301 /* Descriptor for EC_IOCTL_REGISTER_PDMEMORYPROVIDER */
1302 typedef struct _EC_T_MEMPROV_DESC
1304     EC_T_PVOID      pvContext;                      /* Context pointer. This pointer is used each time one of
1305                                                      * the callback functions is called. 
1306                                                      */
1307     EC_T_BOOL       bUseMasterShadowInUserSyncNowaitMode;
1308                                                     /* This flag determines whether the master shall use an 
1309                                                      * internally allocated shadow memory where new input 
1310                                                      * process data will be stored when received from 
1311                                                      * the link layer. Only valid in 
1312                                                      * eSyncMode_USER_SYNC_NOWAIT.
1313                                                      */
1314     EC_T_PBYTE      pbyPDOutData;                   /* Pointer to the default output process data buffer */
1315     EC_T_DWORD      dwPDOutDataLength;              /* Length of the output process data buffer */
1317     EC_T_PBYTE      pbyPDInData;                    /* Pointer to the default input process data buffer */
1318     EC_T_DWORD      dwPDInDataLength;               /* Length of the input  process data buffer */
1320 #ifdef INCLUDE_MEMORY_PROVIDER
1321     EC_T_PFMEMREQ   pfPDOutDataReadRequest;         /* This function will be called by the master within the 
1322                                                      * process data transfer cycle prior to read data.
1323                                                      */
1324     EC_T_PFMEMREL   pfPDOutDataReadRelease;         /* This function will be called after all data was read 
1325                                                      * from output process data buffer.
1326                                                      */
1328     EC_T_PFMEMREQ   pfPDInDataWriteRequest;         /* This function will be called by the master within the 
1329                                                      * process data transfer cycle prior to write data.
1330                                                      */
1331     EC_T_PFMEMREL   pfPDInDataWriteRelease;         /* This function will be called after all data was written
1332                                                      * to input process data buffer.
1333                                                      */
1334 #endif
1335 } EC_PACKED(4) EC_T_MEMPROV_DESC, *EC_PT_MEMPROV_DESC;
1337 typedef struct _EC_T_SB_SLAVEINFO_DESC
1339     EC_T_DWORD  dwScanBusStatus;                    /* Status during last Bus Scan */
1340     
1341     EC_T_DWORD  dwVendorId;                         /* Vendor Identification */
1342     EC_T_DWORD  dwProductCode;                      /* Product Code */
1343     EC_T_DWORD  dwRevisionNumber;                   /* Revision Number */
1344     EC_T_DWORD  dwSerialNumber;                     /* Serial Number */
1345 } EC_PACKED(4) EC_T_SB_SLAVEINFO_DESC, *EC_PT_SB_SLAVEINFO_DESC;
1347 typedef enum _EC_T_eEEPENTRY
1349     eEEP_VendorId               = ESC_SII_REG_VENDORID,
1350     eEEP_ProductCode        = ESC_SII_REG_PRODUCTCODE,
1351     eEEP_RevisionNumber     = ESC_SII_REG_REVISIONNUMBER,
1352     eEEP_SerialNumber       = ESC_SII_REG_SERIALNUMBER,
1353     eEEP_BootRcvMbx         = ESC_SII_REG_BOOT_RECV_MBX_OFFSET,
1354     eEEP_BootSndMbx         = ESC_SII_REG_BOOT_SEND_MBX_OFFSET,
1355     eEEP_StdRcvMbx          = ESC_SII_REG_STD_RECV_MBX_OFFSET,
1356     eEEP_StdSndMbx          = ESC_SII_REG_STD_SEND_MBX_OFFSET,
1357     eEEP_MbxProtocol        = ESC_SII_REG_MBX_PROTOCOL,
1358     eEEP_AliasAddress       = ESC_SII_REG_ALIASADDRESS,
1360     /* Borland C++ datatype alignment correction */
1361     eEEP_BCppDummy          = 0xFFFFFFFF
1362 } EC_T_eEEPENTRY;
1364 #define BT_CHECK_EEPENTRY_VENDORID      EC_TRUE
1365 #define BT_CHECK_EEPENTRY_PRODUCTCODE   EC_TRUE
1366 #define BT_CHECK_EEPENTRY_REVISIONNO    EC_TRUE
1367 #define BT_CHECK_EEPENTRY_SERIALNO      EC_TRUE
1369 typedef struct _EC_T_SCANBUS_PROP_DESC
1371     EC_T_eEEPENTRY  eEEPROMEntry;
1372     EC_T_DWORD      dwVerify;
1373 } EC_PACKED(4) EC_T_SCANBUS_PROP_DESC, *EC_PT_SCANBUS_PROP_DESC;
1375 typedef enum _EC_T_eSBSlaveInfoType
1377     sbsit_unknown           = 0,
1378     sbsit_bustopology   = 1,
1379     sbsit_configuration = 2,
1381     /* Borland C++ datatype alignment correction */
1382     sbsit_BCppDummy     = 0xFFFFFFFF
1383 } EC_T_eSBSlaveInfoType;
1385 typedef struct _EC_T_SB_SLAVEINFO_EEP_REQ_DESC
1387     EC_T_eSBSlaveInfoType       eSbSlaveInfoType;
1388     EC_T_DWORD                  wAutoIncAddress;
1389     EC_T_eEEPENTRY              eEEPROMEntry;
1390 } EC_T_SB_SLAVEINFO_EEP_REQ_DESC;
1392 typedef struct _EC_T_SB_SLAVEINFO_EEP_RES_DESC
1394     EC_T_DWORD                  dwScanBusStatus;
1395     EC_T_eEEPENTRY              eEEPROMEntry;
1396     EC_T_DWORD                  dwEEPROMValue;
1397 } EC_PACKED(4) EC_T_SB_SLAVEINFO_EEP_RES_DESC;
1399 typedef enum _EC_T_eINFOENTRY
1401     eie_unknown         =  0,       /** nothing / invalid */
1402     eie_pdoffs_in       =  1,       /** get process data offset of Input data (in Bits) */
1403     eie_pdsize_in       =  2,       /** get process data size of Input Data (in Bits) */
1404     eie_pdoffs_out      =  3,       /** get process data offset of Output data (in Bits) */
1405     eie_pdsize_out      =  4,       /** get process data size of Output Data (in Bits) */
1406     eie_phys_address    =  5,       /** get slave phys Address */
1407     eie_portstate       =  6,       /** get port link state (SB Instance) */
1408     eie_dcsupport       =  7,       /** slave does support DC */
1409     eie_dc64support     =  8,       /** slave does support 64Bit DC */
1410     eie_alias_address   =  9,       /** get slave alias address */
1411     eie_cfgphy_address  = 10,       /** get slave configured phys address */
1412     eie_device_name     = 11,       /** get slave name from configuration */
1413     eie_ismailbox_slave = 12,       /** get whether slave support mailboxes */
1414     eie_pdoffs_in2      = 21,       /** get process data offset of Input data (in Bits) */
1415     eie_pdsize_in2      = 22,       /** get process data size of Input Data (in Bits) */
1416     eie_pdoffs_out2     = 23,       /** get process data offset of Output data (in Bits) */
1417     eie_pdsize_out2     = 24,       /** get process data size of Output Data (in Bits) */
1418     eie_pdoffs_in3      = 31,       /** get process data offset of Input data (in Bits) */
1419     eie_pdsize_in3      = 32,       /** get process data size of Input Data (in Bits) */
1420     eie_pdoffs_out3     = 33,       /** get process data offset of Output data (in Bits) */
1421     eie_pdsize_out3     = 34,       /** get process data size of Output Data (in Bits) */
1422     eie_pdoffs_in4      = 41,       /** get process data offset of Input data (in Bits) */
1423     eie_pdsize_in4      = 42,       /** get process data size of Input Data (in Bits) */
1424     eie_pdoffs_out4     = 43,       /** get process data offset of Output data (in Bits) */
1425     eie_pdsize_out4     = 44,       /** get process data size of Output Data (in Bits) */
1426     
1427     eie_mbx_outsize     = 45,       /** get out mailbox 1 size */
1428     eie_mbx_insize      = 46,       /** get in mailbox 1 size */
1429     eie_mbx_outsize2    = 47,       /** get out mailbox 2 size */
1430     eie_mbx_insize2     = 48,       /** get in mailbox 2 size */
1432     eie_isoptional      = 49,       /** is slave optional */
1433     eie_ispresent       = 50,       /** is slave present on bus */
1435     eie_esctype         = 51,       /** Type of ESC controller */
1436     /* Borland C++ datatype alignment correction */
1437     eie_BCppDummy       = 0xFFFFFFFF
1438 } EC_T_eINFOENTRY;
1440 typedef struct _EC_T_SB_SLAVEINFO_REQ_DESC
1442     EC_T_eINFOENTRY eInfoEntry;
1443     EC_T_WORD       wAutoIncAddress;
1444 } EC_PACKED(4) EC_T_SB_SLAVEINFO_REQ_DESC;
1446 typedef struct _EC_T_SB_SLAVEINFO_RES_DESC
1448     EC_T_eINFOENTRY eInfoEntry;
1449     EC_T_DWORD      dwInfoLength;
1450     EC_T_PBYTE      pbyInfo;
1451 } EC_PACKED(4) EC_T_SB_SLAVEINFO_RES_DESC;
1453 typedef struct _EC_T_DCL_ENABLE_DESC
1455     EC_T_DWORD  dwVerifySyncLatchConfiguration;
1456     EC_T_DWORD  dwDCLInitTimeout;
1457 } EC_PACKED(4) EC_T_DCL_ENABLE_DESC;
1460 /* descriptor for EC_IOCTL_GET_CYCLIC_CONFIG_INFO call */
1461 typedef struct _EC_T_CYC_CONFIG_DESC
1463     EC_T_DWORD      dwNumCycEntries;    /* total number of cyclic entries */
1464     EC_T_DWORD      dwTaskId;           /* task id of selected cyclic entry */
1465     EC_T_DWORD      dwPriority;         /* priority of selected cyclic entry */
1466     EC_T_DWORD      dwCycleTime;        /* cycle time of selected cyclic entry */
1467 } EC_PACKED(4) EC_T_CYC_CONFIG_DESC;
1469 typedef EC_T_DWORD (*EC_PF_TIMESTAMP)(              EC_T_PVOID      pCallerData,
1470                                                     EC_T_DWORD*     pdwHostTimeLo   );
1471                                                     
1472 /* Structure carrying instantaneous values for Master Sync */
1473 typedef struct _EC_T_ACTUALVAL
1475     EC_T_DWORD  dwBeginUpdateCnt;               /*< out call counter incremented each time structure
1476                                                  *      update is started */
1477     EC_T_DWORD  dwEndUpdateCnt;                 /*< out call counter incremented each time structure
1478                                                  *      update is finished */
1479     EC_T_DWORD  dwBusSyncFrameSendTimeLo;       /*< out Host stamped time (result from pfTimeStamp) LSDW */
1480     EC_T_DWORD  dwBusTimeHi;                    /*< out Bus time (result from ARMW) MSDW */
1481     EC_T_DWORD  dwBusTimeLo;                    /*< out Bus time (result from ARMW) LSDW */
1482     EC_T_DWORD  dwBusSyncFramePostSendTimeLo;   /*< out Host stamped time (result from pfTimeStamp) LSDW */
1483     EC_T_DWORD  dwSyncPulseGridOffsetHi;        /*< out Sync Pulse Offset (initial grid offset) */
1484     EC_T_DWORD  dwSyncPulseGridOffsetLo;        /*< out Sync Pulse Offset (initial grid offset) */
1485     EC_T_BOOL   bDcmCtlInSync;                  /*< in  DCM controller has synchronized with DC ref.clock */
1486     EC_T_DWORD  dwSyncPeriodLength;             /*< out bus cycle time in nsec */
1487     EC_T_DWORD  dwRes;                          /*< out reserved */
1488     EC_T_DWORD  dwLastTimeStampResult;          /*< out Last result of call to registered callback 
1489                                                  *      function EC_PF_TIMESTAMP */
1490     EC_T_BOOL   bSlavesInSync;                  /*< out Slaves are in sync = EC_TRUE; out of sync = EC_FALSE; */
1491     EC_T_BOOL   bResetRequest;                  /*< out If EC_TRUE, master request DCM controller reset (e.g. if reference clock disappears) */
1492 } EC_PACKED(4) EC_T_ACTUALVAL;
1494 /* Controller client register parameters */
1495 typedef struct _EC_T_REGISTER_TSPARMS
1497     EC_T_VOID*  pCallerData;                    /*< in  used by all callback functions */  
1498     EC_PF_TIMESTAMP     pfTimeStamp;                /*< in  timestamp callback function pointer */
1499     EC_T_DWORD  dwUpdateMultiplier;             /*< in  Interval multiplier */
1500     EC_T_DWORD  dwEnableHardRealtime;           /*< in  enable hard real time in link layer */
1501     EC_T_DWORD  aReserved[10];                  /*< in  reserved for future use */
1502 } EC_PACKED(4) EC_T_REGISTER_TSPARMS;
1504 /* Controller client register result */
1505 typedef struct _EC_T_REGISTER_TSRESULTS
1507     EC_T_DWORD          dwHardRealtimeEnabled;  /*< out Hard real time is used */
1508     EC_T_ACTUALVAL*     pActualValues;          /*< out pointer to data carrying current data */
1509 } EC_PACKED(4) EC_T_REGISTER_TSRESULTS;
1511 typedef struct _EC_T_SLVSTATISTICS_DESC
1513     EC_T_WORD       wRxErrorCounter[ESC_PORT_COUNT];     /*< out RX Error Counters per Slave Port */
1514     EC_T_BYTE       byFwdRxErrorCounter[ESC_PORT_COUNT]; /*< out Forwarded RX Error Counters per Slave Port */
1515     EC_T_BYTE       byEcatProcUnitErrorCounter;         /*< out EtherCAT Processing unit error counter */
1516     EC_T_BYTE       byPDIErrorCounter;                  /*< out PDI Error counter */
1517     EC_T_WORD       wAlStatusCode;                      /*< out AL status code    */
1518     EC_T_BYTE       byLostLinkCounter[ESC_PORT_COUNT];   /*< out Lost Link Counter per Slave Port */
1519 } EC_PACKED(4) EC_T_SLVSTATISTICS_DESC;
1521 typedef struct _EC_T_SLAVE_PORT_DESC
1523     EC_T_WORD       wSlaveAddress;
1524     EC_T_WORD       wPortNumber;
1525 } EC_PACKED(4) EC_T_SLAVE_PORT_DESC;
1527 typedef enum _EC_T_EHOTCONNECTMODE
1529     echm_unknown        = 0x0000,
1530     echm_manual         = 0x0001,
1531     echm_automatic      = 0x0002,
1532     echm_fullmanual     = 0x0004,
1533     echm_borderclose    = 0x0010,
1535     echm_BCppDummy =   0xFFFFFFFF
1536 } EC_T_EHOTCONNECTMODE;
1537 #define echm_automan_mask (0x000f)
1539 /* textual description of HotConnect Mode */
1540 #define HotConnectModeText(eMode)                   \
1541     ((eMode)==echm_unknown?"unknown":               \
1542      ((eMode)==echm_manual?"manual":                \
1543       ((eMode)==echm_automatic?"automatic":         \
1544        ((eMode)==echm_fullmanual?"fullmanual":      \
1545         ((eMode)==echm_borderclose?"borderclose":   \
1546           "INVALID EC_T_EHOTCONNECTMODE")))))
1548 /* callback pointer for RX frame */ 
1549 typedef EC_T_VOID (*EC_T_PF_RXFRAME_CB)(EC_T_VOID*);
1551 /* ecatGetCfgSlaveInfo */
1552 typedef struct _EC_T_CFG_SLAVE_INFO
1554     EC_T_DWORD                  dwSlaveId;              /*< out Slave ID */
1555     EC_T_CHAR                   abyDeviceName[ECAT_DEVICE_NAMESIZE]; /*< out Slave name */
1556     EC_T_DWORD                  dwHCGroupIdx;           /*< out Index of the hot connect group, 0 for mandatory */
1557     EC_T_BOOL                   bIsPresent;             /*< out Slave is currently present on bus */
1558     EC_T_BOOL                   bIsHCGroupPresent;      /*< out Slave the hot connect group of the slave is present */
1560     EC_T_DWORD                  dwVendorId;             /*< out Vendor identification */
1561     EC_T_DWORD                  dwProductCode;          /*< out Product code */
1562     EC_T_DWORD                  dwRevisionNumber;       /*< out Revision number */
1563     EC_T_DWORD                  dwSerialNumber;         /*< out Serial number */
1565     EC_T_WORD                   wStationAddress;        /*< out Station address */
1566     EC_T_WORD                   wAutoIncAddress;        /*< out Auto increment address */
1568     EC_T_DWORD                  dwPdOffsIn;             /*< out Process data offset of input data (ENI: ProcessData/Recv[1]/BitStart) */
1569     EC_T_DWORD                  dwPdSizeIn;             /*< out Process data size of input data (ENI: ProcessData/Recv[1]/BitLength) */
1570     EC_T_DWORD                  dwPdOffsOut;            /*< out Process data offset of output data (ENI: ProcessData/Send[1]/BitStart) */
1571     EC_T_DWORD                  dwPdSizeOut;            /*< out Process data size of output data (ENI: ProcessData/Send[1]/BitLength) */
1572     EC_T_DWORD                  dwPdOffsIn2;            /*< out Process data offset of input data (ENI: ProcessData/Recv[2]/BitStart) */
1573     EC_T_DWORD                  dwPdSizeIn2;            /*< out Process data size of input data (ENI: ProcessData/Recv[2]/BitLength) */
1574     EC_T_DWORD                  dwPdOffsOut2;           /*< out Process data offset of output data (ENI: ProcessData/Send[2]/BitStart) */
1575     EC_T_DWORD                  dwPdSizeOut2;           /*< out Process data size of output data (ENI: ProcessData/Send[2]/BitLength) */
1576     EC_T_DWORD                  dwPdOffsIn3;            /*< out Process data offset of input data (ENI: ProcessData/Recv[3]/BitStart) */
1577     EC_T_DWORD                  dwPdSizeIn3;            /*< out Process data size of input data (ENI: ProcessData/Recv[3]/BitLength) */
1578     EC_T_DWORD                  dwPdOffsOut3;           /*< out Process data offset of output data (ENI: ProcessData/Send[3]/BitStart) */
1579     EC_T_DWORD                  dwPdSizeOut3;           /*< out Process data size of output data (ENI: ProcessData/Send[3]/BitLength) */
1580     EC_T_DWORD                  dwPdOffsIn4;            /*< out Process data offset of input data (ENI: ProcessData/Recv[4]/BitStart) */
1581     EC_T_DWORD                  dwPdSizeIn4;            /*< out Process data size of input data (ENI: ProcessData/Recv[4]/BitLength) */
1582     EC_T_DWORD                  dwPdOffsOut4;           /*< out Process data offset of output data (ENI: ProcessData/Send[4]/BitStart) */
1583     EC_T_DWORD                  dwPdSizeOut4;           /*< out Process data size of output data (ENI: ProcessData/Send[4]/BitLength) */
1585     EC_T_DWORD                  dwMbxSupportedProtocols;/*< out Supported mailbox protocols */
1586     EC_T_DWORD                  dwMbxOutSize;           /*< out Mailbox 1 output size (ENI: Mailbox/Send) */
1587     EC_T_DWORD                  dwMbxInSize;            /*< out Mailbox 1 input size (ENI: Mailbox/Recv) */
1588     EC_T_DWORD                  dwMbxOutSize2;          /*< out Mailbox 2 output size (ENI: Mailbox/Bootstrap/Send) */
1589     EC_T_DWORD                  dwMbxInSize2;           /*< out Mailbox 2 input size (ENI: Mailbox/Bootstrap/Recv) */
1591     EC_T_BOOL                   bDcSupport;             /*< out Slave supports DC */
1593     EC_T_WORD                   wNumProcessVarsInp;     /*< out Number of output process data variables*/
1594     EC_T_WORD                   wNumProcessVarsOutp;    /*< out Number of input process data variables */
1596     EC_T_WORD                   wPrevStationAddress;    /*< Station address of the previous slave */
1597     EC_T_WORD                   wPrevPort;              /*< Connected port of the previous slave */
1599     EC_T_WORD                   wIdentifyAdo;           /*< out ADO used for identification command */
1600     EC_T_WORD                   wIdentifyData;          /*< out Identification value to be validated */
1601     EC_T_BYTE                   byPortDescriptor;       /*< out Port descriptor (ESC register  0x0007) */
1603     EC_T_BYTE                   abyReserved[3];
1604     EC_T_WORD                   wWkcStateDiagOffsIn[EC_CFG_SLAVE_PD_SECTIONS]; /*< out Offset of WkcState bit in diagnosis image (ENI: ProcessData/Recv[1..4]/BitStart) */
1605     EC_T_WORD                   wWkcStateDiagOffsOut[EC_CFG_SLAVE_PD_SECTIONS];/*< out Offset of WkcState bit in diagnosis image (ENI: ProcessData/Send[1..4]/BitStart) */
1606     EC_T_DWORD                  adwReserved[3];
1607 } EC_PACKED(4) EC_T_CFG_SLAVE_INFO;
1609 /* ecatGetBusSlaveInfo */
1610 typedef struct _EC_T_BUS_SLAVE_INFO
1612     EC_T_DWORD                  dwSlaveId;              /*< out Slave ID */
1613     EC_T_DWORD                  adwPortSlaveIds[ESC_PORT_COUNT]; /*< out Slave IDs connected to ports */
1614     EC_T_WORD                   wPortState;             /*< out Port state */
1615     EC_T_WORD                   wAutoIncAddress;        /*< out Auto increment address */
1616     EC_T_BOOL                   bDcSupport;             /*< out Slave support DC */
1617     EC_T_BOOL                   bDc64Support;           /*< out Slave support 64Bit DC */
1619     EC_T_DWORD                  dwVendorId;             /*< out Vendor identification   (EEPROM offset 0x0008) */
1620     EC_T_DWORD                  dwProductCode;          /*< out Product code            (EEPROM offset 0x000A) */
1621     EC_T_DWORD                  dwRevisionNumber;       /*< out Revision number         (EEPROM offset 0x000C) */
1622     EC_T_DWORD                  dwSerialNumber;         /*< out Serial number           (EEPROM offset 0x000E) */
1624     EC_T_BYTE                   byESCType;              /*< out ESC type                (ESC register  0x0000) */
1625     EC_T_BYTE                   byESCRevision;          /*< out ESC revision            (ESC register  0x0001) */
1626     EC_T_WORD                   wESCBuild;              /*< out ESC build               (ESC register  0x0002) */
1627     EC_T_BYTE                   byPortDescriptor;       /*< out Port descriptor         (ESC register  0x0007) */
1628     EC_T_BYTE                   byReserved;
1629     EC_T_WORD                   wFeaturesSupported;     /*< out Features supported      (ESC register  0x0008) */
1630     EC_T_WORD                   wStationAddress;        /*< out Station address         (ESC register  0x0010) */
1631     EC_T_WORD                   wAliasAddress;          /*< out Alias address           (ESC register  0x0012) */
1632     EC_T_WORD                   wAlStatus;              /*< out AL status               (ESC register  0x0130) */
1633     EC_T_WORD                   wAlStatusCode;          /*< out AL status code          (ESC register  0x0132) */
1634     EC_T_DWORD                  dwSystemTimeDifference; /*< out System time difference  (ESC register  0x092C) */
1635     EC_T_WORD                   wMbxSupportedProtocols; /*< out Support mailbox         (EEPROM offset 0x001C) */
1636     EC_T_WORD                   wDlStatus;              /*< out DL status               (ESC register  0x0110) */
1637     EC_T_WORD                   wPrevPort;              /*< out Connected port of the previous slave */
1638     EC_T_WORD                   wIdentifyData;          /*< out Last read identification value see EC_T_CFG_SLAVE_INFO.wIdentifyAdo */
1639     EC_T_BOOL                   bLineCrossed;           /*< out Line crossed detected */
1640     EC_T_DWORD                  dwSlaveDelay;           /*< out Time delay "behind" slave in ns */
1641     EC_T_DWORD                  dwPropagDelay;          /*< out Propagation delay       (ESC register  0x0928) */
1642     EC_T_BOOL                   bIsRefClock;            /*< out Slave is reference clock */
1644     EC_T_DWORD                  adwReserved[4];
1646 } EC_PACKED(4) EC_T_BUS_SLAVE_INFO;
1648 /* EC_IOCTL_SB_GET_BUS_SLAVE_PORTS_INFO */
1649 typedef struct _EC_T_BUS_SLAVE_PORTS_INFO
1651     EC_T_BYTE   byPortDescriptor;               /* ESC:0x0007 */
1652     EC_T_WORD   wDlStatus;                      /* ESC:0x0110 */
1653     EC_T_DWORD  adwRecvTime[ESC_PORT_COUNT];    /* ESC:0x0900 - 0x090C */
1654     EC_T_UINT64 qwRecvTimeProcessingUnit;       /* ESC:0x0918 */
1656 } EC_PACKED(4) EC_T_BUS_SLAVE_PORTS_INFO;
1657 #include EC_PACKED_INCLUDESTOP
1659 #include EC_PACKED_INCLUDESTART(8)
1660 typedef struct _EC_T_TRACE_DATA_INFO
1662     EC_T_BYTE*      pbyData;    /*< [out] Process Data Image output data buffer */
1663     EC_T_DWORD      dwOffset;   /*< [out] Trace Data offset in Process Data Image output data buffer (in bytes) */
1664     EC_T_WORD       wSize;      /*< [out] Trace Data size (in bytes) */
1665 } EC_PACKED(8) EC_T_TRACE_DATA_INFO;
1666 #include EC_PACKED_INCLUDESTOP
1668 /*-COMPILER SETTINGS---------------------------------------------------------*/
1669 #ifdef __cplusplus
1670 } /* extern "C" */
1671 #endif
1673 #endif /* INC_ECINTERFACECOMMON */
1675 /*-END OF SOURCE FILE--------------------------------------------------------*/