aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/epl/Epl.h
diff options
context:
space:
mode:
authorDaniel Krueger <daniel.krueger@systec-electronic.com>2008-12-19 14:41:57 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2009-01-06 16:52:36 -0500
commit9d7164cfdb611c2f864d535ae5794f23db3d84f7 (patch)
tree046847f7d6432f1f3dc8236f62492503f4c9ebdc /drivers/staging/epl/Epl.h
parent37bcd24b845abbfd85c838ee9ce07c2b254d3a05 (diff)
Staging: add epl stack
This is the openPOWERLINK network stack from systec electronic. It's a bit messed up as there is a driver mixed into the middle of it, lots of work needs to be done to unwind the different portions to make it sane. Cc: Daniel Krueger <daniel.krueger@systec-electronic.com> Cc: Ronald Sieber <Ronald.Sieber@systec-electronic.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/epl/Epl.h')
-rw-r--r--drivers/staging/epl/Epl.h304
1 files changed, 304 insertions, 0 deletions
diff --git a/drivers/staging/epl/Epl.h b/drivers/staging/epl/Epl.h
new file mode 100644
index 00000000000..986995e0292
--- /dev/null
+++ b/drivers/staging/epl/Epl.h
@@ -0,0 +1,304 @@
1/****************************************************************************
2
3 (c) SYSTEC electronic GmbH, D-07973 Greiz, August-Bebel-Str. 29
4 www.systec-electronic.com
5
6 Project: openPOWERLINK
7
8 Description: include file for EPL API layer
9
10 License:
11
12 Redistribution and use in source and binary forms, with or without
13 modification, are permitted provided that the following conditions
14 are met:
15
16 1. Redistributions of source code must retain the above copyright
17 notice, this list of conditions and the following disclaimer.
18
19 2. Redistributions in binary form must reproduce the above copyright
20 notice, this list of conditions and the following disclaimer in the
21 documentation and/or other materials provided with the distribution.
22
23 3. Neither the name of SYSTEC electronic GmbH nor the names of its
24 contributors may be used to endorse or promote products derived
25 from this software without prior written permission. For written
26 permission, please contact info@systec-electronic.com.
27
28 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
31 FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
32 COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
33 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
34 BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
35 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
36 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
37 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
38 ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
39 POSSIBILITY OF SUCH DAMAGE.
40
41 Severability Clause:
42
43 If a provision of this License is or becomes illegal, invalid or
44 unenforceable in any jurisdiction, that shall not affect:
45 1. the validity or enforceability in that jurisdiction of any other
46 provision of this License; or
47 2. the validity or enforceability in other jurisdictions of that or
48 any other provision of this License.
49
50 -------------------------------------------------------------------------
51
52 $RCSfile: Epl.h,v $
53
54 $Author: D.Krueger $
55
56 $Revision: 1.8 $ $Date: 2008/11/17 16:40:39 $
57
58 $State: Exp $
59
60 Build Environment:
61 GCC V3.4
62
63 -------------------------------------------------------------------------
64
65 Revision History:
66
67 2006/05/22 d.k.: start of the implementation, version 1.00
68
69
70****************************************************************************/
71
72#ifndef _EPL_API_H_
73#define _EPL_API_H_
74
75#include "EplInc.h"
76#include "EplSdo.h"
77#include "EplObd.h"
78#include "EplLed.h"
79#include "EplEvent.h"
80
81//---------------------------------------------------------------------------
82// const defines
83//---------------------------------------------------------------------------
84
85
86//---------------------------------------------------------------------------
87// typedef
88//---------------------------------------------------------------------------
89
90
91typedef struct
92{
93 unsigned int m_uiNodeId;
94 tEplNmtState m_NmtState;
95 tEplNmtNodeEvent m_NodeEvent;
96 WORD m_wErrorCode; // EPL error code if m_NodeEvent == kEplNmtNodeEventError
97 BOOL m_fMandatory;
98
99} tEplApiEventNode;
100
101
102typedef struct
103{
104 tEplNmtState m_NmtState; // local NMT state
105 tEplNmtBootEvent m_BootEvent;
106 WORD m_wErrorCode; // EPL error code if m_BootEvent == kEplNmtBootEventError
107
108} tEplApiEventBoot;
109
110
111typedef struct
112{
113 tEplLedType m_LedType; // type of the LED (e.g. Status or Error)
114 BOOL m_fOn; // state of the LED (e.g. on or off)
115
116} tEplApiEventLed;
117
118
119typedef enum
120{
121 kEplApiEventNmtStateChange = 0x10, // m_NmtStateChange
122// kEplApiEventRequestNmt = 0x11, // m_bNmtCmd
123 kEplApiEventCriticalError = 0x12, // m_InternalError, Stack halted
124 kEplApiEventWarning = 0x13, // m_InternalError, Stack running
125 kEplApiEventNode = 0x20, // m_Node
126 kEplApiEventBoot = 0x21, // m_Boot
127 kEplApiEventSdo = 0x62, // m_Sdo
128 kEplApiEventObdAccess = 0x69, // m_ObdCbParam
129 kEplApiEventLed = 0x70, // m_Led
130
131} tEplApiEventType;
132
133
134typedef union
135{
136 tEplEventNmtStateChange m_NmtStateChange;
137 tEplEventError m_InternalError;
138 tEplSdoComFinished m_Sdo;
139 tEplObdCbParam m_ObdCbParam;
140 tEplApiEventNode m_Node;
141 tEplApiEventBoot m_Boot;
142 tEplApiEventLed m_Led;
143
144} tEplApiEventArg;
145
146
147typedef tEplKernel (PUBLIC ROM* tEplApiCbEvent) (
148 tEplApiEventType EventType_p, // IN: event type (enum)
149 tEplApiEventArg* pEventArg_p, // IN: event argument (union)
150 void GENERIC* pUserArg_p);
151
152
153typedef struct
154{
155 unsigned int m_uiSizeOfStruct;
156 BOOL m_fAsyncOnly; // do not need to register PRes
157 unsigned int m_uiNodeId; // local node ID
158 BYTE m_abMacAddress[6]; // local MAC address
159
160 // 0x1F82: NMT_FeatureFlags_U32
161 DWORD m_dwFeatureFlags;
162 // Cycle Length (0x1006: NMT_CycleLen_U32) in [us]
163 DWORD m_dwCycleLen; // required for error detection
164 // 0x1F98: NMT_CycleTiming_REC
165 // 0x1F98.1: IsochrTxMaxPayload_U16
166 unsigned int m_uiIsochrTxMaxPayload; // const
167 // 0x1F98.2: IsochrRxMaxPayload_U16
168 unsigned int m_uiIsochrRxMaxPayload; // const
169 // 0x1F98.3: PResMaxLatency_U32
170 DWORD m_dwPresMaxLatency; // const in [ns], only required for IdentRes
171 // 0x1F98.4: PReqActPayloadLimit_U16
172 unsigned int m_uiPreqActPayloadLimit; // required for initialisation (+28 bytes)
173 // 0x1F98.5: PResActPayloadLimit_U16
174 unsigned int m_uiPresActPayloadLimit; // required for initialisation of Pres frame (+28 bytes)
175 // 0x1F98.6: ASndMaxLatency_U32
176 DWORD m_dwAsndMaxLatency; // const in [ns], only required for IdentRes
177 // 0x1F98.7: MultiplCycleCnt_U8
178 unsigned int m_uiMultiplCycleCnt; // required for error detection
179 // 0x1F98.8: AsyncMTU_U16
180 unsigned int m_uiAsyncMtu; // required to set up max frame size
181 // 0x1F98.9: Prescaler_U16
182 unsigned int m_uiPrescaler; // required for sync
183 // $$$ Multiplexed Slot
184
185 // 0x1C14: DLL_LossOfFrameTolerance_U32 in [ns]
186 DWORD m_dwLossOfFrameTolerance;
187
188 // 0x1F8A: NMT_MNCycleTiming_REC
189 // 0x1F8A.1: WaitSoCPReq_U32 in [ns]
190 DWORD m_dwWaitSocPreq;
191
192 // 0x1F8A.2: AsyncSlotTimeout_U32 in [ns]
193 DWORD m_dwAsyncSlotTimeout;
194
195 DWORD m_dwDeviceType; // NMT_DeviceType_U32
196 DWORD m_dwVendorId; // NMT_IdentityObject_REC.VendorId_U32
197 DWORD m_dwProductCode; // NMT_IdentityObject_REC.ProductCode_U32
198 DWORD m_dwRevisionNumber; // NMT_IdentityObject_REC.RevisionNo_U32
199 DWORD m_dwSerialNumber; // NMT_IdentityObject_REC.SerialNo_U32
200 QWORD m_qwVendorSpecificExt1;
201 DWORD m_dwVerifyConfigurationDate; // CFM_VerifyConfiguration_REC.ConfDate_U32
202 DWORD m_dwVerifyConfigurationTime; // CFM_VerifyConfiguration_REC.ConfTime_U32
203 DWORD m_dwApplicationSwDate; // PDL_LocVerApplSw_REC.ApplSwDate_U32 on programmable device or date portion of NMT_ManufactSwVers_VS on non-programmable device
204 DWORD m_dwApplicationSwTime; // PDL_LocVerApplSw_REC.ApplSwTime_U32 on programmable device or time portion of NMT_ManufactSwVers_VS on non-programmable device
205 DWORD m_dwIpAddress;
206 DWORD m_dwSubnetMask;
207 DWORD m_dwDefaultGateway;
208 BYTE m_sHostname[32];
209 BYTE m_abVendorSpecificExt2[48];
210
211 char* m_pszDevName; // NMT_ManufactDevName_VS (0x1008/0 local OD)
212 char* m_pszHwVersion; // NMT_ManufactHwVers_VS (0x1009/0 local OD)
213 char* m_pszSwVersion; // NMT_ManufactSwVers_VS (0x100A/0 local OD)
214
215 tEplApiCbEvent m_pfnCbEvent;
216 void* m_pEventUserArg;
217 tEplSyncCb m_pfnCbSync;
218
219} tEplApiInitParam;
220
221
222typedef struct
223{
224 void* m_pImage;
225 unsigned int m_uiSize;
226
227} tEplApiProcessImage;
228
229
230//---------------------------------------------------------------------------
231// function prototypes
232//---------------------------------------------------------------------------
233
234tEplKernel PUBLIC EplApiInitialize(tEplApiInitParam* pInitParam_p);
235
236tEplKernel PUBLIC EplApiShutdown(void);
237
238tEplKernel PUBLIC EplApiReadObject(
239 tEplSdoComConHdl* pSdoComConHdl_p,
240 unsigned int uiNodeId_p,
241 unsigned int uiIndex_p,
242 unsigned int uiSubindex_p,
243 void* pDstData_le_p,
244 unsigned int* puiSize_p,
245 tEplSdoType SdoType_p,
246 void* pUserArg_p);
247
248tEplKernel PUBLIC EplApiWriteObject(
249 tEplSdoComConHdl* pSdoComConHdl_p,
250 unsigned int uiNodeId_p,
251 unsigned int uiIndex_p,
252 unsigned int uiSubindex_p,
253 void* pSrcData_le_p,
254 unsigned int uiSize_p,
255 tEplSdoType SdoType_p,
256 void* pUserArg_p);
257
258tEplKernel PUBLIC EplApiFreeSdoChannel(
259 tEplSdoComConHdl SdoComConHdl_p);
260
261tEplKernel PUBLIC EplApiReadLocalObject(
262 unsigned int uiIndex_p,
263 unsigned int uiSubindex_p,
264 void* pDstData_p,
265 unsigned int* puiSize_p);
266
267tEplKernel PUBLIC EplApiWriteLocalObject(
268 unsigned int uiIndex_p,
269 unsigned int uiSubindex_p,
270 void* pSrcData_p,
271 unsigned int uiSize_p);
272
273tEplKernel PUBLIC EplApiCbObdAccess(tEplObdCbParam MEM* pParam_p);
274
275tEplKernel PUBLIC EplApiLinkObject( unsigned int uiObjIndex_p,
276 void* pVar_p,
277 unsigned int* puiVarEntries_p,
278 tEplObdSize* pEntrySize_p,
279 unsigned int uiFirstSubindex_p);
280
281tEplKernel PUBLIC EplApiExecNmtCommand(tEplNmtEvent NmtEvent_p);
282
283tEplKernel PUBLIC EplApiProcess(void);
284
285
286#if (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_NMT_MN)) != 0)
287tEplKernel PUBLIC EplApiMnTriggerStateChange(unsigned int uiNodeId_p,
288 tEplNmtNodeCommand NodeCommand_p);
289#endif
290
291tEplKernel PUBLIC EplApiGetIdentResponse(
292 unsigned int uiNodeId_p,
293 tEplIdentResponse** ppIdentResponse_p);
294
295
296// functions for process image will be implemented in separate file
297tEplKernel PUBLIC EplApiProcessImageSetup(void);
298tEplKernel PUBLIC EplApiProcessImageExchangeIn(tEplApiProcessImage* pPI_p);
299tEplKernel PUBLIC EplApiProcessImageExchangeOut(tEplApiProcessImage* pPI_p);
300
301
302#endif // #ifndef _EPL_API_H_
303
304