added 2.6.29.6 aldebaran kernel
[nao-ulib.git] / kernel / 2.6.29.6-aldebaran-rt / drivers / staging / epl / EplEvent.h
blobb6dc1b9b2ab1cb73bb4ee3e7adae5b40146f4234
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 event module
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: EplEvent.h,v $
54 $Author: D.Krueger $
56 $Revision: 1.8 $ $Date: 2008/11/17 16:40:39 $
58 $State: Exp $
60 Build Environment:
61 GCC V3.4
63 -------------------------------------------------------------------------
65 Revision History:
67 2006/06/12 d.k.: start of the implementation, version 1.00
69 ****************************************************************************/
71 #ifndef _EPL_EVENT_H_
72 #define _EPL_EVENT_H_
74 #include "EplInc.h"
75 #include "EplNmt.h"
77 //---------------------------------------------------------------------------
78 // const defines
79 //---------------------------------------------------------------------------
81 // name and size of event queues
82 #define EPL_EVENT_NAME_SHB_KERNEL_TO_USER "ShbKernelToUser"
83 #ifndef EPL_EVENT_SIZE_SHB_KERNEL_TO_USER
84 #define EPL_EVENT_SIZE_SHB_KERNEL_TO_USER 32768 // 32 kByte
85 #endif
87 #define EPL_EVENT_NAME_SHB_USER_TO_KERNEL "ShbUserToKernel"
88 #ifndef EPL_EVENT_SIZE_SHB_USER_TO_KERNEL
89 #define EPL_EVENT_SIZE_SHB_USER_TO_KERNEL 32768 // 32 kByte
90 #endif
92 // max size of event argument
93 #ifndef EPL_MAX_EVENT_ARG_SIZE
94 #define EPL_MAX_EVENT_ARG_SIZE 256 // because of PDO
95 #endif
97 #define EPL_DLL_ERR_MN_CRC 0x00000001L // object 0x1C00
98 #define EPL_DLL_ERR_MN_COLLISION 0x00000002L // object 0x1C01
99 #define EPL_DLL_ERR_MN_CYCTIMEEXCEED 0x00000004L // object 0x1C02
100 #define EPL_DLL_ERR_MN_LOSS_LINK 0x00000008L // object 0x1C03
101 #define EPL_DLL_ERR_MN_CN_LATE_PRES 0x00000010L // objects 0x1C04-0x1C06
102 #define EPL_DLL_ERR_MN_CN_LOSS_PRES 0x00000080L // objects 0x1C07-0x1C09
103 #define EPL_DLL_ERR_CN_COLLISION 0x00000400L // object 0x1C0A
104 #define EPL_DLL_ERR_CN_LOSS_SOC 0x00000800L // object 0x1C0B
105 #define EPL_DLL_ERR_CN_LOSS_SOA 0x00001000L // object 0x1C0C
106 #define EPL_DLL_ERR_CN_LOSS_PREQ 0x00002000L // object 0x1C0D
107 #define EPL_DLL_ERR_CN_RECVD_PREQ 0x00004000L // decrement object 0x1C0D/2
108 #define EPL_DLL_ERR_CN_SOC_JITTER 0x00008000L // object 0x1C0E
109 #define EPL_DLL_ERR_CN_CRC 0x00010000L // object 0x1C0F
110 #define EPL_DLL_ERR_CN_LOSS_LINK 0x00020000L // object 0x1C10
111 #define EPL_DLL_ERR_MN_LOSS_STATRES 0x00040000L // objects 0x1C15-0x1C17 (should be operated by NmtMnu module)
112 #define EPL_DLL_ERR_BAD_PHYS_MODE 0x00080000L // no object
113 #define EPL_DLL_ERR_MAC_BUFFER 0x00100000L // no object (NMT_GT6)
114 #define EPL_DLL_ERR_INVALID_FORMAT 0x00200000L // no object (NMT_GT6)
115 #define EPL_DLL_ERR_ADDRESS_CONFLICT 0x00400000L // no object (remove CN from configuration)
117 //---------------------------------------------------------------------------
118 // typedef
119 //---------------------------------------------------------------------------
121 // EventType determines the argument of the event
122 typedef enum {
123 kEplEventTypeNmtEvent = 0x01, // NMT event
124 // arg is pointer to tEplNmtEvent
125 kEplEventTypePdoRx = 0x02, // PDO frame received event (PRes/PReq)
126 // arg is pointer to tEplFrame
127 kEplEventTypePdoTx = 0x03, // PDO frame transmitted event (PRes/PReq)
128 // arg is pointer to tEplFrameInfo
129 kEplEventTypePdoSoa = 0x04, // SoA frame received event (isochronous phase completed)
130 // arg is pointer to nothing
131 kEplEventTypeSync = 0x05, // Sync event (e.g. SoC or anticipated SoC)
132 // arg is pointer to nothing
133 kEplEventTypeTimer = 0x06, // Timer event
134 // arg is pointer to tEplTimerEventArg
135 kEplEventTypeHeartbeat = 0x07, // Heartbeat event
136 // arg is pointer to tEplHeartbeatEvent
137 kEplEventTypeDllkCreate = 0x08, // DLL kernel create event
138 // arg is pointer to the new tEplNmtState
139 kEplEventTypeDllkDestroy = 0x09, // DLL kernel destroy event
140 // arg is pointer to the old tEplNmtState
141 kEplEventTypeDllkFillTx = 0x0A, // DLL kernel fill TxBuffer event
142 // arg is pointer to tEplDllAsyncReqPriority
143 kEplEventTypeDllkPresReady = 0x0B, // DLL kernel PRes ready event
144 // arg is pointer to nothing
145 kEplEventTypeError = 0x0C, // Error event for API layer
146 // arg is pointer to tEplEventError
147 kEplEventTypeNmtStateChange = 0x0D, // indicate change of NMT-State
148 // arg is pointer to tEplEventNmtStateChange
149 kEplEventTypeDllError = 0x0E, // DLL error event for Error handler
150 // arg is pointer to tEplErrorHandlerkEvent
151 kEplEventTypeAsndRx = 0x0F, // received ASnd frame for DLL user module
152 // arg is pointer to tEplFrame
153 kEplEventTypeDllkServFilter = 0x10, // configure ServiceIdFilter
154 // arg is pointer to tEplDllCalServiceIdFilter
155 kEplEventTypeDllkIdentity = 0x11, // configure Identity
156 // arg is pointer to tEplDllIdentParam
157 kEplEventTypeDllkConfig = 0x12, // configure ConfigParam
158 // arg is pointer to tEplDllConfigParam
159 kEplEventTypeDllkIssueReq = 0x13, // issue Ident/Status request
160 // arg is pointer to tEplDllCalIssueRequest
161 kEplEventTypeDllkAddNode = 0x14, // add node to isochronous phase
162 // arg is pointer to tEplDllNodeInfo
163 kEplEventTypeDllkDelNode = 0x15, // remove node from isochronous phase
164 // arg is pointer to unsigned int
165 kEplEventTypeDllkSoftDelNode = 0x16, // remove node softly from isochronous phase
166 // arg is pointer to unsigned int
167 kEplEventTypeDllkStartReducedCycle = 0x17, // start reduced EPL cycle on MN
168 // arg is pointer to nothing
169 kEplEventTypeNmtMnuNmtCmdSent = 0x18, // NMT command was actually sent
170 // arg is pointer to tEplFrame
172 } tEplEventType;
174 // EventSink determines the consumer of the event
175 typedef enum {
176 kEplEventSinkSync = 0x00, // Sync event for application or kernel EPL module
177 kEplEventSinkNmtk = 0x01, // events for Nmtk module
178 kEplEventSinkDllk = 0x02, // events for Dllk module
179 kEplEventSinkDlluCal = 0x03, // events for DlluCal module
180 kEplEventSinkDllkCal = 0x04, // events for DllkCal module
181 kEplEventSinkPdok = 0x05, // events for Pdok module
182 kEplEventSinkNmtu = 0x06, // events for Nmtu module
183 kEplEventSinkErrk = 0x07, // events for Error handler module
184 kEplEventSinkErru = 0x08, // events for Error signaling module
185 kEplEventSinkSdoAsySeq = 0x09, // events for asyncronous SDO Sequence Layer module
186 kEplEventSinkNmtMnu = 0x0A, // events for NmtMnu module
187 kEplEventSinkLedu = 0x0B, // events for Ledu module
188 kEplEventSinkApi = 0x0F, // events for API module
190 } tEplEventSink;
192 // EventSource determines the source of an errorevent
193 typedef enum {
194 // kernelspace modules
195 kEplEventSourceDllk = 0x01, // Dllk module
196 kEplEventSourceNmtk = 0x02, // Nmtk module
197 kEplEventSourceObdk = 0x03, // Obdk module
198 kEplEventSourcePdok = 0x04, // Pdok module
199 kEplEventSourceTimerk = 0x05, // Timerk module
200 kEplEventSourceEventk = 0x06, // Eventk module
201 kEplEventSourceSyncCb = 0x07, // sync-Cb
202 kEplEventSourceErrk = 0x08, // Error handler module
204 // userspace modules
205 kEplEventSourceDllu = 0x10, // Dllu module
206 kEplEventSourceNmtu = 0x11, // Nmtu module
207 kEplEventSourceNmtCnu = 0x12, // NmtCnu module
208 kEplEventSourceNmtMnu = 0x13, // NmtMnu module
209 kEplEventSourceObdu = 0x14, // Obdu module
210 kEplEventSourceSdoUdp = 0x15, // Sdo/Udp module
211 kEplEventSourceSdoAsnd = 0x16, // Sdo/Asnd module
212 kEplEventSourceSdoAsySeq = 0x17, // Sdo asynchronus Sequence Layer module
213 kEplEventSourceSdoCom = 0x18, // Sdo command layer module
214 kEplEventSourceTimeru = 0x19, // Timeru module
215 kEplEventSourceCfgMau = 0x1A, // CfgMau module
216 kEplEventSourceEventu = 0x1B, // Eventu module
217 kEplEventSourceEplApi = 0x1C, // Api module
218 kEplEventSourceLedu = 0x1D, // Ledu module
220 } tEplEventSource;
222 // structure of EPL event (element order must not be changed!)
223 typedef struct {
224 tEplEventType m_EventType /*:28 */ ; // event type
225 tEplEventSink m_EventSink /*:4 */ ; // event sink
226 tEplNetTime m_NetTime; // timestamp
227 unsigned int m_uiSize; // size of argument
228 void *m_pArg; // argument of event
230 } tEplEvent;
232 // short structure of EPL event without argument and its size (element order must not be changed!)
233 typedef struct {
234 tEplEventType m_EventType /*:28 */ ; // event type
235 tEplEventSink m_EventSink /*:4 */ ; // event sink
236 tEplNetTime m_NetTime; // timestamp
238 } tEplEventShort;
240 typedef struct {
241 unsigned int m_uiIndex;
242 unsigned int m_uiSubIndex;
244 } tEplEventObdError;
246 // structure for kEplEventTypeError
247 typedef struct {
248 tEplEventSource m_EventSource; // module which posted this error event
249 tEplKernel m_EplError; // EPL error which occured
250 union {
251 BYTE m_bArg;
252 DWORD m_dwArg;
253 tEplEventSource m_EventSource; // from Eventk/u module (originating error source)
254 tEplEventObdError m_ObdError; // from Obd module
255 // tEplErrHistoryEntry m_HistoryEntry; // from Nmtk/u module
257 } m_Arg;
259 } tEplEventError;
261 // structure for kEplEventTypeDllError
262 typedef struct {
263 unsigned long m_ulDllErrorEvents; // EPL_DLL_ERR_*
264 unsigned int m_uiNodeId;
265 tEplNmtState m_NmtState;
267 } tEplErrorHandlerkEvent;
269 // callback function to get informed about sync event
270 typedef tEplKernel(PUBLIC * tEplSyncCb) (void);
272 // callback function for generic events
273 typedef tEplKernel(PUBLIC * tEplProcessEventCb) (tEplEvent * pEplEvent_p);
275 //---------------------------------------------------------------------------
276 // function prototypes
277 //---------------------------------------------------------------------------
279 #endif // #ifndef _EPL_EVENT_H_