//------------------------------------------------------------------------------
static tOplkError sendGenericAsyncFrame(const tFrameInfo* pFrameInfo_p)
{
    tOplkError  ret = kErrorOk;
    UINT16      etherType = ami_getUint16Be(&pFrameInfo_p->frame.pBuffer->etherType);

    if ((etherType == 0x0000) || (etherType == C_DLL_ETHERTYPE_EPL))
    {
        ret = instance_l.pTxGenFuncs->pfnInsertDataBlock(
                                          instance_l.dllCalQueueTxGen,
                                          (const UINT8*)pFrameInfo_p->frame.pBuffer,
                                          pFrameInfo_p->frameSize);
    }
    else
    {
#if defined(CONFIG_INCLUDE_VETH)
        ret = instance_l.pTxVethFuncs->pfnInsertDataBlock(
                                           instance_l.dllCalQueueTxVeth,
                                           (const UINT8*)pFrameInfo_p->frame.pBuffer,
                                           pFrameInfo_p->frameSize);
#else
    // Return error since virtual Ethernet is not existing!
    ret = kErrorIllegalInstance;
    DEBUG_LVL_ERROR_TRACE("%s() frame cannot be sent, "
                          "because virtual Ethernet is inactive!\n",
                          __func__);
#endif
    }

    return ret;
}
Exemple #2
0
//------------------------------------------------------------------------------
static tOplkError sendGenericAsyncFrame(tFrameInfo* pFrameInfo_p)
{
    tOplkError  ret = kErrorOk;
    UINT16      etherType = ami_getUint16Be(&pFrameInfo_p->frame.pBuffer->etherType);

    if (etherType == 0 || etherType == C_DLL_ETHERTYPE_EPL)
    {
        ret = instance_l.pTxGenFuncs->pfnInsertDataBlock(
                                    instance_l.dllCalQueueTxGen,
                                    (UINT8*)pFrameInfo_p->frame.pBuffer,
                                    &(pFrameInfo_p->frameSize));
    }
    else
    {
#if defined(CONFIG_INCLUDE_VETH)
        ret = instance_l.pTxVethFuncs->pfnInsertDataBlock(
                                    instance_l.dllCalQueueTxVeth,
                                    (UINT8*)pFrameInfo_p->frame.pBuffer,
                                    &(pFrameInfo_p->frameSize));
#else
        // Return error since virtual Ethernet is not existing!
        ret = kErrorIllegalInstance;
#endif
    }

    return ret;
}
//------------------------------------------------------------------------------
static tOplkError handleRxAsyncFrame(const tFrameInfo* pFrameInfo_p)
{
    tOplkError  ret = kErrorOk;
    UINT16      etherType = ami_getUint16Be(&pFrameInfo_p->frame.pBuffer->etherType);

    switch (etherType)
    {
        case C_DLL_ETHERTYPE_EPL:
            ret = handleRxAsndFrame(pFrameInfo_p);
            break;

        default:
            DEBUG_LVL_DLL_TRACE("Received frame with etherType=0x%04X\n", etherType);
#if defined(CONFIG_INCLUDE_VETH)
            if (instance_l.pfnDlluCbNonPlk != NULL)
                ret = instance_l.pfnDlluCbNonPlk(pFrameInfo_p);
#endif
            break;
    }

    return ret;
}