VOS_VOID AT_InitResetCtx(VOS_VOID) { AT_RESET_CTX_STRU *pstResetCtx = VOS_NULL_PTR; PS_MEM_SET(&g_stAtStatsInfo, 0, sizeof(g_stAtStatsInfo)); pstResetCtx = AT_GetResetCtxAddr(); pstResetCtx->hResetSem = VOS_NULL_PTR; pstResetCtx->ulResetingFlag = VOS_FALSE; /* 分配二进制信号量 */ if (VOS_OK != VOS_SmBCreate( "AT", 0, VOS_SEMA4_FIFO, &pstResetCtx->hResetSem)) { (VOS_VOID)vos_printf("Create AT acpu cnf sem failed!\r\n"); AT_DBG_SET_SEM_INIT_FLAG(VOS_FALSE); AT_DBG_CREATE_BINARY_SEM_FAIL_NUM(1); return; } else { AT_DBG_SAVE_BINARY_SEM_ID(pstResetCtx->hResetSem); } AT_DBG_SET_SEM_INIT_FLAG(VOS_TRUE); return; }
VOS_UINT32 diag_AgentMsgProcInit(enum VOS_INIT_PHASE_DEFINE ip) { VOS_UINT32 ret = ERR_MSP_SUCCESS; #if(FEATURE_SOCP_ON_DEMAND == FEATURE_ON) DIAG_MSG_SOCP_VOTE_REQ_STRU * voteReq; #endif if (ip == VOS_IP_RESTART) { DIAG_DEBUG_SDM_FUN(EN_DIAG_DEBUG_AGENT_INIT,ret,0,0); /*DIAG SOCP BUF初始化*/ ret = diag_BufCtrlGlobalInit(); if(ret != ERR_MSP_SUCCESS) { DIAG_DEBUG_SDM_FUN(EN_DIAG_DEBUG_AGENT_INIT_ERROR,ret,0,0); return ret; } /*设置DIAG初始化bit*/ ret = diag_CfgSetGlobalBitValue(&g_ulDiagCfgInfo,DIAG_CFG_INIT_BIT,DIAG_CFG_SWT_OPEN); if(ret != ERR_MSP_SUCCESS) { DIAG_DEBUG_SDM_FUN(EN_DIAG_DEBUG_AGENT_INIT_ERROR,ret,0,1); return ret; } #if(FEATURE_SOCP_ON_DEMAND == FEATURE_ON) #if 0 if(ERR_MSP_SUCCESS != VOS_SmBCreate(NULL, 0, VOS_SEMA4_FIFO, &g_diagAgentSem)) { diag_printf("[%s]:agent sem init err!\n",__FUNCTION__); return ERR_MSP_FAILURE; } #endif voteReq = (DIAG_MSG_SOCP_VOTE_REQ_STRU *)VOS_AllocMsg(MSP_PID_DIAG_AGENT,(sizeof(DIAG_MSG_SOCP_VOTE_REQ_STRU) - 20)); if(voteReq == NULL) { DIAG_DEBUG_SDM_FUN(EN_DIAG_DEBUG_AGENT_INIT_ERROR,ERR_MSP_FAILURE,2,2); return ERR_MSP_FAILURE; } voteReq->ulReceiverPid = MSP_PID_DIAG_APP_AGENT; voteReq->ulSenderPid = MSP_PID_DIAG_AGENT; voteReq->ulLength = sizeof(DIAG_MSG_SOCP_VOTE_REQ_STRU) - 20; voteReq->ulVoteId = SOCP_VOTE_DIAG_COMM; voteReq->ulVoteType = SOCP_VOTE_FOR_SLEEP; ret = VOS_SendMsg(MSP_PID_DIAG_AGENT, voteReq); if(ret != ERR_MSP_SUCCESS) { DIAG_DEBUG_SDM_FUN(EN_DIAG_DEBUG_AGENT_INIT_ERROR,ret,3,2); return ret; } #endif } return ret; }
VOS_UINT32 diag_PortInit(VOS_VOID) { VOS_UINT32 ret = ERR_MSP_SUCCESS; diag_PortCtrlInfo_Init(); /*USB init*/ ret = diag_UsbInit(); if(ret) { diag_printf("[%s]:usb init err!\n",__FUNCTION__); } /*HSIC init*/ ret = diag_HiscInit(); if(ret) { diag_printf("[%s]:hsic init err!\n",__FUNCTION__); } /*VCOM init*/ ret = diag_VcomInit(); if(ret) { diag_printf("[%s]:vcom init err!\n",__FUNCTION__); } /*TCP SOCKET init*/ ret = diag_SocketInit(); if(ret) { diag_printf("[%s]:socket init err!\n",__FUNCTION__); } /*SD init*/ ret = diag_SdInit(); if(ret) { diag_printf("[%s]:sd init err!\n",__FUNCTION__); } // 向CDM模块注册编码目标通道数据处理函数 SCM_RegCoderDestProc(SOCP_CODER_DST_LOM_CNF,(SCM_CODERDESTFUCN)diag_SocpCodeDesDataProc); SCM_RegCoderDestProc(SOCP_CODER_DST_LOM_IND,(SCM_CODERDESTFUCN)diag_SocpCodeDesDataProc); #if(FEATURE_SOCP_ON_DEMAND == FEATURE_ON) blist_head_init(&g_diagPortDataBuf.dataList); if(ERR_MSP_SUCCESS != VOS_SmBCreate(NULL, 1, VOS_SEMA4_FIFO, &g_diagPortSem)) { diag_printf("[%s]:port sem init err!\n",__FUNCTION__); } #endif return ERR_MSP_SUCCESS; }
VOS_UINT32 CSD_InitSem(VOS_VOID) { VOS_UINT32 ulRslt; VOS_UINT32 *pULDataSem; VOS_UINT32 *pDLDataSem; pDLDataSem = CSD_GetDownLinkDataSem(); pULDataSem = CSD_GetUpLinkDataSem(); /* 初始下行信号量 */ ulRslt = VOS_SmBCreate("ulDldataSem", CSD_SEMAPHORE_INIT_CNT, VOS_SEMA4_FIFO, pDLDataSem); if (VOS_OK != ulRslt) { VOS_SmDelete(*pDLDataSem); CSD_ERROR_LOG(ACPU_PID_CSD, "CSD_InitSem:: VOS_SmBCreate pDLDataSem fail"); return VOS_ERR; } /* 初始上行信号量 */ ulRslt = VOS_SmBCreate("ulUldataSem", CSD_SEMAPHORE_INIT_CNT, VOS_SEMA4_FIFO, pULDataSem); if (VOS_OK != ulRslt) { VOS_SmDelete(*pULDataSem); CSD_ERROR_LOG(ACPU_PID_CSD, "CSD_InitSem:: VOS_SmBCreate pULDataSem fail"); return VOS_ERR; } return VOS_OK; }
VOS_UINT32 diag_BufCtrlGlobalInit(VOS_VOID) { VOS_UINT32 ret = ERR_MSP_SUCCESS; VOS_UINT32 i = 0; VOS_INT32 aulLen[DIAG_CODER_SRC_TYPE_BUTT] = {0,}; #ifndef CHIP_BB_HI6210 BSP_DDR_SECT_QUERY_S stSectQuery = {}; BSP_DDR_SECT_INFO_S stSectInfo = {}; #endif /* 创建 控制LOG上报的信号量,第二个参数1表示一开始能take到信号量,不需等待,0表示一开始take不到*/ ret = VOS_SmBCreate(NULL, 1, VOS_SEMA4_FIFO,&g_DiagLogSem); if (ERR_MSP_SUCCESS != ret) { diag_printf("[%s]:VOS_SmBCreate fail!\n",__FUNCTION__); return ret; } #ifndef CHIP_BB_HI6210 stSectQuery.enSectType = BSP_DDR_SECT_TYPE_SOCP; mdrv_get_fix_ddr_addr(&stSectQuery, &stSectInfo); g_DiagMemVirt = stSectInfo.pSectVirtAddr; g_DiagMemPhy = stSectInfo.pSectPhysAddr; g_DiagMemSize = stSectInfo.ulSectSize; #else /*lint -save -e40 -e539*/ #ifdef DIAG_MEMMAP g_DiagMemVirt = (VOS_UINT8*)MSP_NOCACHEMAP(DIAG_MEM_ADDR_BASE,DIAG_MEM_TOTAL_SIZE); #else g_DiagMemVirt = (VOS_UINT8*)SOCP_GLOBAL_MEM_ADDR_VIRT; #endif /*lint -restore*/ #endif diag_GetBufLen((VOS_UINT32 *)aulLen); /* 创建log发送缓冲区 */ for(i = 0 ; i< DIAG_CODER_SRC_TYPE_BUTT; i++) { if (VOS_OK != diag_CreateLogBuf(&g_stDiagBufCtrl[i], aulLen[i])) { diag_printf("diag_BufCtrlGlobalInit:diag_CreateLogBuffer Failed!\n"); return ERR_MSP_FAILURE; } } #if ((VOS_OS_VER == VOS_VXWORKS) || (VOS_OS_VER == VOS_RTOSCK)) /*lint -save -e539*/ diag_InitSocpChan(); /*lint -restore */ #endif return ret; }
/***************************************************************************** Function Name : drx_msp_fid_vote Description : msp fids reject vote to sleep Input :drx_msp_fid_vote_e e_drx_vote Output : None Return : None History : *****************************************************************************/ VOS_VOID drx_msp_fid_vote_lock(drx_msp_fid_vote_e e_drx_vote) { VOS_INT32 vote_status_temp = 0; VOS_INT32 vote_status_bit_shift = 0; /* create sem */ if(0 ==g_drx_vote_sem) { if ( VOS_OK != VOS_SmBCreate( "DRX", 1, VOS_SEMA4_FIFO, &g_drx_vote_sem)) { vos_printf("%s: create sem failed!\n",__FUNCTION__); return; } } if(e_drx_vote >=DRX_MSP_VOTE_BUTT) { vos_printf("%s: e_drx_vote si too larger!\n",__FUNCTION__); return ; } /* modify current status */ if(VOS_OK != VOS_SmP(g_drx_vote_sem, 0)) { vos_printf("%s: post sem failed!\n",__FUNCTION__); return ; } /* save current status */ vote_status_temp = gbl_drx_msp_vote_status; vote_status_bit_shift = 0x1<<((VOS_INT32)e_drx_vote); set_drx_status_bit(vote_status_bit_shift); if((DRX_MSP_VOTE_SLEEP_OK == vote_status_temp) && (DRX_MSP_VOTE_SLEEP_OK != gbl_drx_msp_vote_status)) { #if(VOS_OS_VER == VOS_VXWORKS) DRV_PWRCTRL_SLEEPVOTE_LOCK(PWRCTRL_SLEEP_OAM); #endif #if(VOS_OS_VER == VOS_LINUX) wake_lock(&msp_wakelock); #endif gbl_drx_cur_vote_status.drx_msp_cur_vote_status |= vote_status_bit_shift; } VOS_SmV(g_drx_vote_sem); }
VOS_VOID ADS_InitResetSem(VOS_VOID) { g_stAdsCtx.ulULResetSem = 0; g_stAdsCtx.ulDLResetSem = 0; /* 分配二进制信号量 */ if (VOS_OK != VOS_SmBCreate( "UL", 0, VOS_SEMA4_FIFO, &g_stAdsCtx.ulULResetSem)) { vos_printf("Create ADS acpu UL_CNF sem failed!\r\n"); ADS_UL_DBG_CREATE_BINARY_SEM_FAIL_NUM(1); ADS_DBG_SET_SEM_INIT_FLAG(VOS_FALSE); return; } else { ADS_UL_DBG_SAVE_BINARY_SEM_ID(g_stAdsCtx.ulULResetSem); } if (VOS_OK != VOS_SmBCreate( "DL", 0, VOS_SEMA4_FIFO, &g_stAdsCtx.ulDLResetSem)) { vos_printf("Create ADS acpu DL_CNF sem failed!\r\n"); ADS_DL_DBG_CREATE_BINARY_SEM_FAIL_NUM(1); ADS_DBG_SET_SEM_INIT_FLAG(VOS_FALSE); return; } else { ADS_DL_DBG_SAVE_BINARY_SEM_ID(g_stAdsCtx.ulDLResetSem); } ADS_DBG_SET_SEM_INIT_FLAG(VOS_TRUE); return; }
VOS_VOID TTF_RbRxFreeMemTaskInit( VOS_VOID ) { VOS_UINT32 ulResult; PS_MEM_SET(&g_stTtfMemRbMntnEntity, 0x0, sizeof(TTF_MEM_RB_MNTN_INFO_STRU)); /* 初始化信号量 */ if ( VOS_OK != VOS_SmBCreate("ulMemFreeSem", 0, VOS_SEMA4_FIFO, (VOS_SEM *)&g_ulTtfMemRbFreeSem ) ) { TTF_LOG(UEPS_PID_TTF_MEM_RB_FREE, PS_PRINT_ERROR, "TTF_MemRb, TTF_MEM_RB_RxFreeMemTaskInit, ERROR, Create ulMemFreeSem fail!\n"); return ; } /*两核内存回收和释放队列初始化*/ /*lint -e778*/ ulResult = LUP_CreateSharedQue(UEPS_PID_TTF_MEM_RB_FREE, &g_pstCcpuTTFMemFreeQue, TTF_MEM_FREE_QUE_LEN, (VOS_UINT8*)(CORESHARE_MEM_WAN_ADDR), TTF_MEM_FREE_AREA_SIZE); /*lint +e778*/ if (PS_SUCC != ulResult) { vos_printf("TTF_RbRxFreeMemTaskInit: Create g_pstCcpuTTFMemFreeQue fail!\n"); return ; } /*lint -e778*/ ulResult = LUP_CreateSharedQue(UEPS_PID_TTF_MEM_RB_FREE, &g_pstCcpuIMMMemFreeQue, IMM_MEM_FREE_QUE_LEN, (VOS_UINT8*)(CORESHARE_MEM_WAN_ADDR+TTF_MEM_FREE_AREA_SIZE), IMM_MEM_FREE_AREA_SIZE); /*lint +e778*/ if (PS_SUCC != ulResult) { vos_printf("TTF_RbRxFreeMemTaskInit: Create g_pstCcpuIMMMemFreeQue fail!\n"); return ; } TTF_MemRbIsrInit(UEPS_PID_TTF_MEM_RB_FREE, TTF_IPC_MEM_FREE_INT, (VOIDFUNCPTR)TTF_MemRbRelDataIsr); TTF_MemRegExtFreeCallBack(TTF_MemRbRemoteFreeMem); return; }/* TTF_RbRxFreeMemTaskInit */
VOS_VOID IMM_RbRxFreeMemTaskInit( VOS_VOID ) { /* 初始化 IMM MEM RB 可维可测实体 */ PS_MEM_SET(&g_stImmMemRbMntnEntity, 0x0, sizeof(IMM_MEM_RB_MNTN_INFO_STRU)); /* 初始化信号量 */ if ( VOS_OK != VOS_SmBCreate("g_ulImmMemRbFreeSem", 0, VOS_SEMA4_FIFO, (VOS_SEM *)&g_ulImmMemRbFreeSem ) ) { IMM_LOG(UEPS_PID_IMM_RB_FREE, IMM_PRINT_ERROR, "IMM_RB, IMM_RbRxFreeMemTaskInit, ERROR, Create g_ulImmMemRbFreeSem fail!\n"); return; } VOS_SpinLockInit(&g_stImmRbSpinLock); IMM_RbMemFreeQueInit(); IMM_RbIsrInit(UEPS_PID_IMM_RB_FREE, IMM_IPC_MEM_FREE_INT, (VOIDFUNCPTR)IMM_RbMemRelDataIsr); IMM_MemRegExtFreeCallBack(IMM_RbRemoteFreeMem); IMM_MntnInit(); return ; }/* IMM_RbRxFreeMemTaskInit */
VOS_UINT32 diag_BufCtrlGlobalInit(VOS_VOID) { VOS_UINT32 ret = ERR_MSP_SUCCESS; VOS_UINT32 i = 0; VOS_INT32 aulLen[DIAG_CODER_SRC_TYPE_BUTT] = {0,}; /* 创建 控制LOG上报的信号量,第二个参数1表示一开始能take到信号量,不需等待,0表示一开始take不到*/ ret = VOS_SmBCreate(NULL, 1, VOS_SEMA4_FIFO,&g_DiagLogSem); /*lint -save -e830*/ if (ERR_MSP_SUCCESS != ret) { diag_printf("[%s]:VOS_SmBCreate fail!\n",__FUNCTION__); return ret; } /*lint -restore*/ #ifdef DIAG_MEMMAP g_DiagMemVirt = (VOS_UINT8*)MSP_NOCACHEMAP(DIAG_MEM_ADDR_BASE,DIAG_MEM_TOTAL_SIZE); #else g_DiagMemVirt = (VOS_UINT8*)SOCP_GLOBAL_MEM_ADDR_VIRT; #endif diag_GetBufLen((VOS_UINT32 *)aulLen); /*lint -save -e830*/ /* 创建log发送缓冲区 */ for(i = 0 ; i< DIAG_CODER_SRC_TYPE_BUTT; i++) { if (VOS_OK != diag_CreateLogBuf(&g_stDiagBufCtrl[i], aulLen[i])) { diag_printf("diag_BufCtrlGlobalInit:diag_CreateLogBuffer Failed!\n"); return ERR_MSP_FAILURE; } } /*lint -restore*/ #if ((VOS_OS_VER == VOS_VXWORKS) || (VOS_OS_VER == VOS_RTOSCK)) diag_InitSocpChan(); #endif return ret; }
VOS_UINT32 diag_SocketInit(VOS_VOID) { VOS_UINT32 ret = ERR_MSP_SUCCESS; VOS_UINT8 ulTcpPort = 0; /*lint -save -e958*/ DIAG_TCPIP_CTRL_INFO_STRU *pstDiagTcpInfo; /*lint -restore*/ VOS_UINT32 aulPort[EN_TCP_PORT_FULL] = {0,}; diag_SocketInfo_Init(); if(BSP_MODULE_SUPPORT != DRV_GET_WIFI_SUPPORT()) { return ERR_MSP_SUCCESS; } diag_GetTcpPort(aulPort); pstDiagTcpInfo = diag_GetTcpInfo(); for (ulTcpPort = 0; ulTcpPort < EN_TCP_PORT_FULL; ulTcpPort++) { pstDiagTcpInfo->astTcpIpPort[ulTcpPort].listener= INVALID_SOCKET; pstDiagTcpInfo->astTcpIpPort[ulTcpPort].Tcp = INVALID_SOCKET; ret = VOS_SmBCreate(NULL, 1, VOS_SEMA4_FIFO,&pstDiagTcpInfo->astTcpIpPort[ulTcpPort].hSem); if ((pstDiagTcpInfo->astTcpIpPort[ulTcpPort].hSem == (VOS_UINT32)NULL)|| (ret != ERR_MSP_SUCCESS)) { ret = ERR_MSP_FAILURE; break; } pstDiagTcpInfo->astTcpIpPort[ulTcpPort].aulPortNum = aulPort[ulTcpPort]; } DIAG_PORT_INIT_STATE_SWITCH(EN_DIAG_SOCKET_BEARER_TCP_20248,EN_PORT_INIT_SUCC); return ret; }
VOS_UINT32 Taf_Agent_InitCtx(VOS_VOID) { g_stTafAgentCtx.pucTafAcpuCnfMsg = VOS_NULL_PTR; /* 分配互斥信号量 */ if (VOS_OK != VOS_SmMCreate("SYNC", VOS_SEMA4_FIFO, &g_stTafAgentCtx.hTafAcpuSyncSem)) { TAFAGENT_ERROR_LOG(ACPU_PID_TAFAGENT, "Create aps acpu sycn sem failed!"); TAF_AGENT_DBG_CREATE_MUTEX_SEM_FAIL_NUM(1); g_stTafAgentCtx.ulInitFlg = VOS_FALSE; return VOS_ERR; } else { TAF_AGENT_DBG_SAVE_MUTEX_SEM_ID(g_stTafAgentCtx.hTafAcpuSyncSem); } /* 分配二进制信号量 */ if (VOS_OK != VOS_SmBCreate( "CNF", 0, VOS_SEMA4_FIFO, &g_stTafAgentCtx.hTafAcpuCnfSem)) { TAFAGENT_ERROR_LOG(ACPU_PID_TAFAGENT, "Create aps acpu cnf sem failed!"); TAF_AGENT_DBG_CREATE_BINARY_SEM_FAIL_NUM(1); g_stTafAgentCtx.ulInitFlg = VOS_FALSE; return VOS_ERR; } else { TAF_AGENT_DBG_SAVE_BINARY_SEM_ID(g_stTafAgentCtx.hTafAcpuCnfSem); } g_stTafAgentCtx.ulInitFlg = VOS_TRUE; TAF_AGENT_SET_ACPU_CNF_SEM_LOCK_FLG(VOS_FALSE); TAF_AGENT_ClearMsg(); return VOS_OK; }
VOS_VOID diag_MailboxSelfTask(VOS_VOID) { VOS_UINT32 len, ret; DIAG_MSG_DSP_CNF_TO_AGENT_STRU * pData; if(ERR_MSP_SUCCESS != VOS_SmBCreate("diagmbx", 0, VOS_SEMA4_FIFO, &g_diagMbxSem)) { diag_printf("[%s]:agent sem init err!\n",__FUNCTION__); return ; } /* 向邮箱注册回调函数 */ if(ERR_MSP_SUCCESS != BSP_MailBox_ComNotifyReg(EN_MAILBOX_SERVICE_RTT_SYS_CTRL, diag_MailboxCb)) { diag_printf("[%s]:BSP_MailBox_ComNotifyReg err!\n",__FUNCTION__); return ; } /*lint -save -e716*/ while(1) /*lint -restore*/ { if(VOS_OK != VOS_SmP(g_diagMbxSem, 0)) { diag_printf("[%s] VOS_SmP failed.\n", __FUNCTION__); continue; } DIAG_DEBUG_SDM_FUN(EN_DIAG_AGENT_LDSP_MB_MSG, 0, 0, 0); len = BSP_MailBox_ComMsgSize(EN_MAILBOX_SERVICE_RTT_SYS_CTRL); if(0 == len) { DIAG_DEBUG_SDM_FUN(EN_DIAG_AGENT_LDSP_MB_MSG, 1, 0, 0); continue ; } /* VOS消息体在事先分配好的内存中查找空闲,没有阻塞操作 */ pData = (DIAG_MSG_DSP_CNF_TO_AGENT_STRU *)VOS_AllocMsg(MSP_PID_DIAG_AGENT, len); if(VOS_NULL == pData) { DIAG_DEBUG_SDM_FUN(EN_DIAG_AGENT_LDSP_MB_MSG, 2, 0, 0); continue ; } /* (pData+20)表示把邮箱中的内容直接读取到消息中 */ ret = BSP_MailBox_ComMsgRead(EN_MAILBOX_SERVICE_RTT_SYS_CTRL, ((VOS_UINT8 *)pData+VOS_MSG_HEAD_LENGTH), len, EN_MAILBOX_SLEEP_WAKEUP); if(ret) { DIAG_DEBUG_SDM_FUN(EN_DIAG_AGENT_LDSP_MB_MSG, 3, 0, 0); continue; } pData->ulReceiverPid = MSP_PID_DIAG_AGENT; pData->ulSenderPid = MSP_PID_DIAG_AGENT; pData->ulLength = len; /* 注意,只能给自己发消息,跨核发消息中会有阻塞接口,不能在中断中调用 */ ret = VOS_SendMsg(MSP_PID_DIAG_AGENT, pData); if (ret != VOS_OK) { DIAG_DEBUG_SDM_FUN(EN_DIAG_AGENT_LDSP_MB_MSG, 4, 0, 0); } } }
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; } } } }