Пример #1
0
tEplKernel EplDllkCalAsyncGetTxFrame(void * pFrame_p, unsigned int * puiFrameSize_p, tEplDllAsyncReqPriority Priority_p)
{
tEplKernel      Ret = kEplSuccessful;
#if EPL_USE_SHAREDBUFF != FALSE
tShbError       ShbError;
unsigned long   ulFrameSize;

    switch (Priority_p)
    {
        case kEplDllAsyncReqPrioNmt:    // NMT request priority
            ShbError = ShbCirReadDataBlock (EplDllkCalInstance_g.m_ShbInstanceTxNmt, (BYTE *) pFrame_p, *puiFrameSize_p, &ulFrameSize);
            // returns kShbOk, kShbDataTruncated, kShbInvalidArg, kShbNoReadableData
            break;

        default:    // generic priority
            ShbError = ShbCirReadDataBlock (EplDllkCalInstance_g.m_ShbInstanceTxGen, (BYTE *) pFrame_p, *puiFrameSize_p, &ulFrameSize);
            // returns kShbOk, kShbDataTruncated, kShbInvalidArg, kShbNoReadableData
            break;

    }

    // error handling
    if (ShbError != kShbOk)
    {
        if (ShbError == kShbNoReadableData)
        {
            Ret = kEplDllAsyncTxBufferEmpty;
        }
        else
        {   // other error
            Ret = kEplNoResource;
        }
        goto Exit;
    }

    *puiFrameSize_p = (unsigned int) ulFrameSize;

Exit:
#else
    switch (Priority_p)
    {
        case kEplDllAsyncReqPrioNmt:    // NMT request priority
            *puiFrameSize_p = min(*puiFrameSize_p, EplDllkCalInstance_g.m_uiFrameSizeNmt);
            EPL_MEMCPY(pFrame_p, EplDllkCalInstance_g.m_abFrameNmt, *puiFrameSize_p);
            EplDllkCalInstance_g.m_uiFrameSizeNmt = 0;
            break;

        default:    // generic priority
            *puiFrameSize_p = min(*puiFrameSize_p, EplDllkCalInstance_g.m_uiFrameSizeGen);
            EPL_MEMCPY(pFrame_p, EplDllkCalInstance_g.m_abFrameGen, *puiFrameSize_p);
            EplDllkCalInstance_g.m_uiFrameSizeGen = 0;
            break;
    }

#endif

    return Ret;
}
static tEplKernel EplApiProcessImageFetchCopyJob(
    unsigned int uiPriority_p,
    tEplApiProcessImageCopyJobInt* pCopyJob_p)
{
    tEplKernel      Ret = kEplSuccessful;
    tShbError       ShbError;
    tShbInstance    ShbInstance;
    unsigned long   ulCopyJobCount = 0;
    unsigned long   ulCopyJobSize = 0;

    if (pCopyJob_p == NULL)
    {
        Ret = kEplApiInvalidParam;
        goto Exit;
    }

    if (uiPriority_p == 0)
    {
        ShbInstance = EplApiProcessImageInstance_g.m_ShbInstanceJobQueueHi;
    }
    else
    {
        ShbInstance = EplApiProcessImageInstance_g.m_ShbInstanceJobQueueLo;
    }

    ShbError = ShbCirGetReadBlockCount(ShbInstance, &ulCopyJobCount);
    if (ShbError != kShbOk)
    {
        Ret = kEplNoResource;
        goto Exit;
    }
    if (ulCopyJobCount > 0)
    {
        ShbError = ShbCirReadDataBlock (ShbInstance, pCopyJob_p, sizeof (*pCopyJob_p), &ulCopyJobSize);
        if (ShbError != kShbOk)
        {
            Ret = kEplNoResource;
            goto Exit;
        }
        if (sizeof (*pCopyJob_p) != ulCopyJobSize)
        {
            Ret = kEplApiPIInvalidJobSize;
            goto Exit;
        }
    }
    else
    {
        Ret = kEplApiPIJobQueueEmpty;
    }

Exit:
    return Ret;
}
Пример #3
0
static void  EplEventuRxSignalHandlerCb (
    tShbInstance pShbRxInstance_p,
    unsigned long ulDataSize_p)
{
tEplEvent      *pEplEvent;
tShbError       ShbError;
BYTE*           pabDataBuffer;

    TGT_DBG_SIGNAL_TRACE_POINT(21);

    pabDataBuffer = &EplEventuInstance_g.m_abRxBuffer[0];

    // copy data from event queue
    ShbError = ShbCirReadDataBlock (pShbRxInstance_p,
                            pabDataBuffer,
                            sizeof(EplEventuInstance_g.m_abRxBuffer),
                            &ulDataSize_p);
    if(ShbError != kShbOk)
    {
        EplEventuPostError(kEplEventSourceEventu, kEplEventReadError, sizeof (ShbError), &ShbError);
        // error goto exit
        goto Exit;
    }

    // resolve the pointer to the event structure
    pEplEvent = (tEplEvent *) pabDataBuffer;
    // set Datasize
    pEplEvent->m_uiSize = (ulDataSize_p - sizeof(tEplEvent));
    if(pEplEvent->m_uiSize > 0)
    {
        // set pointer to argument
        pEplEvent->m_pArg = &pabDataBuffer[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);

Exit:
    return;
}
Пример #4
0
static void  EplEventkRxSignalHandlerCb (
                tShbInstance pShbRxInstance_p,
                unsigned long ulDataSize_p)
{
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

//    TGT_DBG_SIGNAL_TRACE_POINT(20);

    BENCHMARK_MOD_27_RESET(0);
    // 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_27_SET(0);
    // call processfunction
    EplEventkProcess(pEplEvent);

Exit:
    return;
}
Пример #5
0
static void  EplEventuRxSignalHandlerCb (
    tShbInstance pShbRxInstance_p,
    unsigned long ulDataSize_p)
{
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

//    TGT_DBG_SIGNAL_TRACE_POINT(21);

// d.k. not needed because it is already done in SharedBuff
/*    do
    {
        BENCHMARK_MOD_28_SET(1);    // 4 µs until reset
        // get messagesize
        ShbError = ShbCirGetReadDataSize (pShbRxInstance_p, &ulDataSize);
        if(ShbError != kShbOk)
        {
            // error goto exit
            goto Exit;
        }

        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
// d.k. not needed because it is already done in SharedBuff
/*        ShbError = ShbCirGetReadBlockCount (pShbRxInstance_p, &ulBlockCount);
        if (ShbError != kShbOk)
        {
            // error goto exit
            goto Exit;
        }
    } while (ulBlockCount > 0);
*/
Exit:
    return;
}