Пример #1
0
VOS_VOID CDS_SaveIpfDlSrcMem(const IPF_CONFIG_DLPARAM_S *pstIpfDlBdBuff, VOS_UINT32 ulSaveNum)
{
    LUP_QUEUE_STRU                   *pstDlFreeQue;
    VOS_UINT32                        ulCnt;
    TTF_MEM_ST                       *pstSrcMem;

    CDS_ASSERT(VOS_NULL_PTR != pstIpfDlBdBuff);

    if (ulSaveNum > IPF_DLBD_DESC_SIZE)
    {
        CDS_ERROR_LOG1(UEPS_PID_CDS,"CDS_SaveIpfDlMemInfo:Input Bd Num Error.",ulSaveNum);
        return ;
    }

    pstDlFreeQue = CDS_IPF_DL_SRCMEM_FREE_QUE();
    CDS_ASSERT(VOS_NULL_PTR != pstDlFreeQue);

    for (ulCnt = 0; ulCnt < ulSaveNum; ulCnt ++)
    {
        pstSrcMem = (TTF_MEM_ST*)pstIpfDlBdBuff[ulCnt].u32Data;
        if (PS_SUCC != LUP_EnQue(pstDlFreeQue,pstSrcMem))
        {
            CDS_ERROR_LOG2(UEPS_PID_CDS,"CDS_SaveIpfDlMemInfo: Src Mem Leak.",ulCnt,ulSaveNum);
            vos_printf("CDS_SaveIpfDlMemInfo: Buffer Full!! cnt=%d,ulSaveNum=%d\n",ulCnt,ulSaveNum);
            TTF_MemFree(UEPS_PID_CDS,pstSrcMem);
            CDS_DBG_DL_IPF_SAVE_SRCMEM_FAIL_NUM(1);
            continue;
        }

        CDS_DBG_DL_IPF_SAVE_SRCMEM_SUCC_NUM(1);
    }

    return ;
}
BST_UINT32 BST_PAL_NetApiPacketRcved( const BST_UINT8 *pData, const BST_UINT32 ulLen )
{
    BST_OS_LOCKCNT_T            tThreadLockCnt;
    BST_PAL_NET_ENTITY_STRU    *pstBstNetEntity;

    pstBstNetEntity             = BST_PAL_NetGetEntity();
    /*入参判断*/
    if ( ulLen != BST_OS_SIZEOF(TTF_MEM_ST) )
    {
        BST_RLS_LOG( "BST_EnQueueOtaData: Wrong Size" );
        return 0;
    }
    if ( BST_NULL_PTR == pData )
    {
        BST_RLS_LOG( "BST_EnQueueOtaData: NULL pData" );
        return 0;
    }

    /*入队*/
    tThreadLockCnt          = BST_OS_ThreadLock();
    if ( PS_SUCC != LUP_EnQue( pstBstNetEntity->pstDlDataQue,
                               (BST_VOID *)pData ) )
    {
        BST_PAL_NetApiPacketFree( (BST_VOID *)pData );
        BST_OS_ThreadUnLock( tThreadLockCnt );
        BST_RLS_LOG( "BST_EnQueueOtaData: EnQueue Fail" );
        return 0;
    }
    BST_OS_ThreadUnLock( tThreadLockCnt );
    /*wakeup cds*/
    BST_SYS_ApiSndEvtToBastet( BST_CDS_EVENT_RCV_DL_PROC );
    return ulLen;
}
VOS_VOID TTF_MemRbRemoteFreeMem( VOS_VOID *pucAddr)
{
    VOS_ULONG                           ulLockLevel;
    VOS_UINT32                          ulResult;
    VOS_UINT32                          ulNum;
    VOS_INT32                           lIsrRet;    /* 中断操作返回值 */

    VOS_SpinLockIntLock(&g_stTtfMemRBSpinLock, ulLockLevel);
    ulResult    = LUP_EnQue(g_pstCcpuIMMMemFreeQue, pucAddr);
    g_stTtfMemRbMntnEntity.ulTtfMemRbEnQTotalCnt++;
    ulNum       = LUP_QueCnt(g_pstCcpuIMMMemFreeQue);
    VOS_SpinUnlockIntUnlock(&g_stTtfMemRBSpinLock, ulLockLevel);

    if (PS_SUCC != ulResult)
    {
        g_stTtfMemRbMntnEntity.ulTtfMemRbEnQFailCnt++;
        vos_printf("TTF_MemRbRemoteFreeMem: LUP_EnQue fail!\n");
    }

#ifndef WTTF_PS_FUSION_PC_ST
    if ( 0 == (g_ulFreeTtfMemBlkNoticNum & ulNum))
    {
        lIsrRet = TTF_MEM_TRIG_IPC_MEMRB_INT(IPC_CORE_APPARM, TTF_IPC_MEM_RECYCLE_INT);
        g_stTtfMemRbMntnEntity.ulTtfMemRbSendIntCnt++;

        if (lIsrRet != VOS_OK)
        {
            TTF_LOG(UEPS_PID_TTF_MEM_RB_FREE, PS_PRINT_ERROR, "ERROR:TTF_MemRbRemoteFreeMem: DRV_IPC_INTSEND fail!\n");
        }
    }
#else
    lIsrRet = VHW_IPC_IntSend((IPC_INT_CORE_E)IPC_CORE_APPARM, (IPC_INT_LEV_E)IPC_INT_DICC_RELDATA);
    g_stTtfMemRbMntnEntity.ulTtfMemRbSendIntCnt++;

    if (lIsrRet != VOS_OK)
    {
        TTF_LOG(UEPS_PID_TTF_MEM_RB_FREE, PS_PRINT_ERROR, "ERROR:TTF_MemRbRemoteFreeMem: DRV_IPC_INTSEND fail!\n");
    }
#endif

    return;
}/*TTF_MemRbRemoteFreeMem*/
VOS_UINT32 CDS_RxDataFromImsNIC(const VOS_UINT8 *pData, VOS_UINT16 usLen,MODEM_ID_ENUM_UINT16 enModemId)
{
    CDS_ENTITY_STRU             *pstCdsEntity;
    TTF_MEM_ST                  *pstTtfPkt;
    VOS_INT32                    lLock;

    CDS_DBG_IMS_UL_RX_FUN_CALL_NUM(1);

    /*入参判断*/
    if (VOS_NULL_PTR == pData)
    {
        CDS_ERROR_LOG(UEPS_PID_CDS, "CDS_RxPktFromImsNIC:Input Para is NULL");
        CDS_DBG_IMS_UL_RX_FUN_PARA_ERR(1);
        return PS_FAIL;
    }

    if ((0 == usLen) || (usLen > ETH_MAX_MTU))
    {
        CDS_ERROR_LOG1(UEPS_PID_CDS,"CDS_RxPktFromImsNIC ; Packet Length Error.",usLen);
        CDS_DBG_IMS_UL_RX_FUN_PARA_ERR(1);
        return PS_FAIL;
    }

    pstCdsEntity = CDS_GetCdsEntity(enModemId);
    if (VOS_NULL_PTR == pstCdsEntity)
    {
        CDS_ERROR_LOG1(UEPS_PID_CDS,"CDS_RxPktFromImsNIC ; Modem ID Error.",enModemId);
        CDS_DBG_IMS_UL_RX_FUN_PARA_ERR(1);
        return PS_FAIL;
    }

    CDS_DBG_IMS_UL_RX_NIC_PKT_NUM(1);

    /*申请TTF内存,并将其拷贝到TTF内存中*/
    pstTtfPkt = CDS_AllocTtfMem(usLen);
    if (VOS_NULL_PTR == pstTtfPkt)
    {
        CDS_ERROR_LOG(UEPS_PID_CDS,"CDS_RxDataFromImsNIC: Alloc Mem Fail.");
        CDS_DBG_IMS_UL_ALLOC_MEM_FAIL_NUM(1);
        return PS_FAIL;
    }
    PS_MEM_CPY(pstTtfPkt->pData,pData,usLen);

    /*入队*/
    lLock = VOS_SplIMP();
    if (PS_SUCC != LUP_EnQue(pstCdsEntity->pstIMSDataQue,pstTtfPkt))
    {
        VOS_Splx(lLock);
        CDS_DBG_IMS_UL_EN_QUE_FAIL_NUM(1);
        TTF_MemFree(UEPS_PID_CDS, pstTtfPkt);
        CDS_SendEventToCds(CDS_EVENT_UL_IMS_PROC);
        CDS_DBG_IMS_UL_TRIGGER_IMS_EVENT_NUM(1);
        return PS_FAIL;
    }
    VOS_Splx(lLock);
    CDS_DBG_IMS_UL_EN_QUE_SUCC_NUM(1);

    /*wakeup cds*/
    CDS_SendEventToCds(CDS_EVENT_UL_IMS_PROC);
    CDS_DBG_IMS_UL_TRIGGER_IMS_EVENT_NUM(1);
    return PS_SUCC;
}