Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 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 event module |
| 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: EplEvent.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/06/12 d.k.: start of the implementation, version 1.00 |
| 68 | |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 69 | ****************************************************************************/ |
| 70 | |
| 71 | #ifndef _EPL_EVENT_H_ |
| 72 | #define _EPL_EVENT_H_ |
| 73 | |
| 74 | #include "EplInc.h" |
| 75 | #include "EplNmt.h" |
| 76 | |
| 77 | //--------------------------------------------------------------------------- |
| 78 | // const defines |
| 79 | //--------------------------------------------------------------------------- |
| 80 | |
| 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 |
Greg Kroah-Hartman | e0ca059 | 2008-12-19 17:09:38 -0800 | [diff] [blame] | 84 | #define EPL_EVENT_SIZE_SHB_KERNEL_TO_USER 32768 // 32 kByte |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 85 | #endif |
| 86 | |
| 87 | #define EPL_EVENT_NAME_SHB_USER_TO_KERNEL "ShbUserToKernel" |
| 88 | #ifndef EPL_EVENT_SIZE_SHB_USER_TO_KERNEL |
Greg Kroah-Hartman | e0ca059 | 2008-12-19 17:09:38 -0800 | [diff] [blame] | 89 | #define EPL_EVENT_SIZE_SHB_USER_TO_KERNEL 32768 // 32 kByte |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 90 | #endif |
| 91 | |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 92 | // max size of event argument |
| 93 | #ifndef EPL_MAX_EVENT_ARG_SIZE |
Greg Kroah-Hartman | e0ca059 | 2008-12-19 17:09:38 -0800 | [diff] [blame] | 94 | #define EPL_MAX_EVENT_ARG_SIZE 256 // because of PDO |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 95 | #endif |
| 96 | |
Greg Kroah-Hartman | e0ca059 | 2008-12-19 17:09:38 -0800 | [diff] [blame] | 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) |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 116 | |
| 117 | //--------------------------------------------------------------------------- |
| 118 | // typedef |
| 119 | //--------------------------------------------------------------------------- |
| 120 | |
| 121 | // EventType determines the argument of the event |
Greg Kroah-Hartman | e0ca059 | 2008-12-19 17:09:38 -0800 | [diff] [blame] | 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 |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 171 | |
| 172 | } tEplEventType; |
| 173 | |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 174 | // EventSink determines the consumer of the event |
Greg Kroah-Hartman | e0ca059 | 2008-12-19 17:09:38 -0800 | [diff] [blame] | 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 |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 189 | |
| 190 | } tEplEventSink; |
| 191 | |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 192 | // EventSource determines the source of an errorevent |
Greg Kroah-Hartman | e0ca059 | 2008-12-19 17:09:38 -0800 | [diff] [blame] | 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 |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 203 | |
Greg Kroah-Hartman | e0ca059 | 2008-12-19 17:09:38 -0800 | [diff] [blame] | 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 |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 219 | |
| 220 | } tEplEventSource; |
| 221 | |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 222 | // structure of EPL event (element order must not be changed!) |
Greg Kroah-Hartman | e0ca059 | 2008-12-19 17:09:38 -0800 | [diff] [blame] | 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 |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 229 | |
| 230 | } tEplEvent; |
| 231 | |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 232 | // short structure of EPL event without argument and its size (element order must not be changed!) |
Greg Kroah-Hartman | e0ca059 | 2008-12-19 17:09:38 -0800 | [diff] [blame] | 233 | typedef struct { |
| 234 | tEplEventType m_EventType /*:28 */ ; // event type |
| 235 | tEplEventSink m_EventSink /*:4 */ ; // event sink |
| 236 | tEplNetTime m_NetTime; // timestamp |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 237 | |
| 238 | } tEplEventShort; |
| 239 | |
Greg Kroah-Hartman | e0ca059 | 2008-12-19 17:09:38 -0800 | [diff] [blame] | 240 | typedef struct { |
| 241 | unsigned int m_uiIndex; |
| 242 | unsigned int m_uiSubIndex; |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 243 | |
| 244 | } tEplEventObdError; |
| 245 | |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 246 | // structure for kEplEventTypeError |
Greg Kroah-Hartman | e0ca059 | 2008-12-19 17:09:38 -0800 | [diff] [blame] | 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 |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 255 | // tEplErrHistoryEntry m_HistoryEntry; // from Nmtk/u module |
| 256 | |
Greg Kroah-Hartman | e0ca059 | 2008-12-19 17:09:38 -0800 | [diff] [blame] | 257 | } m_Arg; |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 258 | |
| 259 | } tEplEventError; |
| 260 | |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 261 | // structure for kEplEventTypeDllError |
Greg Kroah-Hartman | e0ca059 | 2008-12-19 17:09:38 -0800 | [diff] [blame] | 262 | typedef struct { |
| 263 | unsigned long m_ulDllErrorEvents; // EPL_DLL_ERR_* |
| 264 | unsigned int m_uiNodeId; |
| 265 | tEplNmtState m_NmtState; |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 266 | |
| 267 | } tEplErrorHandlerkEvent; |
| 268 | |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 269 | // callback function to get informed about sync event |
Greg Kroah-Hartman | e0ca059 | 2008-12-19 17:09:38 -0800 | [diff] [blame] | 270 | typedef tEplKernel(PUBLIC * tEplSyncCb) (void); |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 271 | |
| 272 | // callback function for generic events |
Greg Kroah-Hartman | e0ca059 | 2008-12-19 17:09:38 -0800 | [diff] [blame] | 273 | typedef tEplKernel(PUBLIC * tEplProcessEventCb) (tEplEvent * pEplEvent_p); |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 274 | |
| 275 | //--------------------------------------------------------------------------- |
| 276 | // function prototypes |
| 277 | //--------------------------------------------------------------------------- |
| 278 | |
Greg Kroah-Hartman | e0ca059 | 2008-12-19 17:09:38 -0800 | [diff] [blame] | 279 | #endif // #ifndef _EPL_EVENT_H_ |