aboutsummaryrefslogtreecommitdiff
path: root/drivers/staging/epl/EplEventu.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/staging/epl/EplEventu.c')
-rw-r--r--drivers/staging/epl/EplEventu.c863
1 files changed, 432 insertions, 431 deletions
diff --git a/drivers/staging/epl/EplEventu.c b/drivers/staging/epl/EplEventu.c
index cb0215a1754..815f9a87abf 100644
--- a/drivers/staging/epl/EplEventu.c
+++ b/drivers/staging/epl/EplEventu.c
@@ -77,9 +77,9 @@
#include "Benchmark.h"
#ifdef EPL_NO_FIFO
- #include "kernel/EplEventk.h"
+#include "kernel/EplEventk.h"
#else
- #include "SharedBuff.h"
+#include "SharedBuff.h"
#endif
/***************************************************************************/
@@ -96,28 +96,27 @@
// TracePoint support for realtime-debugging
#ifdef _DBG_TRACE_POINTS_
- void PUBLIC TgtDbgSignalTracePoint (BYTE bTracePointNumber_p);
- void PUBLIC TgtDbgPostTraceValue (DWORD dwTraceValue_p);
- #define TGT_DBG_SIGNAL_TRACE_POINT(p) TgtDbgSignalTracePoint(p)
- #define TGT_DBG_POST_TRACE_VALUE(v) TgtDbgPostTraceValue(v)
+void PUBLIC TgtDbgSignalTracePoint(BYTE bTracePointNumber_p);
+void PUBLIC TgtDbgPostTraceValue(DWORD dwTraceValue_p);
+#define TGT_DBG_SIGNAL_TRACE_POINT(p) TgtDbgSignalTracePoint(p)
+#define TGT_DBG_POST_TRACE_VALUE(v) TgtDbgPostTraceValue(v)
#else
- #define TGT_DBG_SIGNAL_TRACE_POINT(p)
- #define TGT_DBG_POST_TRACE_VALUE(v)
+#define TGT_DBG_SIGNAL_TRACE_POINT(p)
+#define TGT_DBG_POST_TRACE_VALUE(v)
#endif
//---------------------------------------------------------------------------
// local types
//---------------------------------------------------------------------------
-typedef struct
-{
+typedef struct {
#ifndef EPL_NO_FIFO
- tShbInstance m_pShbKernelToUserInstance;
- tShbInstance m_pShbUserToKernelInstance;
+ tShbInstance m_pShbKernelToUserInstance;
+ tShbInstance m_pShbUserToKernelInstance;
#endif
- tEplProcessEventCb m_pfnApiProcessEventCb;
+ tEplProcessEventCb m_pfnApiProcessEventCb;
-}tEplEventuInstance;
+} tEplEventuInstance;
//---------------------------------------------------------------------------
// modul globale vars
@@ -133,9 +132,8 @@ static tEplEventuInstance EplEventuInstance_g;
#ifndef EPL_NO_FIFO
// callback function for incomming events
-static void EplEventuRxSignalHandlerCb (
- tShbInstance pShbRxInstance_p,
- unsigned long ulDataSize_p);
+static void EplEventuRxSignalHandlerCb(tShbInstance pShbRxInstance_p,
+ unsigned long ulDataSize_p);
#endif
/***************************************************************************/
@@ -176,17 +174,14 @@ static void EplEventuRxSignalHandlerCb (
//---------------------------------------------------------------------------
tEplKernel PUBLIC EplEventuInit(tEplProcessEventCb pfnApiProcessEventCb_p)
{
-tEplKernel Ret;
-
-
- Ret = EplEventuAddInstance(pfnApiProcessEventCb_p);
+ tEplKernel Ret;
+ Ret = EplEventuAddInstance(pfnApiProcessEventCb_p);
-return Ret;
+ return Ret;
}
-
//---------------------------------------------------------------------------
//
// Function: EplEventuAddInstance
@@ -204,62 +199,67 @@ return Ret;
// State:
//
//---------------------------------------------------------------------------
-tEplKernel PUBLIC EplEventuAddInstance(tEplProcessEventCb pfnApiProcessEventCb_p)
+tEplKernel PUBLIC EplEventuAddInstance(tEplProcessEventCb
+ pfnApiProcessEventCb_p)
{
-tEplKernel Ret;
+ tEplKernel Ret;
#ifndef EPL_NO_FIFO
-tShbError ShbError;
-unsigned int fShbNewCreated;
+ tShbError ShbError;
+ unsigned int fShbNewCreated;
#endif
- Ret = kEplSuccessful;
-
+ Ret = kEplSuccessful;
- // init instance variables
- EplEventuInstance_g.m_pfnApiProcessEventCb = pfnApiProcessEventCb_p;
+ // init instance variables
+ EplEventuInstance_g.m_pfnApiProcessEventCb = pfnApiProcessEventCb_p;
#ifndef EPL_NO_FIFO
- // init shared loop buffer
- // kernel -> user
- ShbError = ShbCirAllocBuffer (EPL_EVENT_SIZE_SHB_KERNEL_TO_USER,
- EPL_EVENT_NAME_SHB_KERNEL_TO_USER,
- &EplEventuInstance_g.m_pShbKernelToUserInstance,
- &fShbNewCreated);
- if(ShbError != kShbOk)
- {
- EPL_DBGLVL_EVENTK_TRACE1("EplEventuAddInstance(): ShbCirAllocBuffer(K2U) -> 0x%X\n", ShbError);
- Ret = kEplNoResource;
- goto Exit;
- }
-
-
- // user -> kernel
- ShbError = ShbCirAllocBuffer (EPL_EVENT_SIZE_SHB_USER_TO_KERNEL,
- EPL_EVENT_NAME_SHB_USER_TO_KERNEL,
- &EplEventuInstance_g.m_pShbUserToKernelInstance,
- &fShbNewCreated);
- if(ShbError != kShbOk)
- {
- EPL_DBGLVL_EVENTK_TRACE1("EplEventuAddInstance(): ShbCirAllocBuffer(U2K) -> 0x%X\n", ShbError);
- Ret = kEplNoResource;
- goto Exit;
- }
-
- // register eventhandler
- ShbError = ShbCirSetSignalHandlerNewData (EplEventuInstance_g.m_pShbKernelToUserInstance,
- EplEventuRxSignalHandlerCb,
- kShbPriorityNormal);
- if(ShbError != kShbOk)
- {
- EPL_DBGLVL_EVENTK_TRACE1("EplEventuAddInstance(): ShbCirSetSignalHandlerNewData(K2U) -> 0x%X\n", ShbError);
- Ret = kEplNoResource;
- goto Exit;
- }
-
-Exit:
+ // init shared loop buffer
+ // kernel -> user
+ ShbError = ShbCirAllocBuffer(EPL_EVENT_SIZE_SHB_KERNEL_TO_USER,
+ EPL_EVENT_NAME_SHB_KERNEL_TO_USER,
+ &EplEventuInstance_g.
+ m_pShbKernelToUserInstance,
+ &fShbNewCreated);
+ if (ShbError != kShbOk) {
+ EPL_DBGLVL_EVENTK_TRACE1
+ ("EplEventuAddInstance(): ShbCirAllocBuffer(K2U) -> 0x%X\n",
+ ShbError);
+ Ret = kEplNoResource;
+ goto Exit;
+ }
+
+ // user -> kernel
+ ShbError = ShbCirAllocBuffer(EPL_EVENT_SIZE_SHB_USER_TO_KERNEL,
+ EPL_EVENT_NAME_SHB_USER_TO_KERNEL,
+ &EplEventuInstance_g.
+ m_pShbUserToKernelInstance,
+ &fShbNewCreated);
+ if (ShbError != kShbOk) {
+ EPL_DBGLVL_EVENTK_TRACE1
+ ("EplEventuAddInstance(): ShbCirAllocBuffer(U2K) -> 0x%X\n",
+ ShbError);
+ Ret = kEplNoResource;
+ goto Exit;
+ }
+ // register eventhandler
+ ShbError =
+ ShbCirSetSignalHandlerNewData(EplEventuInstance_g.
+ m_pShbKernelToUserInstance,
+ EplEventuRxSignalHandlerCb,
+ kShbPriorityNormal);
+ if (ShbError != kShbOk) {
+ EPL_DBGLVL_EVENTK_TRACE1
+ ("EplEventuAddInstance(): ShbCirSetSignalHandlerNewData(K2U) -> 0x%X\n",
+ ShbError);
+ Ret = kEplNoResource;
+ goto Exit;
+ }
+
+ Exit:
#endif
- return Ret;
+ return Ret;
}
@@ -282,51 +282,52 @@ Exit:
//---------------------------------------------------------------------------
tEplKernel PUBLIC EplEventuDelInstance()
{
-tEplKernel Ret;
+ tEplKernel Ret;
#ifndef EPL_NO_FIFO
-tShbError ShbError;
+ tShbError ShbError;
#endif
- Ret = kEplSuccessful;
+ Ret = kEplSuccessful;
#ifndef EPL_NO_FIFO
- // set eventhandler to NULL
- ShbError = ShbCirSetSignalHandlerNewData (EplEventuInstance_g.m_pShbKernelToUserInstance,
- NULL,
- kShbPriorityNormal);
- if(ShbError != kShbOk)
- {
- EPL_DBGLVL_EVENTK_TRACE1("EplEventuDelInstance(): ShbCirSetSignalHandlerNewData(K2U) -> 0x%X\n", ShbError);
- Ret = kEplNoResource;
- }
-
- // free buffer User -> Kernel
- ShbError = ShbCirReleaseBuffer (EplEventuInstance_g.m_pShbUserToKernelInstance);
- if((ShbError != kShbOk) && (ShbError != kShbMemUsedByOtherProcs))
- {
- EPL_DBGLVL_EVENTK_TRACE1("EplEventuDelInstance(): ShbCirReleaseBuffer(U2K) -> 0x%X\n", ShbError);
- Ret = kEplNoResource;
- }
- else
- {
- EplEventuInstance_g.m_pShbUserToKernelInstance = NULL;
- }
-
- // free buffer Kernel -> User
- ShbError = ShbCirReleaseBuffer (EplEventuInstance_g.m_pShbKernelToUserInstance);
- if((ShbError != kShbOk) && (ShbError != kShbMemUsedByOtherProcs))
- {
- EPL_DBGLVL_EVENTK_TRACE1("EplEventuDelInstance(): ShbCirReleaseBuffer(K2U) -> 0x%X\n", ShbError);
- Ret = kEplNoResource;
- }
- else
- {
- EplEventuInstance_g.m_pShbKernelToUserInstance = NULL;
- }
+ // set eventhandler to NULL
+ ShbError =
+ ShbCirSetSignalHandlerNewData(EplEventuInstance_g.
+ m_pShbKernelToUserInstance, NULL,
+ kShbPriorityNormal);
+ if (ShbError != kShbOk) {
+ EPL_DBGLVL_EVENTK_TRACE1
+ ("EplEventuDelInstance(): ShbCirSetSignalHandlerNewData(K2U) -> 0x%X\n",
+ ShbError);
+ Ret = kEplNoResource;
+ }
+ // free buffer User -> Kernel
+ ShbError =
+ ShbCirReleaseBuffer(EplEventuInstance_g.m_pShbUserToKernelInstance);
+ if ((ShbError != kShbOk) && (ShbError != kShbMemUsedByOtherProcs)) {
+ EPL_DBGLVL_EVENTK_TRACE1
+ ("EplEventuDelInstance(): ShbCirReleaseBuffer(U2K) -> 0x%X\n",
+ ShbError);
+ Ret = kEplNoResource;
+ } else {
+ EplEventuInstance_g.m_pShbUserToKernelInstance = NULL;
+ }
+
+ // free buffer Kernel -> User
+ ShbError =
+ ShbCirReleaseBuffer(EplEventuInstance_g.m_pShbKernelToUserInstance);
+ if ((ShbError != kShbOk) && (ShbError != kShbMemUsedByOtherProcs)) {
+ EPL_DBGLVL_EVENTK_TRACE1
+ ("EplEventuDelInstance(): ShbCirReleaseBuffer(K2U) -> 0x%X\n",
+ ShbError);
+ Ret = kEplNoResource;
+ } else {
+ EplEventuInstance_g.m_pShbKernelToUserInstance = NULL;
+ }
#endif
-return Ret;
+ return Ret;
}
@@ -347,159 +348,153 @@ return Ret;
// State:
//
//---------------------------------------------------------------------------
-tEplKernel PUBLIC EplEventuProcess(tEplEvent* pEvent_p)
+tEplKernel PUBLIC EplEventuProcess(tEplEvent * pEvent_p)
{
-tEplKernel Ret;
-tEplEventSource EventSource;
+ tEplKernel Ret;
+ tEplEventSource EventSource;
- Ret = kEplSuccessful;
+ Ret = kEplSuccessful;
- // check m_EventSink
- switch(pEvent_p->m_EventSink)
- {
- // NMT-User-Module
- case kEplEventSinkNmtu:
- {
+ // check m_EventSink
+ switch (pEvent_p->m_EventSink) {
+ // NMT-User-Module
+ case kEplEventSinkNmtu:
+ {
#if (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_NMTU)) != 0)
- Ret = EplNmtuProcessEvent(pEvent_p);
- if ((Ret != kEplSuccessful) && (Ret != kEplShutdown))
- {
- EventSource = kEplEventSourceNmtu;
-
- // Error event for API layer
- EplEventuPostError(kEplEventSourceEventu,
- Ret,
- sizeof(EventSource),
- &EventSource);
- }
+ Ret = EplNmtuProcessEvent(pEvent_p);
+ if ((Ret != kEplSuccessful) && (Ret != kEplShutdown)) {
+ EventSource = kEplEventSourceNmtu;
+
+ // Error event for API layer
+ EplEventuPostError(kEplEventSourceEventu,
+ Ret,
+ sizeof(EventSource),
+ &EventSource);
+ }
#endif
- break;
- }
+ break;
+ }
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_NMT_MN)) != 0)
- // NMT-MN-User-Module
- case kEplEventSinkNmtMnu:
- {
- Ret = EplNmtMnuProcessEvent(pEvent_p);
- if ((Ret != kEplSuccessful) && (Ret != kEplShutdown))
- {
- EventSource = kEplEventSourceNmtMnu;
-
- // Error event for API layer
- EplEventuPostError(kEplEventSourceEventu,
- Ret,
- sizeof(EventSource),
- &EventSource);
- }
- break;
- }
+ // NMT-MN-User-Module
+ case kEplEventSinkNmtMnu:
+ {
+ Ret = EplNmtMnuProcessEvent(pEvent_p);
+ if ((Ret != kEplSuccessful) && (Ret != kEplShutdown)) {
+ EventSource = kEplEventSourceNmtMnu;
+
+ // Error event for API layer
+ EplEventuPostError(kEplEventSourceEventu,
+ Ret,
+ sizeof(EventSource),
+ &EventSource);
+ }
+ break;
+ }
#endif
#if ((((EPL_MODULE_INTEGRATION) & (EPL_MODULE_SDOC)) != 0) \
|| (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_SDOS)) != 0))
- // events for asynchronus SDO Sequence Layer
- case kEplEventSinkSdoAsySeq:
- {
- Ret = EplSdoAsySeqProcessEvent(pEvent_p);
- if ((Ret != kEplSuccessful) && (Ret != kEplShutdown))
- {
- EventSource = kEplEventSourceSdoAsySeq;
-
- // Error event for API layer
- EplEventuPostError(kEplEventSourceEventu,
- Ret,
- sizeof(EventSource),
- &EventSource);
- }
- break;
- }
+ // events for asynchronus SDO Sequence Layer
+ case kEplEventSinkSdoAsySeq:
+ {
+ Ret = EplSdoAsySeqProcessEvent(pEvent_p);
+ if ((Ret != kEplSuccessful) && (Ret != kEplShutdown)) {
+ EventSource = kEplEventSourceSdoAsySeq;
+
+ // Error event for API layer
+ EplEventuPostError(kEplEventSourceEventu,
+ Ret,
+ sizeof(EventSource),
+ &EventSource);
+ }
+ break;
+ }
#endif
- // LED user part module
- case kEplEventSinkLedu:
- {
+ // LED user part module
+ case kEplEventSinkLedu:
+ {
#if (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_LEDU)) != 0)
- Ret = EplLeduProcessEvent(pEvent_p);
- if ((Ret != kEplSuccessful) && (Ret != kEplShutdown))
- {
- EventSource = kEplEventSourceLedu;
-
- // Error event for API layer
- EplEventuPostError(kEplEventSourceEventu,
- Ret,
- sizeof(EventSource),
- &EventSource);
- }
+ Ret = EplLeduProcessEvent(pEvent_p);
+ if ((Ret != kEplSuccessful) && (Ret != kEplShutdown)) {
+ EventSource = kEplEventSourceLedu;
+
+ // Error event for API layer
+ EplEventuPostError(kEplEventSourceEventu,
+ Ret,
+ sizeof(EventSource),
+ &EventSource);
+ }
#endif
- break;
- }
-
- // event for EPL api
- case kEplEventSinkApi:
- {
- if (EplEventuInstance_g.m_pfnApiProcessEventCb != NULL)
- {
- Ret = EplEventuInstance_g.m_pfnApiProcessEventCb(pEvent_p);
- if ((Ret != kEplSuccessful) && (Ret != kEplShutdown))
- {
- EventSource = kEplEventSourceEplApi;
-
- // Error event for API layer
- EplEventuPostError(kEplEventSourceEventu,
- Ret,
- sizeof(EventSource),
- &EventSource);
- }
- }
- break;
-
- }
-
- case kEplEventSinkDlluCal:
- {
- Ret = EplDlluCalProcess(pEvent_p);
- if ((Ret != kEplSuccessful) && (Ret != kEplShutdown))
- {
- EventSource = kEplEventSourceDllu;
-
- // Error event for API layer
- EplEventuPostError(kEplEventSourceEventu,
- Ret,
- sizeof(EventSource),
- &EventSource);
- }
- break;
-
- }
-
- case kEplEventSinkErru:
- {
- /*
- Ret = EplErruProcess(pEvent_p);
- if ((Ret != kEplSuccessful) && (Ret != kEplShutdown))
- {
- EventSource = kEplEventSourceErru;
-
- // Error event for API layer
- EplEventuPostError(kEplEventSourceEventu,
- Ret,
- sizeof(EventSource),
- &EventSource);
- }
- */
- break;
-
- }
-
- // unknown sink
- default:
- {
- Ret = kEplEventUnknownSink;
- }
-
- } // end of switch(pEvent_p->m_EventSink)
-
- return Ret;
+ break;
+ }
+
+ // event for EPL api
+ case kEplEventSinkApi:
+ {
+ if (EplEventuInstance_g.m_pfnApiProcessEventCb != NULL) {
+ Ret =
+ EplEventuInstance_g.
+ m_pfnApiProcessEventCb(pEvent_p);
+ if ((Ret != kEplSuccessful)
+ && (Ret != kEplShutdown)) {
+ EventSource = kEplEventSourceEplApi;
+
+ // Error event for API layer
+ EplEventuPostError
+ (kEplEventSourceEventu, Ret,
+ sizeof(EventSource), &EventSource);
+ }
+ }
+ break;
+
+ }
+
+ case kEplEventSinkDlluCal:
+ {
+ Ret = EplDlluCalProcess(pEvent_p);
+ if ((Ret != kEplSuccessful) && (Ret != kEplShutdown)) {
+ EventSource = kEplEventSourceDllu;
+
+ // Error event for API layer
+ EplEventuPostError(kEplEventSourceEventu,
+ Ret,
+ sizeof(EventSource),
+ &EventSource);
+ }
+ break;
+
+ }
+
+ case kEplEventSinkErru:
+ {
+ /*
+ Ret = EplErruProcess(pEvent_p);
+ if ((Ret != kEplSuccessful) && (Ret != kEplShutdown))
+ {
+ EventSource = kEplEventSourceErru;
+
+ // Error event for API layer
+ EplEventuPostError(kEplEventSourceEventu,
+ Ret,
+ sizeof(EventSource),
+ &EventSource);
+ }
+ */
+ break;
+
+ }
+
+ // unknown sink
+ default:
+ {
+ Ret = kEplEventUnknownSink;
+ }
+
+ } // end of switch(pEvent_p->m_EventSink)
+
+ return Ret;
}
@@ -522,143 +517,158 @@ tEplEventSource EventSource;
//---------------------------------------------------------------------------
tEplKernel PUBLIC EplEventuPost(tEplEvent * pEvent_p)
{
-tEplKernel Ret;
+ tEplKernel Ret;
#ifndef EPL_NO_FIFO
-tShbError ShbError;
-tShbCirChunk ShbCirChunk;
-unsigned long ulDataSize;
-unsigned int fBufferCompleted;
+ tShbError ShbError;
+ tShbCirChunk ShbCirChunk;
+ unsigned long ulDataSize;
+ unsigned int fBufferCompleted;
#endif
- Ret = kEplSuccessful;
-
+ Ret = kEplSuccessful;
#ifndef EPL_NO_FIFO
- // 2006/08/03 d.k.: Event and argument are posted as separate chunks to the event queue.
- ulDataSize = sizeof(tEplEvent) + ((pEvent_p->m_pArg != NULL) ? pEvent_p->m_uiSize : 0);
+ // 2006/08/03 d.k.: Event and argument are posted as separate chunks to the event queue.
+ ulDataSize =
+ sizeof(tEplEvent) +
+ ((pEvent_p->m_pArg != NULL) ? pEvent_p->m_uiSize : 0);
#endif
- // decide in which buffer the event have to write
- switch(pEvent_p->m_EventSink)
- {
- // kernelspace modules
- case kEplEventSinkSync:
- case kEplEventSinkNmtk:
- case kEplEventSinkDllk:
- case kEplEventSinkDllkCal:
- case kEplEventSinkPdok:
- case kEplEventSinkErrk:
- {
+ // decide in which buffer the event have to write
+ switch (pEvent_p->m_EventSink) {
+ // kernelspace modules
+ case kEplEventSinkSync:
+ case kEplEventSinkNmtk:
+ case kEplEventSinkDllk:
+ case kEplEventSinkDllkCal:
+ case kEplEventSinkPdok:
+ case kEplEventSinkErrk:
+ {
#ifndef EPL_NO_FIFO
- // post message
- ShbError = ShbCirAllocDataBlock (EplEventuInstance_g.m_pShbUserToKernelInstance,
- &ShbCirChunk,
- ulDataSize);
- if (ShbError != kShbOk)
- {
- EPL_DBGLVL_EVENTK_TRACE1("EplEventuPost(): ShbCirAllocDataBlock(U2K) -> 0x%X\n", ShbError);
- Ret = kEplEventPostError;
- goto Exit;
- }
- ShbError = ShbCirWriteDataChunk (EplEventuInstance_g.m_pShbUserToKernelInstance,
- &ShbCirChunk,
- pEvent_p,
- sizeof (tEplEvent),
- &fBufferCompleted);
- if (ShbError != kShbOk)
- {
- EPL_DBGLVL_EVENTK_TRACE1("EplEventuPost(): ShbCirWriteDataChunk(U2K) -> 0x%X\n", ShbError);
- Ret = kEplEventPostError;
- goto Exit;
- }
- if (fBufferCompleted == FALSE)
- {
- ShbError = ShbCirWriteDataChunk (EplEventuInstance_g.m_pShbUserToKernelInstance,
- &ShbCirChunk,
- pEvent_p->m_pArg,
- (unsigned long) pEvent_p->m_uiSize,
- &fBufferCompleted);
- if ((ShbError != kShbOk) || (fBufferCompleted == FALSE))
- {
- EPL_DBGLVL_EVENTK_TRACE1("EplEventuPost(): ShbCirWriteDataChunk2(U2K) -> 0x%X\n", ShbError);
- Ret = kEplEventPostError;
- goto Exit;
- }
- }
+ // post message
+ ShbError =
+ ShbCirAllocDataBlock(EplEventuInstance_g.
+ m_pShbUserToKernelInstance,
+ &ShbCirChunk, ulDataSize);
+ if (ShbError != kShbOk) {
+ EPL_DBGLVL_EVENTK_TRACE1
+ ("EplEventuPost(): ShbCirAllocDataBlock(U2K) -> 0x%X\n",
+ ShbError);
+ Ret = kEplEventPostError;
+ goto Exit;
+ }
+ ShbError =
+ ShbCirWriteDataChunk(EplEventuInstance_g.
+ m_pShbUserToKernelInstance,
+ &ShbCirChunk, pEvent_p,
+ sizeof(tEplEvent),
+ &fBufferCompleted);
+ if (ShbError != kShbOk) {
+ EPL_DBGLVL_EVENTK_TRACE1
+ ("EplEventuPost(): ShbCirWriteDataChunk(U2K) -> 0x%X\n",
+ ShbError);
+ Ret = kEplEventPostError;
+ goto Exit;
+ }
+ if (fBufferCompleted == FALSE) {
+ ShbError =
+ ShbCirWriteDataChunk(EplEventuInstance_g.
+ m_pShbUserToKernelInstance,
+ &ShbCirChunk,
+ pEvent_p->m_pArg,
+ (unsigned long)
+ pEvent_p->m_uiSize,
+ &fBufferCompleted);
+ if ((ShbError != kShbOk)
+ || (fBufferCompleted == FALSE)) {
+ EPL_DBGLVL_EVENTK_TRACE1
+ ("EplEventuPost(): ShbCirWriteDataChunk2(U2K) -> 0x%X\n",
+ ShbError);
+ Ret = kEplEventPostError;
+ goto Exit;
+ }
+ }
#else
- Ret = EplEventkProcess(pEvent_p);
+ Ret = EplEventkProcess(pEvent_p);
#endif
- break;
- }
-
- // userspace modules
- case kEplEventSinkNmtMnu:
- case kEplEventSinkNmtu:
- case kEplEventSinkSdoAsySeq:
- case kEplEventSinkApi:
- case kEplEventSinkDlluCal:
- case kEplEventSinkErru:
- case kEplEventSinkLedu:
- {
+ break;
+ }
+
+ // userspace modules
+ case kEplEventSinkNmtMnu:
+ case kEplEventSinkNmtu:
+ case kEplEventSinkSdoAsySeq:
+ case kEplEventSinkApi:
+ case kEplEventSinkDlluCal:
+ case kEplEventSinkErru:
+ case kEplEventSinkLedu:
+ {
#ifndef EPL_NO_FIFO
- // post message
- ShbError = ShbCirAllocDataBlock (EplEventuInstance_g.m_pShbKernelToUserInstance,
- &ShbCirChunk,
- ulDataSize);
- if(ShbError != kShbOk)
- {
- EPL_DBGLVL_EVENTK_TRACE1("EplEventuPost(): ShbCirAllocDataBlock(K2U) -> 0x%X\n", ShbError);
- Ret = kEplEventPostError;
- goto Exit;
- }
- ShbError = ShbCirWriteDataChunk (EplEventuInstance_g.m_pShbKernelToUserInstance,
- &ShbCirChunk,
- pEvent_p,
- sizeof (tEplEvent),
- &fBufferCompleted);
- if(ShbError != kShbOk)
- {
- EPL_DBGLVL_EVENTK_TRACE1("EplEventuPost(): ShbCirWriteDataChunk(K2U) -> 0x%X\n", ShbError);
- Ret = kEplEventPostError;
- goto Exit;
- }
- if (fBufferCompleted == FALSE)
- {
- ShbError = ShbCirWriteDataChunk (EplEventuInstance_g.m_pShbKernelToUserInstance,
- &ShbCirChunk,
- pEvent_p->m_pArg,
- (unsigned long) pEvent_p->m_uiSize,
- &fBufferCompleted);
- if ((ShbError != kShbOk) || (fBufferCompleted == FALSE))
- {
- EPL_DBGLVL_EVENTK_TRACE1("EplEventuPost(): ShbCirWriteDataChunk2(K2U) -> 0x%X\n", ShbError);
- Ret = kEplEventPostError;
- goto Exit;
- }
- }
-
+ // post message
+ ShbError =
+ ShbCirAllocDataBlock(EplEventuInstance_g.
+ m_pShbKernelToUserInstance,
+ &ShbCirChunk, ulDataSize);
+ if (ShbError != kShbOk) {
+ EPL_DBGLVL_EVENTK_TRACE1
+ ("EplEventuPost(): ShbCirAllocDataBlock(K2U) -> 0x%X\n",
+ ShbError);
+ Ret = kEplEventPostError;
+ goto Exit;
+ }
+ ShbError =
+ ShbCirWriteDataChunk(EplEventuInstance_g.
+ m_pShbKernelToUserInstance,
+ &ShbCirChunk, pEvent_p,
+ sizeof(tEplEvent),
+ &fBufferCompleted);
+ if (ShbError != kShbOk) {
+ EPL_DBGLVL_EVENTK_TRACE1
+ ("EplEventuPost(): ShbCirWriteDataChunk(K2U) -> 0x%X\n",
+ ShbError);
+ Ret = kEplEventPostError;
+ goto Exit;
+ }
+ if (fBufferCompleted == FALSE) {
+ ShbError =
+ ShbCirWriteDataChunk(EplEventuInstance_g.
+ m_pShbKernelToUserInstance,
+ &ShbCirChunk,
+ pEvent_p->m_pArg,
+ (unsigned long)
+ pEvent_p->m_uiSize,
+ &fBufferCompleted);
+ if ((ShbError != kShbOk)
+ || (fBufferCompleted == FALSE)) {
+ EPL_DBGLVL_EVENTK_TRACE1
+ ("EplEventuPost(): ShbCirWriteDataChunk2(K2U) -> 0x%X\n",
+ ShbError);
+ Ret = kEplEventPostError;
+ goto Exit;
+ }
+ }
#else
- Ret = EplEventuProcess(pEvent_p);
+ Ret = EplEventuProcess(pEvent_p);
#endif
- break;
- }
-
- default:
- {
- Ret = kEplEventUnknownSink;
- }
+ break;
+ }
+ default:
+ {
+ Ret = kEplEventUnknownSink;
+ }
- }// end of switch(pEvent_p->m_EventSink)
+ } // end of switch(pEvent_p->m_EventSink)
#ifndef EPL_NO_FIFO
-Exit:
+ Exit:
#endif
- return Ret;
+ return Ret;
}
+
//---------------------------------------------------------------------------
//
// Function: EplEventuPostError
@@ -680,36 +690,35 @@ Exit:
//
//---------------------------------------------------------------------------
tEplKernel PUBLIC EplEventuPostError(tEplEventSource EventSource_p,
- tEplKernel EplError_p,
- unsigned int uiArgSize_p,
- void* pArg_p)
+ tEplKernel EplError_p,
+ unsigned int uiArgSize_p, void *pArg_p)
{
-tEplKernel Ret;
-BYTE abBuffer[EPL_MAX_EVENT_ARG_SIZE];
-tEplEventError* pEventError = (tEplEventError*) abBuffer;
-tEplEvent EplEvent;
-
- Ret = kEplSuccessful;
-
- // create argument
- pEventError->m_EventSource = EventSource_p;
- pEventError->m_EplError = EplError_p;
- EPL_MEMCPY(&pEventError->m_Arg, pArg_p, uiArgSize_p);
-
- // create event
- EplEvent.m_EventType = kEplEventTypeError;
- EplEvent.m_EventSink = kEplEventSinkApi;
- EPL_MEMSET(&EplEvent.m_NetTime, 0x00, sizeof(EplEvent.m_NetTime));
- EplEvent.m_uiSize = (sizeof(EventSource_p)+ sizeof(EplError_p)+ uiArgSize_p);
- EplEvent.m_pArg = &abBuffer[0];
-
- // post errorevent
- Ret = EplEventuPost(&EplEvent);
-
- return Ret;
+ tEplKernel Ret;
+ BYTE abBuffer[EPL_MAX_EVENT_ARG_SIZE];
+ tEplEventError *pEventError = (tEplEventError *) abBuffer;
+ tEplEvent EplEvent;
+
+ Ret = kEplSuccessful;
+
+ // create argument
+ pEventError->m_EventSource = EventSource_p;
+ pEventError->m_EplError = EplError_p;
+ EPL_MEMCPY(&pEventError->m_Arg, pArg_p, uiArgSize_p);
+
+ // create event
+ EplEvent.m_EventType = kEplEventTypeError;
+ EplEvent.m_EventSink = kEplEventSinkApi;
+ EPL_MEMSET(&EplEvent.m_NetTime, 0x00, sizeof(EplEvent.m_NetTime));
+ EplEvent.m_uiSize =
+ (sizeof(EventSource_p) + sizeof(EplError_p) + uiArgSize_p);
+ EplEvent.m_pArg = &abBuffer[0];
+
+ // post errorevent
+ Ret = EplEventuPost(&EplEvent);
+
+ return Ret;
}
-
//=========================================================================//
// //
// P R I V A T E F U N C T I O N S //
@@ -735,19 +744,18 @@ tEplEvent EplEvent;
//
//---------------------------------------------------------------------------
#ifndef EPL_NO_FIFO
-static void EplEventuRxSignalHandlerCb (
- tShbInstance pShbRxInstance_p,
- unsigned long ulDataSize_p)
+static void EplEventuRxSignalHandlerCb(tShbInstance pShbRxInstance_p,
+ unsigned long ulDataSize_p)
{
-tEplEvent *pEplEvent;
-tShbError ShbError;
+ tEplEvent *pEplEvent;
+ tShbError ShbError;
//unsigned long ulBlockCount;
//unsigned long ulDataSize;
-BYTE abDataBuffer[sizeof(tEplEvent) + EPL_MAX_EVENT_ARG_SIZE];
- // d.k.: abDataBuffer contains the complete tEplEvent structure
- // and behind this the argument
+ BYTE abDataBuffer[sizeof(tEplEvent) + EPL_MAX_EVENT_ARG_SIZE];
+ // d.k.: abDataBuffer contains the complete tEplEvent structure
+ // and behind this the argument
- TGT_DBG_SIGNAL_TRACE_POINT(21);
+ TGT_DBG_SIGNAL_TRACE_POINT(21);
// d.k. not needed because it is already done in SharedBuff
/* do
@@ -763,38 +771,32 @@ BYTE abDataBuffer[sizeof(tEplEvent) + EPL_MAX_EVENT_ARG_SIZE];
BENCHMARK_MOD_28_RESET(1); // 14 µs until set
*/
- // copy data from event queue
- ShbError = ShbCirReadDataBlock (pShbRxInstance_p,
- &abDataBuffer[0],
- sizeof(abDataBuffer),
- &ulDataSize_p);
- if(ShbError != kShbOk)
- {
- // error goto exit
- goto Exit;
- }
-
- // resolve the pointer to the event structure
- pEplEvent = (tEplEvent *) abDataBuffer;
- // set Datasize
- pEplEvent->m_uiSize = (ulDataSize_p - sizeof(tEplEvent));
- if(pEplEvent->m_uiSize > 0)
- {
- // set pointer to argument
- pEplEvent->m_pArg = &abDataBuffer[sizeof(tEplEvent)];
- }
- else
- {
- //set pointer to NULL
- pEplEvent->m_pArg = NULL;
- }
-
- BENCHMARK_MOD_28_SET(1);
- // call processfunction
- EplEventuProcess(pEplEvent);
-
- BENCHMARK_MOD_28_RESET(1);
- // read number of left messages to process
+ // copy data from event queue
+ ShbError = ShbCirReadDataBlock(pShbRxInstance_p,
+ &abDataBuffer[0],
+ sizeof(abDataBuffer), &ulDataSize_p);
+ if (ShbError != kShbOk) {
+ // error goto exit
+ goto Exit;
+ }
+ // resolve the pointer to the event structure
+ pEplEvent = (tEplEvent *) abDataBuffer;
+ // set Datasize
+ pEplEvent->m_uiSize = (ulDataSize_p - sizeof(tEplEvent));
+ if (pEplEvent->m_uiSize > 0) {
+ // set pointer to argument
+ pEplEvent->m_pArg = &abDataBuffer[sizeof(tEplEvent)];
+ } else {
+ //set pointer to NULL
+ pEplEvent->m_pArg = NULL;
+ }
+
+ BENCHMARK_MOD_28_SET(1);
+ // call processfunction
+ EplEventuProcess(pEplEvent);
+
+ BENCHMARK_MOD_28_RESET(1);
+ // read number of left messages to process
// d.k. not needed because it is already done in SharedBuff
/* ShbError = ShbCirGetReadBlockCount (pShbRxInstance_p, &ulBlockCount);
if (ShbError != kShbOk)
@@ -804,10 +806,9 @@ BYTE abDataBuffer[sizeof(tEplEvent) + EPL_MAX_EVENT_ARG_SIZE];
}
} while (ulBlockCount > 0);
*/
-Exit:
- return;
+ Exit:
+ return;
}
#endif
// EOF
-