added 2.6.29.6 aldebaran kernel
[nao-ulib.git] / kernel / 2.6.29.6-aldebaran-rt / drivers / staging / epl / EplFrame.h
blob9a7f8b9f594e64baa3eca4ade3bafb931b3420e7
1 /****************************************************************************
3 (c) SYSTEC electronic GmbH, D-07973 Greiz, August-Bebel-Str. 29
4 www.systec-electronic.com
6 Project: openPOWERLINK
8 Description: include file for EPL frames
10 License:
12 Redistribution and use in source and binary forms, with or without
13 modification, are permitted provided that the following conditions
14 are met:
16 1. Redistributions of source code must retain the above copyright
17 notice, this list of conditions and the following disclaimer.
19 2. Redistributions in binary form must reproduce the above copyright
20 notice, this list of conditions and the following disclaimer in the
21 documentation and/or other materials provided with the distribution.
23 3. Neither the name of SYSTEC electronic GmbH nor the names of its
24 contributors may be used to endorse or promote products derived
25 from this software without prior written permission. For written
26 permission, please contact info@systec-electronic.com.
28 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
31 FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
32 COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
33 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
34 BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
35 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
36 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
37 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
38 ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
39 POSSIBILITY OF SUCH DAMAGE.
41 Severability Clause:
43 If a provision of this License is or becomes illegal, invalid or
44 unenforceable in any jurisdiction, that shall not affect:
45 1. the validity or enforceability in that jurisdiction of any other
46 provision of this License; or
47 2. the validity or enforceability in other jurisdictions of that or
48 any other provision of this License.
50 -------------------------------------------------------------------------
52 $RCSfile: EplFrame.h,v $
54 $Author: D.Krueger $
56 $Revision: 1.5 $ $Date: 2008/06/23 14:56:33 $
58 $State: Exp $
60 Build Environment:
61 GCC V3.4
63 -------------------------------------------------------------------------
65 Revision History:
67 2006/05/22 d.k.: start of the implementation, version 1.00
69 ****************************************************************************/
71 #ifndef _EPL_FRAME_H_
72 #define _EPL_FRAME_H_
74 //---------------------------------------------------------------------------
75 // const defines
76 //---------------------------------------------------------------------------
78 // defines for EplFrame.m_wFlag
79 #define EPL_FRAME_FLAG1_RD 0x01 // ready (PReq, PRes)
80 #define EPL_FRAME_FLAG1_ER 0x02 // exception reset (error signalling) (SoA)
81 #define EPL_FRAME_FLAG1_EA 0x04 // exception acknowledge (error signalling) (PReq, SoA)
82 #define EPL_FRAME_FLAG1_EC 0x08 // exception clear (error signalling) (StatusRes)
83 #define EPL_FRAME_FLAG1_EN 0x10 // exception new (error signalling) (PRes, StatusRes)
84 #define EPL_FRAME_FLAG1_MS 0x20 // multiplexed slot (PReq)
85 #define EPL_FRAME_FLAG1_PS 0x40 // prescaled slot (SoC)
86 #define EPL_FRAME_FLAG1_MC 0x80 // multiplexed cycle completed (SoC)
87 #define EPL_FRAME_FLAG2_RS 0x07 // number of pending requests to send (PRes, StatusRes, IdentRes)
88 #define EPL_FRAME_FLAG2_PR 0x38 // priority of requested asynch. frame (PRes, StatusRes, IdentRes)
89 #define EPL_FRAME_FLAG2_PR_SHIFT 3 // shift of priority of requested asynch. frame
91 // error history/status entry types
92 #define EPL_ERR_ENTRYTYPE_STATUS 0x8000
93 #define EPL_ERR_ENTRYTYPE_HISTORY 0x0000
94 #define EPL_ERR_ENTRYTYPE_EMCY 0x4000
95 #define EPL_ERR_ENTRYTYPE_MODE_ACTIVE 0x1000
96 #define EPL_ERR_ENTRYTYPE_MODE_CLEARED 0x2000
97 #define EPL_ERR_ENTRYTYPE_MODE_OCCURRED 0x3000
98 #define EPL_ERR_ENTRYTYPE_MODE_MASK 0x3000
99 #define EPL_ERR_ENTRYTYPE_PROF_VENDOR 0x0001
100 #define EPL_ERR_ENTRYTYPE_PROF_EPL 0x0002
101 #define EPL_ERR_ENTRYTYPE_PROF_MASK 0x0FFF
103 // defines for EPL version / PDO version
104 #define EPL_VERSION_SUB 0x0F // sub version
105 #define EPL_VERSION_MAIN 0xF0 // main version
107 //---------------------------------------------------------------------------
108 // typedef
109 //---------------------------------------------------------------------------
111 // $$$ d.k.: move this definition to global.h
112 // byte-align structures
113 #ifdef _MSC_VER
114 # pragma pack( push, packing )
115 # pragma pack( 1 )
116 # define PACK_STRUCT
117 #elif defined( __GNUC__ )
118 # define PACK_STRUCT __attribute__((packed))
119 #else
120 # error you must byte-align these structures with the appropriate compiler directives
121 #endif
123 typedef struct {
124 // Offset 17
125 BYTE m_le_bRes1; // reserved
126 // Offset 18
127 BYTE m_le_bFlag1; // Flags: MC, PS
128 // Offset 19
129 BYTE m_le_bFlag2; // Flags: res
130 // Offset 20
131 tEplNetTime m_le_NetTime; // supported if D_NMT_NetTimeIsRealTime_BOOL is set
132 // Offset 28
133 QWORD m_le_RelativeTime; // in us (supported if D_NMT_RelativeTime_BOOL is set)
135 } PACK_STRUCT tEplSocFrame;
137 typedef struct {
138 // Offset 17
139 BYTE m_le_bRes1; // reserved
140 // Offset 18
141 BYTE m_le_bFlag1; // Flags: MS, EA, RD
142 // Offset 19
143 BYTE m_le_bFlag2; // Flags: res
144 // Offset 20
145 BYTE m_le_bPdoVersion;
146 // Offset 21
147 BYTE m_le_bRes2; // reserved
148 // Offset 22
149 WORD m_le_wSize;
150 // Offset 24
151 BYTE m_le_abPayload[256 /*D_NMT_IsochrRxMaxPayload_U16 */ ];
153 } PACK_STRUCT tEplPreqFrame;
155 typedef struct {
156 // Offset 17
157 BYTE m_le_bNmtStatus; // NMT state
158 // Offset 18
159 BYTE m_le_bFlag1; // Flags: MS, EN, RD
160 // Offset 19
161 BYTE m_le_bFlag2; // Flags: PR, RS
162 // Offset 20
163 BYTE m_le_bPdoVersion;
164 // Offset 21
165 BYTE m_le_bRes2; // reserved
166 // Offset 22
167 WORD m_le_wSize;
168 // Offset 24
169 BYTE m_le_abPayload[256 /*D_NMT_IsochrRxMaxPayload_U16
170 / D_NMT_IsochrTxMaxPayload_U16 */ ];
172 } PACK_STRUCT tEplPresFrame;
174 typedef struct {
175 // Offset 17
176 BYTE m_le_bNmtStatus; // NMT state
177 // Offset 18
178 BYTE m_le_bFlag1; // Flags: EA, ER
179 // Offset 19
180 BYTE m_le_bFlag2; // Flags: res
181 // Offset 20
182 BYTE m_le_bReqServiceId;
183 // Offset 21
184 BYTE m_le_bReqServiceTarget;
185 // Offset 22
186 BYTE m_le_bEplVersion;
188 } PACK_STRUCT tEplSoaFrame;
190 typedef struct {
191 WORD m_wEntryType;
192 WORD m_wErrorCode;
193 tEplNetTime m_TimeStamp;
194 BYTE m_abAddInfo[8];
196 } PACK_STRUCT tEplErrHistoryEntry;
198 typedef struct {
199 // Offset 18
200 BYTE m_le_bFlag1; // Flags: EN, EC
201 BYTE m_le_bFlag2; // Flags: PR, RS
202 BYTE m_le_bNmtStatus; // NMT state
203 BYTE m_le_bRes1[3];
204 QWORD m_le_qwStaticError; // static error bit field
205 tEplErrHistoryEntry m_le_aErrHistoryEntry[14];
207 } PACK_STRUCT tEplStatusResponse;
209 typedef struct {
210 // Offset 18
211 BYTE m_le_bFlag1; // Flags: res
212 BYTE m_le_bFlag2; // Flags: PR, RS
213 BYTE m_le_bNmtStatus; // NMT state
214 BYTE m_le_bIdentRespFlags; // Flags: FW
215 BYTE m_le_bEplProfileVersion;
216 BYTE m_le_bRes1;
217 DWORD m_le_dwFeatureFlags; // NMT_FeatureFlags_U32
218 WORD m_le_wMtu; // NMT_CycleTiming_REC.AsyncMTU_U16: C_IP_MIN_MTU - C_IP_MAX_MTU
219 WORD m_le_wPollInSize; // NMT_CycleTiming_REC.PReqActPayload_U16
220 WORD m_le_wPollOutSize; // NMT_CycleTiming_REC.PResActPayload_U16
221 DWORD m_le_dwResponseTime; // NMT_CycleTiming_REC.PResMaxLatency_U32
222 WORD m_le_wRes2;
223 DWORD m_le_dwDeviceType; // NMT_DeviceType_U32
224 DWORD m_le_dwVendorId; // NMT_IdentityObject_REC.VendorId_U32
225 DWORD m_le_dwProductCode; // NMT_IdentityObject_REC.ProductCode_U32
226 DWORD m_le_dwRevisionNumber; // NMT_IdentityObject_REC.RevisionNo_U32
227 DWORD m_le_dwSerialNumber; // NMT_IdentityObject_REC.SerialNo_U32
228 QWORD m_le_qwVendorSpecificExt1;
229 DWORD m_le_dwVerifyConfigurationDate; // CFM_VerifyConfiguration_REC.ConfDate_U32
230 DWORD m_le_dwVerifyConfigurationTime; // CFM_VerifyConfiguration_REC.ConfTime_U32
231 DWORD m_le_dwApplicationSwDate; // PDL_LocVerApplSw_REC.ApplSwDate_U32 on programmable device or date portion of NMT_ManufactSwVers_VS on non-programmable device
232 DWORD m_le_dwApplicationSwTime; // PDL_LocVerApplSw_REC.ApplSwTime_U32 on programmable device or time portion of NMT_ManufactSwVers_VS on non-programmable device
233 DWORD m_le_dwIpAddress;
234 DWORD m_le_dwSubnetMask;
235 DWORD m_le_dwDefaultGateway;
236 BYTE m_le_sHostname[32];
237 BYTE m_le_abVendorSpecificExt2[48];
239 } PACK_STRUCT tEplIdentResponse;
241 typedef struct {
242 // Offset 18
243 BYTE m_le_bNmtCommandId;
244 BYTE m_le_bRes1;
245 BYTE m_le_abNmtCommandData[32];
247 } PACK_STRUCT tEplNmtCommandService;
249 typedef struct {
250 BYTE m_le_bReserved;
251 BYTE m_le_bTransactionId;
252 BYTE m_le_bFlags;
253 BYTE m_le_bCommandId;
254 WORD m_le_wSegmentSize;
255 WORD m_le_wReserved;
256 BYTE m_le_abCommandData[8]; // just reserve a minimum number of bytes as a placeholder
258 } PACK_STRUCT tEplAsySdoCom;
260 // asynchronous SDO Sequence Header
261 typedef struct {
262 BYTE m_le_bRecSeqNumCon;
263 BYTE m_le_bSendSeqNumCon;
264 BYTE m_le_abReserved[2];
265 tEplAsySdoCom m_le_abSdoSeqPayload;
267 } PACK_STRUCT tEplAsySdoSeq;
269 typedef struct {
270 // Offset 18
271 BYTE m_le_bNmtCommandId;
272 BYTE m_le_bTargetNodeId;
273 BYTE m_le_abNmtCommandData[32];
275 } PACK_STRUCT tEplNmtRequestService;
277 typedef union {
278 // Offset 18
279 tEplStatusResponse m_StatusResponse;
280 tEplIdentResponse m_IdentResponse;
281 tEplNmtCommandService m_NmtCommandService;
282 tEplNmtRequestService m_NmtRequestService;
283 tEplAsySdoSeq m_SdoSequenceFrame;
284 BYTE m_le_abPayload[256 /*D_NMT_ASndTxMaxPayload_U16
285 / D_NMT_ASndRxMaxPayload_U16 */ ];
287 } tEplAsndPayload;
289 typedef struct {
290 // Offset 17
291 BYTE m_le_bServiceId;
292 // Offset 18
293 tEplAsndPayload m_Payload;
295 } PACK_STRUCT tEplAsndFrame;
297 typedef union {
298 // Offset 17
299 tEplSocFrame m_Soc;
300 tEplPreqFrame m_Preq;
301 tEplPresFrame m_Pres;
302 tEplSoaFrame m_Soa;
303 tEplAsndFrame m_Asnd;
305 } tEplFrameData;
307 typedef struct {
308 // Offset 0
309 BYTE m_be_abDstMac[6]; // MAC address of the addressed nodes
310 // Offset 6
311 BYTE m_be_abSrcMac[6]; // MAC address of the transmitting node
312 // Offset 12
313 WORD m_be_wEtherType; // Ethernet message type (big endian)
314 // Offset 14
315 BYTE m_le_bMessageType; // EPL message type
316 // Offset 15
317 BYTE m_le_bDstNodeId; // EPL node ID of the addressed nodes
318 // Offset 16
319 BYTE m_le_bSrcNodeId; // EPL node ID of the transmitting node
320 // Offset 17
321 tEplFrameData m_Data;
323 } PACK_STRUCT tEplFrame;
325 // un-byte-align structures
326 #ifdef _MSC_VER
327 # pragma pack( pop, packing )
328 #endif
330 typedef enum {
331 kEplMsgTypeNonEpl = 0x00,
332 kEplMsgTypeSoc = 0x01,
333 kEplMsgTypePreq = 0x03,
334 kEplMsgTypePres = 0x04,
335 kEplMsgTypeSoa = 0x05,
336 kEplMsgTypeAsnd = 0x06,
338 } tEplMsgType;
340 //---------------------------------------------------------------------------
341 // function prototypes
342 //---------------------------------------------------------------------------
344 #endif // #ifndef _EPL_FRAME_H_