コード例 #1
0
INLINE_FUNCTION tShbError  ShbIpcStopSignalingNewData (
    tShbInstance pShbInstance_p)
{
tShbMemInst*    pShbMemInst;
tShbMemHeader*  pShbMemHeader;
tShbError       ShbError;

    DEBUG_LVL_29_TRACE0("------->ShbIpcStopSignalingNewData\n");
    if (pShbInstance_p == NULL)
    {
        return (kShbInvalidArg);
    }
    ShbError = kShbOk;
    pShbMemInst = ShbIpcGetShbMemInst (pShbInstance_p);
    pShbMemHeader = ShbIpcGetShbMemHeader (pShbMemInst);

    DEBUG_LVL_26_TRACE2("ShbIpcStopSignalingNewData(%p) pfnSignHndlrNewData=%p\n", pShbInstance_p, pShbMemInst->m_pfnSigHndlrNewData);
    if (pShbMemInst->m_pfnSigHndlrNewData != NULL)
    {   // signal handler was set before
        kthread_stop(pShbMemInst->m_tThreadNewDataId);

        pShbMemInst->m_pfnSigHndlrNewData = NULL;
        pShbMemInst->m_tThreadNewDataId = INVALID_ID;
    }

    return ShbError;

}
コード例 #2
0
INLINE_FUNCTION tShbError  ShbIpcStartSignalingNewData (
    tShbInstance pShbInstance_p,
    tSigHndlrNewData pfnSignalHandlerNewData_p,
    tShbPriority ShbPriority_p)
{
tShbMemInst*    pShbMemInst;
tShbMemHeader*  pShbMemHeader;
tShbError       ShbError;

    DEBUG_LVL_29_TRACE0("------->ShbIpcStartSignalingNewData\n");
    if ((pShbInstance_p == NULL) || (pfnSignalHandlerNewData_p == NULL))
    {
        return (kShbInvalidArg);
    }

    pShbMemInst   = ShbIpcGetShbMemInst   (pShbInstance_p);
    pShbMemHeader = ShbIpcGetShbMemHeader (pShbMemInst);
    ShbError = kShbOk;

    if ((pShbMemInst->m_tThreadNewDataId != INVALID_ID)
        || (pShbMemInst->m_pfnSigHndlrNewData != NULL))
    {
        ShbError = kShbAlreadySignaling;
        goto Exit;
    }
    DEBUG_LVL_26_TRACE2("ShbIpcStartSignalingNewData(%p) m_pfnSigHndlrNewData = %p\n", pShbInstance_p, pfnSignalHandlerNewData_p);
    pShbMemInst->m_pfnSigHndlrNewData = pfnSignalHandlerNewData_p;
    pShbMemHeader->m_fNewData = FALSE;

    switch (ShbPriority_p)
    {
        case kShbPriorityLow:
            pShbMemInst->m_lThreadNewDataNice = -2;
            break;

        case kShbPriorityNormal:
            pShbMemInst->m_lThreadNewDataNice = -9;
            break;

        case kShbPriorityHigh:
            pShbMemInst->m_lThreadNewDataNice = -20;
            break;

    }

    //create thread for signalling new data
    pShbMemInst->m_tThreadNewDataId = kthread_run(ShbIpcThreadSignalNewData,
                                                  pShbInstance_p,
                                                  "ShbND%p", pShbInstance_p);

Exit:
    return ShbError;

}
コード例 #3
0
ファイル: ShbIpc-NoOS.c プロジェクト: tomyqg/powerlinkstm32
INLINE_FUNCTION tShbError  ShbIpcStartSignalingNewData (
    tShbInstance pShbInstance_p,
    tSigHndlrNewData pfnSignalHandlerNewData_p,
    tShbPriority ShbPriority_p)
{
tShbMemInst*    pShbMemInst;
tShbMemInst**   ppShbMemInst;
tShbMemHeader*  pShbMemHeader;
tShbError       ShbError;

    DEBUG_LVL_29_TRACE0("------->ShbIpcStartSignalingNewData\n");
    if (ShbTgtIsInterruptContext())
    {
        return (kShbInterruptContextNotAllowed);
    }

    if ((pShbInstance_p == NULL) || (pfnSignalHandlerNewData_p == NULL))
    {
        return (kShbInvalidArg);
    }

    pShbMemInst   = ShbIpcGetShbMemInst(pShbInstance_p);
    pShbMemHeader = ShbIpcGetShbMemHeader(pShbMemInst);
    ShbError = kShbOk;

    if (pShbMemInst->m_pfnSigHndlrNewData != NULL)
    {
        ShbError = kShbAlreadySignaling;
        goto Exit;
    }
    DEBUG_LVL_26_TRACE2("ShbIpcStartSignalingNewData(%p) m_pfnSigHndlrNewData = %p\n", pShbInstance_p, pfnSignalHandlerNewData_p);
    pShbMemInst->m_pfnSigHndlrNewData = pfnSignalHandlerNewData_p;
    pShbMemInst->m_PriorityNewData = ShbPriority_p;
    pShbMemHeader->m_fNewData = FALSE;

    // insert ShbMemInst into NewData process list
    // higher priority entries first
    ppShbMemInst = &pShbIpcProcessListNewDataFirst_g;
    while (*ppShbMemInst != NULL)
    {
        if ((*ppShbMemInst)->m_PriorityNewData < pShbMemInst->m_PriorityNewData)
        {
            break;
        }
        ppShbMemInst = &(*ppShbMemInst)->m_pProcessListNewDataNext;
    }
    pShbMemInst->m_pProcessListNewDataNext = *ppShbMemInst;
    *ppShbMemInst = pShbMemInst;

Exit:
    return ShbError;

}
コード例 #4
0
ファイル: ShbIpc-NoOS.c プロジェクト: tomyqg/powerlinkstm32
INLINE_FUNCTION tShbError  ShbIpcStopSignalingNewData (
    tShbInstance pShbInstance_p)
{
tShbMemInst*    pShbMemInst;
tShbMemInst**   ppShbMemInst;
tShbMemHeader*  pShbMemHeader;
tShbError       ShbError;

    DEBUG_LVL_29_TRACE0("------->ShbIpcStopSignalingNewData\n");
    if (ShbTgtIsInterruptContext())
    {
        return (kShbInterruptContextNotAllowed);
    }

    if (pShbInstance_p == NULL)
    {
        return (kShbInvalidArg);
    }
    ShbError = kShbOk;
    pShbMemInst = ShbIpcGetShbMemInst (pShbInstance_p);
    pShbMemHeader = ShbIpcGetShbMemHeader (pShbMemInst);

    DEBUG_LVL_26_TRACE2("ShbIpcStopSignalingNewData(%p) pfnSignHndlrNewData=%p\n", pShbInstance_p, pShbMemInst->m_pfnSigHndlrNewData);
    if (pShbMemInst->m_pfnSigHndlrNewData != NULL)
    {   // signal handler was set before
        // remove pShbMemInst from NewData process list
        ShbError = kShbInvalidSigHndlr;
        ppShbMemInst = &pShbIpcProcessListNewDataFirst_g;
        while (*ppShbMemInst != NULL)
        {
            if (*ppShbMemInst == pShbMemInst)
            {
                *ppShbMemInst = pShbMemInst->m_pProcessListNewDataNext;
                pShbMemInst->m_pProcessListNewDataNext = NULL;
                pShbMemInst->m_pfnSigHndlrNewData = NULL;

                if (ppShbIpcProcessListNewDataCurrent_g == &pShbMemInst->m_pProcessListNewDataNext)
                {
                    ppShbIpcProcessListNewDataCurrent_g = ppShbMemInst;
                }

                ShbError = kShbOk;
                break;
            }
            ppShbMemInst = &(*ppShbMemInst)->m_pProcessListNewDataNext;
        }
    }

    return ShbError;

}