/***************************************************************************** 函 数 名 : 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); } } }
VOS_UINT32 NAS_CC_GetErrLogRingBufContent( VOS_CHAR *pbuffer, VOS_UINT32 ulbytes ) { return (VOS_UINT32)OM_RingBufferGet(NAS_CC_GetErrLogRingBufAddr(), pbuffer, (VOS_INT)ulbytes); }
/***************************************************************************** 函 数 名 : 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 TTF_MNTN_ErrlogBufGet(VOS_UINT32 ulPid, MODEM_ID_ENUM_UINT16 enModemId, VOS_CHAR *pBuffer, VOS_UINT32 ulBytes) { VOS_UINT32 ulRslt; OM_RING_ID pRingId; if (VOS_NULL_PTR == pBuffer) { TTF_LOG(ulPid, 0, PS_PRINT_ERROR, "TTF_MNTN_ErrlogBufGet: pBuffer NULL PTR"); return; } if (enModemId >= MODEM_ID_BUTT) { TTF_LOG1(ulPid, 0, PS_PRINT_ERROR, "TTF_MNTN_ErrlogBufGet: Invalid ModemId ", enModemId); return; } pRingId = TTF_ERR_LOG_ENT_RINGID_GET(enModemId); if (VOS_NULL_PTR == pRingId) { TTF_LOG(ulPid, 0, PS_PRINT_ERROR, "TTF_MNTN_ErrlogBufGet: pRingId NULL PTR"); return; } ulRslt = VOS_SmP(TTF_ERR_LOG_ENT_SEM_GET(enModemId), TTF_ERR_SEM_TIMEOUT_LEN); if(VOS_OK != ulRslt) { TTF_LOG2(ulPid, 0, PS_PRINT_WARNING, "TTF_MNTN_ErrlogBufGet: VOS_SmP <1>, ulRslt<2> fail!", enModemId, (VOS_INT32)ulRslt); return; } ulRslt = (VOS_UINT32)OM_RingBufferGet(pRingId, pBuffer, (VOS_INT)ulBytes); if (ulRslt != ulBytes) { OM_RingBufferFlush(pRingId); TTF_LOG2(ulPid, 0, PS_PRINT_ERROR, "TTF_MNTN_ErrlogBufGet: ERROR OM_RingBufferGet fail!", (VOS_INT32)ulRslt, (VOS_INT32)ulBytes); } VOS_SmV(TTF_ERR_LOG_ENT_SEM_GET(enModemId)); }
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; }
VOS_VOID SCM_SoftDecodeCfgRcvSelfTask( VOS_UINT32 ulPara1, VOS_UINT32 ulPara2, VOS_UINT32 ulPara3, VOS_UINT32 ulPara4) { VOS_INT32 sRet; VOS_INT32 lLen; VOS_INT32 lRemainlen; VOS_INT32 lReadLen; VOS_UINT32 ulPktNum; VOS_UINT32 i; VOS_ULONG ulLockLevel; ulPara1 = ulPara1; ulPara2 = ulPara2; ulPara3 = ulPara3; ulPara4 = ulPara4; for (;;) { if (VOS_OK != VOS_SmP(g_stSCMDataRcvTaskCtrlInfo.SmID, 0)) { continue; } diag_PTR(EN_DIAG_PTR_SCM_SELFTASK); lLen = OM_RingBufferNBytes(g_stSCMDataRcvTaskCtrlInfo.rngOmRbufId); if (lLen <= 0) { continue; } ulPktNum = (VOS_UINT32)((lLen + SCM_DATA_RCV_PKT_SIZE - 1) / SCM_DATA_RCV_PKT_SIZE); lRemainlen = lLen; for (i = 0; i < ulPktNum; i++) { if (SCM_DATA_RCV_PKT_SIZE < lRemainlen) { lReadLen = SCM_DATA_RCV_PKT_SIZE; sRet = OM_RingBufferGet(g_stSCMDataRcvTaskCtrlInfo.rngOmRbufId, g_stSCMDataRcvTaskCtrlInfo.pucBuffer, SCM_DATA_RCV_PKT_SIZE); } else { lReadLen = lRemainlen; sRet = OM_RingBufferGet(g_stSCMDataRcvTaskCtrlInfo.rngOmRbufId, g_stSCMDataRcvTaskCtrlInfo.pucBuffer, lRemainlen); } if (sRet != lReadLen) { VOS_SpinLockIntLock(&g_stScmSoftDecodeDataRcvSpinLock, ulLockLevel); OM_RingBufferFlush(g_stSCMDataRcvTaskCtrlInfo.rngOmRbufId); VOS_SpinUnlockIntUnlock(&g_stScmSoftDecodeDataRcvSpinLock, ulLockLevel); g_stScmSoftDecodeInfo.stRbInfo.ulRingBufferFlush++; diag_PTR(EN_DIAG_PTR_SCM_ERR3); continue; } lRemainlen -= lReadLen; g_stScmSoftDecodeInfo.stGetInfo.ulDataLen += lReadLen; diag_PTR(EN_DIAG_PTR_SCM_RCVDATA); /* 调用HDLC解封装函数 */ if (VOS_OK != SCM_SoftDecodeAcpuRcvData(&g_stScmHdlcSoftDecodeEntity, (VOS_UINT8 *)g_stSCMDataRcvTaskCtrlInfo.pucBuffer, (VOS_UINT32)lReadLen)) { /*lint -e534*/ vos_printf("SCM_SoftDecodeCfgRcvSelfTask: SCM_SoftDecodeAcpuRcvData Fail.\n"); /*lint +e534*/ } } #if (defined(DMT)) return; #endif } }
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; } } } }