1 /****************************************************************************
3 (c) SYSTEC electronic GmbH, D-07973 Greiz, August-Bebel-Str. 29
4 www.systec-electronic.com
8 Description: include file for event module
12 Redistribution and use in source and binary forms, with or without
13 modification, are permitted provided that the following conditions
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.
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 $
56 $Revision: 1.8 $ $Date: 2008/11/17 16:40:39 $
63 -------------------------------------------------------------------------
67 2006/06/12 d.k.: start of the implementation, version 1.00
70 ****************************************************************************/
78 //---------------------------------------------------------------------------
80 //---------------------------------------------------------------------------
82 // name and size of event queues
83 #define EPL_EVENT_NAME_SHB_KERNEL_TO_USER "ShbKernelToUser"
84 #ifndef EPL_EVENT_SIZE_SHB_KERNEL_TO_USER
85 #define EPL_EVENT_SIZE_SHB_KERNEL_TO_USER 32768 // 32 kByte
88 #define EPL_EVENT_NAME_SHB_USER_TO_KERNEL "ShbUserToKernel"
89 #ifndef EPL_EVENT_SIZE_SHB_USER_TO_KERNEL
90 #define EPL_EVENT_SIZE_SHB_USER_TO_KERNEL 32768 // 32 kByte
94 // max size of event argument
95 #ifndef EPL_MAX_EVENT_ARG_SIZE
96 #define EPL_MAX_EVENT_ARG_SIZE 256 // because of PDO
99 #define EPL_DLL_ERR_MN_CRC 0x00000001L // object 0x1C00
100 #define EPL_DLL_ERR_MN_COLLISION 0x00000002L // object 0x1C01
101 #define EPL_DLL_ERR_MN_CYCTIMEEXCEED 0x00000004L // object 0x1C02
102 #define EPL_DLL_ERR_MN_LOSS_LINK 0x00000008L // object 0x1C03
103 #define EPL_DLL_ERR_MN_CN_LATE_PRES 0x00000010L // objects 0x1C04-0x1C06
104 #define EPL_DLL_ERR_MN_CN_LOSS_PRES 0x00000080L // objects 0x1C07-0x1C09
105 #define EPL_DLL_ERR_CN_COLLISION 0x00000400L // object 0x1C0A
106 #define EPL_DLL_ERR_CN_LOSS_SOC 0x00000800L // object 0x1C0B
107 #define EPL_DLL_ERR_CN_LOSS_SOA 0x00001000L // object 0x1C0C
108 #define EPL_DLL_ERR_CN_LOSS_PREQ 0x00002000L // object 0x1C0D
109 #define EPL_DLL_ERR_CN_RECVD_PREQ 0x00004000L // decrement object 0x1C0D/2
110 #define EPL_DLL_ERR_CN_SOC_JITTER 0x00008000L // object 0x1C0E
111 #define EPL_DLL_ERR_CN_CRC 0x00010000L // object 0x1C0F
112 #define EPL_DLL_ERR_CN_LOSS_LINK 0x00020000L // object 0x1C10
113 #define EPL_DLL_ERR_MN_LOSS_STATRES 0x00040000L // objects 0x1C15-0x1C17 (should be operated by NmtMnu module)
114 #define EPL_DLL_ERR_BAD_PHYS_MODE 0x00080000L // no object
115 #define EPL_DLL_ERR_MAC_BUFFER 0x00100000L // no object (NMT_GT6)
116 #define EPL_DLL_ERR_INVALID_FORMAT 0x00200000L // no object (NMT_GT6)
117 #define EPL_DLL_ERR_ADDRESS_CONFLICT 0x00400000L // no object (remove CN from configuration)
120 //---------------------------------------------------------------------------
122 //---------------------------------------------------------------------------
124 // EventType determines the argument of the event
127 kEplEventTypeNmtEvent = 0x01, // NMT event
128 // arg is pointer to tEplNmtEvent
129 kEplEventTypePdoRx = 0x02, // PDO frame received event (PRes/PReq)
130 // arg is pointer to tEplFrame
131 kEplEventTypePdoTx = 0x03, // PDO frame transmitted event (PRes/PReq)
132 // arg is pointer to tEplFrameInfo
133 kEplEventTypePdoSoa = 0x04, // SoA frame received event (isochronous phase completed)
134 // arg is pointer to nothing
135 kEplEventTypeSync = 0x05, // Sync event (e.g. SoC or anticipated SoC)
136 // arg is pointer to nothing
137 kEplEventTypeTimer = 0x06, // Timer event
138 // arg is pointer to tEplTimerEventArg
139 kEplEventTypeHeartbeat = 0x07, // Heartbeat event
140 // arg is pointer to tEplHeartbeatEvent
141 kEplEventTypeDllkCreate = 0x08, // DLL kernel create event
142 // arg is pointer to the new tEplNmtState
143 kEplEventTypeDllkDestroy = 0x09, // DLL kernel destroy event
144 // arg is pointer to the old tEplNmtState
145 kEplEventTypeDllkFillTx = 0x0A, // DLL kernel fill TxBuffer event
146 // arg is pointer to tEplDllAsyncReqPriority
147 kEplEventTypeDllkPresReady = 0x0B, // DLL kernel PRes ready event
148 // arg is pointer to nothing
149 kEplEventTypeError = 0x0C, // Error event for API layer
150 // arg is pointer to tEplEventError
151 kEplEventTypeNmtStateChange = 0x0D, // indicate change of NMT-State
152 // arg is pointer to tEplEventNmtStateChange
153 kEplEventTypeDllError = 0x0E, // DLL error event for Error handler
154 // arg is pointer to tEplErrorHandlerkEvent
155 kEplEventTypeAsndRx = 0x0F, // received ASnd frame for DLL user module
156 // arg is pointer to tEplFrame
157 kEplEventTypeDllkServFilter = 0x10, // configure ServiceIdFilter
158 // arg is pointer to tEplDllCalServiceIdFilter
159 kEplEventTypeDllkIdentity = 0x11, // configure Identity
160 // arg is pointer to tEplDllIdentParam
161 kEplEventTypeDllkConfig = 0x12, // configure ConfigParam
162 // arg is pointer to tEplDllConfigParam
163 kEplEventTypeDllkIssueReq = 0x13, // issue Ident/Status request
164 // arg is pointer to tEplDllCalIssueRequest
165 kEplEventTypeDllkAddNode = 0x14, // add node to isochronous phase
166 // arg is pointer to tEplDllNodeInfo
167 kEplEventTypeDllkDelNode = 0x15, // remove node from isochronous phase
168 // arg is pointer to unsigned int
169 kEplEventTypeDllkSoftDelNode= 0x16, // remove node softly from isochronous phase
170 // arg is pointer to unsigned int
171 kEplEventTypeDllkStartReducedCycle = 0x17, // start reduced EPL cycle on MN
172 // arg is pointer to nothing
173 kEplEventTypeNmtMnuNmtCmdSent = 0x18, // NMT command was actually sent
174 // arg is pointer to tEplFrame
179 // EventSink determines the consumer of the event
182 kEplEventSinkSync = 0x00, // Sync event for application or kernel EPL module
183 kEplEventSinkNmtk = 0x01, // events for Nmtk module
184 kEplEventSinkDllk = 0x02, // events for Dllk module
185 kEplEventSinkDlluCal = 0x03, // events for DlluCal module
186 kEplEventSinkDllkCal = 0x04, // events for DllkCal module
187 kEplEventSinkPdok = 0x05, // events for Pdok module
188 kEplEventSinkNmtu = 0x06, // events for Nmtu module
189 kEplEventSinkErrk = 0x07, // events for Error handler module
190 kEplEventSinkErru = 0x08, // events for Error signaling module
191 kEplEventSinkSdoAsySeq = 0x09, // events for asyncronous SDO Sequence Layer module
192 kEplEventSinkNmtMnu = 0x0A, // events for NmtMnu module
193 kEplEventSinkLedu = 0x0B, // events for Ledu module
194 kEplEventSinkApi = 0x0F, // events for API module
199 // EventSource determines the source of an errorevent
202 // kernelspace modules
203 kEplEventSourceDllk = 0x01, // Dllk module
204 kEplEventSourceNmtk = 0x02, // Nmtk module
205 kEplEventSourceObdk = 0x03, // Obdk module
206 kEplEventSourcePdok = 0x04, // Pdok module
207 kEplEventSourceTimerk = 0x05, // Timerk module
208 kEplEventSourceEventk = 0x06, // Eventk module
209 kEplEventSourceSyncCb = 0x07, // sync-Cb
210 kEplEventSourceErrk = 0x08, // Error handler module
213 kEplEventSourceDllu = 0x10, // Dllu module
214 kEplEventSourceNmtu = 0x11, // Nmtu module
215 kEplEventSourceNmtCnu = 0x12, // NmtCnu module
216 kEplEventSourceNmtMnu = 0x13, // NmtMnu module
217 kEplEventSourceObdu = 0x14, // Obdu module
218 kEplEventSourceSdoUdp = 0x15, // Sdo/Udp module
219 kEplEventSourceSdoAsnd = 0x16, // Sdo/Asnd module
220 kEplEventSourceSdoAsySeq = 0x17, // Sdo asynchronus Sequence Layer module
221 kEplEventSourceSdoCom = 0x18, // Sdo command layer module
222 kEplEventSourceTimeru = 0x19, // Timeru module
223 kEplEventSourceCfgMau = 0x1A, // CfgMau module
224 kEplEventSourceEventu = 0x1B, // Eventu module
225 kEplEventSourceEplApi = 0x1C, // Api module
226 kEplEventSourceLedu = 0x1D, // Ledu module
231 // structure of EPL event (element order must not be changed!)
234 tEplEventType m_EventType /*:28*/; // event type
235 tEplEventSink m_EventSink /*:4*/; // event sink
236 tEplNetTime m_NetTime; // timestamp
237 unsigned int m_uiSize; // size of argument
238 void * m_pArg; // argument of event
243 // short structure of EPL event without argument and its size (element order must not be changed!)
246 tEplEventType m_EventType /*:28*/; // event type
247 tEplEventSink m_EventSink /*:4*/; // event sink
248 tEplNetTime m_NetTime; // timestamp
255 unsigned int m_uiIndex;
256 unsigned int m_uiSubIndex;
261 // structure for kEplEventTypeError
264 tEplEventSource m_EventSource; // module which posted this error event
265 tEplKernel m_EplError; // EPL error which occured
270 tEplEventSource m_EventSource; // from Eventk/u module (originating error source)
271 tEplEventObdError m_ObdError; // from Obd module
272 // tEplErrHistoryEntry m_HistoryEntry; // from Nmtk/u module
279 // structure for kEplEventTypeDllError
282 unsigned long m_ulDllErrorEvents; // EPL_DLL_ERR_*
283 unsigned int m_uiNodeId;
284 tEplNmtState m_NmtState;
286 } tEplErrorHandlerkEvent;
289 // callback function to get informed about sync event
290 typedef tEplKernel (PUBLIC* tEplSyncCb) (void);
292 // callback function for generic events
293 typedef tEplKernel (PUBLIC* tEplProcessEventCb) (tEplEvent* pEplEvent_p);
295 //---------------------------------------------------------------------------
296 // function prototypes
297 //---------------------------------------------------------------------------
301 #endif // #ifndef _EPL_EVENT_H_