예제 #1
0
VOS_VOID NFExt_CtrlTxMsgTask(VOS_VOID)
{

    NF_EXT_DATA_RING_BUF_STRU   stData;
    VOS_UINT32                  ulRst;

/* 解决UT死循环问题 */
#ifdef __UT_CENTER__
    VOS_UINT32              i;
#endif


/* 解决UT死循环问题 */
#ifndef __UT_CENTER__
    for ( ; ; )
#else
    for (i = 0; i < 1; i++)
#endif
    {

        if (VOS_NULL_PTR == g_stExEntity.pRingBufferId)
        {
            PS_LOG(ACPU_PID_NFEXT, 0, PS_PRINT_WARNING,
                "NFExt_CtrlSendTask : ERROR : pRingBufferId is NULL!" );
            break;
        }

        /*lint -e522*/
        wait_event_interruptible(g_stExEntity.stWaitHeadTxTask, (VOS_TRUE != OM_RingBufferIsEmpty(g_stExEntity.pRingBufferId)));
        /*lint +e522*/

        ulRst = (VOS_UINT32)NFExt_RingBufferGet(g_stExEntity.pRingBufferId, (VOS_CHAR *)&stData,
            sizeof(NF_EXT_DATA_RING_BUF_STRU));

        if ((0 != ulRst) && (ulRst != sizeof(NF_EXT_DATA_RING_BUF_STRU)))
        {
            PS_LOG(ACPU_PID_NFEXT, 0, PS_PRINT_WARNING,
                "NFExt_CtrlSendTask : ERROR : Get data error from ring buffer!" );

            NF_EXT_STATS_INC(1, NF_EXT_STATS_GET_BUF_FAIL);

            NFExt_FlushRingBuffer(g_stExEntity.pRingBufferId);

            continue;
        }

        if (0 != ulRst)
        {
            OM_AcpuSendData((OM_RSP_PACKET_STRU*)stData.pData, stData.usDataLen);

            NF_EXT_MEM_FREE(ACPU_PID_NFEXT, stData.pData);
        }
    }
}
예제 #2
0
/*****************************************************************************
 函 数 名  : Log_SelfTask
 功能描述  : 打印自处理任务
 输入参数  : VOS_UINT32 ulPara1
                         VOS_UINT32 ulPara2
                         VOS_UINT32 ulPara3
                         VOS_UINT32 ulPara4
 输出参数  : 无
 返 回 值  : VOS_VOID
 调用函数  :
 被调函数  :

 修改历史      :
  1.日    期   : 2007年4月24日
        作    者   : 李霄 46160
        修改内容   : 新生成函数

*****************************************************************************/
VOS_VOID Log_SelfTask(VOS_UINT32 ulPara1, VOS_UINT32 ulPara2,
                  VOS_UINT32 ulPara3, VOS_UINT32 ulPara4)
{
    VOS_INT32                           sRet;
    VOS_UINT32                          ulLen;
/*lint -e813*/
    VOS_CHAR                            acTmpStr[LOG_MAX_COLUMN_VAL_EX + 1];
/*lint +e813*/

    ulPara1 = ulPara1;
    ulPara2 = ulPara2;
    ulPara3 = ulPara3;
    ulPara4 = ulPara4;

    Log_Init();

    for(;;)
    {
        if(VOS_OK != VOS_SmP(g_stLogEnt.semOmPrint, 0))
        {
            continue;
        }

        if (LOG_NULL_PTR == g_stLogEnt.rngOmRbufId)
        {
            continue;
        }

        if (LOG_TRUE == OM_RingBufferIsEmpty(g_stLogEnt.rngOmRbufId))
        {
            continue;
        }

        sRet = OM_RingBufferGet(g_stLogEnt.rngOmRbufId, (VOS_CHAR*)(&ulLen), sizeof(VOS_UINT32));
        if (sizeof(VOS_UINT32) != (VOS_UINT32)sRet)
        {
            continue;
        }

        if(LOG_MAX_COLUMN_VAL_EX < ulLen)
        {
            OM_RingBufferFlush(g_stLogEnt.rngOmRbufId);

            continue;
        }

        sRet = OM_RingBufferGet(g_stLogEnt.rngOmRbufId, acTmpStr, (VOS_INT32)ulLen);
        if (ulLen == (VOS_UINT32)sRet)
        {
            Log_Output(g_stLogEnt.ulLogOutput, acTmpStr, ulLen);
        }
    }
}
예제 #3
0
VOS_VOID NFExt_FlushRingBuffer(OM_RING_ID rngId)
{
    NF_EXT_DATA_RING_BUF_STRU   stData;
    VOS_UINT32                  ulFlags;

    while (!OM_RingBufferIsEmpty(rngId))
    {
        NFExt_RingBufferGet(rngId, (VOS_CHAR*)(&stData), sizeof(NF_EXT_DATA_RING_BUF_STRU));
        NF_EXT_MEM_FREE(ACPU_PID_NFEXT, stData.pData);
    }

    spin_lock_irqsave(&g_stExEntity.stLockTxTask, ulFlags);
    OM_RingBufferFlush(rngId);
    spin_unlock_irqrestore(&g_stExEntity.stLockTxTask, ulFlags);
}
예제 #4
0
VOS_INT NFExt_RingBufferGet( OM_RING_ID rngId, VOS_CHAR *buffer, VOS_INT maxbytes )
{
    VOS_UINT32  ulFlags;
    VOS_INT     iRst;

    iRst = 0;

    spin_lock_irqsave(&g_stExEntity.stLockTxTask, ulFlags);
    if (!OM_RingBufferIsEmpty(rngId))
    {
        iRst = OM_RingBufferGet(rngId, buffer, maxbytes );
    }
    spin_unlock_irqrestore(&g_stExEntity.stLockTxTask, ulFlags);

    return iRst;
}
예제 #5
0
/*****************************************************************************
 函 数 名  : Log_SelfTask
 功能描述  : 打印自处理任务
 输入参数  : unsigned long ulPara1
                         unsigned long ulPara2
                         unsigned long ulPara3
                         unsigned long ulPara4
 输出参数  : 无
 返 回 值  : void
 调用函数  :
 被调函数  :

 修改历史      :
  1.日    期   : 2007年4月24日
        作    者   : 李霄 46160
        修改内容   : 新生成函数

*****************************************************************************/
void Log_SelfTask(unsigned long ulPara1, unsigned long ulPara2,
                  unsigned long ulPara3, unsigned long ulPara4)
{
    int             sRet;
    unsigned long   ulLen;
/*lint -e813*/
    char            acTmpStr[LOG_MAX_COLUMN_VAL_EX + 1];
/*lint +e813*/
    Log_Init();

    for(;;)
    {
        if(VOS_OK != VOS_SmP(g_stLogEnt.semOmPrint, 0))
        {
            continue;
        }

        if (LOG_NULL_PTR == g_stLogEnt.rngOmRbufId)
        {
            continue;
        }

        if (LOG_TRUE == OM_RingBufferIsEmpty(g_stLogEnt.rngOmRbufId))
        {
            continue;
        }

        sRet = OM_RingBufferGet(g_stLogEnt.rngOmRbufId, (char*)(&ulLen), sizeof(unsigned long));
        if (sizeof(unsigned long) != (unsigned long)sRet)
        {
            continue;
        }

        if(LOG_MAX_COLUMN_VAL_EX < ulLen)
        {
            OM_RingBufferFlush(g_stLogEnt.rngOmRbufId);

            continue;
        }

        sRet = OM_RingBufferGet(g_stLogEnt.rngOmRbufId, acTmpStr, (long)ulLen);
        if (ulLen == (unsigned long)sRet)
        {
            Log_Output(g_stLogEnt.ulLogOutput, acTmpStr, ulLen);
        }
    }
}
VOS_VOID OM_PrintfTask(VOS_VOID)
{
    VOS_UINT32          ulBufLen;
    VOS_UINT32          ulBufAlignLen;
#if (VOS_WIN32 == VOS_OS_VER)
    VOS_UINT32          i;
#endif

    /*lint -e813 */
    /* 前四字节用来存储模块ID */
    VOS_CHAR            acOutput[VOS_MAX_PRINT_LEN+8];
    /*lint +e813 */

    VOS_UINT32          ulRet;

    if ( VOS_OK != VOS_SmBCreate( "PRT", 0, VOS_SEMA4_FIFO, &g_ulPrintfTaskSem))
    {
        return;
    }

#if (VOS_WIN32 == VOS_OS_VER)
    for (i = 0; i < 1; i++)
#else
    for (;;)
#endif
    {

        if(VOS_OK != VOS_SmP(g_ulPrintfTaskSem, 0))
        {
            g_ulPrintfErrType = OM_ERR_FAILTAKETASKSEM;
            continue;
        }

        /* ringbuf中无数据 */
#if (VOS_WIN32 == VOS_OS_VER)
        for (i = 0; i < 1; i++)
#else
        while(VOS_FALSE == OM_RingBufferIsEmpty(g_pstOmPrintfBufId))
#endif
        {
            /* 获取数据长度 */
            ulRet = (VOS_UINT32)OM_RingBufferGet(g_pstOmPrintfBufId, (VOS_CHAR *)&ulBufLen,
                                                 sizeof(VOS_UINT32));
            if (sizeof(VOS_UINT32) != ulRet)
            {
                g_ulPrintfErrType = OM_ERR_FAILPUTDATA;
                OM_RingBufferFlush(g_pstOmPrintfBufId);
                continue;
            }

            /* ringbuf中数据损坏 */
            if (VOS_MAX_PRINT_LEN <= ulBufLen)
            {
                g_ulPrintfErrType = OM_ERR_DATADESTROY;
                OM_RingBufferFlush(g_pstOmPrintfBufId);
                continue;
            }

            ulBufAlignLen = (ulBufLen+OM_ALIGNMENT)&(~OM_ALIGNMENT);

            /* 获取数据内容 */
            ulRet = (VOS_UINT32)OM_RingBufferGet(g_pstOmPrintfBufId, (VOS_CHAR *)acOutput,
                                (VOS_INT)ulBufAlignLen);
            if (ulBufAlignLen != ulRet)
            {
                g_ulPrintfErrType = OM_ERR_FAILPUTDATA;
                OM_RingBufferFlush(g_pstOmPrintfBufId);
                continue;
            }

            /* 根据输出端口分发数据 */
            switch(g_ulOmPrintfPort)
            {
                case OM_OUTPUT_SHELL:
                    acOutput[ulBufLen] = 0;
#if (VOS_OS_VER == VOS_LINUX)
                    printk( "%s", acOutput + OM_PRINTF_OFFSET);
#else
                    printf( "%s", acOutput + OM_PRINTF_OFFSET);
#endif
                    break;

                case OM_OUTPUT_SDT:
                    OM_SndPrintfToOm(acOutput, ulBufLen);
                    break;

                default:
                    break;
            }
        }
    }
}