Exemplo n.º 1
0
tEplKernel EplDllkCalProcess(tEplEvent * pEvent_p)
{
tEplKernel      Ret = kEplSuccessful;

    switch (pEvent_p->m_EventType)
    {
        case kEplEventTypeDllkServFilter:
        {
        tEplDllCalAsndServiceIdFilter*  pServFilter;

            pServFilter = (tEplDllCalAsndServiceIdFilter*) pEvent_p->m_pArg;
            Ret = EplDllkSetAsndServiceIdFilter(pServFilter->m_ServiceId, pServFilter->m_Filter);
            break;
        }

#if (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_NMT_MN)) != 0)
        case kEplEventTypeDllkIssueReq:
        {
        tEplDllCalIssueRequest*  pIssueReq;

            pIssueReq = (tEplDllCalIssueRequest*) pEvent_p->m_pArg;
            Ret = EplDllkCalIssueRequest(pIssueReq->m_Service, pIssueReq->m_uiNodeId, pIssueReq->m_bSoaFlag1);
            break;
        }
#endif

#if EPL_NMT_MAX_NODE_ID > 0
        case kEplEventTypeDllkConfigNode:
        {
        tEplDllNodeInfo*    pNodeInfo;

            pNodeInfo = (tEplDllNodeInfo*) pEvent_p->m_pArg;
            Ret = EplDllkConfigNode(pNodeInfo);
            break;
        }

        case kEplEventTypeDllkAddNode:
        {
        tEplDllNodeOpParam*    pNodeOpParam;

            pNodeOpParam = (tEplDllNodeOpParam*) pEvent_p->m_pArg;
            Ret = EplDllkAddNode(pNodeOpParam);
            break;
        }

        case kEplEventTypeDllkDelNode:
        {
        tEplDllNodeOpParam*    pNodeOpParam;

            pNodeOpParam = (tEplDllNodeOpParam*) pEvent_p->m_pArg;
            Ret = EplDllkDeleteNode(pNodeOpParam);
            break;
        }
#endif // EPL_NMT_MAX_NODE_ID > 0
/*
        case kEplEventTypeDllkSoftDelNode:
        {
        unsigned int*   puiNodeId;

            puiNodeId = (unsigned int*) pEvent_p->m_pArg;
            Ret = EplDllkSoftDeleteNode(*puiNodeId);
            break;
        }
*/

        case kEplEventTypeDllkIdentity:
        {
        tEplDllIdentParam*  pIdentParam;

            pIdentParam = (tEplDllIdentParam*) pEvent_p->m_pArg;
            if (pIdentParam->m_uiSizeOfStruct > pEvent_p->m_uiSize)
            {
                pIdentParam->m_uiSizeOfStruct = pEvent_p->m_uiSize;
            }
            Ret = EplDllkSetIdentity(pIdentParam);
            break;
        }

        case kEplEventTypeDllkConfig:
        {
        tEplDllConfigParam* pConfigParam;

            pConfigParam = (tEplDllConfigParam*) pEvent_p->m_pArg;
            if (pConfigParam->m_uiSizeOfStruct > pEvent_p->m_uiSize)
            {
                pConfigParam->m_uiSizeOfStruct = pEvent_p->m_uiSize;
            }
            Ret = EplDllkConfig(pConfigParam);
            break;
        }

        default:
        {
            Ret = kEplInvalidEvent;
            break;
        }
    }

//Exit:
    return Ret;
}
tEplKernel EplPdokConfigureChannel(tEplPdoChannelConf* pChannelConf_p)
{
    tEplKernel      Ret = kEplSuccessful;
    tEplPdoChannel* pDestPdoChannel;

    if (pChannelConf_p->m_fTx == FALSE)
    {   // RPDO
#if EPL_NMT_MAX_NODE_ID > 0
        tEplDllNodeOpParam  NodeOpParam;

        NodeOpParam.m_OpNodeType = kEplDllNodeOpTypeFilterPdo;
#endif

        if (pChannelConf_p->m_uiChannelId >= EplPdokInstance_g.m_Allocation.m_uiRxPdoChannelCount)
        {
            Ret = kEplPdoNotExist;
            goto Exit;
        }

        if (pChannelConf_p->m_PdoChannel.m_uiMappObjectCount > tabentries(*EplPdokInstance_g.m_paRxObject))
        {
            Ret = kEplPdoErrorMapp;
            goto Exit;
        }

        pDestPdoChannel = &EplPdokInstance_g.m_pRxPdoChannel[pChannelConf_p->m_uiChannelId];

#if EPL_NMT_MAX_NODE_ID > 0
        if ((pDestPdoChannel->m_uiNodeId != EPL_PDO_INVALID_NODE_ID)
                && (pDestPdoChannel->m_uiNodeId != EPL_PDO_PREQ_NODE_ID))
        {   // disable old PRes filter in DLL
            NodeOpParam.m_uiNodeId = pDestPdoChannel->m_uiNodeId;

            Ret = EplDllkDeleteNode(&NodeOpParam);
            if (Ret != kEplSuccessful)
            {
                goto Exit;
            }
        }
#endif // EPL_NMT_MAX_NODE_ID > 0

        // copy channel configuration to local structure
        EPL_MEMCPY(pDestPdoChannel,
                   &pChannelConf_p->m_PdoChannel,
                   sizeof (pChannelConf_p->m_PdoChannel));

        EPL_MEMCPY(&EplPdokInstance_g.m_paRxObject[pChannelConf_p->m_uiChannelId],
                   &pChannelConf_p->m_aMappObject[0],
                   (pChannelConf_p->m_PdoChannel.m_uiMappObjectCount
                    * sizeof (pChannelConf_p->m_aMappObject[0])));

#if EPL_NMT_MAX_NODE_ID > 0
        if ((pDestPdoChannel->m_uiNodeId != EPL_PDO_INVALID_NODE_ID)
                && (pDestPdoChannel->m_uiNodeId != EPL_PDO_PREQ_NODE_ID))
        {   // enable new PRes filter in DLL
            NodeOpParam.m_uiNodeId = pDestPdoChannel->m_uiNodeId;

            Ret = EplDllkAddNode(&NodeOpParam);
            if (Ret != kEplSuccessful)
            {
                goto Exit;
            }
        }
#endif // EPL_NMT_MAX_NODE_ID > 0

    }
    else
    {   // TPDO
        if (pChannelConf_p->m_uiChannelId >= EplPdokInstance_g.m_Allocation.m_uiTxPdoChannelCount)
        {
            Ret = kEplPdoNotExist;
            goto Exit;
        }

        if (pChannelConf_p->m_PdoChannel.m_uiMappObjectCount > tabentries(*EplPdokInstance_g.m_paTxObject))
        {
            Ret = kEplPdoErrorMapp;
            goto Exit;
        }

        // copy channel configuration to local structure
        EPL_MEMCPY(&EplPdokInstance_g.m_pTxPdoChannel[pChannelConf_p->m_uiChannelId],
                   &pChannelConf_p->m_PdoChannel,
                   sizeof (pChannelConf_p->m_PdoChannel));

        EPL_MEMCPY(&EplPdokInstance_g.m_paTxObject[pChannelConf_p->m_uiChannelId],
                   &pChannelConf_p->m_aMappObject[0],
                   (pChannelConf_p->m_PdoChannel.m_uiMappObjectCount
                    * sizeof (pChannelConf_p->m_aMappObject[0])));

    }

Exit:
    return Ret;
}