DSP

ENDPT_410_ProcessVrgEndptConsoleCmd

2019-07-13 16:57发布

state = GetEndptState( lineId ); //获取线路对象 casDriver = boardHalCasGetDriver( state->endptNum ); //获取CAS驱动对象 switch ( cmd ) //显示当前DSP mips值,当前该功能没用,返回硬编码0 case EPCMD_DSP_MIPS: VRG_LOG_INFO((VRG_LOG_MOD_EPT,"Current DSP MIPS usage: %ld", hdspRmGetTotalMips() )); //打印所有VHD对象信息 case EPCMD_PRINT_VHDS: PrintVhdInfo(); for ( i = 0; i < vrgEndptGetNumEndpoints(); i++ ) //遍历所有线路VHD对象 if ( ( endptState = &vrgEndpt[i] ) && ( endptState->isLineUsed ) ) //有效端点 //显示当前线路在第几个DSP芯片上 VRG_LOG_INFO(( VRG_LOG_MOD_EPT, "VHD handle 0x%x – resource manager",(endptState->dspNum << 8) | HAPIRESMAN )); //显示当前线路ID VRG_LOG_INFO(( VRG_LOG_MOD_EPT, "VHD handle 0x%x - endpt %d VHD", endptState->lineVhdHdl, i )); for ( i = 0; i < VRG_ENDPT_CFG_NUM_CNX; i++ ) //遍历所有资源VHD对象 cnxState = &vrgCnxState[i]; if ( cnxState ) if ( cnxState->bLiteWeight ) cnxTypeStr = "lite"; else cnxTypeStr = "heavy"; //打印资源VHD对象信息,资源类型、资源ID、当前使用该资源的线 //路ID VRG_LOG_INFO(( VRG_LOG_MOD_EPT, "VHD handle 0x%x - secondary (%s) cnx %d, endpt %d",cnxState->vhdhdl, cnxTypeStr, (int)cnxState->cnxId, cnxState->lineId )); //显示DSP ENDPT VHD对象信息 case EPCMD_ENDPTVHD_STATS: if ( state ) hdspVhdDisplayEndptStats( state->lineVhdHdl ); //当前DSP不支持 //显示指定线路和资源相关的信息 case EPCMD_VHD_STATS_FROM_CNX: hdspVhdGetVoiceStats( vhdHdl, &netvoicestats ); hdspVhdDisplayVoiceStatsRaw( vhdHdl, &netvoicestats ); //显示VHD统计信息 case EPCMD_VHD_STATS: if (IsCnxVhd(vhdhdl)) //只支持资源VHD对象 //显示指定线路和资源相关的信息 hdspVhdGetVoiceStats( vhdhdl, &netvoicestats ); hdspVhdDisplayVoiceStatsRaw( vhdhdl, &netvoicestats ); //显示指定线路PVE服务相关信息 hdspVhdDisplayPveState( vhdhdl ); //获取RTP、Jitter buffer等信息 case EPCMD_RTP_STATS: vrgEndptGetRtpStats( endptState, cnxId, &epRtpStats ); ProcessVrgEndptGetRtpStats(endptState, cnxId, &epRtpStats); state = GetEndptState( lineId ); //获取线路对象 //获取对应资源对象 for( cnxIndex = 0; cnxIndex < VRG_ENDPT_CFG_MAX_CNX_PER_ENDPT; cnxIndex++ ) if ((state->cnx[cnxIndex]) && (state->cnx[cnxIndex]->cnxId == cnxId)) break; if (cnxIndex == VRG_ENDPT_CFG_MAX_CNX_PER_ENDPT) return( EPSTATUS_CNX_UNKNOWN ); cnx = state->cnx[cnxIndex]; GetConnectionRtpStats(cnx, epRtpStats); //非语音模式不能获取RTP信息 if ( cnx->voiceMode != VM_ACTIVE || cnx->vhdMode == NETMODE_FAXRELAY ) return( EPSTATUS_BAD_MODE ); //获取RTP信息 hdspSendCmdData( cnx->vhdhdl, (HAPI_RTP_GETSTATS_EXT_CMD | HDSP_SYNCCMD_ERR_IGN), HSCMDRESP, sizeof(HAPI_RTP_STATS), &RTPStats); //获取PVE服务信息及jitter buffer平均延时 hdspVhdGetVoiceStats( cnx->vhdhdl, &pveStats ); hdspVhdGetAvgJBDelay( cnx->vhdhdl, &(epRtpStats->jbAvg)); //填充上面获取的信息 epRtpStats->txpkts = ((RTPStats.cumulative.ingressRtpPacketsHigh)<<16) + RTPStats.cumulative.ingressRtpPacketsLow; …… //获取当前资源VHD中jitter buffer寄存器设置值 case EPCMD_VHD_JBREGS: if (IsCnxVhd(vhdHdl)) hdspVhdGetJitterBuffer( vhdHdl, &voiceJBFixed, &voiceJBMin, &voiceJBMax, &voiceJBTarget, &dataJBTarget, &ajcCustomReg ); //获取T38传真信息 case EPCMD_FAXR_STATS: if (IsCnxVhd(vhdHdl)) //获取T38传真信息 hdspVhdDisplayFaxrStats( vhdHdl ); hdspSendCmdData( vhdhdl, HAPINET_GETFAXSTATS, HSCMDRESP, sizeof( netfaxrstats ), &netfaxrstats )) //打印IPC通道信息 case EPCMD_IPC_STATS: #if BRCM_NONDIST_BUILD VRG_LOG_INFO((VRG_LOG_MOD_EPT, "IPC not supported")); #else boardHalIpcDump( ipcDumpComHandle, ipcDumpMode ); for ( i = 0; i < IPCSHAREDMEM_CFG_MAX_DUPLEX_CHANNELS; i++ ) if (( gIpcChan[i].inUse == XDRV_TRUE ) &&((gIpcChan[i].comHandle == comHandle) || (comHandle == -1))) xdrvIpcPrint( gIpcChan[i].ipcDrv, mode ); ipcSharedMemPrint(gIpcChan[i].ipcDrv, mode )); PrintSharedChannelInfo( pIpcXDrv, mode ); duplexDrv = (IPCSHAREDMEM_DUPLEX_DRV *)(pIpcDrv->ipcHandle); readDrv = &(duplexDrv->ipcRead); writeDrv = &(duplexDrv->ipcWrite); switch (mode) case XDRV_IPC_PRINT_MODE_INFO: IPC_LOG(( " IPC shared memory channel info (%p) ", duplexDrv )); …… case XDRV_IPC_PRINT_MODE_FULL_DUMP: IPC_LOG(( " Read (DSP-->host) buf - size: %d, addr: %p ", readDrv->bufferSize, srcp )); IPC_LOG(( " IPC shared memory stats (%p) ", stats )); …… #endif //显示DSP及主机命令缓冲池信息 case EPCMD_DSP_BUFFERS: hdspRmQueryDspBuffers( dspNum ); hdspSendCmdData( ((dsp << 8) | HAPIRESMAN), HAPI_RM_DSP_BUFFER_QUERY_CMD, HSCMDRESP, sizeof( HAPI_RM_DSPBUFSTATS ), &bufStats ); VRG_LOG_DBG((VRG_LOG_MOD_HDSP, "DSP - Buffer Manager Information:")); VRG_LOG_DBG((VRG_LOG_MOD_HDSP, "%u %u: Free/Low Buffers in Message Buffer Pool", bufStats.hapiMsgBufPoolnumFree, bufStats.hapiMsgBufPoollowWater)); …… hdspSendCmdData( ((dsp << 8) | HAPIRESMAN), HAPI_RM_HOST_BUFFER_QUERY_CMD, HSCMDRESP, sizeof( HAPI_RM_DSPBUFSTATS ), &bufStats ); VRG_LOG_DBG((VRG_LOG_MOD_HDSP, "Host - Buffer Manager Information:")); VRG_LOG_DBG((VRG_LOG_MOD_HDSP, "%u %u: Free/Low Buffers in Message Buffer Pool", bufStats.hapiMsgBufPoolnumFree, bufStats.hapiMsgBufPoollowWater)); …… //设置DSP是否开启节能模式 case EPCMD_PWRMGMT_VPM: #if BRCM_NONDIST_BUILD VRG_LOG_INFO((VRG_LOG_MOD_EPT, "Power saving mode not supported!")); #else //是否开启节能模式 if (enable) boardHalPowerSavingsEnable(); #if defined(CONFIG_SMP) || !defined(BRCM_NONDIST_BUILD) boardHalDspTaskHalt(); //停止hausware任务 #endif bosSleep( 50 ); #ifndef BRCM_NONDIST_BUILD xdrvItpcSendSyncCommand( &gHalItpcDrv, ITPC_POWERSAVE_CMD_ID, &enable, 0 ); //通知DSP线程进入节能模式。 #endif else boardHalPowerSavingsDisable(); #endif case EPCMD_PWRMGMT_AFE: VRG_LOG_INFO(( VRG_LOG_MOD_EPT, "AFE power management not supported!" )); //获取DSP中断次数 case EPCMD_DSP_GETCNT: #if BRCM_NONDIST_BUILD for ( i = 0; i < 3; i++ ) intCount = boardHalIntCountGet(); VRG_LOG_INFO(( VRG_LOG_MOD_EPT, "Interrupt count (%d) 0x%x", i, intCount )); #else pDebugDriver = vrgEndptGetDebugDriver(); xdrvDebugDspReadCnt( pDebugDriver ) != 0 ); #endif //强制让DSP线程产生断言 case EPCMD_DSP_FORCEASSERT: #if BRCM_NONDIST_BUILD VRG_LOG_INFO((VRG_LOG_MOD_EPT, "Force assert not supported!")); #else pDebugDriver = vrgEndptGetDebugDriver(); xdrvDebugDspForceAssert( pDebugDriver ); #endif //获取断言时DSP的上下文及函数栈信息 case EPCMD_DSP_CHECKASSERT: #if BRCM_NONDIST_BUILD VRG_LOG_INFO((VRG_LOG_MOD_EPT, "Check assert not supported")); #else pDebugDriver = vrgEndptGetDebugDriver(); xdrvDebugDspGetAssertStackPtr( pDebugDriver ); #endif //获取当前DSP寄存器的快照: case EPCMD_DSP_GETREGS: #if BRCM_NONDIST_BUILD VRG_LOG_INFO((VRG_LOG_MOD_EPT, "DSP get regs not supported")); #else pDebugDriver = vrgEndptGetDebugDriver(); xdrvDebugDspGetRegs( pDebugDriver ); #endif //获取DSP数据内存信息,目前不支持 case EPCMD_DSP_READDMEM: pDebugDriver = vrgEndptGetDebugDriver(); xdrvDebugDspDumpDataMem( pDebugDriver, consoleCmdParams->arg[0], consoleCmdParams->arg[1]); //VBD传输测试 case EPCMD_TR57_ENABLE: cnx = GetCnxState( cnxId ); //获取资源对象 enableTr57 = consoleCmdParams->arg[1]; if (enableTr57) if (state->offHook) cnx->vbData.bEnabled = VRG_TRUE; SetVoiceMode( cnx, VM_ACTIVE ); //设置为VBD模式 EcanStateSet(state, ECAN_OFF); //关闭回音消除 state->testMode = TESTMODE_TR57; else state->testMode = TESTMODE_NONE; if (state->offHook) //恢复语音模式,并开启回音消除 cnx->vbData.bEnabled = VRG_FALSE; SetVoiceMode( cnx, VM_ACTIVE ); EcanStateSet(state, ECAN_ON); //DSP资源对象环回测试 case EPCMD_VHD_LOOPBACK_ENABLE: //代码被屏蔽了 //获取线路摘挂机状态 case EPCMD_READ_HOOK_STATE: slicDriver = boardHalSlicGetDriver( state->endptNum ); //获取SLIC驱动对象 isOffhook = xdrvSlicIsOffhook(slicDriver); //读取摘挂机状态 //设置状态标记 if ( isOffhook ) state->offHook = VRG_TRUE; else state->offHook = VRG_FALSE; //如果开启GR303支持,使用RFC2833上报摘挂机 if ( state->bGR303Support ) for( ; cnxIndex < VRG_ENDPT_CFG_MAX_CNX_PER_ENDPT; cnxIndex++ ) if ((state->cnx[cnxIndex]) && (state->cnx[cnxIndex]->cnxId == cnxId)) break; if (cnxIndex == VRG_ENDPT_CFG_MAX_CNX_PER_ENDPT) break; GenerateNteEvent( state->cnx[cnxIndex], (state->offHook ? RTP_NTE_OFFHOOK : RTP_NTE_ONHOOK) ); //设置SLIC状态 case EPCMD_SET_SLIC_STATE: switch (slicState) case EPSLIC_MODE_LCF: //设置到传送状态 xdrvCasSetSlicMode( casDriver, XDRV_SLIC_MODE_LCF ); case EPSLIC_MODE_STANDBY: // 恢复断开状态 xdrvCasSetSlicMode( casDriver, XDRV_SLIC_MODE_STANDBY); case EPSLIC_MODE_LCFO: //设置到断开状态 xdrvCasSetSlicMode( casDriver, XDRV_SLIC_MODE_LCFO ); //打印DSP各种能力信息 case EPCMD_PRINT_DSP_CAPABILITIES: boardHalDspDisplayCfg(); //显示DSP栈使用信息 case EPCMD_DSP_STACK_SHOW: #if BRCM_NONDIST_BUILD VRG_LOG_INFO((VRG_LOG_MOD_EPT, "DSP stack show not supported")); #else pDebugDriver = vrgEndptGetDebugDriver(); xdrvDebugDspStackShow( pDebugDriver ); #endif //ICP校正,目前不支持 case EPCMD_DSP_ICP_CALIBRATE: hdspIcpCalibrate(); //启动ICP(空闲调节机制?) case EPCMD_DSP_ICP_START: #if BRCM_NONDIST_BUILD VRG_LOG_INFO((VRG_LOG_MOD_EPT, "Icp not supported")); #else hdspIcpStart( consoleCmdParams->arg[0], consoleCmdParams->arg[1] ); #endif //关闭ICP(空闲调节机制?) case EPCMD_DSP_ICP_STOP: #if BRCM_NONDIST_BUILD VRG_LOG_INFO((VRG_LOG_MOD_EPT, "Icp not supported")); #else hdspIcpStop( VRG_TRUE ); #endif //开启DSP处理中调节机制,并得到统计结果 case EPCMD_DSP_DPR_START: if ( IsCnxVhd(vhdhdl) || (vhdhdl == state->lineVhdHdl)) startDprIngress( vhdhdl ); bosSleep( 10*1000 ); stopDpr(); startDprEgress( vhdhdl ); bosSleep( 10*1000 ); stopDpr(); //设置网络服务寄存器值 case EPCMD_HAPINET_CONFIG_SETREG: hdspSendCmdData( vhdHdl, HAPINET_CONFIG_GETREGS, HSCMDEXTDATA, sizeof(netRegs), &netRegs); hdspSendCmdData( vhdHdl, HAPINET_CONFIG_SETREGS, HSCMDEXTDATA, sizeof(netRegs), &netRegs ); //网络测试,断开从线路VHD与资源VHD的单向连接 case EPCMD_CONFIGURE_NETWTEST: //断开线路VHD到资源VHD连接 hdspRmSwitchBoardConnect( state->lineVhdHdl, HAPI_SWB_TOS, state->cnx[PRIMARY_CNX_INDEX]->vhdhdl, HAPI_SWB_BOS, HAPI_SWB_SIMPLEX, VRG_FALSE ); //连接资源VHD到线路VHD连接 hdspRmSwitchBoardConnect( state->cnx[PRIMARY_CNX_INDEX]->vhdhdl, HAPI_SWB_BOS, state->lineVhdHdl, HAPI_SWB_TOS, HAPI_SWB_SIMPLEX, VRG_TRUE ); //回声消除测试,向进来的包中插入爆破音 case EPCMD_HEC_BURST_ENABLE: //向网络侧来的媒体包中插入爆破白噪音 hdspSendCmdAsync( state->lineVhdHdl, HAPI_HEC_SETREG1_CMD, HSCMDDATA, VRG_OFFSETOF(HEC_REGS, options), HAPI_HEC_EGRESSBURST_ON ); //设置接收增益 hdspSendCmdAsync( state->lineVhdHdl, HAPI_HEC_SETREG1_CMD, HSCMDDATA, VRG_OFFSETOF(HEC_REGS, volumedB), 10 * ( 1 << 8 ) ); //回音消除测试,向进来的包中插入白噪音 case EPCMD_HEC_NOISE_ENABLE: //设置接收增益 hdspSendCmdAsync( state->lineVhdHdl, HAPI_HEC_SETREG1_CMD, HSCMDDATA, VRG_OFFSETOF(HEC_REGS, volumedB), 10 * ( 1 << 8 ) ); //向网络侧来的媒体包中插入白噪音 hdspSendCmdAsync( state->lineVhdHdl, HAPI_HEC_SETREG1_CMD, HSCMDDATA, VRG_OFFSETOF(HEC_REGS, options), HAPI_HEC_EGRESSNOISE_ON ); //设置回音消除默认选项 case EPCMD_HEC_DEFAULT: hdspSendCmdAsync( state->lineVhdHdl, HAPI_HEC_SETREG1_CMD, HSCMDDATA, VRG_OFFSETOF(HEC_REGS, options), 0 ); //获取回音消除状态 case EPCMD_HEC_GET_STATE: hdspSendCmdAsync( state->lineVhdHdl, HAPI_HEC_GETSTATE_CMD, HSCMDDATA, 0, 0); //产生摘挂机等CAS事件 case EPCMD_CASEVT_GENERATE: CasEventCallback( endptState->lineId, CAS_CTL_DETECT_EVENT, consoleCmdParams->arg[0] ); //生成TONE音事件 case EPCMD_TONEEVT_GENERATE: int eventType = consoleCmdParams->arg[0]; evt.hsxop2.val = consoleCmdParams->arg[1]; evt.hsxdevhdl = 0x54 + endptState->lineId; switch ( eventType ) case 0: evt.hsxevt = HAPI_PTE_TONE_OFF_EVT; EndptVhdEventCallback( &evt, 0 ); case 1: evt.hsxevt = HAPI_PTE_TONE_ON_EVT; EndptVhdEventCallback( &evt, 0 ); //向网络侧生成带内DTMF case EPCMD_INDTMF_GENERATE: if ( consoleCmdParams->arg[0] < HAPI_PTE_DTMFDMAXDGT ) //合法按键 hbUpdatePatientState( state->cnxSignalHBId, HBSTATE_ACTIVE ); //获取用户设置,DTMF按键能量值、脉冲时间、斜率 Provision( state->endptArchive, EPPROV_DtmfDbLevel, &dbLevel ); Provision( state->endptArchive, EPPROV_DtmfPulseTime, &pulseTime ); Provision( state->endptArchive, EPPROV_DTMFSkew, &skew ); //生成带内DTMF hdspDigitOn( state->lineVhdHdl, state->lineId, consoleCmdParams->arg[0], dbLevel, skew, pulseTime, INGRESS_TONE ); //向上层报告事件 (*endptConfig.notify)( state->endptArchive, -1, digitMap->epEvent, NULL, 0, EPDTMFACT_TONEON); (*endptConfig.notify)( state->endptArchive, -1, digitMap->epEvent, NULL, 0 , EPDTMFACT_TONEOFF); //设置DSP接收增益 case EPCMD_EGRESSGAIN_SET: int egGaindB = consoleCmdParams->arg[0] + 1; if ( egGaindB <= 20 && egGaindB >= -20 ) state->rxGain = egGaindB; hdspSendCmdAsync( state->lineVhdHdl, HAPI_HEC_SETREG1_CMD, HSCMDDATA, VRG_OFFSETOF( HEC_REGS, volumedB ), HEC_DB2DBQ8( egGaindB ) ); //设置DSP发送增益 case EPCMD_INGRESSGAIN_SET: int inGaindB = consoleCmdParams->arg[0] + 1; if ( inGaindB <= 20 && inGaindB >= -20 ) state->txGain = inGaindB; hdspSendCmdAsync( state->lineVhdHdl, HAPI_HEC_SETREG1_CMD, HSCMDDATA, VRG_OFFSETOF( HEC_REGS, gaindB ), HEC_DB2DBQ8( inGaindB ) ); //将两个线路VHD连接在一起 case EPCMD_CONNECTSB: VRG_ENDPT* state1 = GetEndptState( endptState->lineId ); VRG_ENDPT* state2 = GetEndptState( consoleCmdParams->arg[0] ); hdspRmSwitchBoardConnect( state1->lineVhdHdl, HAPI_SWB_BOS, state2->lineVhdHdl, HAPI_SWB_BOS, HAPI_SWB_DUPLEX, VRG_TRUE ); //设置回声消除 case EPCMD_SET_ECAN_STATE: EcanStateSet(state, consoleCmdParams->arg[0]); //通知DSP,DECT模块已经启动,需要DECT的处理 case EPCMD_DECT_START_BUFF_PROC: xdrvItpcSendSyncCommand( &gHalItpcDrv, ITPC_SET_START_DECT_BUFFER_PROCESSING_CMD_ID, VRG_FALSE, 0 ); //通知DSP,DECT模块关闭,不需要DECT的处理 case EPCMD_DECT_STOP_BUFF_PROC: xdrvItpcSendSyncCommand( &gHalItpcDrv, ITPC_SET_START_DECT_BUFFER_PROCESSING_CMD_ID, VRG_FALSE, 0 ); //进行DECT模块测试 case EPCMD_DECTTEST: dectTest(consoleCmdParams->arg[0]); //开启模拟环回测试 case EPCMD_PBDT_START: VRG_ENDPT* pState = GetEndptState( endptState->lineId ); hdspVhdEnableCmtd(pState->lineVhdHdl, pState->country); cmtdCtlConfigFilter( lineVhdHdl, country, CMTD_TONE_TYPE_DIAL, CMTD_FILTER_1 ); //获取拨号音过滤参数 filtParamp = ( CMTD_STMPARAMS * )&northAmericaDialToneParam; //设置过滤系数 setFilterCoeff( hdl, filtParamp->filtSize, filtParamp->filtCoeffp, filterIndex ); //设置CMTD状态机参数 setStmParam( hdl, &filtParamp->stmParam, filterIndex ); //开启CMTD状态机服务、过滤器 enblFiltStm( hdl, filterIndex, filterIndex ); configuredTone[filterIndex] = toneType; //记载当前过滤音的类型 //开启模拟环回测试 requestLoopback(state, VRG_TRUE); //通知临控模块,线路信号已经处于激活状态 hbUpdatePatientState( state->signalHBId, HBSTATE_ACTIVE ); //关闭回声消除 EcanStateSet(state, ECAN_OFF); state->testMode = TESTMODE_ANALOGLOOPBACK; //标记正在模拟环回测试 //设置SLIC开启模拟环回寄存器 boardHalSetAnalogLoopback( lineId, value ); boardHalSetAnalogLoopbackApm( lineId, enabled ); boardHalSetAnalogLoopback9530(lineId, enabled); //停止模拟环回测试 case EPCMD_PBDT_STOP: requestLoopback(state, VRG_FALSE); //通知临控模块,线路信号已经处于激活状态 hbUpdatePatientState( state->signalHBId, HBSTATE_ACTIVE ); state->testMode = TESTMODE_NONE; //清除测试标记 //设置SLIC关闭模拟环回寄存器 boardHalSetAnalogLoopback( lineId, value ); boardHalSetAnalogLoopbackApm( lineId, enabled ); boardHalSetAnalogLoopback9530(lineId, enabled); //通知临控模块,线路信号已经处于去激活状态 hbUpdatePatientState( state->signalHBId, HBSTATE_INACTIVE ); //获取采样点声音能量 case EPCMD_PBDT_POWER: result = hdspVhdGetCmtdPowerLevel(state->lineVhdHdl, &power); (*endptConfig.notify)( state->endptArchive, -1, EPEVT_DTMF_LEVEL, &power, sizeof(power), -1 ); //执行线路诊断测试 case EPCMD_TPD_START: requestTpd(state, EPSIG_DIAGTESTS_NOPROV_START, consoleCmdParams->arg[0]); state->testMode = TESTMODE_LINEDIAG; //标记测试模式为线路诊断 bActive = (state->offHook) || (state->cnxCnt > 0); //当前线路活动状态 //线路诊断测试请求 mltRequest( state->endptNum, value, bActive ); //根据用户设置测试类型,获取对应TPD控制标记位 translateRequest(portId, testCase); //附加强制测试标记位 tpdCtl[portId].start |= TPD_CTL_TEST_FORCE; //触发TDP任务执行对应类型的线路诊断测试,测试完成后通过事件回调报 //给上层。 tpdCtlProcessSignal(TPD_CTL_SIGNAL_NOPROV_TESTS, portId, isLineActive, tpdCtl[portId].start); //设置RTP时间戳到DSP case EPCMD_RTCP_NTP_TS_UPDATE: //获取时间 ntpTimestamp.ntpTimeStampSecHigh = (consoleCmdParams->arg[1] >> 16) &0xFFFF; ntpTimestamp.ntpTimeStampSecLow = (consoleCmdParams->arg[1]) & 0xFFFF; ntpTimestamp.ntpTimeStampUsecHigh = (consoleCmdParams->arg[2] >> 16) & 0xFFFF; ntpTimestamp.ntpTimeStampUsecLow = (consoleCmdParams->arg[2]) & 0xFFFF; //设置RTP时间戳到DSP hdspSendCmdData( 0x50, HAPI_RTP_SET_NTP_TIMESTAMP_CMD, HSCMDEXTDATA, sizeof(ntpTimestamp), &ntpTimestamp ) //打印每条线路的provTable表配置参数 case EPCMD_PROVTABLE_SHOW: endptProvShow(); for ( line = 0; line < vrgEndptGetNumEndpoints(); line++ ) PROV_ENTRY* pTable = provTable; while ( pTable->provItemId != EPPROV_LastItem ) unsigned char* p = pTable->provItemValue[line]; VRG_LOG_INFO(( VRG_LOG_MOD_PROV, " %-4u | %-4u | %-28s | %-4u | 0x%08X| %02X %02X %02X %02X", line, pTable->provItemId, pTable->provItemName, (unsigned int)pTable->provItemSize, (unsigned int)p, *p, *(p+1), *(p+2), *(p+3) )); pTable++; //将provTable表恢复为默认值 case EPCMD_RESET_PROVTABLE: endptProvResetDefaults(state->country); for ( line = 0; line < vrgEndptGetNumEndpoints(); line++ ) PROV_ENTRY* pTable = provTable; while ( pTable->provItemId != EPPROV_LastItem ) //如果配置是国家特定则使用不同国家默认值覆盖,否则使用默认值 if( (pTable->isCountrySpecific == VRG_TRUE) ) provTemp = malloc(pTable->provItemSize); globeEndptGetDefault(country, EPGLOBE_ID_NULL, pTable->provItemId, provTemp ) memcpy(pTable->provItemValue[line], provTemp, sizeof(provTemp)); free(provTemp); else if(pTable->defaultValue != PROV_UNINITIALIZED_VALUE) memcpy(pTable->provItemValue[line], &pTable->defaultValue, pTable->provItemSize); pTable++; //触发断言 case EPCMD_HOSTASSERT: XCHG_ASSERT( 0 ); //设置Endpoint打印等级 case EPCMD_LOGLEVEL_SET: Endpt_LogLevel = consoleCmdParams->arg[0]; //设置拍叉上下限 case EPCMD_SET_FLASH_HOOK_DURATION: minFlashDuration = consoleCmdParams->arg[0]; maxFlashDuration = consoleCmdParams->arg[1]; //将拍叉上下限设置到所有线路的CAS服务控制块中,用于CAS服务控制块根据此值 //执行拍叉逻辑处理。 casCtlSetFlashDuration(minFlashDuration, maxFlashDuration); for (chan = 0; chan < casState.numChannels; chan++) localp = &(casState.service[chan].localmem); if( (localp != NULL) && (localp->status & CAS_ENABLED) ) localp->channelinfo.fxoParms.minHookFlash = minFlashDuration; localp->channelinfo.fxoParms.maxHookFlash = maxFlashDuration; //设置铃流参数 case EPCMD_SET_RINGER_PARAM_SET: //获取铃流参数(波形、振幅、音量、电压偏移),并设置到provTable参数表中 int waveform = consoleCmdParams->arg[0]; int frequency = consoleCmdParams->arg[1]; int voltage = consoleCmdParams->arg[2]; int offset = consoleCmdParams->arg[3]; endptConfig.setProvision( state->lineId, EPPROV_RingWaveform, &waveform, length); endptConfig.setProvision( state->lineId, EPPROV_PowerRingFrequency, &frequency, length); endptConfig.setProvision( state->lineId, EPPROV_RingVoltage, &voltage, length); endptConfig.setProvision( state->lineId, EPPROV_RingDCOffset, &offset, length); SetRingParams(state); //获取SLIC驱动对象、APM升压模块驱动对象 slicDriver = boardHalSlicGetDriver( state->endptNum ); apmDriver = boardHalApmGetDriver( state->dspNum ); //从provTable参数表中获取铃流参数 ProvisionRingParams(state, ringParam); parms.drvHdl = (void*)apmDriver; parms.arguments[0] = ringParam->frequency; parms.arguments[1] = ringParam->waveshape; parms.arguments[2] = ringParam->voltage; parms.arguments[3] = ringParam->offset; parms.arguments[4] = ringParam->offsetCal; //向APM模块发送设置铃流参数控制命令 casCtlSendExtendedCommand(CAS_REQ_APM_SET_RING_PARMS,CAS_CMD_MODE_ASYNC, &parms ); //向SLIC驱动发送设置铃流参数控制命令 parms.drvHdl = (void*)slicDriver; casCtlSendExtendedCommand( CAS_REQ_SLIC_SET_RING_PARMS, CAS_CMD_MODE_ASYNC, &parms ); //控制振铃使能 case EPCMD_FXS_RING_SET: if(consoleCmdParams->arg[0]) //启振 VRG_BOOL ringInterleave = VRG_TRUE; //通知临控模块,线路信号已经处于激活状态 hbUpdatePatientState( state->signalHBId, HBSTATE_ACTIVE ); //获取铃音相关属性文件 GetRingPattern( EPSIG_RINGING, endptConfig.country, &pattern ); //触发CAS开启振铃 casCtlRingProfileOn( state->casCtlHandle, &pattern, ringInterleave ); else //停振 //通知临控模块,线路信号已经处于激活状态 hbUpdatePatientState( state->signalHBId, HBSTATE_ACTIVE ); //触发CAS停止振铃 casCtlRingOff( state->casCtlHandle, VRG_FALSE ); //通知临控模块,线路信号已经处于去激活状态 hbUpdatePatientState( state->signalHBId, HBSTATE_INACTIVE ); //控制SLIC反极 case EPCMD_FXS_REV_BATTERY: //只能生效于当前使能的FXS口 if( state->isLineUsed != VRG_TRUE || state->endptType != EPTYPE_FXS) return EPSTATUS_ERROR; if(consoleCmdParams->arg[0]) slicmode = XDRV_SLIC_MODE_RLCF; else slicmode = XDRV_SLIC_MODE_LCF; //设置SLIC模式 boardHalSlicModeCtrl(lineId, (int)slicmode);