/*lint -e{416,419,831} */
VOS_VOID TTF_MNTN_ErrlogBufRpt(VOS_UINT32 ulSenderPid, VOS_UINT32 ulReceiverPid, MODEM_ID_ENUM_UINT16 enModemId)
{
    VOS_UINT32                      ulRslt;
    VOS_UINT32                      ulErrLogBufSize;
    VOS_UINT32                      ulTtfCommInfoBufSize;
    VOS_UINT32                      ulMsgLen;
    OM_RING_ID                      pRingId;
    VOS_UINT32                      ulCpuID;
    OM_ERR_LOG_REPORT_CNF_STRU     *pstLogRpt;
    VOS_UINT32                      ulOffSetLen;
    VOS_CHAR                       *pucContent;

    if (enModemId >= MODEM_ID_BUTT)
    {
        TTF_LOG1(ulSenderPid, 0, PS_PRINT_ERROR,
            "TTF_MNTN_ErrlogBufRpt: enModemId Invalid!", enModemId);

        return;
    }

    ulCpuID         = VOS_GET_CPU_ID(ulReceiverPid);
    if ( ulCpuID >= VOS_SUPPORT_CPU_NUM_MAX )
    {
        TTF_LOG1(ulSenderPid, 0, PS_PRINT_ERROR,
            "TTF_MNTN_ErrlogBufRpt: ulReceiverPid Invalid!", (VOS_INT32)ulReceiverPid);

        return;
    }

    /* 初始化没有异常 */
    ulErrLogBufSize = 0;

    pRingId   = TTF_ERR_LOG_ENT_RINGID_GET(enModemId);
    if (VOS_NULL_PTR != pRingId)
    {
        /* 将各模块本地缓存的数据写入Buffer */
        TTF_MNTN_ErrlogCbRun(enModemId);

        /* 保留的长度复位 */
        TTF_ERR_LOG_ENT_RST_BUF_RSV_LEN(enModemId);

        ulRslt = VOS_SmP(TTF_ERR_LOG_ENT_SEM_GET(enModemId), TTF_ERR_SEM_TIMEOUT_LEN);
        if(VOS_OK != ulRslt)
        {
            TTF_LOG2(ulSenderPid, 0, PS_PRINT_WARNING,
                "TTF_MNTN_ErrlogBufRpt: VOS_SmP <1>, ulRslt<2> fail!", enModemId, (VOS_INT32)ulRslt);

            return;
        }

        ulErrLogBufSize = (VOS_UINT32)OM_RingBufferNBytes(pRingId);
        if (ulErrLogBufSize > TTF_ERR_LOG_BUF_SIZE)
        {
            OM_RingBufferFlush(pRingId);

            TTF_LOG1(ulSenderPid, 0, PS_PRINT_WARNING,
                "TTF_MNTN_ErrlogBufRpt: ulErrLogBufSize invalid!", (VOS_INT32)ulErrLogBufSize);

            ulErrLogBufSize = 0;
        }

        VOS_SmV(TTF_ERR_LOG_ENT_SEM_GET(enModemId));
    }

    ulTtfCommInfoBufSize = 0;
    if (VOS_NULL_PTR != TTF_ERR_LOG_ENT_WCDMA_COMM_INFO_GET(enModemId))
    {
        ulTtfCommInfoBufSize += sizeof(TTF_MNTN_WCDMA_COMM_INFO_STRU);
        TTF_ERR_LOG_ENT_WCDMA_COMM_INFO_GET(enModemId)->usRingBufferOverCounter = TTF_ERR_LOG_ENT_BUFFER_OVER_CNT_GET(enModemId);
    }

    if (VOS_NULL_PTR != TTF_ERR_LOG_ENT_GSM_COMM_INFO_GET(enModemId))
    {
        ulTtfCommInfoBufSize += sizeof(TTF_MNTN_GSM_COMM_INFO_STRU);
        TTF_ERR_LOG_ENT_GSM_COMM_INFO_GET(enModemId)->usRingBufferOverCounter   = TTF_ERR_LOG_ENT_BUFFER_OVER_CNT_GET(enModemId);
    }

    /* Reset环形Buffer溢出标识 */
    TTF_ERR_LOG_ENT_BUFFER_OVER_CNT_SET(enModemId, 0);

    /* 计算消息总的长度 */
    TTF_GET_OFFSET(ulOffSetLen, OM_ERR_LOG_REPORT_CNF_STRU, aucContent);
    ulMsgLen  = ulOffSetLen + ulTtfCommInfoBufSize + ulErrLogBufSize;

    pstLogRpt = (OM_ERR_LOG_REPORT_CNF_STRU *)PS_ALLOC_MSG_WITH_HEADER_LEN(ulSenderPid, ulMsgLen);
    if (VOS_NULL_PTR == pstLogRpt)
    {
        TTF_LOG1(ulSenderPid, 0, PS_PRINT_WARNING,
                "TTF_MNTN_ErrlogBufRpt: PS_ALLOC_MSG_WITH_HEADER_LEN fail!", (VOS_INT32)ulMsgLen);
        return;
    }

    /* 开始拷贝基本信息 */
    pucContent = (VOS_CHAR *)(pstLogRpt->aucContent);

    if (VOS_NULL_PTR != TTF_ERR_LOG_ENT_WCDMA_COMM_INFO_GET(enModemId))
    /*lint -e{662,669} */
    {
        /* 拷贝WCDMA基本配置信息 */
        PS_MEM_CPY((VOS_VOID *)pucContent, (VOS_VOID *)TTF_ERR_LOG_ENT_WCDMA_COMM_INFO_GET(enModemId), (VOS_UINT32)(sizeof(TTF_MNTN_WCDMA_COMM_INFO_STRU)));
        pucContent += (VOS_UINT32)(sizeof(TTF_MNTN_WCDMA_COMM_INFO_STRU));
    }

    if (VOS_NULL_PTR != TTF_ERR_LOG_ENT_GSM_COMM_INFO_GET(enModemId))
    /*lint -e{662,669} */
    {
        /* 拷贝GSM基本配置信息 */
        PS_MEM_CPY((VOS_VOID *)pucContent, (VOS_VOID *)TTF_ERR_LOG_ENT_GSM_COMM_INFO_GET(enModemId), (VOS_UINT32)(sizeof(TTF_MNTN_GSM_COMM_INFO_STRU)));
        pucContent += (VOS_UINT32)(sizeof(TTF_MNTN_GSM_COMM_INFO_STRU));
    }

    /* 拷贝异常事件信息 */
    if (0 != ulErrLogBufSize)
    {
        TTF_MNTN_ErrlogBufGet(  ulSenderPid,
                                enModemId,
                                pucContent,
                                ulErrLogBufSize);
    }

    pstLogRpt->ulReceiverPid    = ulReceiverPid;
    pstLogRpt->ulMsgName        = ID_OM_ERR_LOG_REPORT_CNF;
    pstLogRpt->ulMsgType        = OM_ERR_LOG_MSG_ERR_REPORT;
    pstLogRpt->ulMsgSN          = mdrv_timer_get_normal_timestamp();
    pstLogRpt->ulRptlen         = ulTtfCommInfoBufSize + ulErrLogBufSize;

    PS_SEND_MSG(UEPS_PID_SN, pstLogRpt);

    return;
}
Пример #2
0
VOS_VOID TTF_MNTN_ErrlogBufRpt(VOS_UINT32 ulSenderPid, VOS_UINT32 ulReceiverPid, MODEM_ID_ENUM_UINT16 enModemId)
{
    VOS_UINT32                      ulRslt;
    VOS_UINT32                      ulBufSize;
    VOS_UINT32                      ulMsgLen;
    OM_RING_ID                      pRingId;
    VOS_UINT32                      ulCpuID;
    OM_ERR_LOG_REPORT_CNF_STRU     *pstLogRpt;

    if (enModemId >= MODEM_ID_BUTT)
    {
        PS_LOG1(ulSenderPid, 0, PS_PRINT_ERROR,
            "TTF_MNTN_ErrlogBufRpt: enModemId Invalid!", enModemId);

        return;
    }

    ulCpuID         = VOS_GET_CPU_ID(ulReceiverPid);

    if ( ulCpuID >= VOS_SUPPORT_CPU_NUM_MAX )
    {
        PS_LOG1(ulSenderPid, 0, PS_PRINT_ERROR,
            "TTF_MNTN_ErrlogBufRpt: ulReceiverPid Invalid!", (VOS_INT32)ulReceiverPid);

        return;
    }

    pRingId   = TTF_ERR_LOG_ENT_RINGID_GET(enModemId);

    /* Default没有异常 */
    ulBufSize = 0;

    if (VOS_NULL_PTR != pRingId)
    {
        /* 保留的长度复位 */
        TTF_ERR_LOG_ENT_RST_BUF_RSV_LEN(enModemId);

        /* 将各模块本地缓存的数据写入Buffer */
        TTF_MNTN_ErrlogCbRun(enModemId);

        ulRslt = VOS_SmP(TTF_ERR_LOG_ENT_SEM_GET(enModemId), TTF_ERR_SEM_TIMEOUT_LEN);

        if(VOS_OK != ulRslt)
        {
            PS_LOG2(ulSenderPid, 0, PS_PRINT_WARNING,
                "TTF_MNTN_ErrlogBufRpt: VOS_SmP <1>, ulRslt<2> fail!", enModemId, (VOS_INT32)ulRslt);

            return;
        }

        ulBufSize = (VOS_UINT32)OM_RingBufferNBytes(pRingId);

        if (ulBufSize > TTF_ERR_LOG_BUF_SIZE)
        {
            OM_RingBufferFlush(pRingId);

            PS_LOG1(ulSenderPid, 0, PS_PRINT_WARNING,
                "TTF_MNTN_ErrlogBufGet: ulBufSize invalid!", (VOS_INT32)ulBufSize);

            ulBufSize = 0;
        }

        VOS_SmV(TTF_ERR_LOG_ENT_SEM_GET(enModemId));
    }

    /*lint -e413*/
    ulMsgLen  = (TTF_OFFSET_OF(OM_ERR_LOG_REPORT_CNF_STRU, aucContent[0])) + ulBufSize;
    pstLogRpt = (OM_ERR_LOG_REPORT_CNF_STRU *)PS_ALLOC_MSG_WITH_HEADER_LEN(ulSenderPid, ulMsgLen);

    if (VOS_NULL_PTR == pstLogRpt)
    {
        return;
    }

    if (0 != ulBufSize)
    {
        TTF_MNTN_ErrlogBufGet(ulSenderPid, enModemId, (VOS_CHAR *)(pstLogRpt->aucContent), ulBufSize);
    }

    pstLogRpt->ulReceiverPid    = ulReceiverPid;
    pstLogRpt->ulMsgName        = ID_OM_ERR_LOG_REPORT_CNF;
    pstLogRpt->ulMsgType        = OM_ERR_LOG_MSG_ERR_REPORT;
    pstLogRpt->ulMsgSN          = VOS_GetSlice();
    pstLogRpt->ulRptlen         = ulBufSize;

    /*lint +e413*/

    PS_SEND_MSG(UEPS_PID_SN, pstLogRpt);
}