📄 ixhssaccccm.c
字号:
} /* check to see if disabled yet */ if ((status == IX_SUCCESS) && (ixHssAccCCMEnabledState[hssPortId] == TRUE)) { /* stop the service */ status = ixHssAccCCMPortDisable (hssPortId); } /* * check to see if there is any timeslot switching channels enabled. * If there are, disable all of them. */ if (status == IX_SUCCESS) { for (bypassNum = 0; bypassNum < IX_HSSACC_CHAN_TSLOTSWITCH_NUM_BYPASS_MAX; bypassNum++) { /* if timeslot switching channel exists, disable it */ if (pConfig[bypassNum].bypassEnabledState == TRUE) { status = ixHssAccCCMTslotSwitchDisable (hssPortId, bypassNum); } /* if disable fail, exit the for loop */ if (status != IX_SUCCESS) { break; } } } if (status == IX_SUCCESS) { /* * clear the client connection parameters saved for reference * NOTE: don't want to zero whole structure. Want to leave the * rxCallback set to the dummy callback for debug purposes */ ixHssAccCCMParams[hssPortId].bytesPerTSTrigger = 0; ixHssAccCCMParams[hssPortId].rxCircular = 0; ixHssAccCCMParams[hssPortId].numRxBytesPerTS = 0; ixHssAccCCMParams[hssPortId].txPtrList = 0; ixHssAccCCMParams[hssPortId].numTxPtrLists = 0; ixHssAccCCMParams[hssPortId].numTxBytesPerBlk = 0; ixHssAccCCMParams[hssPortId].tmpRxCallback = NULL; ixHssAccCCMConnectedState[hssPortId] = FALSE; ixHssAccCCMStats.disconnects++; } IX_HSSACC_TRACE0 (IX_HSSACC_FN_ENTRY_EXIT, "Exiting ixHssAccCCMDisconnect\n"); return status;}/** * Function definition: ixHssAccCCMTslotSwitchEnable */IX_STATUS ixHssAccCCMTslotSwitchEnable (IxHssAccHssPort hssPortId, UINT32 sTimeslot, UINT32 dTimeslot, UINT32 *tsSwitchHandle){ IX_STATUS status = IX_SUCCESS; IxNpeMhMessage message; UINT32 bypassNum; UINT32 availBypassChan = IX_HSSACC_CHAN_TSLOTSWITCH_BYPASS_NOT_AVAIL; UINT32 bypassChanConf = 0; UINT32 srcNpeVoiceChanId; UINT32 destNpeVoiceChanId; IxHssAccChanTsSwitchConf *pConfig = &(ixHssAccCCMParams[hssPortId].tsSwitchConf[0]); IX_HSSACC_TRACE0 (IX_HSSACC_FN_ENTRY_EXIT, "Entering ixHssAccCCMTslotSwitchEnable\n"); /* check to see if there is a valid connection on the hss port */ if (ixHssAccCCMConnectedState[hssPortId] == FALSE) { /* report the error */ IX_HSSACC_TRACE0 (IX_HSSACC_DEBUG, "ixHssAccCCMTslotSwitchEnable - no valid channelised " "connection on specified hssPortId\n"); /* return error */ status = IX_FAIL; } if (status == IX_SUCCESS) { /* scan through each timeslot switching channel associated with pConfig[bypassNum] */ for (bypassNum = 0; bypassNum < IX_HSSACC_CHAN_TSLOTSWITCH_NUM_BYPASS_MAX; bypassNum++) { /* check if the timeslot switching channel has been enabled */ if (pConfig[bypassNum].bypassEnabledState == TRUE) { /* * check whether the timeslot switching channel with same source and * destination timeslots already exist */ if ((sTimeslot == pConfig[bypassNum].srcTimeslot) && (dTimeslot == pConfig[bypassNum].destTimeslot)) { /* report the error */ IX_HSSACC_TRACE0 (IX_HSSACC_DEBUG, "ixHssAccCCMTslotSwitchEnable - this bypass" " channel already existed on specified" " hssPortId\n"); /* return error */ status = IX_FAIL; break; } /* * check whether the destination timeslot has already been used in * other timeslot switching channel */ if (dTimeslot == pConfig[bypassNum].destTimeslot) { /* report the error */ IX_HSSACC_TRACE0 (IX_HSSACC_DEBUG, "ixHssAccCCMTslotSwitchEnable - this" " destination timeslot has been used" " in other timeslot switching channel" " on the specified hssPortId\n"); /* return error */ status = IX_FAIL; break; } } else { /* * if the timeslot switching channel associated with pConfig[bypassNum] * is available, assign availBypassChan to it */ if (availBypassChan == IX_HSSACC_CHAN_TSLOTSWITCH_BYPASS_NOT_AVAIL) { availBypassChan = bypassNum; } } } } if (status == IX_SUCCESS) { /* if no more timeslot switching channel available */ if (availBypassChan == IX_HSSACC_CHAN_TSLOTSWITCH_BYPASS_NOT_AVAIL) { /* report the error */ IX_HSSACC_TRACE0 (IX_HSSACC_DEBUG, "ixHssAccCCMTslotSwitchEnable - only up to 2 bypass" " channels are allowed on one HSS Port at any one" " time\n"); /* return error */ status = IX_FAIL; } else { /* enable the timeslot switching channel */ /* translate both source & destination timeslot Id to NPE voice channel Id */ srcNpeVoiceChanId = ixHssAccComTdmToNpeVoiceChanTranslate (hssPortId, sTimeslot); destNpeVoiceChanId = ixHssAccComTdmToNpeVoiceChanTranslate (hssPortId, dTimeslot); /* send both source & destination timeslot Id to NPE via the message handler */ bypassChanConf = (srcNpeVoiceChanId << IX_HSSACC_NPE_CHAN_SRCTSLOT_OFFSET) | (destNpeVoiceChanId << IX_HSSACC_NPE_CHAN_DESTTSLOT_OFFSET); /* create the NpeMh message - NPE_A message format */ ixHssAccComNpeCmdMsgCreate (IX_NPE_A_MSSG_HSS_CHAN_TSLOTSWITCH_ENABLE, 0, hssPortId, availBypassChan, bypassChanConf, &message); /* send the message */ status = ixHssAccComNpeCmdMsgSend (message, TRUE, /* block for response */ IX_NPE_A_MSSG_HSS_CHAN_TSLOTSWITCH_ENABLE); if (status == IX_SUCCESS) { /* save for reference */ pConfig[availBypassChan].bypassEnabledState = TRUE; pConfig[availBypassChan].srcTimeslot = sTimeslot; pConfig[availBypassChan].destTimeslot = dTimeslot; *tsSwitchHandle = availBypassChan; ixHssAccCCMStats.bypassChanEnables++; } else { /* report the error */ IX_HSSACC_TRACE0 (IX_HSSACC_DEBUG, "ixHssAccCCMTslotSwitchEnable - bypass channel" " enable failed\n"); /* ensure not passing another components fail return type */ status = IX_FAIL; } } } IX_HSSACC_TRACE0 (IX_HSSACC_FN_ENTRY_EXIT, "Exiting ixHssAccCCMTslotSwitchEnable\n"); return status;}/** * Function definition: ixHssAccCCMTslotSwitchDisable */IX_STATUS ixHssAccCCMTslotSwitchDisable (IxHssAccHssPort hssPortId, UINT32 tsSwitchHandle){ IX_STATUS status = IX_SUCCESS; IxNpeMhMessage message; IxHssAccChanTsSwitchConf *pConfig = &(ixHssAccCCMParams[hssPortId].tsSwitchConf[0]); IX_HSSACC_TRACE0 (IX_HSSACC_FN_ENTRY_EXIT, "Entering ixHssAccCCMTslotSwitchDisable\n"); /* check to see if tsSwitchHandle hooks to a valid bypass channel on the hss port */ if (pConfig[tsSwitchHandle].bypassEnabledState == FALSE) { /* report the error */ IX_HSSACC_TRACE0 (IX_HSSACC_DEBUG, "ixHssAccCCMTslotSwitchDisable - this timeslot switching" " channel is not enabled\n"); /* return error */ status = IX_FAIL; } else { /* create the NpeMh message - NPE_A message format */ ixHssAccComNpeCmdMsgCreate (IX_NPE_A_MSSG_HSS_CHAN_TSLOTSWITCH_DISABLE, 0, hssPortId, tsSwitchHandle, 0, &message); /* send the message */ status = ixHssAccComNpeCmdMsgSend (message, TRUE, /* block for response */ IX_NPE_A_MSSG_HSS_CHAN_TSLOTSWITCH_DISABLE); if (status == IX_SUCCESS) { /* save for reference */ pConfig[tsSwitchHandle].bypassEnabledState = FALSE; ixHssAccCCMStats.bypassChanDisables++; } else { /* report the error */ IX_HSSACC_TRACE0 (IX_HSSACC_DEBUG, "ixHssAccCCMTslotSwitchDisable - timeslot switching" " channel disable failed\n"); /* ensure not passing another components fail return type */ status = IX_FAIL; } } IX_HSSACC_TRACE0 (IX_HSSACC_FN_ENTRY_EXIT, "Exiting ixHssAccCCMTslotSwitchDisable\n"); return status;}/** * Function definition: ixHssAccCCMTslotSwitchGctDownload */IX_STATUS ixHssAccCCMTslotSwitchGctDownload (IxHssAccHssPort hssPortId, UINT8 *gainCtrlTable, UINT32 tsSwitchHandle){ IX_STATUS status = IX_SUCCESS; IxNpeMhMessage message; UINT32 gctEntryWord; UINT32 index1; IxHssAccChanTsSwitchConf *pConfig = &(ixHssAccCCMParams[hssPortId].tsSwitchConf[0]); IX_HSSACC_TRACE0 (IX_HSSACC_FN_ENTRY_EXIT, "Entering ixHssAccCCMTslotSwitchGctDownload\n"); /* check to see if tsSwitchHandle hooks to a valid bypass channel on the hss port */ if (pConfig[tsSwitchHandle].bypassEnabledState == FALSE) { /* report the error */ IX_HSSACC_TRACE0 (IX_HSSACC_DEBUG, "ixHssAccCCMTslotSwitchGctDownload - this timeslot switching" " channel is not enabled\n"); /* return error */ status = IX_FAIL; } else { /* download gain control table to NPE */ for (index1 = 0; (index1 < IX_HSSACC_CHAN_TSLOTSWITCH_NUM_GCT_ENTRY_MAX) && (status == IX_SUCCESS); index1+=4) { /* * create gain control table word (4 entries/word) from the entries taken from * the table passed by client */ gctEntryWord = (gainCtrlTable[index1 + IX_HSSACC_CHAN_GCT_BYTE0_POS] << IX_HSSACC_NPE_CHAN_GCT_BYTE0_OFFSET) | (gainCtrlTable[index1 + IX_HSSACC_CHAN_GCT_BYTE1_POS] << IX_HSSACC_NPE_CHAN_GCT_BYTE1_OFFSET) | (gainCtrlTable[index1 + IX_HSSACC_CHAN_GCT_BYTE2_POS] << IX_HSSACC_NPE_CHAN_GCT_BYTE2_OFFSET) | (gainCtrlTable[index1 + IX_HSSACC_CHAN_GCT_BYTE3_POS] << IX_HSSACC_NPE_CHAN_GCT_BYTE3_OFFSET); /* create the NpeMh message - NPE_A message format */ ixHssAccComNpeCmdMsgCreate (IX_NPE_A_MSSG_HSS_CHAN_TSLOTSWITCH_GCT_DOWNLOAD, index1, hssPortId, tsSwitchHandle, gctEntryWord, &message); /* send the message */ status = ixHssAccComNpeCmdMsgSend (message, TRUE, /* block for response */ IX_NPE_A_MSSG_HSS_CHAN_TSLOTSWITCH_GCT_DOWNLOAD); } if (status == IX_SUCCESS) { /* save for reference */ pConfig[tsSwitchHandle].gctDownloadedState = TRUE; ixHssAccCCMStats.bypassChanGctDl++; } else { /* report the error */ IX_HSSACC_TRACE0 (IX_HSSACC_DEBUG, "ixHssAccCCMTslotSwitchGctDownload - gain control" " table downloading failed\n"); /* ensure not passing another components fail return type */ status = IX_FAIL; } } IX_HSSACC_TRACE0 (IX_HSSACC_FN_ENTRY_EXIT, "Exiting ixHssAccCCMTslotSwitchGctDownload\n"); return status;}/** * Function definition: ixHssAccCCMRxCallbackRun */void ixHssAccCCMRxCallbackRun (IxHssAccHssPort hssPortId, unsigned rxOffset, unsigned txOffset, unsigned numHssErrs){ /* * call the client issued callback. NOTE: no need for error * check here. When disconnected a private callback will be * registered to gather statistics */ ixHssAccCCMParams[hssPortId].rxCallback (hssPortId, rxOffset, txOffset, numHssErrs); ixHssAccCCMStats.rxCallbacks++;}/** * Function definition: ixHssAccCCMEmptyRxCallback */PRIVATE voidixHssAccCCMEmptyRxCallback (IxHssAccHssPort hssPortId, unsigned rxOffset, unsigned txOffset, unsigned numHssErrs){ ixHssAccCCMStats.emptyRxCallbacks++;}/** * Function definition: ixHssAccCCMQidGet */IxQMgrQIdixHssAccCCMQidGet (IxHssAccHssPort hssPortId){ /* parameters error checked before use */ return ixHssAccCCMQids[hssPortId];}/** * Function definition: ixHssAccCCMShow */void ixHssAccCCMShow (void){ UINT32 bypassNum; IxHssAccChanTsSwitchConf *pConfig = &(ixHssAccCCMParams[0].tsSwitchConf[0]); IxHssAccHssPort hssPortIndex; printf ("\nixHssAccCCMShow:\n"); printf ("\t connects: %d \t enables: %d \t rxCallbacks: %d\n", ixHssAccCCMStats.connects, ixHssAccCCMStats.enables, ixHssAccCCMStats.rxCallbacks); printf ("\tdisconnects: %d \tdisables: %d \temptyRxCallbacks: %d\n\n", ixHssAccCCMStats.disconnects, ixHssAccCCMStats.disables, ixHssAccCCMStats.emptyRxCallbacks); for (hssPortIndex = IX_HSSACC_HSS_PORT_0; hssPortIndex < hssPortMax; hssPortIndex++) { printf ("\thssPort[%d]: %s, %s\n", hssPortIndex, (ixHssAccCCMConnectedState[hssPortIndex] ? "Connected" : "Disconnected"), (ixHssAccCCMEnabledState[hssPortIndex] ? "Enabled" : "Disabled")); if (ixHssAccCCMConnectedState[hssPortIndex]) { printf ("\t\tbytesPerTSTrigger: %d\n", ixHssAccCCMParams[hssPortIndex].bytesPerTSTrigger); printf ("\t\t rxCircular: 0x%p\n", ixHssAccCCMParams[hssPortIndex].rxCircular); printf ("\t\t numRxBytesPerTS: %d\n", ixHssAccCCMParams[hssPortIndex].numRxBytesPerTS); printf ("\t\t txPtrList: 0x%p\n", ixHssAccCCMParams[hssPortIndex].txPtrList); printf ("\t\t numTxPtrLists: %d\n", ixHssAccCCMParams[hssPortIndex].numTxPtrLists); printf ("\t\t numTxBytesPerBlk: %d\n", ixHssAccCCMParams[hssPortIndex].numTxBytesPerBlk); printf ("\t\t rxCallback: %p\n", ixHssAccCCMParams[hssPortIndex].rxCallback); } } printf ("\n\nChannelised timeslot switching (for HSS Port 0 only):\n"); printf ("\t enables: %d \tdisables: %d \t GCT downloads: %d\n\n", ixHssAccCCMStats.bypassChanEnables, ixHssAccCCMStats.bypassChanDisables, ixHssAccCCMStats.bypassChanGctDl); /* scan through each timeslot switching channel associated with pConfig[bypassNum] */ for (bypassNum = 0; bypassNum < IX_HSSACC_CHAN_TSLOTSWITCH_NUM_BYPASS_MAX; bypassNum++) { printf ("\tTimeslot switching channel #%d: %s\n", bypassNum, pConfig[bypassNum].bypassEnabledState ? "Enabled" : "Disabled"); if (pConfig[bypassNum].bypassEnabledState) { printf ("\t\t srcTimeslot: %d\n", pConfig[bypassNum].srcTimeslot); printf ("\t\t destTimeslot: %d\n", pConfig[bypassNum].destTimeslot); printf ("\t\tgctDownloadedState: %s\n", pConfig[bypassNum].gctDownloadedState ? "Downloaded" : "Not downloaded"); } }}/** * Function definition: ixHssAccCCMStatsInit */void ixHssAccCCMStatsInit (void){ ixHssAccCCMStats.connects = 0; ixHssAccCCMStats.disconnects = 0; ixHssAccCCMStats.enables = 0; ixHssAccCCMStats.disables = 0; ixHssAccCCMStats.rxCallbacks = 0; ixHssAccCCMStats.emptyRxCallbacks = 0; ixHssAccCCMStats.bypassChanEnables = 0; ixHssAccCCMStats.bypassChanDisables = 0; ixHssAccCCMStats.bypassChanGctDl = 0;}/** * Function definition: ixHssAccCCMInit */IX_STATUS ixHssAccCCMInit (void){ IxHssAccHssPort hssPortIndex; IX_HSSACC_TRACE0 (IX_HSSACC_FN_ENTRY_EXIT, "Entering ixHssAccCCMInit\n"); /* initialise the stats */ ixHssAccCCMStatsInit (); for (hssPortIndex = IX_HSSACC_HSS_PORT_0; hssPortIndex < IX_HSSACC_HSS_PORT_MAX; hssPortIndex++) { ixHssAccCCMConnectedState[hssPortIndex] = FALSE; ixHssAccCCMEnabledState[hssPortIndex] = FALSE; } IX_HSSACC_TRACE0 (IX_HSSACC_FN_ENTRY_EXIT, "Exiting ixHssAccCCMInit\n"); return IX_SUCCESS;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -