VOS_UINT32 OM_AcpuEstablishReq(APP_OM_MSG_EX_STRU *pstAppToOmMsg, VOS_UINT16 usReturnPrimId) { VOS_UINT32 ulRet; #if (FEATURE_ON == FEATURE_CBT_LOG) VOS_UINT32 ulState; ulState = g_ulAcpuOMSwitchOnOff; #endif VOS_MemSet(&g_stAcpuTraceEventConfig, 0, sizeof(OM_TRACE_EVENT_CONFIG_PS_STRU)); VOS_MemSet(g_astOmPrintfOutPutLev, 0, OM_PRINTF_MODULE_MAX_NUM*sizeof(LOG_LEVEL_EN)); VOS_MemSet(g_aulLogPrintLevPsTable, 0, LOG_PS_MODULE_MAX_NUM*sizeof(LOG_LEVEL_EN)); VOS_MemSet(g_aulLogPrintLevDrvTable, 0, LOG_DRV_MODULE_MAX_NUM*sizeof(LOG_LEVEL_EN)); /* 先断开链路 */ g_ulAcpuOMSwitchOnOff = OM_STATE_IDLE; #if(FEATURE_ON == FEATURE_SOCP_ON_DEMAND) OM_AcpuSocpVoteInfoAdd(OM_SOCPVOTE_CALLBEGIN); DRV_SOCP_VOTE(SOCP_VOTE_GU_OM_APP, SOCP_VOTE_FOR_WAKE); OM_AcpuSocpVoteInfoAdd(OM_SOCPVOTE_CALLEND); #endif /* 以兼容校准工具,建链成功回复状态字0x02 */ ulRet = 0x02; /* 给工具回复建链成功状态 */ OM_AcpuSendResult(OM_QUERY_FUNC, ulRet, usReturnPrimId); /* 激活链路 */ g_ulAcpuOMSwitchOnOff = OM_STATE_ACTIVE; #if (FEATURE_ON == FEATURE_CBT_LOG) if ((OM_STATE_ACTIVE == ulState) && (OM_CBT_LOG_ENABLE_FLAG == g_ulCBTLogEnable)) { return VOS_OK; } #endif /* 通知CCPU链路状态 */ if(VOS_OK != GU_OamSndPcMsgToCcpu((VOS_UINT8*)pstAppToOmMsg, sizeof(APP_OM_MSG_EX_STRU))) { /* 打印错误 */ LogPrint("OM_AcpuEstablishReq: The ICC UDI Write is Error.\n"); } return VOS_OK; }
VOS_UINT32 OM_AcpuCnfEstablishProc(APP_OM_MSG_EX_STRU *pstAppToOmMsg, VOS_UINT16 usReturnPrimId) { VOS_UINT32 ulRet; #ifdef SCM_SNCHECK g_stSnCheck.ulCount = 0; g_ulSnErrCount = 0; #endif VOS_MemSet(&g_stAcpuTraceEventConfig, 0, sizeof(OM_TRACE_EVENT_CONFIG_PS_STRU)); VOS_MemSet(g_astOmPrintfOutPutLev, 0, OM_PRINTF_MODULE_MAX_NUM*sizeof(LOG_LEVEL_EN)); VOS_MemSet(g_aulLogPrintLevPsTable, 0, LOG_PS_MODULE_MAX_NUM*sizeof(LOG_LEVEL_EN)); VOS_MemSet(g_aulLogPrintLevDrvTable, 0, LOG_DRV_MODULE_MAX_NUM*sizeof(LOG_LEVEL_EN)); /* 先断开链路 */ g_stAcpuCnfCtrlInfo.ulOMSwitchOnOff = OM_STATE_IDLE; /* OM建链后投票禁止睡眠 */ #if(FEATURE_ON == FEATURE_SOCP_ON_DEMAND) OM_AcpuSocpVoteInfoAdd(OM_SOCPVOTE_CALLBEGIN); DRV_SOCP_VOTE(SOCP_VOTE_GU_OM_APP, SOCP_VOTE_FOR_WAKE); OM_AcpuSocpVoteInfoAdd(OM_SOCPVOTE_CALLEND); #endif /* 以兼容校准工具,建链成功回复状态字0x02 */ ulRet = 0x02; g_ulAcpuEstRcvCnt++; /* 给工具回复建链成功状态 */ OM_AcpuSendResultChannel(OM_LOGIC_CHANNEL_CNF, OM_QUERY_FUNC, ulRet, usReturnPrimId); /* 激活链路 */ g_stAcpuCnfCtrlInfo.ulOMSwitchOnOff = OM_STATE_ACTIVE; /* 通知CCPU链路状态 */ if(VOS_OK != GU_OamSndPcMsgToCcpu(&g_stAcpuCnfCtrlInfo,(VOS_UINT8*)pstAppToOmMsg, sizeof(APP_OM_MSG_EX_STRU))) { /* 打印错误 */ } return VOS_OK; }
VOS_UINT32 PPM_LogPortSwitch(VOS_UINT32 ulPhyPort, VOS_BOOL ulEffect) { CPM_PHY_PORT_ENUM_UINT32 enPhyCfgPort; CPM_PHY_PORT_ENUM_UINT32 enPhyIndPort; VOS_ULONG ulLockLevel; VOS_BOOL ulSndMsg; if ((CPM_OM_PORT_TYPE_USB != ulPhyPort) && (CPM_OM_PORT_TYPE_VCOM != ulPhyPort)) { vos_printf("\r\n PPM_LogPortSwitch: enPhyPort is error.port %d\n", ulPhyPort); g_stPpmPortSwitchInfo.ulPortTypeErr++; return VOS_ERR; } /* 切换的端口与当前端口一致不切换 */ if (ulPhyPort == g_stPortCfg.enPortNum) { DRV_SOCP_VOTE(SOCP_VOTE_PPM_RCV, SOCP_VOTE_FOR_WAKE); /* 切换到VCOM输出时在LOG延迟写入开启情况下需要重新设置SOCP的超时中断 */ if (CPM_OM_PORT_TYPE_VCOM == g_stPortCfg.enPortNum) { (VOS_VOID)DRV_SOCP_SET_TIMEOUT(SOCP_TIMEOUT_TRF, 0); } /* 为了规避USB输出时开启了延时写入无法连接工具,切换到USB输出时需要重新设置SOCP的超时中断到默认值 */ if (CPM_OM_PORT_TYPE_USB == g_stPortCfg.enPortNum) { (VOS_VOID)DRV_SOCP_SET_TIMEOUT(SOCP_TIMEOUT_TRF, 0x17); } DRV_SOCP_VOTE(SOCP_VOTE_PPM_RCV, SOCP_VOTE_FOR_SLEEP); return VOS_OK; } g_stPpmPortSwitchInfo.ulStartSlice = OM_GetSlice(); enPhyCfgPort = CPM_QueryPhyPort(CPM_OM_CFG_COMM); enPhyIndPort = CPM_QueryPhyPort(CPM_OM_IND_COMM); ulSndMsg = VOS_FALSE; VOS_SpinLockIntLock(&g_stPpmPortSwitchSpinLock, ulLockLevel); /* 切换到VCOM输出 */ if (CPM_OM_PORT_TYPE_VCOM == ulPhyPort) { /* 当前是USB输出 */ if ((CPM_CFG_PORT == enPhyCfgPort) && (CPM_IND_PORT == enPhyIndPort)) { /* 需要断开连接 */ ulSndMsg = VOS_TRUE; CPM_DisconnectPorts(CPM_CFG_PORT, CPM_OM_CFG_COMM); CPM_DisconnectPorts(CPM_IND_PORT, CPM_OM_IND_COMM); } /* 当前OM走VCOM上报 */ CPM_ConnectPorts(CPM_VCOM_CFG_PORT, CPM_OM_CFG_COMM); CPM_ConnectPorts(CPM_VCOM_IND_PORT, CPM_OM_IND_COMM); g_stPortCfg.enPortNum = CPM_OM_PORT_TYPE_VCOM; } /* 切换到USB输出 */ else { /* 当前是VCOM输出 */ if ((CPM_VCOM_CFG_PORT == enPhyCfgPort) && (CPM_VCOM_IND_PORT == enPhyIndPort)) { /* 断开连接 */ ulSndMsg = VOS_TRUE; CPM_DisconnectPorts(CPM_VCOM_CFG_PORT, CPM_OM_CFG_COMM); CPM_DisconnectPorts(CPM_VCOM_IND_PORT, CPM_OM_IND_COMM); } /* OM走USB上报 */ CPM_ConnectPorts(CPM_CFG_PORT, CPM_OM_CFG_COMM); CPM_ConnectPorts(CPM_IND_PORT, CPM_OM_IND_COMM); g_stPortCfg.enPortNum = CPM_OM_PORT_TYPE_USB; } VOS_SpinUnlockIntUnlock(&g_stPpmPortSwitchSpinLock, ulLockLevel); if (VOS_TRUE == ulSndMsg) { PPM_DisconnectAllPort(OM_LOGIC_CHANNEL_CNF); } DRV_SOCP_VOTE(SOCP_VOTE_PPM_RCV, SOCP_VOTE_FOR_WAKE); /* 切换到VCOM输出时在LOG延迟写入开启情况下需要重新设置SOCP的超时中断 */ if (CPM_OM_PORT_TYPE_VCOM == g_stPortCfg.enPortNum) { (VOS_VOID)DRV_SOCP_SET_TIMEOUT(SOCP_TIMEOUT_TRF, 0); } /* 为了规避USB输出时开启了延时写入无法连接工具,切换到USB输出时需要重新设置SOCP的超时中断到默认值 */ if (CPM_OM_PORT_TYPE_USB == g_stPortCfg.enPortNum) { (VOS_VOID)DRV_SOCP_SET_TIMEOUT(SOCP_TIMEOUT_TRF, 0x17); } DRV_SOCP_VOTE(SOCP_VOTE_PPM_RCV, SOCP_VOTE_FOR_SLEEP); g_stPpmPortSwitchInfo.ulSwitchSucc++; g_stPpmPortSwitchInfo.ulEndSlice = OM_GetSlice(); if (VOS_TRUE == ulEffect) { if (VOS_OK != NV_Write(en_NV_Item_Om_Port_Type, &g_stPortCfg, sizeof(OM_CHANNLE_PORT_CFG_STRU))) { vos_printf("\r\n PPM_LogPortSwitch: NV_Write fail\n"); } } return VOS_OK; }