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: source file for Epl-Userspace-Event-Modul |
| 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: EplEventu.c,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/20 k.t.: start of the implementation |
| 68 | |
| 69 | ****************************************************************************/ |
| 70 | |
| 71 | #include "user/EplEventu.h" |
| 72 | #include "user/EplNmtu.h" |
| 73 | #include "user/EplNmtMnu.h" |
| 74 | #include "user/EplSdoAsySequ.h" |
| 75 | #include "user/EplDlluCal.h" |
| 76 | #include "user/EplLedu.h" |
| 77 | #include "Benchmark.h" |
| 78 | |
| 79 | #ifdef EPL_NO_FIFO |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 80 | #include "kernel/EplEventk.h" |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 81 | #else |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 82 | #include "SharedBuff.h" |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 83 | #endif |
| 84 | |
| 85 | /***************************************************************************/ |
| 86 | /* */ |
| 87 | /* */ |
| 88 | /* G L O B A L D E F I N I T I O N S */ |
| 89 | /* */ |
| 90 | /* */ |
| 91 | /***************************************************************************/ |
| 92 | |
| 93 | //--------------------------------------------------------------------------- |
| 94 | // const defines |
| 95 | //--------------------------------------------------------------------------- |
| 96 | |
| 97 | // TracePoint support for realtime-debugging |
| 98 | #ifdef _DBG_TRACE_POINTS_ |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 99 | void PUBLIC TgtDbgSignalTracePoint(BYTE bTracePointNumber_p); |
| 100 | void PUBLIC TgtDbgPostTraceValue(DWORD dwTraceValue_p); |
| 101 | #define TGT_DBG_SIGNAL_TRACE_POINT(p) TgtDbgSignalTracePoint(p) |
| 102 | #define TGT_DBG_POST_TRACE_VALUE(v) TgtDbgPostTraceValue(v) |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 103 | #else |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 104 | #define TGT_DBG_SIGNAL_TRACE_POINT(p) |
| 105 | #define TGT_DBG_POST_TRACE_VALUE(v) |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 106 | #endif |
| 107 | |
| 108 | //--------------------------------------------------------------------------- |
| 109 | // local types |
| 110 | //--------------------------------------------------------------------------- |
| 111 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 112 | typedef struct { |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 113 | #ifndef EPL_NO_FIFO |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 114 | tShbInstance m_pShbKernelToUserInstance; |
| 115 | tShbInstance m_pShbUserToKernelInstance; |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 116 | #endif |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 117 | tEplProcessEventCb m_pfnApiProcessEventCb; |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 118 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 119 | } tEplEventuInstance; |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 120 | |
| 121 | //--------------------------------------------------------------------------- |
| 122 | // modul globale vars |
| 123 | //--------------------------------------------------------------------------- |
| 124 | |
| 125 | //#ifndef EPL_NO_FIFO |
| 126 | static tEplEventuInstance EplEventuInstance_g; |
| 127 | //#endif |
| 128 | |
| 129 | //--------------------------------------------------------------------------- |
| 130 | // local function prototypes |
| 131 | //--------------------------------------------------------------------------- |
| 132 | |
| 133 | #ifndef EPL_NO_FIFO |
| 134 | // callback function for incomming events |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 135 | static void EplEventuRxSignalHandlerCb(tShbInstance pShbRxInstance_p, |
| 136 | unsigned long ulDataSize_p); |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 137 | #endif |
| 138 | |
| 139 | /***************************************************************************/ |
| 140 | /* */ |
| 141 | /* */ |
| 142 | /* C L A S S <Epl-User-Event> */ |
| 143 | /* */ |
| 144 | /* */ |
| 145 | /***************************************************************************/ |
| 146 | // |
| 147 | // Description: |
| 148 | // |
| 149 | // |
| 150 | /***************************************************************************/ |
| 151 | |
| 152 | //=========================================================================// |
| 153 | // // |
| 154 | // P U B L I C F U N C T I O N S // |
| 155 | // // |
| 156 | //=========================================================================// |
| 157 | |
| 158 | //--------------------------------------------------------------------------- |
| 159 | // |
| 160 | // Function: EplEventuInit |
| 161 | // |
| 162 | // Description: function initialize the first instance |
| 163 | // |
| 164 | // |
| 165 | // |
| 166 | // Parameters: pfnApiProcessEventCb_p = function pointer for API event callback |
| 167 | // |
| 168 | // |
| 169 | // Returns: tEpKernel = errorcode |
| 170 | // |
| 171 | // |
| 172 | // State: |
| 173 | // |
| 174 | //--------------------------------------------------------------------------- |
| 175 | tEplKernel PUBLIC EplEventuInit(tEplProcessEventCb pfnApiProcessEventCb_p) |
| 176 | { |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 177 | tEplKernel Ret; |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 178 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 179 | Ret = EplEventuAddInstance(pfnApiProcessEventCb_p); |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 180 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 181 | return Ret; |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 182 | |
| 183 | } |
| 184 | |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 185 | //--------------------------------------------------------------------------- |
| 186 | // |
| 187 | // Function: EplEventuAddInstance |
| 188 | // |
| 189 | // Description: function add one more instance |
| 190 | // |
| 191 | // |
| 192 | // |
| 193 | // Parameters: pfnApiProcessEventCb_p = function pointer for API event callback |
| 194 | // |
| 195 | // |
| 196 | // Returns: tEpKernel = errorcode |
| 197 | // |
| 198 | // |
| 199 | // State: |
| 200 | // |
| 201 | //--------------------------------------------------------------------------- |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 202 | tEplKernel PUBLIC EplEventuAddInstance(tEplProcessEventCb |
| 203 | pfnApiProcessEventCb_p) |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 204 | { |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 205 | tEplKernel Ret; |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 206 | #ifndef EPL_NO_FIFO |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 207 | tShbError ShbError; |
| 208 | unsigned int fShbNewCreated; |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 209 | #endif |
| 210 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 211 | Ret = kEplSuccessful; |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 212 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 213 | // init instance variables |
| 214 | EplEventuInstance_g.m_pfnApiProcessEventCb = pfnApiProcessEventCb_p; |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 215 | |
| 216 | #ifndef EPL_NO_FIFO |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 217 | // init shared loop buffer |
| 218 | // kernel -> user |
| 219 | ShbError = ShbCirAllocBuffer(EPL_EVENT_SIZE_SHB_KERNEL_TO_USER, |
| 220 | EPL_EVENT_NAME_SHB_KERNEL_TO_USER, |
| 221 | &EplEventuInstance_g. |
| 222 | m_pShbKernelToUserInstance, |
| 223 | &fShbNewCreated); |
| 224 | if (ShbError != kShbOk) { |
| 225 | EPL_DBGLVL_EVENTK_TRACE1 |
| 226 | ("EplEventuAddInstance(): ShbCirAllocBuffer(K2U) -> 0x%X\n", |
| 227 | ShbError); |
| 228 | Ret = kEplNoResource; |
| 229 | goto Exit; |
| 230 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 231 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 232 | // user -> kernel |
| 233 | ShbError = ShbCirAllocBuffer(EPL_EVENT_SIZE_SHB_USER_TO_KERNEL, |
| 234 | EPL_EVENT_NAME_SHB_USER_TO_KERNEL, |
| 235 | &EplEventuInstance_g. |
| 236 | m_pShbUserToKernelInstance, |
| 237 | &fShbNewCreated); |
| 238 | if (ShbError != kShbOk) { |
| 239 | EPL_DBGLVL_EVENTK_TRACE1 |
| 240 | ("EplEventuAddInstance(): ShbCirAllocBuffer(U2K) -> 0x%X\n", |
| 241 | ShbError); |
| 242 | Ret = kEplNoResource; |
| 243 | goto Exit; |
| 244 | } |
| 245 | // register eventhandler |
| 246 | ShbError = |
| 247 | ShbCirSetSignalHandlerNewData(EplEventuInstance_g. |
| 248 | m_pShbKernelToUserInstance, |
| 249 | EplEventuRxSignalHandlerCb, |
| 250 | kShbPriorityNormal); |
| 251 | if (ShbError != kShbOk) { |
| 252 | EPL_DBGLVL_EVENTK_TRACE1 |
| 253 | ("EplEventuAddInstance(): ShbCirSetSignalHandlerNewData(K2U) -> 0x%X\n", |
| 254 | ShbError); |
| 255 | Ret = kEplNoResource; |
| 256 | goto Exit; |
| 257 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 258 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 259 | Exit: |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 260 | #endif |
| 261 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 262 | return Ret; |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 263 | |
| 264 | } |
| 265 | |
| 266 | //--------------------------------------------------------------------------- |
| 267 | // |
| 268 | // Function: EplEventuDelInstance |
| 269 | // |
| 270 | // Description: function delete instance an free the bufferstructure |
| 271 | // |
| 272 | // |
| 273 | // |
| 274 | // Parameters: |
| 275 | // |
| 276 | // |
| 277 | // Returns: tEpKernel = errorcode |
| 278 | // |
| 279 | // |
| 280 | // State: |
| 281 | // |
| 282 | //--------------------------------------------------------------------------- |
| 283 | tEplKernel PUBLIC EplEventuDelInstance() |
| 284 | { |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 285 | tEplKernel Ret; |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 286 | #ifndef EPL_NO_FIFO |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 287 | tShbError ShbError; |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 288 | #endif |
| 289 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 290 | Ret = kEplSuccessful; |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 291 | |
| 292 | #ifndef EPL_NO_FIFO |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 293 | // set eventhandler to NULL |
| 294 | ShbError = |
| 295 | ShbCirSetSignalHandlerNewData(EplEventuInstance_g. |
| 296 | m_pShbKernelToUserInstance, NULL, |
| 297 | kShbPriorityNormal); |
| 298 | if (ShbError != kShbOk) { |
| 299 | EPL_DBGLVL_EVENTK_TRACE1 |
| 300 | ("EplEventuDelInstance(): ShbCirSetSignalHandlerNewData(K2U) -> 0x%X\n", |
| 301 | ShbError); |
| 302 | Ret = kEplNoResource; |
| 303 | } |
| 304 | // free buffer User -> Kernel |
| 305 | ShbError = |
| 306 | ShbCirReleaseBuffer(EplEventuInstance_g.m_pShbUserToKernelInstance); |
| 307 | if ((ShbError != kShbOk) && (ShbError != kShbMemUsedByOtherProcs)) { |
| 308 | EPL_DBGLVL_EVENTK_TRACE1 |
| 309 | ("EplEventuDelInstance(): ShbCirReleaseBuffer(U2K) -> 0x%X\n", |
| 310 | ShbError); |
| 311 | Ret = kEplNoResource; |
| 312 | } else { |
| 313 | EplEventuInstance_g.m_pShbUserToKernelInstance = NULL; |
| 314 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 315 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 316 | // free buffer Kernel -> User |
| 317 | ShbError = |
| 318 | ShbCirReleaseBuffer(EplEventuInstance_g.m_pShbKernelToUserInstance); |
| 319 | if ((ShbError != kShbOk) && (ShbError != kShbMemUsedByOtherProcs)) { |
| 320 | EPL_DBGLVL_EVENTK_TRACE1 |
| 321 | ("EplEventuDelInstance(): ShbCirReleaseBuffer(K2U) -> 0x%X\n", |
| 322 | ShbError); |
| 323 | Ret = kEplNoResource; |
| 324 | } else { |
| 325 | EplEventuInstance_g.m_pShbKernelToUserInstance = NULL; |
| 326 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 327 | |
| 328 | #endif |
| 329 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 330 | return Ret; |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 331 | |
| 332 | } |
| 333 | |
| 334 | //--------------------------------------------------------------------------- |
| 335 | // |
| 336 | // Function: EplEventuProcess |
| 337 | // |
| 338 | // Description: Kernelthread that dispatches events in kernelspace |
| 339 | // |
| 340 | // |
| 341 | // |
| 342 | // Parameters: pEvent_p = pointer to event-structur from buffer |
| 343 | // |
| 344 | // |
| 345 | // Returns: tEpKernel = errorcode |
| 346 | // |
| 347 | // |
| 348 | // State: |
| 349 | // |
| 350 | //--------------------------------------------------------------------------- |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 351 | tEplKernel PUBLIC EplEventuProcess(tEplEvent * pEvent_p) |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 352 | { |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 353 | tEplKernel Ret; |
| 354 | tEplEventSource EventSource; |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 355 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 356 | Ret = kEplSuccessful; |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 357 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 358 | // check m_EventSink |
| 359 | switch (pEvent_p->m_EventSink) { |
| 360 | // NMT-User-Module |
| 361 | case kEplEventSinkNmtu: |
| 362 | { |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 363 | #if (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_NMTU)) != 0) |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 364 | Ret = EplNmtuProcessEvent(pEvent_p); |
| 365 | if ((Ret != kEplSuccessful) && (Ret != kEplShutdown)) { |
| 366 | EventSource = kEplEventSourceNmtu; |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 367 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 368 | // Error event for API layer |
| 369 | EplEventuPostError(kEplEventSourceEventu, |
| 370 | Ret, |
| 371 | sizeof(EventSource), |
| 372 | &EventSource); |
| 373 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 374 | #endif |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 375 | break; |
| 376 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 377 | |
| 378 | #if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_NMT_MN)) != 0) |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 379 | // NMT-MN-User-Module |
| 380 | case kEplEventSinkNmtMnu: |
| 381 | { |
| 382 | Ret = EplNmtMnuProcessEvent(pEvent_p); |
| 383 | if ((Ret != kEplSuccessful) && (Ret != kEplShutdown)) { |
| 384 | EventSource = kEplEventSourceNmtMnu; |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 385 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 386 | // Error event for API layer |
| 387 | EplEventuPostError(kEplEventSourceEventu, |
| 388 | Ret, |
| 389 | sizeof(EventSource), |
| 390 | &EventSource); |
| 391 | } |
| 392 | break; |
| 393 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 394 | #endif |
| 395 | |
| 396 | #if ((((EPL_MODULE_INTEGRATION) & (EPL_MODULE_SDOC)) != 0) \ |
| 397 | || (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_SDOS)) != 0)) |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 398 | // events for asynchronus SDO Sequence Layer |
| 399 | case kEplEventSinkSdoAsySeq: |
| 400 | { |
| 401 | Ret = EplSdoAsySeqProcessEvent(pEvent_p); |
| 402 | if ((Ret != kEplSuccessful) && (Ret != kEplShutdown)) { |
| 403 | EventSource = kEplEventSourceSdoAsySeq; |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 404 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 405 | // Error event for API layer |
| 406 | EplEventuPostError(kEplEventSourceEventu, |
| 407 | Ret, |
| 408 | sizeof(EventSource), |
| 409 | &EventSource); |
| 410 | } |
| 411 | break; |
| 412 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 413 | #endif |
| 414 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 415 | // LED user part module |
| 416 | case kEplEventSinkLedu: |
| 417 | { |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 418 | #if (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_LEDU)) != 0) |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 419 | Ret = EplLeduProcessEvent(pEvent_p); |
| 420 | if ((Ret != kEplSuccessful) && (Ret != kEplShutdown)) { |
| 421 | EventSource = kEplEventSourceLedu; |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 422 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 423 | // Error event for API layer |
| 424 | EplEventuPostError(kEplEventSourceEventu, |
| 425 | Ret, |
| 426 | sizeof(EventSource), |
| 427 | &EventSource); |
| 428 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 429 | #endif |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 430 | break; |
| 431 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 432 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 433 | // event for EPL api |
| 434 | case kEplEventSinkApi: |
| 435 | { |
| 436 | if (EplEventuInstance_g.m_pfnApiProcessEventCb != NULL) { |
| 437 | Ret = |
| 438 | EplEventuInstance_g. |
| 439 | m_pfnApiProcessEventCb(pEvent_p); |
| 440 | if ((Ret != kEplSuccessful) |
| 441 | && (Ret != kEplShutdown)) { |
| 442 | EventSource = kEplEventSourceEplApi; |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 443 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 444 | // Error event for API layer |
| 445 | EplEventuPostError |
| 446 | (kEplEventSourceEventu, Ret, |
| 447 | sizeof(EventSource), &EventSource); |
| 448 | } |
| 449 | } |
| 450 | break; |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 451 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 452 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 453 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 454 | case kEplEventSinkDlluCal: |
| 455 | { |
| 456 | Ret = EplDlluCalProcess(pEvent_p); |
| 457 | if ((Ret != kEplSuccessful) && (Ret != kEplShutdown)) { |
| 458 | EventSource = kEplEventSourceDllu; |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 459 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 460 | // Error event for API layer |
| 461 | EplEventuPostError(kEplEventSourceEventu, |
| 462 | Ret, |
| 463 | sizeof(EventSource), |
| 464 | &EventSource); |
| 465 | } |
| 466 | break; |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 467 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 468 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 469 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 470 | case kEplEventSinkErru: |
| 471 | { |
| 472 | /* |
| 473 | Ret = EplErruProcess(pEvent_p); |
| 474 | if ((Ret != kEplSuccessful) && (Ret != kEplShutdown)) |
| 475 | { |
| 476 | EventSource = kEplEventSourceErru; |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 477 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 478 | // Error event for API layer |
| 479 | EplEventuPostError(kEplEventSourceEventu, |
| 480 | Ret, |
| 481 | sizeof(EventSource), |
| 482 | &EventSource); |
| 483 | } |
| 484 | */ |
| 485 | break; |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 486 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 487 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 488 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 489 | // unknown sink |
| 490 | default: |
| 491 | { |
| 492 | Ret = kEplEventUnknownSink; |
| 493 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 494 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 495 | } // end of switch(pEvent_p->m_EventSink) |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 496 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 497 | return Ret; |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 498 | |
| 499 | } |
| 500 | |
| 501 | //--------------------------------------------------------------------------- |
| 502 | // |
| 503 | // Function: EplEventuPost |
| 504 | // |
| 505 | // Description: post events from userspace |
| 506 | // |
| 507 | // |
| 508 | // |
| 509 | // Parameters: pEvent_p = pointer to event-structur from buffer |
| 510 | // |
| 511 | // |
| 512 | // Returns: tEpKernel = errorcode |
| 513 | // |
| 514 | // |
| 515 | // State: |
| 516 | // |
| 517 | //--------------------------------------------------------------------------- |
| 518 | tEplKernel PUBLIC EplEventuPost(tEplEvent * pEvent_p) |
| 519 | { |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 520 | tEplKernel Ret; |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 521 | #ifndef EPL_NO_FIFO |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 522 | tShbError ShbError; |
| 523 | tShbCirChunk ShbCirChunk; |
| 524 | unsigned long ulDataSize; |
| 525 | unsigned int fBufferCompleted; |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 526 | #endif |
| 527 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 528 | Ret = kEplSuccessful; |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 529 | |
| 530 | #ifndef EPL_NO_FIFO |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 531 | // 2006/08/03 d.k.: Event and argument are posted as separate chunks to the event queue. |
| 532 | ulDataSize = |
| 533 | sizeof(tEplEvent) + |
| 534 | ((pEvent_p->m_pArg != NULL) ? pEvent_p->m_uiSize : 0); |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 535 | #endif |
| 536 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 537 | // decide in which buffer the event have to write |
| 538 | switch (pEvent_p->m_EventSink) { |
| 539 | // kernelspace modules |
| 540 | case kEplEventSinkSync: |
| 541 | case kEplEventSinkNmtk: |
| 542 | case kEplEventSinkDllk: |
| 543 | case kEplEventSinkDllkCal: |
| 544 | case kEplEventSinkPdok: |
| 545 | case kEplEventSinkErrk: |
| 546 | { |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 547 | #ifndef EPL_NO_FIFO |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 548 | // post message |
| 549 | ShbError = |
| 550 | ShbCirAllocDataBlock(EplEventuInstance_g. |
| 551 | m_pShbUserToKernelInstance, |
| 552 | &ShbCirChunk, ulDataSize); |
| 553 | if (ShbError != kShbOk) { |
| 554 | EPL_DBGLVL_EVENTK_TRACE1 |
| 555 | ("EplEventuPost(): ShbCirAllocDataBlock(U2K) -> 0x%X\n", |
| 556 | ShbError); |
| 557 | Ret = kEplEventPostError; |
| 558 | goto Exit; |
| 559 | } |
| 560 | ShbError = |
| 561 | ShbCirWriteDataChunk(EplEventuInstance_g. |
| 562 | m_pShbUserToKernelInstance, |
| 563 | &ShbCirChunk, pEvent_p, |
| 564 | sizeof(tEplEvent), |
| 565 | &fBufferCompleted); |
| 566 | if (ShbError != kShbOk) { |
| 567 | EPL_DBGLVL_EVENTK_TRACE1 |
| 568 | ("EplEventuPost(): ShbCirWriteDataChunk(U2K) -> 0x%X\n", |
| 569 | ShbError); |
| 570 | Ret = kEplEventPostError; |
| 571 | goto Exit; |
| 572 | } |
| 573 | if (fBufferCompleted == FALSE) { |
| 574 | ShbError = |
| 575 | ShbCirWriteDataChunk(EplEventuInstance_g. |
| 576 | m_pShbUserToKernelInstance, |
| 577 | &ShbCirChunk, |
| 578 | pEvent_p->m_pArg, |
| 579 | (unsigned long) |
| 580 | pEvent_p->m_uiSize, |
| 581 | &fBufferCompleted); |
| 582 | if ((ShbError != kShbOk) |
| 583 | || (fBufferCompleted == FALSE)) { |
| 584 | EPL_DBGLVL_EVENTK_TRACE1 |
| 585 | ("EplEventuPost(): ShbCirWriteDataChunk2(U2K) -> 0x%X\n", |
| 586 | ShbError); |
| 587 | Ret = kEplEventPostError; |
| 588 | goto Exit; |
| 589 | } |
| 590 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 591 | #else |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 592 | Ret = EplEventkProcess(pEvent_p); |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 593 | #endif |
| 594 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 595 | break; |
| 596 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 597 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 598 | // userspace modules |
| 599 | case kEplEventSinkNmtMnu: |
| 600 | case kEplEventSinkNmtu: |
| 601 | case kEplEventSinkSdoAsySeq: |
| 602 | case kEplEventSinkApi: |
| 603 | case kEplEventSinkDlluCal: |
| 604 | case kEplEventSinkErru: |
| 605 | case kEplEventSinkLedu: |
| 606 | { |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 607 | #ifndef EPL_NO_FIFO |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 608 | // post message |
| 609 | ShbError = |
| 610 | ShbCirAllocDataBlock(EplEventuInstance_g. |
| 611 | m_pShbKernelToUserInstance, |
| 612 | &ShbCirChunk, ulDataSize); |
| 613 | if (ShbError != kShbOk) { |
| 614 | EPL_DBGLVL_EVENTK_TRACE1 |
| 615 | ("EplEventuPost(): ShbCirAllocDataBlock(K2U) -> 0x%X\n", |
| 616 | ShbError); |
| 617 | Ret = kEplEventPostError; |
| 618 | goto Exit; |
| 619 | } |
| 620 | ShbError = |
| 621 | ShbCirWriteDataChunk(EplEventuInstance_g. |
| 622 | m_pShbKernelToUserInstance, |
| 623 | &ShbCirChunk, pEvent_p, |
| 624 | sizeof(tEplEvent), |
| 625 | &fBufferCompleted); |
| 626 | if (ShbError != kShbOk) { |
| 627 | EPL_DBGLVL_EVENTK_TRACE1 |
| 628 | ("EplEventuPost(): ShbCirWriteDataChunk(K2U) -> 0x%X\n", |
| 629 | ShbError); |
| 630 | Ret = kEplEventPostError; |
| 631 | goto Exit; |
| 632 | } |
| 633 | if (fBufferCompleted == FALSE) { |
| 634 | ShbError = |
| 635 | ShbCirWriteDataChunk(EplEventuInstance_g. |
| 636 | m_pShbKernelToUserInstance, |
| 637 | &ShbCirChunk, |
| 638 | pEvent_p->m_pArg, |
| 639 | (unsigned long) |
| 640 | pEvent_p->m_uiSize, |
| 641 | &fBufferCompleted); |
| 642 | if ((ShbError != kShbOk) |
| 643 | || (fBufferCompleted == FALSE)) { |
| 644 | EPL_DBGLVL_EVENTK_TRACE1 |
| 645 | ("EplEventuPost(): ShbCirWriteDataChunk2(K2U) -> 0x%X\n", |
| 646 | ShbError); |
| 647 | Ret = kEplEventPostError; |
| 648 | goto Exit; |
| 649 | } |
| 650 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 651 | #else |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 652 | Ret = EplEventuProcess(pEvent_p); |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 653 | #endif |
| 654 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 655 | break; |
| 656 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 657 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 658 | default: |
| 659 | { |
| 660 | Ret = kEplEventUnknownSink; |
| 661 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 662 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 663 | } // end of switch(pEvent_p->m_EventSink) |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 664 | |
| 665 | #ifndef EPL_NO_FIFO |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 666 | Exit: |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 667 | #endif |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 668 | return Ret; |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 669 | |
| 670 | } |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 671 | |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 672 | //--------------------------------------------------------------------------- |
| 673 | // |
| 674 | // Function: EplEventuPostError |
| 675 | // |
| 676 | // Description: post errorevent from userspace |
| 677 | // |
| 678 | // |
| 679 | // |
| 680 | // Parameters: EventSource_p = source-module of the errorevent |
| 681 | // EplError_p = code of occured error |
| 682 | // uiArgSize_p = size of the argument |
| 683 | // pArg_p = pointer to the argument |
| 684 | // |
| 685 | // |
| 686 | // Returns: tEpKernel = errorcode |
| 687 | // |
| 688 | // |
| 689 | // State: |
| 690 | // |
| 691 | //--------------------------------------------------------------------------- |
| 692 | tEplKernel PUBLIC EplEventuPostError(tEplEventSource EventSource_p, |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 693 | tEplKernel EplError_p, |
| 694 | unsigned int uiArgSize_p, void *pArg_p) |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 695 | { |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 696 | tEplKernel Ret; |
| 697 | BYTE abBuffer[EPL_MAX_EVENT_ARG_SIZE]; |
| 698 | tEplEventError *pEventError = (tEplEventError *) abBuffer; |
| 699 | tEplEvent EplEvent; |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 700 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 701 | Ret = kEplSuccessful; |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 702 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 703 | // create argument |
| 704 | pEventError->m_EventSource = EventSource_p; |
| 705 | pEventError->m_EplError = EplError_p; |
| 706 | EPL_MEMCPY(&pEventError->m_Arg, pArg_p, uiArgSize_p); |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 707 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 708 | // create event |
| 709 | EplEvent.m_EventType = kEplEventTypeError; |
| 710 | EplEvent.m_EventSink = kEplEventSinkApi; |
| 711 | EPL_MEMSET(&EplEvent.m_NetTime, 0x00, sizeof(EplEvent.m_NetTime)); |
| 712 | EplEvent.m_uiSize = |
| 713 | (sizeof(EventSource_p) + sizeof(EplError_p) + uiArgSize_p); |
| 714 | EplEvent.m_pArg = &abBuffer[0]; |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 715 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 716 | // post errorevent |
| 717 | Ret = EplEventuPost(&EplEvent); |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 718 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 719 | return Ret; |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 720 | } |
| 721 | |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 722 | //=========================================================================// |
| 723 | // // |
| 724 | // P R I V A T E F U N C T I O N S // |
| 725 | // // |
| 726 | //=========================================================================// |
| 727 | |
| 728 | //--------------------------------------------------------------------------- |
| 729 | // |
| 730 | // Function: EplEventuRxSignalHandlerCb() |
| 731 | // |
| 732 | // Description: Callback-function for evets from kernelspace |
| 733 | // |
| 734 | // |
| 735 | // |
| 736 | // Parameters: pShbRxInstance_p = Instance-pointer for buffer |
| 737 | // ulDataSize_p = size of data |
| 738 | // |
| 739 | // |
| 740 | // Returns: void |
| 741 | // |
| 742 | // |
| 743 | // State: |
| 744 | // |
| 745 | //--------------------------------------------------------------------------- |
| 746 | #ifndef EPL_NO_FIFO |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 747 | static void EplEventuRxSignalHandlerCb(tShbInstance pShbRxInstance_p, |
| 748 | unsigned long ulDataSize_p) |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 749 | { |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 750 | tEplEvent *pEplEvent; |
| 751 | tShbError ShbError; |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 752 | //unsigned long ulBlockCount; |
| 753 | //unsigned long ulDataSize; |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 754 | BYTE abDataBuffer[sizeof(tEplEvent) + EPL_MAX_EVENT_ARG_SIZE]; |
| 755 | // d.k.: abDataBuffer contains the complete tEplEvent structure |
| 756 | // and behind this the argument |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 757 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 758 | TGT_DBG_SIGNAL_TRACE_POINT(21); |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 759 | |
| 760 | // d.k. not needed because it is already done in SharedBuff |
| 761 | /* do |
| 762 | { |
| 763 | BENCHMARK_MOD_28_SET(1); // 4 µs until reset |
| 764 | // get messagesize |
| 765 | ShbError = ShbCirGetReadDataSize (pShbRxInstance_p, &ulDataSize); |
| 766 | if(ShbError != kShbOk) |
| 767 | { |
| 768 | // error goto exit |
| 769 | goto Exit; |
| 770 | } |
| 771 | |
| 772 | BENCHMARK_MOD_28_RESET(1); // 14 µs until set |
| 773 | */ |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 774 | // copy data from event queue |
| 775 | ShbError = ShbCirReadDataBlock(pShbRxInstance_p, |
| 776 | &abDataBuffer[0], |
| 777 | sizeof(abDataBuffer), &ulDataSize_p); |
| 778 | if (ShbError != kShbOk) { |
| 779 | // error goto exit |
| 780 | goto Exit; |
| 781 | } |
| 782 | // resolve the pointer to the event structure |
| 783 | pEplEvent = (tEplEvent *) abDataBuffer; |
| 784 | // set Datasize |
| 785 | pEplEvent->m_uiSize = (ulDataSize_p - sizeof(tEplEvent)); |
| 786 | if (pEplEvent->m_uiSize > 0) { |
| 787 | // set pointer to argument |
| 788 | pEplEvent->m_pArg = &abDataBuffer[sizeof(tEplEvent)]; |
| 789 | } else { |
| 790 | //set pointer to NULL |
| 791 | pEplEvent->m_pArg = NULL; |
| 792 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 793 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 794 | BENCHMARK_MOD_28_SET(1); |
| 795 | // call processfunction |
| 796 | EplEventuProcess(pEplEvent); |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 797 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 798 | BENCHMARK_MOD_28_RESET(1); |
| 799 | // read number of left messages to process |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 800 | // d.k. not needed because it is already done in SharedBuff |
| 801 | /* ShbError = ShbCirGetReadBlockCount (pShbRxInstance_p, &ulBlockCount); |
| 802 | if (ShbError != kShbOk) |
| 803 | { |
| 804 | // error goto exit |
| 805 | goto Exit; |
| 806 | } |
| 807 | } while (ulBlockCount > 0); |
| 808 | */ |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 809 | Exit: |
| 810 | return; |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 811 | } |
| 812 | #endif |
| 813 | |
| 814 | // EOF |