diff options
Diffstat (limited to 'software/octdeviceapi/oct6100api/oct6100_api')
19 files changed, 635 insertions, 544 deletions
diff --git a/software/octdeviceapi/oct6100api/oct6100_api/oct6100_adpcm_chan.c b/software/octdeviceapi/oct6100api/oct6100_api/oct6100_adpcm_chan.c index 6abeda3..94f4495 100644 --- a/software/octdeviceapi/oct6100api/oct6100_api/oct6100_adpcm_chan.c +++ b/software/octdeviceapi/oct6100api/oct6100_api/oct6100_adpcm_chan.c @@ -2,7 +2,7 @@ File: oct6100_adpcm_chan.c - Copyright (c) 2001-2006 Octasic Inc. + Copyright (c) 2001-2007 Octasic Inc. Description: @@ -22,7 +22,7 @@ You should have received a copy of the GNU General Public License along with the OCT6100 GPL API; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -$Octasic_Release: OCT612xAPI-01.00-PR47 $ +$Octasic_Release: OCT612xAPI-01.00-PR48 $ $Octasic_Revision: 16 $ diff --git a/software/octdeviceapi/oct6100api/oct6100_api/oct6100_channel.c b/software/octdeviceapi/oct6100api/oct6100_api/oct6100_channel.c index 766f93b..4536ad4 100644 --- a/software/octdeviceapi/oct6100api/oct6100_api/oct6100_channel.c +++ b/software/octdeviceapi/oct6100api/oct6100_api/oct6100_channel.c @@ -2,7 +2,7 @@ File: oct6100_channel.c - Copyright (c) 2001-2006 Octasic Inc. + Copyright (c) 2001-2007 Octasic Inc. Description: @@ -23,9 +23,9 @@ You should have received a copy of the GNU General Public License along with the OCT6100 GPL API; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -$Octasic_Release: OCT612xAPI-01.00-PR47 $ +$Octasic_Release: OCT612xAPI-01.00-PR48 $ -$Octasic_Revision: 480 $ +$Octasic_Revision: 491 $ \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ @@ -122,7 +122,6 @@ UINT32 Oct6100ChannelOpenDef( f_pChannelOpen->VqeConfig.lRinAutomaticLevelControlTargetDb = -20; f_pChannelOpen->VqeConfig.fSoutAutomaticLevelControl = FALSE; f_pChannelOpen->VqeConfig.lSoutAutomaticLevelControlTargetDb = -20; - f_pChannelOpen->VqeConfig.ulAlcNoiseBleedOutTime = 0; f_pChannelOpen->VqeConfig.fRinHighLevelCompensation = FALSE; f_pChannelOpen->VqeConfig.lRinHighLevelCompensationThresholdDb = -10; f_pChannelOpen->VqeConfig.fSoutAdaptiveNoiseReduction = FALSE; @@ -154,8 +153,6 @@ UINT32 Oct6100ChannelOpenDef( f_pChannelOpen->VqeConfig.fEnableMusicProtection = FALSE; /* Older images have idle code detection hard-coded to enabled. */ f_pChannelOpen->VqeConfig.fIdleCodeDetection = TRUE; - f_pChannelOpen->VqeConfig.fResetRinAlcOnTones = FALSE; - f_pChannelOpen->VqeConfig.fResetSoutAlcOnTones = FALSE; /* TDM configuration.*/ f_pChannelOpen->TdmConfig.ulRinNumTssts = 1; @@ -358,7 +355,6 @@ UINT32 Oct6100ChannelModifyDef( f_pChannelModify->VqeConfig.lRinAutomaticLevelControlTargetDb = (INT32)cOCT6100_KEEP_PREVIOUS_SETTING; f_pChannelModify->VqeConfig.fSoutAutomaticLevelControl = cOCT6100_KEEP_PREVIOUS_SETTING; f_pChannelModify->VqeConfig.lSoutAutomaticLevelControlTargetDb = (INT32)cOCT6100_KEEP_PREVIOUS_SETTING; - f_pChannelModify->VqeConfig.ulAlcNoiseBleedOutTime = cOCT6100_KEEP_PREVIOUS_SETTING; f_pChannelModify->VqeConfig.fRinHighLevelCompensation = cOCT6100_KEEP_PREVIOUS_SETTING; f_pChannelModify->VqeConfig.lRinHighLevelCompensationThresholdDb = (INT32)cOCT6100_KEEP_PREVIOUS_SETTING; f_pChannelModify->VqeConfig.fSoutAdaptiveNoiseReduction = cOCT6100_KEEP_PREVIOUS_SETTING; @@ -388,8 +384,6 @@ UINT32 Oct6100ChannelModifyDef( f_pChannelModify->VqeConfig.ulToneDisablerVqeActivationDelay = cOCT6100_KEEP_PREVIOUS_SETTING; f_pChannelModify->VqeConfig.fEnableMusicProtection = cOCT6100_KEEP_PREVIOUS_SETTING; f_pChannelModify->VqeConfig.fIdleCodeDetection = cOCT6100_KEEP_PREVIOUS_SETTING; - f_pChannelModify->VqeConfig.fResetRinAlcOnTones = cOCT6100_KEEP_PREVIOUS_SETTING; - f_pChannelModify->VqeConfig.fResetSoutAlcOnTones = cOCT6100_KEEP_PREVIOUS_SETTING; /* TDM config. */ f_pChannelModify->TdmConfig.ulRinNumTssts = cOCT6100_KEEP_PREVIOUS_SETTING; @@ -838,7 +832,6 @@ UINT32 Oct6100ChannelGetStatsDef( f_pChannelStats->VqeConfig.fSoutLevelControl = FALSE; f_pChannelStats->VqeConfig.fRinAutomaticLevelControl = FALSE; f_pChannelStats->VqeConfig.fSoutAutomaticLevelControl = FALSE; - f_pChannelStats->VqeConfig.ulAlcNoiseBleedOutTime = cOCT6100_INVALID_STAT; f_pChannelStats->VqeConfig.fRinHighLevelCompensation = FALSE; f_pChannelStats->VqeConfig.fAcousticEcho = FALSE; f_pChannelStats->VqeConfig.fSoutAdaptiveNoiseReduction = FALSE; @@ -869,8 +862,6 @@ UINT32 Oct6100ChannelGetStatsDef( f_pChannelStats->VqeConfig.ulToneDisablerVqeActivationDelay = cOCT6100_INVALID_STAT; f_pChannelStats->VqeConfig.fEnableMusicProtection = FALSE; f_pChannelStats->VqeConfig.fIdleCodeDetection = FALSE; - f_pChannelStats->VqeConfig.fResetRinAlcOnTones = FALSE; - f_pChannelStats->VqeConfig.fResetSoutAlcOnTones = FALSE; @@ -1967,7 +1958,7 @@ UINT32 Oct6100ApiWriteChannelStructs( mOCT6100_GET_CHANNEL_ENTRY_PNT( f_pApiInstance->pSharedInfo, pChanEntry, f_pChanIndexConf->usEchoChanIndex ); /*==============================================================================*/ - /* Configure the Tsst control memory.*/ + /* Configure the Input Tsst control memory.*/ /* Set the RIN Tsst control entry.*/ if ( f_pChanIndexConf->usRinTsstIndex != cOCT6100_INVALID_INDEX ) @@ -1980,18 +1971,6 @@ UINT32 Oct6100ApiWriteChannelStructs( return ulResult; } - /* Set the ROUT Tsst control entry.*/ - if ( f_pChanIndexConf->usRoutTsstIndex != cOCT6100_INVALID_INDEX ) - { - ulResult = Oct6100ApiWriteOutputTsstControlMemory( f_pApiInstance, - f_pChanIndexConf->usRoutTsstIndex, - f_pChannelOpen->CodecConfig.ulAdpcmNibblePosition, - pTdmConfig->ulRoutNumTssts, - f_pChanIndexConf->usRinRoutTsiMemIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - /* Set the SIN Tsst control entry.*/ if ( f_pChanIndexConf->usSinTsstIndex != cOCT6100_INVALID_INDEX ) { @@ -2003,18 +1982,6 @@ UINT32 Oct6100ApiWriteChannelStructs( return ulResult; } - /* Set the SOUT Tsst control entry.*/ - if ( f_pChanIndexConf->usSoutTsstIndex != cOCT6100_INVALID_INDEX ) - { - ulResult = Oct6100ApiWriteOutputTsstControlMemory( f_pApiInstance, - f_pChanIndexConf->usSoutTsstIndex, - f_pChannelOpen->CodecConfig.ulAdpcmNibblePosition, - pTdmConfig->ulSoutNumTssts, - f_pChanIndexConf->usSinSoutTsiMemIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - /*==============================================================================*/ /*==============================================================================*/ @@ -2036,10 +2003,19 @@ UINT32 Oct6100ApiWriteChannelStructs( { if ( pTdmConfig->ulRinPcmLaw == pTdmConfig->ulRoutPcmLaw ) fProgramAdpcmMem = FALSE; + + /* Check if both ports are assigned. If not, no law conversion needed here.. */ + if ( ( pTdmConfig->ulRinStream == cOCT6100_UNASSIGNED ) + || ( pTdmConfig->ulRoutStream == cOCT6100_UNASSIGNED ) ) + fProgramAdpcmMem = FALSE; } else /* f_pChannelOpen->CodecConfig.ulDecoderPort == cOCT6100_CHANNEL_PORT_SIN */ { - if ( f_pChannelOpen->TdmConfig.ulSinPcmLaw == f_pChannelOpen->TdmConfig.ulSoutPcmLaw ) + if ( pTdmConfig->ulSinPcmLaw == pTdmConfig->ulSoutPcmLaw ) + fProgramAdpcmMem = FALSE; + + if ( ( pTdmConfig->ulSinStream == cOCT6100_UNASSIGNED ) + || ( pTdmConfig->ulSoutStream == cOCT6100_UNASSIGNED ) ) fProgramAdpcmMem = FALSE; } break; @@ -2165,6 +2141,11 @@ UINT32 Oct6100ApiWriteChannelStructs( /* Check for law conversion.*/ if ( pTdmConfig->ulRinPcmLaw == pTdmConfig->ulRoutPcmLaw ) fProgramAdpcmMem = FALSE; + + /* Check if both ports are assigned. If not, no law conversion needed here.. */ + if ( ( pTdmConfig->ulRinStream == cOCT6100_UNASSIGNED ) + || ( pTdmConfig->ulRoutStream == cOCT6100_UNASSIGNED ) ) + fProgramAdpcmMem = FALSE; } else /* f_pChannelOpen->CodecConfig.ulEncoderPort == cOCT6100_CHANNEL_PORT_SOUT */ { @@ -2176,8 +2157,13 @@ UINT32 Oct6100ApiWriteChannelStructs( /* Check for law conversion.*/ if ( pTdmConfig->ulSinPcmLaw == pTdmConfig->ulSoutPcmLaw ) fProgramAdpcmMem = FALSE; - } + /* Check if both ports are assigned. If not, no law conversion needed here.. */ + if ( ( pTdmConfig->ulSinStream == cOCT6100_UNASSIGNED ) + || ( pTdmConfig->ulSoutStream == cOCT6100_UNASSIGNED ) ) + fProgramAdpcmMem = FALSE; + } + break; case cOCT6100_G726_40KBPS: ulCompType = 0x3; @@ -2504,6 +2490,35 @@ UINT32 Oct6100ApiWriteChannelStructs( /*==============================================================================*/ + /*==============================================================================*/ + /* Configure the Output Tsst control memory.*/ + + /* Set the ROUT Tsst control entry.*/ + if ( f_pChanIndexConf->usRoutTsstIndex != cOCT6100_INVALID_INDEX ) + { + ulResult = Oct6100ApiWriteOutputTsstControlMemory( f_pApiInstance, + f_pChanIndexConf->usRoutTsstIndex, + f_pChannelOpen->CodecConfig.ulAdpcmNibblePosition, + pTdmConfig->ulRoutNumTssts, + f_pChanIndexConf->usRinRoutTsiMemIndex ); + if ( ulResult != cOCT6100_ERR_OK ) + return ulResult; + } + + /* Set the SOUT Tsst control entry.*/ + if ( f_pChanIndexConf->usSoutTsstIndex != cOCT6100_INVALID_INDEX ) + { + ulResult = Oct6100ApiWriteOutputTsstControlMemory( f_pApiInstance, + f_pChanIndexConf->usSoutTsstIndex, + f_pChannelOpen->CodecConfig.ulAdpcmNibblePosition, + pTdmConfig->ulSoutNumTssts, + f_pChanIndexConf->usSinSoutTsiMemIndex ); + if ( ulResult != cOCT6100_ERR_OK ) + return ulResult; + } + + /*==============================================================================*/ + return cOCT6100_ERR_OK; } #endif @@ -2568,7 +2583,6 @@ UINT32 Oct6100ApiUpdateChannelEntry( pChanEntry->VqeConfig.fRinAutomaticLevelControl = (UINT8)( pVqeConfig->fRinAutomaticLevelControl & 0xFF ); pChanEntry->VqeConfig.chRinAutomaticLevelControlTargetDb = (OCT_INT8)( pVqeConfig->lRinAutomaticLevelControlTargetDb & 0xFF ); pChanEntry->VqeConfig.fSoutAutomaticLevelControl = (UINT8)( pVqeConfig->fSoutAutomaticLevelControl & 0xFF ); - pChanEntry->VqeConfig.usAlcNoiseBleedOutTime = (UINT16)( pVqeConfig->ulAlcNoiseBleedOutTime & 0xFFFF ); pChanEntry->VqeConfig.chSoutAutomaticLevelControlTargetDb = (OCT_INT8)( pVqeConfig->lSoutAutomaticLevelControlTargetDb & 0xFF ); pChanEntry->VqeConfig.fRinHighLevelCompensation = (UINT8)( pVqeConfig->fRinHighLevelCompensation & 0xFF ); pChanEntry->VqeConfig.chRinHighLevelCompensationThresholdDb = (OCT_INT8)( pVqeConfig->lRinHighLevelCompensationThresholdDb & 0xFF ); @@ -2597,8 +2611,6 @@ UINT32 Oct6100ApiUpdateChannelEntry( pChanEntry->VqeConfig.chRoutNoiseReductionLevelGainDb = (OCT_INT8) (pVqeConfig->lRoutNoiseReductionLevelGainDb & 0xFF); pChanEntry->VqeConfig.fEnableMusicProtection = (UINT8)( pVqeConfig->fEnableMusicProtection & 0xFF ); pChanEntry->VqeConfig.fIdleCodeDetection = (UINT8)( pVqeConfig->fIdleCodeDetection & 0xFF ); - pChanEntry->VqeConfig.fResetRinAlcOnTones = (UINT8)( pVqeConfig->fResetRinAlcOnTones & 0xFF ); - pChanEntry->VqeConfig.fResetSoutAlcOnTones = (UINT8)( pVqeConfig->fResetSoutAlcOnTones & 0xFF ); /* Save the codec information.*/ pChanEntry->CodecConfig.byAdpcmNibblePosition = (UINT8)( pCodecConfig->ulAdpcmNibblePosition & 0xFF ); @@ -3259,6 +3271,16 @@ UINT32 Oct6100ApiInvalidateChannelStructs( return ulResult; /*------------------------------------------------------------------------------*/ + /*------------------------------------------------------------------------------*/ + /* Clear the NLP memory. */ + + SmearParams.ulWriteAddress = cOCT6100_CHANNEL_ROOT_BASE + ( pChanEntry->usEchoMemIndex * cOCT6100_CHANNEL_ROOT_SIZE ) + pSharedInfo->MemoryMap.ulChanRootConfOfst + 0x28; + SmearParams.usWriteData = 0x0000; + SmearParams.ulWriteLength = 2; + + mOCT6100_DRIVER_WRITE_SMEAR_API( SmearParams, ulResult ); + if ( ulResult != cOCT6100_ERR_OK ) + return ulResult; /*------------------------------------------------------------------------------*/ /* Clear the AF information memory. */ @@ -3526,6 +3548,11 @@ UINT32 Oct6100ApiReleaseChannelResources( pChanEntry->fReserved = FALSE; pChanEntry->byEntryOpenCnt++; + /* Reset the port, the bridge and BidirInfo */ + pChanEntry->usMutedPorts = cOCT6100_CHANNEL_MUTE_PORT_NONE; + pChanEntry->fBiDirChannel = FALSE; + pChanEntry->usBridgeIndex = cOCT6100_INVALID_INDEX; + /* Decrement the number of channel open.*/ f_pApiInstance->pSharedInfo->ChipStats.usNumberChannels--; @@ -5846,7 +5873,6 @@ UINT32 Oct6100ApiModifyChannelEntry( pApiVqeConf->fSoutLevelControl = (UINT8)( f_pChannelOpen->VqeConfig.fSoutLevelControl & 0xFF ); pApiVqeConf->fRinAutomaticLevelControl = (UINT8)( f_pChannelOpen->VqeConfig.fRinAutomaticLevelControl & 0xFF ); pApiVqeConf->fSoutAutomaticLevelControl = (UINT8)( f_pChannelOpen->VqeConfig.fSoutAutomaticLevelControl & 0xFF ); - pApiVqeConf->usAlcNoiseBleedOutTime = (UINT16)( f_pChannelOpen->VqeConfig.ulAlcNoiseBleedOutTime & 0xFFFF ); pApiVqeConf->fRinHighLevelCompensation = (UINT8)( f_pChannelOpen->VqeConfig.fRinHighLevelCompensation & 0xFF ); pApiVqeConf->fSoutAdaptiveNoiseReduction = (UINT8)( f_pChannelOpen->VqeConfig.fSoutAdaptiveNoiseReduction & 0xFF ); @@ -5879,8 +5905,6 @@ UINT32 Oct6100ApiModifyChannelEntry( pApiVqeConf->chRoutNoiseReductionLevelGainDb = (OCT_INT8)( f_pChannelOpen->VqeConfig.lRoutNoiseReductionLevelGainDb & 0xFF ); pApiVqeConf->fEnableMusicProtection = (UINT8)( f_pChannelOpen->VqeConfig.fEnableMusicProtection & 0xFF ); pApiVqeConf->fIdleCodeDetection = (UINT8)( f_pChannelOpen->VqeConfig.fIdleCodeDetection & 0xFF ); - pApiVqeConf->fResetRinAlcOnTones = (UINT8)( f_pChannelOpen->VqeConfig.fResetRinAlcOnTones & 0xFF ); - pApiVqeConf->fResetSoutAlcOnTones = (UINT8)( f_pChannelOpen->VqeConfig.fResetSoutAlcOnTones & 0xFF ); } /*=======================================================================*/ @@ -6932,7 +6956,6 @@ UINT32 Oct6100ApiChannelGetStatsSer( f_pChannelStats->VqeConfig.fSoutLevelControl = pChanEntry->VqeConfig.fSoutLevelControl; f_pChannelStats->VqeConfig.fRinAutomaticLevelControl = pChanEntry->VqeConfig.fRinAutomaticLevelControl; f_pChannelStats->VqeConfig.fSoutAutomaticLevelControl = pChanEntry->VqeConfig.fSoutAutomaticLevelControl; - f_pChannelStats->VqeConfig.ulAlcNoiseBleedOutTime = pChanEntry->VqeConfig.usAlcNoiseBleedOutTime; f_pChannelStats->VqeConfig.fRinHighLevelCompensation = pChanEntry->VqeConfig.fRinHighLevelCompensation; f_pChannelStats->VqeConfig.fSoutAdaptiveNoiseReduction = pChanEntry->VqeConfig.fSoutAdaptiveNoiseReduction; f_pChannelStats->VqeConfig.fSoutNoiseBleaching = pChanEntry->VqeConfig.fSoutNoiseBleaching; @@ -6961,8 +6984,6 @@ UINT32 Oct6100ApiChannelGetStatsSer( f_pChannelStats->VqeConfig.lRoutNoiseReductionLevelGainDb = pChanEntry->VqeConfig.chRoutNoiseReductionLevelGainDb; f_pChannelStats->VqeConfig.fEnableMusicProtection = pChanEntry->VqeConfig.fEnableMusicProtection; f_pChannelStats->VqeConfig.fIdleCodeDetection = pChanEntry->VqeConfig.fIdleCodeDetection; - f_pChannelStats->VqeConfig.fResetRinAlcOnTones = pChanEntry->VqeConfig.fResetRinAlcOnTones; - f_pChannelStats->VqeConfig.fResetSoutAlcOnTones = pChanEntry->VqeConfig.fResetSoutAlcOnTones; /* Copy the CODEC configuration.*/ f_pChannelStats->CodecConfig.ulAdpcmNibblePosition = pChanEntry->CodecConfig.byAdpcmNibblePosition; @@ -7783,23 +7804,9 @@ UINT32 Oct6100ApiCheckVqeConfig( if ( ( f_pVqeConfig->fRinAutomaticLevelControl == TRUE ) && ( pImageInfo->fRinAutoLevelControl == FALSE ) ) return cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_RIN_AUTO_LC; - if ( f_pVqeConfig->ulAlcNoiseBleedOutTime > 63750 ) - return cOCT6100_ERR_CHANNEL_ALC_NOISE_BLEED_OUT_TIME; - - if ( ( f_pVqeConfig->ulAlcNoiseBleedOutTime != 0 ) && ( pImageInfo->fAlcNoiseBleedOutTime == FALSE ) ) - return cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_ALC_NOISE_BLEED_OUT_TIME; - if ( ( f_pVqeConfig->fRinHighLevelCompensation == TRUE ) && ( pImageInfo->fRinHighLevelCompensation == FALSE ) ) return cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_RIN_HIGH_LEVEL_COMP; - /* Check the enable reset Rin ALC on tone detection flag. */ - if ( ( f_pVqeConfig->fResetRinAlcOnTones != TRUE ) && ( f_pVqeConfig->fResetRinAlcOnTones != FALSE ) ) - return cOCT6100_ERR_CHANNEL_RESET_RIN_ALC_ON_TONES; - - /* The reset Rin ALC on tone detection can be activated if the image supports it. */ - if ( ( f_pVqeConfig->fResetRinAlcOnTones == TRUE ) && ( pImageInfo->fResetRinAlcOnTones == FALSE ) ) - return cOCT6100_ERR_NOT_SUPPORTED_RESET_RIN_ALC_ON_TONES; - if ( f_pVqeConfig->fRinAutomaticLevelControl == TRUE ) { if ( f_pVqeConfig->fRinLevelControl == TRUE ) @@ -7811,12 +7818,6 @@ UINT32 Oct6100ApiCheckVqeConfig( if ( ( f_pVqeConfig->lRinAutomaticLevelControlTargetDb < -40 || f_pVqeConfig->lRinAutomaticLevelControlTargetDb > 0 ) ) return cOCT6100_ERR_CHANNEL_RIN_AUTO_LEVEL_CONTROL_TARGET; } - else /* if ( f_pVqeConfig->fRinAutomaticLevelControl != TRUE ) */ - { - /* Reset Rin ALC on tones can only be activated in Rin ALC is requested. */ - if ( f_pVqeConfig->fResetRinAlcOnTones == TRUE ) - return cOCT6100_ERR_CHANNEL_RIN_AUTO_LEVEL_CONTROL_REQUIRED; - } if ( f_pVqeConfig->fRinHighLevelCompensation == TRUE ) { @@ -7833,14 +7834,6 @@ UINT32 Oct6100ApiCheckVqeConfig( if ( ( f_pVqeConfig->fSoutAutomaticLevelControl == TRUE ) && ( pImageInfo->fSoutAutoLevelControl == FALSE ) ) return cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_SOUT_AUTO_LC; - /* Check the enable reset Sout ALC on tone detection flag. */ - if ( ( f_pVqeConfig->fResetSoutAlcOnTones != TRUE ) && ( f_pVqeConfig->fResetSoutAlcOnTones != FALSE ) ) - return cOCT6100_ERR_CHANNEL_RESET_SOUT_ALC_ON_TONES; - - /* The reset Sout ALC on tone detection can be activated if the image supports it. */ - if ( ( f_pVqeConfig->fResetSoutAlcOnTones == TRUE ) && ( pImageInfo->fResetSoutAlcOnTones == FALSE ) ) - return cOCT6100_ERR_NOT_SUPPORTED_RESET_SOUT_ALC_ON_TONES; - if ( f_pVqeConfig->fSoutAutomaticLevelControl == TRUE ) { if ( f_pVqeConfig->fSoutLevelControl == TRUE ) @@ -7849,21 +7842,6 @@ UINT32 Oct6100ApiCheckVqeConfig( if ( ( f_pVqeConfig->lSoutAutomaticLevelControlTargetDb < -40 || f_pVqeConfig->lSoutAutomaticLevelControlTargetDb > 0 ) ) return cOCT6100_ERR_CHANNEL_SOUT_AUTO_LEVEL_CONTROL_TARGET; } - else /* if ( f_pVqeConfig->fSoutAutomaticLevelControl != TRUE ) */ - { - /* Reset Sout ALC on tones can only be activated if Sout ALC is requested. */ - if ( f_pVqeConfig->fResetSoutAlcOnTones == TRUE ) - return cOCT6100_ERR_CHANNEL_SOUT_AUTO_LEVEL_CONTROL_REQUIRED; - } - - /* ALC noise bleed out can only be configured if ALC is requested. */ - if ( f_pVqeConfig->ulAlcNoiseBleedOutTime != 0 ) - { - /* If both ports ALC is disabled, let the user know. */ - if ( ( f_pVqeConfig->fRinAutomaticLevelControl == FALSE ) - && ( f_pVqeConfig->fSoutAutomaticLevelControl == FALSE ) ) - return cOCT6100_ERR_CHANNEL_AUTO_LEVEL_CONTROL_REQUIRED; - } if ( f_pVqeConfig->fSoutAdaptiveNoiseReduction != TRUE && f_pVqeConfig->fSoutAdaptiveNoiseReduction != FALSE ) @@ -8076,20 +8054,16 @@ UINT32 Oct6100ApiCheckVqeConfig( if ( f_pVqeConfig->fRoutNoiseReduction == TRUE && pImageInfo->fRoutNoiseReduction == FALSE ) return cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_ROUT_NR; - /* Validate Rout noise reduction Level. */ - if ( f_pVqeConfig->fRoutNoiseReduction == TRUE ) - { - /*Check if noise reduction level gain is supported*/ - if ( ( pImageInfo->fRoutNoiseReductionLevel == FALSE ) && ( f_pVqeConfig->lRoutNoiseReductionLevelGainDb != -18 ) ) - return cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_ROUT_NOISE_REDUCTION_GAIN; - - if ( ( f_pVqeConfig->lRoutNoiseReductionLevelGainDb != 0 ) && - ( f_pVqeConfig->lRoutNoiseReductionLevelGainDb != -6 ) && - ( f_pVqeConfig->lRoutNoiseReductionLevelGainDb != -12 ) && - ( f_pVqeConfig->lRoutNoiseReductionLevelGainDb != -18 ) ) - - return cOCT6100_ERR_CHANNEL_ROUT_NOISE_REDUCTION_GAIN; - } + /*Check if noise reduction level gain is supported*/ + if ( ( pImageInfo->fRoutNoiseReductionLevel == FALSE ) && ( f_pVqeConfig->lRoutNoiseReductionLevelGainDb != -18 ) ) + return cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_ROUT_NOISE_REDUCTION_GAIN; + + if ( ( f_pVqeConfig->lRoutNoiseReductionLevelGainDb != 0 ) && + ( f_pVqeConfig->lRoutNoiseReductionLevelGainDb != -6 ) && + ( f_pVqeConfig->lRoutNoiseReductionLevelGainDb != -12 ) && + ( f_pVqeConfig->lRoutNoiseReductionLevelGainDb != -18 ) ) + + return cOCT6100_ERR_CHANNEL_ROUT_NOISE_REDUCTION_GAIN; /* Check if ANR SNRE is supported. */ if ( ( f_pVqeConfig->lAnrSnrEnhancementDb != -18 ) && ( pImageInfo->fAnrSnrEnhancement == FALSE ) ) @@ -8948,7 +8922,8 @@ UINT32 Oct6100ApiWriteVqeNlpMemory( /* Check if the configuration has been changed. */ if ( ( f_fModifyOnly == FALSE ) || ( ( f_fModifyOnly == TRUE ) - && ( f_pVqeConfig->lRoutNoiseReductionLevelGainDb != pChanEntry->VqeConfig.chRoutNoiseReductionLevelGainDb ) ) ) + && ( (f_pVqeConfig->lRoutNoiseReductionLevelGainDb != pChanEntry->VqeConfig.chRoutNoiseReductionLevelGainDb ) + ||( f_pVqeConfig->fRoutNoiseReduction != pChanEntry->VqeConfig.fRoutNoiseReduction ) ) ) ) { ulFeatureBytesOffset = pSharedInfo->MemoryMap.RinAnrValOfst.usDwordOffset * 4; ulFeatureBitOffset = pSharedInfo->MemoryMap.RinAnrValOfst.byBitOffset; @@ -10552,18 +10527,6 @@ UINT32 Oct6100ApiUpdateOpenStruct( f_pChanOpen->VqeConfig.fRinAutomaticLevelControl = f_pChanModify->VqeConfig.fRinAutomaticLevelControl; - if ( f_pChanModify->VqeConfig.fResetRinAlcOnTones == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->VqeConfig.fResetRinAlcOnTones = f_pChanEntry->VqeConfig.fResetRinAlcOnTones; - else - f_pChanOpen->VqeConfig.fResetRinAlcOnTones = f_pChanModify->VqeConfig.fResetRinAlcOnTones; - - - if ( f_pChanModify->VqeConfig.ulAlcNoiseBleedOutTime == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->VqeConfig.ulAlcNoiseBleedOutTime = f_pChanEntry->VqeConfig.usAlcNoiseBleedOutTime; - else - f_pChanOpen->VqeConfig.ulAlcNoiseBleedOutTime = f_pChanModify->VqeConfig.ulAlcNoiseBleedOutTime; - - if ( f_pChanModify->VqeConfig.fRinHighLevelCompensation == cOCT6100_KEEP_PREVIOUS_SETTING ) f_pChanOpen->VqeConfig.fRinHighLevelCompensation = f_pChanEntry->VqeConfig.fRinHighLevelCompensation; else @@ -10612,12 +10575,6 @@ UINT32 Oct6100ApiUpdateOpenStruct( f_pChanOpen->VqeConfig.fSoutAutomaticLevelControl = f_pChanModify->VqeConfig.fSoutAutomaticLevelControl; - if ( f_pChanModify->VqeConfig.fResetSoutAlcOnTones == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->VqeConfig.fResetSoutAlcOnTones = f_pChanEntry->VqeConfig.fResetSoutAlcOnTones; - else - f_pChanOpen->VqeConfig.fResetSoutAlcOnTones = f_pChanModify->VqeConfig.fResetSoutAlcOnTones; - - if ( f_pChanModify->VqeConfig.lRinLevelControlGainDb == ( (INT32)cOCT6100_KEEP_PREVIOUS_SETTING ) ) f_pChanOpen->VqeConfig.lRinLevelControlGainDb = f_pChanEntry->VqeConfig.chRinLevelControlGainDb; else @@ -11124,7 +11081,9 @@ UINT32 Oct6100ApiCheckChannelCreateBiDirParams( return cOCT6100_ERR_CHANNEL_BIDIR_FIRST_CHANNEL_HANDLE; /* Check the specific state of the channel.*/ - if ( pFirstChanEntry->fRinRoutCodecActive == TRUE || pFirstChanEntry->fSinSoutCodecActive == TRUE ) + if ( pFirstChanEntry->fRinRoutCodecActive == TRUE && pFirstChanEntry->CodecConfig.byEncoderPort != cOCT6100_CHANNEL_PORT_ROUT) + return cOCT6100_ERR_CHANNEL_CODEC_ACTIVATED; + if ( pFirstChanEntry->fSinSoutCodecActive == TRUE && pFirstChanEntry->CodecConfig.byEncoderPort != cOCT6100_CHANNEL_PORT_SOUT) return cOCT6100_ERR_CHANNEL_CODEC_ACTIVATED; if ( pFirstChanEntry->fBiDirChannel == TRUE ) return cOCT6100_ERR_CHANNEL_ALREADY_BIDIR; @@ -11168,9 +11127,9 @@ UINT32 Oct6100ApiCheckChannelCreateBiDirParams( return cOCT6100_ERR_CHANNEL_BIDIR_SECOND_CHANNEL_HANDLE; /* Check the specific state of the channel.*/ - if ( pSecondChanEntry->fRinRoutCodecActive == TRUE ) + if ( pSecondChanEntry->fRinRoutCodecActive == TRUE && pSecondChanEntry->CodecConfig.byEncoderPort != cOCT6100_CHANNEL_PORT_ROUT) return cOCT6100_ERR_CHANNEL_CODEC_ACTIVATED; - if ( pSecondChanEntry->fSinSoutCodecActive == TRUE ) + if ( pSecondChanEntry->fSinSoutCodecActive == TRUE && pSecondChanEntry->CodecConfig.byEncoderPort != cOCT6100_CHANNEL_PORT_SOUT) { return cOCT6100_ERR_CHANNEL_CODEC_ACTIVATED; @@ -12695,10 +12654,7 @@ UINT32 Oct6100ApiSetChannelLevelControl( || ( f_pVqeConfig->lSoutAutomaticLevelControlTargetDb != pChanEntry->VqeConfig.chSoutAutomaticLevelControlTargetDb ) || ( f_pVqeConfig->fSoutNaturalListenerEnhancement != pChanEntry->VqeConfig.fSoutNaturalListenerEnhancement ) || ( f_pVqeConfig->ulSoutAutomaticListenerEnhancementGainDb != pChanEntry->VqeConfig.bySoutAutomaticListenerEnhancementGainDb ) - || ( f_pVqeConfig->ulSoutNaturalListenerEnhancementGainDb != pChanEntry->VqeConfig.bySoutNaturalListenerEnhancementGainDb ) - || ( f_pVqeConfig->fResetRinAlcOnTones != pChanEntry->VqeConfig.fResetRinAlcOnTones ) - || ( f_pVqeConfig->fResetSoutAlcOnTones != pChanEntry->VqeConfig.fResetSoutAlcOnTones ) - || ( f_pVqeConfig->ulAlcNoiseBleedOutTime != pChanEntry->VqeConfig.usAlcNoiseBleedOutTime ) ) + || ( f_pVqeConfig->ulSoutNaturalListenerEnhancementGainDb != pChanEntry->VqeConfig.bySoutNaturalListenerEnhancementGainDb ) ) { /* Calculate base address for manual level control configuration. */ ulBaseAddress = cOCT6100_CHANNEL_ROOT_BASE + ( f_usEchoMemIndex * cOCT6100_CHANNEL_ROOT_SIZE ) + pSharedInfo->MemoryMap.ulChanRootConfOfst; @@ -12812,49 +12768,6 @@ UINT32 Oct6100ApiSetChannelLevelControl( /* Calculate base address for auto level control + high level compensation configuration. */ ulBaseAddress = pSharedInfo->MemoryMap.ulChanMainMemBase + ( f_usEchoMemIndex * pSharedInfo->MemoryMap.ulChanMainMemSize ) + f_pApiInstance->pSharedInfo->MemoryMap.ulChanMainIoMemOfst; - /* Configure the ALC bleed out time. */ - if ( pSharedInfo->ImageInfo.fAlcNoiseBleedOutTime == TRUE ) - { - ulFeatureBytesOffset = pSharedInfo->MemoryMap.AlcNoiseBleedOutTimeFieldOfst.usDwordOffset * 4; - ulFeatureBitOffset = pSharedInfo->MemoryMap.AlcNoiseBleedOutTimeFieldOfst.byBitOffset; - ulFeatureFieldLength = pSharedInfo->MemoryMap.AlcNoiseBleedOutTimeFieldOfst.byFieldSize; - - /* First read the DWORD where the field is located.*/ - mOCT6100_RETRIEVE_NLP_CONF_DWORD( f_pApiInstance, - pChanEntry, - ulBaseAddress + ulFeatureBytesOffset, - &ulTempData, - ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Clear previous value set in the feature field.*/ - mOCT6100_CREATE_FEATURE_MASK( ulFeatureFieldLength, ulFeatureBitOffset, &ulMask ); - - ulTempData &= (~ulMask); - - if ( f_pVqeConfig->ulAlcNoiseBleedOutTime != 0 ) - { - /* Set ALC noise bleed out time. */ - usTempData = (UINT16)( f_pVqeConfig->ulAlcNoiseBleedOutTime / 250 ); - ulTempData |= ( usTempData << ulFeatureBitOffset ); - } - else /* if ( f_pVqeConfig->ulAlcNoiseBleedOutTime == 0 ) */ - { - /* Disable ALC noise bleed out. */ - ulTempData |= ( 0x0 << ulFeatureBitOffset ); - } - - /* Save the DWORD where the field is located.*/ - mOCT6100_SAVE_NLP_CONF_DWORD( f_pApiInstance, - pChanEntry, - ulBaseAddress + ulFeatureBytesOffset, - ulTempData, - ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - /* Check which one is to be disabled first. */ if ( f_pVqeConfig->fRinAutomaticLevelControl == TRUE ) fDisableAlcFirst = FALSE; @@ -13004,88 +12917,6 @@ UINT32 Oct6100ApiSetChannelLevelControl( return ulResult; } - /* Set the reset Rin ALC on tones. */ - if ( pSharedInfo->ImageInfo.fResetRinAlcOnTones == TRUE ) - { - ulFeatureBytesOffset = pSharedInfo->MemoryMap.ResetRinAlcOnTonesFieldOfst.usDwordOffset * 4; - ulFeatureBitOffset = pSharedInfo->MemoryMap.ResetRinAlcOnTonesFieldOfst.byBitOffset; - ulFeatureFieldLength = pSharedInfo->MemoryMap.ResetRinAlcOnTonesFieldOfst.byFieldSize; - - /* First read the DWORD where the field is located.*/ - mOCT6100_RETRIEVE_NLP_CONF_DWORD( f_pApiInstance, - pChanEntry, - ulBaseAddress + ulFeatureBytesOffset, - &ulTempData, - ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Clear previous value set in the feature field.*/ - mOCT6100_CREATE_FEATURE_MASK( ulFeatureFieldLength, ulFeatureBitOffset, &ulMask ); - - ulTempData &= (~ulMask); - - if ( f_pVqeConfig->fResetRinAlcOnTones == TRUE ) - { - ulTempData |= ( 1 << ulFeatureBitOffset ); - } - else /* if ( f_pVqeConfig->fResetRinAlcOnTones == FALSE ) */ - { - /* Disable ALC reset on tone detection. */ - ulTempData |= ( 0 << ulFeatureBitOffset ); - } - - /* Save the DWORD where the field is located.*/ - mOCT6100_SAVE_NLP_CONF_DWORD( f_pApiInstance, - pChanEntry, - ulBaseAddress + ulFeatureBytesOffset, - ulTempData, - ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /* Set the reset Sout ALC on tones. */ - if ( pSharedInfo->ImageInfo.fResetSoutAlcOnTones == TRUE ) - { - ulFeatureBytesOffset = pSharedInfo->MemoryMap.ResetSoutAlcOnTonesFieldOfst.usDwordOffset * 4; - ulFeatureBitOffset = pSharedInfo->MemoryMap.ResetSoutAlcOnTonesFieldOfst.byBitOffset; - ulFeatureFieldLength = pSharedInfo->MemoryMap.ResetSoutAlcOnTonesFieldOfst.byFieldSize; - - /* First read the DWORD where the field is located.*/ - mOCT6100_RETRIEVE_NLP_CONF_DWORD( f_pApiInstance, - pChanEntry, - ulBaseAddress + ulFeatureBytesOffset, - &ulTempData, - ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Clear previous value set in the feature field.*/ - mOCT6100_CREATE_FEATURE_MASK( ulFeatureFieldLength, ulFeatureBitOffset, &ulMask ); - - ulTempData &= (~ulMask); - - if ( f_pVqeConfig->fResetSoutAlcOnTones == TRUE ) - { - ulTempData |= ( 1 << ulFeatureBitOffset ); - } - else /* if ( f_pVqeConfig->fResetSoutAlcOnTones == FALSE ) */ - { - /* Disable ALC reset on tone detection. */ - ulTempData |= ( 0 << ulFeatureBitOffset ); - } - - /* Save the DWORD where the field is located.*/ - mOCT6100_SAVE_NLP_CONF_DWORD( f_pApiInstance, - pChanEntry, - ulBaseAddress + ulFeatureBytesOffset, - ulTempData, - ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - /* Set the high level compensation threshold Db for the Sout port. */ if ( pSharedInfo->ImageInfo.fSoutHighLevelCompensation == TRUE ) { @@ -13960,11 +13791,11 @@ UINT32 Oct6100ApiMuteChannelPorts( if ( pChanEntry->usRoutTsstIndex != cOCT6100_INVALID_INDEX ) { - /* Deactivate the TSST entry.*/ - WriteParams.ulWriteAddress = cOCT6100_TSST_CONTROL_MEM_BASE + ( pChanEntry->usRoutTsstIndex * cOCT6100_TSST_CONTROL_MEM_ENTRY_SIZE ); - WriteParams.usWriteData = 0x0000; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); + ulResult = Oct6100ApiWriteOutputTsstControlMemory( f_pApiInstance, + pChanEntry->usRoutTsstIndex, + pChanEntry->CodecConfig.byAdpcmNibblePosition, + pChanEntry->TdmConfig.byRoutNumTssts, + 1534 ); if ( ulResult != cOCT6100_ERR_OK ) return ulResult; } @@ -14032,12 +13863,12 @@ UINT32 Oct6100ApiMuteChannelPorts( if ( pChanEntry->usSoutTsstIndex != cOCT6100_INVALID_INDEX ) { - /* Deactivate the TSST entry.*/ - WriteParams.ulWriteAddress = cOCT6100_TSST_CONTROL_MEM_BASE + ( pChanEntry->usSoutTsstIndex * cOCT6100_TSST_CONTROL_MEM_ENTRY_SIZE ); - WriteParams.usWriteData = 0x0000; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) + ulResult = Oct6100ApiWriteOutputTsstControlMemory( f_pApiInstance, + pChanEntry->usSoutTsstIndex, + pChanEntry->CodecConfig.byAdpcmNibblePosition, + pChanEntry->TdmConfig.bySoutNumTssts, + 1534 ); + if ( ulResult != cOCT6100_ERR_OK ) return ulResult; } diff --git a/software/octdeviceapi/oct6100api/oct6100_api/oct6100_chip_open.c b/software/octdeviceapi/oct6100api/oct6100_api/oct6100_chip_open.c index ae2fe73..9818c33 100644 --- a/software/octdeviceapi/oct6100api/oct6100_api/oct6100_chip_open.c +++ b/software/octdeviceapi/oct6100api/oct6100_api/oct6100_chip_open.c @@ -2,7 +2,7 @@ File: oct6100_chip_open.c - Copyright (c) 2001-2006 Octasic Inc. + Copyright (c) 2001-2007 Octasic Inc. Description: @@ -24,9 +24,9 @@ You should have received a copy of the GNU General Public License along with the OCT6100 GPL API; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -$Octasic_Release: OCT612xAPI-01.00-PR47 $ +$Octasic_Release: OCT612xAPI-01.00-PR48 $ -$Octasic_Revision: 336 $ +$Octasic_Revision: 347 $ \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ @@ -216,6 +216,7 @@ UINT32 Oct6100ChipOpenDef( /* Configure the soft tone event buffer. */ f_pChipOpen->ulSoftToneEventsBufSize = 2048; f_pChipOpen->fEnableExtToneDetection = FALSE; + f_pChipOpen->fEnable2100StopEvent = FALSE; /* Configure the soft playout event buffer. */ f_pChipOpen->ulSoftBufferPlayoutEventsBufSize = cOCT6100_INVALID_VALUE; @@ -283,7 +284,7 @@ UINT32 Oct6100ChipOpen( ulResult = Oct6100ApiCheckChipConfiguration( f_pChipOpen ); if ( ulResult != cOCT6100_ERR_OK ) return ulResult; - + /* Check if the host system is multi-process or not and adjust instance accordingly. */ if ( f_pChipOpen->fMultiProcessSystem != TRUE ) { @@ -420,21 +421,11 @@ UINT32 Oct6100ChipOpen( /* Proceed with the rest only if the production BIST has not been requested. */ if ( f_pChipOpen->fEnableProductionBist == FALSE ) { - /* Configure the interrupt registers. */ - ulResult = Oct6100ApiIsrHwInit( f_pApiInstance, &f_pChipOpen->InterruptConfig ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - /* Initialize the errors counters. */ ulResult = Oct6100ApiChipStatsSwInit( f_pApiInstance ); if ( ulResult != cOCT6100_ERR_OK ) return ulResult; - /* Configure all interrupts of the chip. */ - ulResult = Oct6100InterruptConfigureSer( f_pApiInstance, &f_pChipOpen->InterruptConfig, FALSE ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - /* Get revision number of chip. */ ulResult = Oct6100ApiGetChipRevisionNum( f_pApiInstance ); if ( ulResult != cOCT6100_ERR_OK ) @@ -466,6 +457,16 @@ UINT32 Oct6100ChipOpen( + + /*Clear all interrupts that could have occured during startup*/ + ulResult = Oct6100ApiClearInterrupts( f_pApiInstance ); + if ( ulResult != cOCT6100_ERR_OK ) + return ulResult; + + /* Configure the interrupt registers. */ + ulResult = Oct6100ApiIsrHwInit( f_pApiInstance, &f_pChipOpen->InterruptConfig ); + if ( ulResult != cOCT6100_ERR_OK ) + return ulResult; } return cOCT6100_ERR_OK; @@ -962,8 +963,8 @@ f_pChipOpen Pointer to chip configuration structure. \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ #if !SKIP_OCT6100ApiReadCapacity -UINT32 Oct6100ApiReadCapacity( IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_API_GET_CAPACITY_PINS f_pGetCapacityPins) +UINT32 Oct6100ApiReadCapacity( IN tPOCT6100_INSTANCE_API f_pApiInstance, + IN tPOCT6100_API_GET_CAPACITY_PINS f_pGetCapacityPins) { UINT32 ulResult; tOCT6100_READ_PARAMS ReadParams; @@ -1078,14 +1079,7 @@ UINT32 Oct6100ApiCheckChipConfiguration( if ( f_pChipOpen->ulUpclkFreq != cOCT6100_UPCLK_FREQ_33_33_MHZ ) return cOCT6100_ERR_OPEN_UP_CLK_FREQ; - if ( f_pChipOpen->ulMemClkFreq != cOCT6100_MCLK_FREQ_133_MHZ && - f_pChipOpen->ulMemClkFreq != cOCT6100_MCLK_FREQ_125_MHZ && - f_pChipOpen->ulMemClkFreq != cOCT6100_MCLK_FREQ_117_MHZ && - f_pChipOpen->ulMemClkFreq != cOCT6100_MCLK_FREQ_108_MHZ && - f_pChipOpen->ulMemClkFreq != cOCT6100_MCLK_FREQ_100_MHZ && - f_pChipOpen->ulMemClkFreq != cOCT6100_MCLK_FREQ_92_MHZ && - f_pChipOpen->ulMemClkFreq != cOCT6100_MCLK_FREQ_83_MHZ && - f_pChipOpen->ulMemClkFreq != cOCT6100_MCLK_FREQ_75_MHZ ) + if ( f_pChipOpen->ulMemClkFreq != cOCT6100_MCLK_FREQ_133_MHZ ) return cOCT6100_ERR_OPEN_MEM_CLK_FREQ; if ( f_pChipOpen->fEnableMemClkOut != TRUE && @@ -1100,6 +1094,10 @@ UINT32 Oct6100ApiCheckChipConfiguration( if ( f_pChipOpen->pbyImageFile == NULL ) return cOCT6100_ERR_OPEN_IMAGE_FILE; + ulTempVar = Oct6100ApiCheckImageFileHeader(f_pChipOpen); + if (ulTempVar != cOCT6100_ERR_OK) + return ulTempVar; + /* Check the acoustic echo activation flag. */ if ( f_pChipOpen->fEnableAcousticEcho != TRUE && f_pChipOpen->fEnableAcousticEcho != FALSE ) @@ -1185,6 +1183,10 @@ UINT32 Oct6100ApiCheckChipConfiguration( f_pChipOpen->fEnableExtToneDetection != FALSE ) return cOCT6100_ERR_OPEN_ENABLE_EXT_TONE_DETECTION; + if ( f_pChipOpen->fEnable2100StopEvent != TRUE && + f_pChipOpen->fEnable2100StopEvent != FALSE) + return cOCT6100_ERR_OPEN_ENABLE_2100_STOP_EVENT; + /* Check soft buffer for playout events size. */ if ( ( f_pChipOpen->ulSoftBufferPlayoutEventsBufSize != cOCT6100_INVALID_VALUE ) && ( f_pChipOpen->ulSoftBufferPlayoutEventsBufSize < cOCT6100_MIN_BUFFER_PLAYOUT_EVENT || @@ -1435,6 +1437,7 @@ UINT32 Oct6100ApiCopyChipConfiguration( /* Add 1 to the circular buffer such that all user requested events can fit in the circular queue. */ pSharedInfo->ChipConfig.ulSoftToneEventsBufSize = f_pChipOpen->ulSoftToneEventsBufSize + 1; pSharedInfo->ChipConfig.fEnableExtToneDetection = (UINT8)( f_pChipOpen->fEnableExtToneDetection & 0xFF ); + pSharedInfo->ChipConfig.fEnable2100StopEvent = (UINT8)( f_pChipOpen->fEnable2100StopEvent & 0xFF ); if ( f_pChipOpen->ulSoftBufferPlayoutEventsBufSize != cOCT6100_INVALID_VALUE ) pSharedInfo->ChipConfig.ulSoftBufPlayoutEventsBufSize = f_pChipOpen->ulSoftBufferPlayoutEventsBufSize + 1; @@ -1524,7 +1527,6 @@ UINT32 Oct6100ApiInitializeMiscellaneousVariables( pSharedInfo->ImageInfo.fNlpControl = FALSE; pSharedInfo->ImageInfo.fRinAutoLevelControl = FALSE; pSharedInfo->ImageInfo.fSoutAutoLevelControl = FALSE; - pSharedInfo->ImageInfo.fAlcNoiseBleedOutTime = FALSE; pSharedInfo->ImageInfo.fRinHighLevelCompensation = FALSE; pSharedInfo->ImageInfo.fSoutHighLevelCompensation = FALSE; pSharedInfo->ImageInfo.fAlcHlcStatus = FALSE; @@ -1571,8 +1573,6 @@ UINT32 Oct6100ApiInitializeMiscellaneousVariables( pSharedInfo->ImageInfo.fIdleCodeDetection = TRUE; pSharedInfo->ImageInfo.fIdleCodeDetectionConfiguration = FALSE; pSharedInfo->ImageInfo.fSinLevel = TRUE; - pSharedInfo->ImageInfo.fResetRinAlcOnTones = FALSE; - pSharedInfo->ImageInfo.fResetSoutAlcOnTones = FALSE; pSharedInfo->ImageInfo.usMaxNumberOfChannels = 0; pSharedInfo->ImageInfo.ulToneProfileNumber = cOCT6100_INVALID_VALUE; @@ -2057,6 +2057,36 @@ UINT32 Oct6100ApiGetChipRevisionNum( } #endif +/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ + +Function: Oct6100ApiCheckImageFileHeader + +Description: This function check if the image loaded is valid + +------------------------------------------------------------------------------- +| Argument | Description +------------------------------------------------------------------------------- +f_pApiInstance Pointer to API instance. This memory is used to keep the + present state of the chip and all its resources. + +\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ +#if !SKIP_Oct6100ApiCheckImageFileHeader +UINT32 Oct6100ApiCheckImageFileHeader( + IN tPOCT6100_CHIP_OPEN f_pChipOpen ) +{ + + PUINT8 pszImageInfoStart = NULL; + UINT32 ulStrLen; + + ulStrLen = Oct6100ApiStrLen( (PUINT8)cOCT6100_IMAGE_START_STRING ); + pszImageInfoStart = Oct6100ApiStrStr(f_pChipOpen->pbyImageFile,(PUINT8)cOCT6100_IMAGE_START_STRING, + f_pChipOpen->pbyImageFile + ulStrLen); + if (pszImageInfoStart == NULL) + return cOCT6100_ERR_OPEN_IMAGE_FILE; + + return cOCT6100_ERR_OK; +} +#endif /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ @@ -2247,7 +2277,7 @@ f_pApiInstance Pointer to API instance. This memory is used to keep the \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ UINT32 Oct6100ApiBootFc2PllReadCap( - IN tPOCT6100_INSTANCE_API f_pApiInstance, + IN tPOCT6100_INSTANCE_API f_pApiInstance, IN tPOCT6100_API_GET_CAPACITY_PINS f_pGetCapacityPins) { tOCT6100_WRITE_PARAMS WriteParams; @@ -2838,7 +2868,7 @@ f_pApiInstance Pointer to API instance. This memory is used to keep the \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ UINT32 Oct6100ApiProgramFc1PllReadCap( - IN tPOCT6100_INSTANCE_API f_pApiInstance, + IN tPOCT6100_INSTANCE_API f_pApiInstance, IN tPOCT6100_API_GET_CAPACITY_PINS f_pGetCapacityPins) { tOCT6100_WRITE_PARAMS WriteParams; @@ -3291,7 +3321,7 @@ f_pApiInstance Pointer to API instance. This memory is used to keep the \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ UINT32 Oct6100ApiCpuRegisterBistReadCap( - IN tPOCT6100_INSTANCE_API f_pApiInstance, + IN tPOCT6100_INSTANCE_API f_pApiInstance, IN tPOCT6100_API_GET_CAPACITY_PINS f_pGetCapacityPins ) { @@ -4512,7 +4542,7 @@ UINT32 Oct6100ApiProgramNLP( { /* Verify if the bist succeeded. */ if ( ( usReadData & 0xFFFF ) != 0x0000 ) - return cOCT6100_ERR_OPEN_FUNCTIONAL_BIST_FAILED; /* Bad chip. */ + return cOCT6100_ERR_OPEN_FUNCTIONAL_BIST_FAILED; ulAfCpuUp = TRUE; } @@ -5360,14 +5390,14 @@ UINT32 Oct6100ApiInitChannels( for( i = 0; i < 6; i++ ) { WriteParams.ulWriteAddress = 0x20000 + ( i * 0x1000 ) + ( 1534 * 2 ); - WriteParams.usWriteData = 0xFF; + WriteParams.usWriteData = 0x3EFF; mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); if ( ulResult != cOCT6100_ERR_OK ) return ulResult; WriteParams.ulWriteAddress = 0x20000 + ( i * 0x1000 ) + ( 1535 * 2 ); - WriteParams.usWriteData = 0xFF; + WriteParams.usWriteData = 0x3EFF; mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); if ( ulResult != cOCT6100_ERR_OK ) @@ -6807,3 +6837,69 @@ UINT32 Oct6100ApiProductionCrc( return cOCT6100_ERR_OK; } #endif + +/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ + +Function: Oct6100ApiClearInterrupts + +Description: Called only by the Oct6100OpenChip function, this function + writes to all register ROLs to clear them. This is necessary + because some ROLs are set during the startup. + +------------------------------------------------------------------------------- +| Argument | Description +------------------------------------------------------------------------------- +IN f_pApiInst Pointer to API instance. This memory is used to keep the + present state of the chip and all its resources. + +\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ +#if !SKIP_Oct6100ApiClearInterrupts +UINT32 Oct6100ApiClearInterrupts( + IN tPOCT6100_INSTANCE_API f_pApiInstance ) +{ + tPOCT6100_SHARED_INFO pSharedInfo; + tOCT6100_WRITE_PARAMS WriteParams; + UINT32 ulResult; + + /* Get local pointer to shared portion of instance. */ + pSharedInfo = f_pApiInstance->pSharedInfo; + + /* Set the process context and user chip ID parameters once and for all. */ + WriteParams.pProcessContext = f_pApiInstance->pProcessContext; + + WriteParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; + + WriteParams.ulWriteAddress = 0x102; + WriteParams.usWriteData = cOCT6100_INTRPT_MASK_REG_102H; + mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) + if ( ulResult != cOCT6100_ERR_OK ) + return ulResult; + + WriteParams.ulWriteAddress = 0x202; + WriteParams.usWriteData = cOCT6100_INTRPT_MASK_REG_202H; + mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) + if ( ulResult != cOCT6100_ERR_OK ) + return ulResult; + + WriteParams.ulWriteAddress = 0x302; + WriteParams.usWriteData = cOCT6100_INTRPT_MASK_REG_302H; + mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) + if ( ulResult != cOCT6100_ERR_OK ) + return ulResult; + + WriteParams.ulWriteAddress = 0x502; + WriteParams.usWriteData = cOCT6100_INTRPT_MASK_REG_502H; + mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) + if ( ulResult != cOCT6100_ERR_OK ) + return ulResult; + + WriteParams.ulWriteAddress = 0x702; + WriteParams.usWriteData = cOCT6100_INTRPT_MASK_REG_702H; + mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) + if ( ulResult != cOCT6100_ERR_OK ) + return ulResult; + + return cOCT6100_ERR_OK; + +} +#endif diff --git a/software/octdeviceapi/oct6100api/oct6100_api/oct6100_chip_stats.c b/software/octdeviceapi/oct6100api/oct6100_api/oct6100_chip_stats.c index ffbde43..346005a 100644 --- a/software/octdeviceapi/oct6100api/oct6100_api/oct6100_chip_stats.c +++ b/software/octdeviceapi/oct6100api/oct6100_api/oct6100_chip_stats.c @@ -2,7 +2,7 @@ File: oct6100_chip_stats.c - Copyright (c) 2001-2006 Octasic Inc. + Copyright (c) 2001-2007 Octasic Inc. Description: @@ -22,9 +22,9 @@ You should have received a copy of the GNU General Public License along with the OCT6100 GPL API; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -$Octasic_Release: OCT612xAPI-01.00-PR47 $ +$Octasic_Release: OCT612xAPI-01.00-PR48 $ -$Octasic_Revision: 88 $ +$Octasic_Revision: 89 $ \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ @@ -217,8 +217,6 @@ UINT32 Oct6100ChipGetImageInfoDef( f_pChipImageInfo->fDoubleTalkBehavior = FALSE; f_pChipImageInfo->fIdleCodeDetection = TRUE; f_pChipImageInfo->fSinLevel = TRUE; - f_pChipImageInfo->fResetAlcOnTones = FALSE; - f_pChipImageInfo->fAlcNoiseBleedOutTime = FALSE; for ( i = 0; i < cOCT6100_MAX_TONE_EVENT; i++ ) { @@ -276,18 +274,12 @@ UINT32 Oct6100ChipGetImageInfo( f_pChipImageInfo->fSinLevel = pImageInfo->fSinLevel; f_pChipImageInfo->fDoubleTalkBehavior = pImageInfo->fDoubleTalkBehavior; f_pChipImageInfo->fHighLevelCompensation = pImageInfo->fRinHighLevelCompensation; - f_pChipImageInfo->fAlcNoiseBleedOutTime = pImageInfo->fAlcNoiseBleedOutTime; if ( ( pImageInfo->fRinAutoLevelControl == TRUE ) && ( pImageInfo->fSoutAutoLevelControl == TRUE ) ) f_pChipImageInfo->fAutoLevelControl = TRUE; else f_pChipImageInfo->fAutoLevelControl = FALSE; - if ( ( pImageInfo->fResetRinAlcOnTones == TRUE ) || ( pImageInfo->fResetSoutAlcOnTones == TRUE ) ) - f_pChipImageInfo->fResetAlcOnTones = TRUE; - else - f_pChipImageInfo->fResetAlcOnTones = FALSE; - f_pChipImageInfo->ulMaxChannels = pImageInfo->usMaxNumberOfChannels; f_pChipImageInfo->ulNumTonesAvailable = pImageInfo->byNumToneDetectors; f_pChipImageInfo->ulToneProfileNumber = pImageInfo->ulToneProfileNumber; diff --git a/software/octdeviceapi/oct6100api/oct6100_api/oct6100_conf_bridge.c b/software/octdeviceapi/oct6100api/oct6100_api/oct6100_conf_bridge.c index 2ff3a5a..4a30671 100644 --- a/software/octdeviceapi/oct6100api/oct6100_api/oct6100_conf_bridge.c +++ b/software/octdeviceapi/oct6100api/oct6100_api/oct6100_conf_bridge.c @@ -2,7 +2,7 @@ File: oct6100_conf_bridge.c - Copyright (c) 2001-2006 Octasic Inc. + Copyright (c) 2001-2007 Octasic Inc. Description: @@ -25,7 +25,7 @@ You should have received a copy of the GNU General Public License along with the OCT6100 GPL API; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -$Octasic_Release: OCT612xAPI-01.00-PR47 $ +$Octasic_Release: OCT612xAPI-01.00-PR48 $ $Octasic_Revision: 145 $ diff --git a/software/octdeviceapi/oct6100api/oct6100_api/oct6100_debug.c b/software/octdeviceapi/oct6100api/oct6100_api/oct6100_debug.c index 6095108..ac25f81 100644 --- a/software/octdeviceapi/oct6100api/oct6100_api/oct6100_debug.c +++ b/software/octdeviceapi/oct6100api/oct6100_api/oct6100_debug.c @@ -2,7 +2,7 @@ File: oct6100_debug.c - Copyright (c) 2001-2006 Octasic Inc. + Copyright (c) 2001-2007 Octasic Inc. Description: @@ -22,9 +22,9 @@ You should have received a copy of the GNU General Public License along with the OCT6100 GPL API; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -$Octasic_Release: OCT612xAPI-01.00-PR47 $ +$Octasic_Release: OCT612xAPI-01.00-PR48 $ -$Octasic_Revision: 63 $ +$Octasic_Revision: 64 $ \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ @@ -233,12 +233,11 @@ UINT32 Oct6100DebugSelectChannelSer( tPOCT6100_API_CHANNEL pChanEntry = NULL; tPOCT6100_API_CHANNEL pTempChanEntry; tOCT6100_CHANNEL_OPEN TempChanOpen; + tOCT6100_WRITE_BURST_PARAMS BurstParams; UINT16 usChanIndex = 0; UINT32 ulEntryOpenCnt; - - tOCT6100_WRITE_BURST_PARAMS BurstParams; - UINT16 ausWriteData[ 2 ]; - UINT32 ulResult; + UINT16 ausWriteData[ 2 ]; + UINT32 ulResult; /* Get local pointer(s). */ pSharedInfo = f_pApiInstance->pSharedInfo; @@ -442,7 +441,7 @@ UINT32 Oct6100DebugSelectChannelSer( return ulResult; pSharedInfo->DebugInfo.usCurrentDebugChanIndex = usChanIndex; - + /* Cancel data dump request, if there was one. */ pSharedInfo->DebugInfo.fDebugDataBeingDumped = FALSE; pSharedInfo->DebugInfo.ulDebugDataTotalNumBytes = cOCT6100_INVALID_VALUE; @@ -491,6 +490,7 @@ UINT32 Oct6100DebugGetDataSer( UINT16 ausWriteData[ 2 ]; UINT16 usReadData; UINT16 usDebugEventReadPtr; + UINT16 usTempNumEvents; UINT32 ulResult; UINT32 ulToneEventIndex; @@ -649,7 +649,11 @@ UINT32 Oct6100DebugGetDataSer( ulTimestamp |= usReadData; - ulTimestamp >>= 12; + ulTimestamp >>= 12; /* TDM time for 1 event (512 ms) */ + + /* There is a probability here (once very 6.2 days) that the timestamp is close */ + /* to 0, because it has wrapped. But still, we need a way to workaround the highly */ + /* occuring case of the chip just being opened. This will fix this problem. */ if ( ulTimestamp < (UINT32)( pSharedInfo->DebugInfo.usMatrixCBMask + 1 ) ) { if ( pSharedInfo->DebugInfo.usChipDebugEventWritePtr >= 2 ) @@ -672,6 +676,7 @@ UINT32 Oct6100DebugGetDataSer( pSharedInfo->DebugInfo.usNumEvents--; } + /* If the user only requested the last 16 seconds, cap the number of events. */ if ( f_pGetData->ulGetDataMode == cOCT6100_DEBUG_GET_DATA_MODE_16S || f_pGetData->ulGetDataMode == cOCT6100_DEBUG_GET_DATA_MODE_16S_LITE ) @@ -681,6 +686,36 @@ UINT32 Oct6100DebugGetDataSer( pSharedInfo->DebugInfo.usNumEvents = (UINT16)( ( 16000 / ( pSharedInfo->DebugInfo.ulRecordedPcmEventByteSize / 8 ) ) & 0xFFFF ); } + /* Make sure that all the events are pertaining to the current hot channel. */ + /* Calculate the event read pointer. */ + ulReadPointer = ( ( pSharedInfo->DebugInfo.usChipDebugEventWritePtr - pSharedInfo->DebugInfo.usNumEvents ) & pSharedInfo->DebugInfo.usMatrixCBMask ) * pSharedInfo->DebugInfo.ulDebugChanStatsByteSize; + ulReadPointer %= ( ( pSharedInfo->DebugInfo.usMatrixCBMask + 1 ) * pSharedInfo->DebugInfo.ulDebugChanStatsByteSize ); + + /* Travel through the events and throw away the bad events. */ + usTempNumEvents = pSharedInfo->DebugInfo.usNumEvents; + pSharedInfo->DebugInfo.usNumEvents = 0; + for ( ulDebugEventIndex = 0; ulDebugEventIndex < usTempNumEvents; ulDebugEventIndex ++ ) + { + /* The HOT channel index for the event is stored at offset 0xF2 (word offset) */ + + ReadParams.ulReadAddress = pSharedInfo->DebugInfo.ulMatrixBaseAddress + ulReadPointer; + ReadParams.ulReadAddress += 0xF2 * sizeof(UINT16); + ReadParams.pusReadData = &usReadData; + + mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); + if ( ulResult != cOCT6100_ERR_OK ) + return ulResult; + + /* Check if the current debug index is the same as the one found in the event. */ + if ( usReadData != pSharedInfo->DebugInfo.usCurrentDebugChanIndex ) + pSharedInfo->DebugInfo.usNumEvents = 0; /* As soon as we hit another channel, we reset the number of valid events. */ + else + pSharedInfo->DebugInfo.usNumEvents++; + + /* Increment read pointer to get next event. */ + ulReadPointer = ( ulReadPointer + pSharedInfo->DebugInfo.ulDebugChanStatsByteSize ) % ( ( pSharedInfo->DebugInfo.usMatrixCBMask + 1 ) * pSharedInfo->DebugInfo.ulDebugChanStatsByteSize ); + } + /* In heavy mode, the AF log pointer is retrieved. */ if ( ( pSharedInfo->DebugInfo.usNumEvents >= 2 ) && ( ( f_pGetData->ulGetDataMode == cOCT6100_DEBUG_GET_DATA_MODE_16S ) diff --git a/software/octdeviceapi/oct6100api/oct6100_api/oct6100_events.c b/software/octdeviceapi/oct6100api/oct6100_api/oct6100_events.c index f765732..ef7a36b 100644 --- a/software/octdeviceapi/oct6100api/oct6100_api/oct6100_events.c +++ b/software/octdeviceapi/oct6100api/oct6100_api/oct6100_events.c @@ -2,7 +2,7 @@ File: oct6100_events.c - Copyright (c) 2001-2006 Octasic Inc. + Copyright (c) 2001-2007 Octasic Inc. Description: @@ -22,9 +22,9 @@ You should have received a copy of the GNU General Public License along with the OCT6100 GPL API; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -$Octasic_Release: OCT612xAPI-01.00-PR47 $ +$Octasic_Release: OCT612xAPI-01.00-PR48 $ -$Octasic_Revision: 80 $ +$Octasic_Revision: 81 $ \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ @@ -440,6 +440,7 @@ UINT32 Oct6100ApiTransferToneEvents( UINT32 ulBaseTimestamp; UINT32 ulToneCnt; UINT32 ulNumWordsToRead; + UINT32 ulEventCode; UINT32 ulResult; UINT32 i, j; @@ -587,38 +588,93 @@ UINT32 Oct6100ApiTransferToneEvents( /* Verify all the possible events that might have been detected. */ for ( j = 4; j < cOCT6100_NUM_WORDS_PER_TONE_EVENT; j++ ) { - if ( (( ausReadData[ j ] >> 8 ) & 0x7 ) != 0x0 ) + ulEventCode = ( ausReadData[ j ] >> 8 ) & 0x7; + + if ( ulEventCode != 0x0 ) { /* This tone generated an event, now check if event is masked for the channel. */ if ((( pEchoChannel->aulToneConf[ ulToneCnt / 32 ] >> ( 31 - ( ulToneCnt % 32 ))) & 0x1) == 1 ) { - /* If enough space. */ - if ( ((pSharedInfo->SoftBufs.ulToneEventBufferWritePtr + 1) != pSharedInfo->SoftBufs.ulToneEventBufferReadPtr) && - ((pSharedInfo->SoftBufs.ulToneEventBufferWritePtr + 1) != pSharedInfo->SoftBufs.ulToneEventBufferSize || pSharedInfo->SoftBufs.ulToneEventBufferReadPtr != 0) ) + BOOL f2100Tone; + + /* Check if it is a 2100 Tone STOP and if the user wants receive those events*/ + ulResult = Oct6100ApiIs2100Tone(f_pApiInstance, + pSharedInfo->ImageInfo.aToneInfo[ ulToneCnt ].ulToneID, + &f2100Tone); + if ( ulResult != cOCT6100_ERR_OK ) + return ulResult; + + if ( (f2100Tone == FALSE) || + ( (f2100Tone == TRUE) && (ulEventCode != 2) ) || + ( (f2100Tone == TRUE) && pSharedInfo->ChipConfig.fEnable2100StopEvent == TRUE ) ) { - /* The tone event is not masked, The API can create a soft tone event. */ - mOCT6100_GET_TONE_EVENT_BUF_PNT( pSharedInfo, pSoftEvent ) - pSoftEvent += pSharedInfo->SoftBufs.ulToneEventBufferWritePtr; - - /* Decode the event type. */ - switch(( ausReadData[ j ] >> 8 ) & 0x7 ) + + /* If enough space. */ + if ( ((pSharedInfo->SoftBufs.ulToneEventBufferWritePtr + 1) != pSharedInfo->SoftBufs.ulToneEventBufferReadPtr) && + ((pSharedInfo->SoftBufs.ulToneEventBufferWritePtr + 1) != pSharedInfo->SoftBufs.ulToneEventBufferSize || pSharedInfo->SoftBufs.ulToneEventBufferReadPtr != 0) ) { - case 1: - pSoftEvent->ulEventType = cOCT6100_TONE_PRESENT; - break; - case 2: - pSoftEvent->ulEventType = cOCT6100_TONE_STOP; - break; - case 3: - /* This one is a little tricky. We first */ - /* generate the "PRESENT" event and then generate the "STOP" event. */ + /* The tone event is not masked, The API can create a soft tone event. */ + mOCT6100_GET_TONE_EVENT_BUF_PNT( pSharedInfo, pSoftEvent ) + pSoftEvent += pSharedInfo->SoftBufs.ulToneEventBufferWritePtr; + + /* Decode the event type. */ + switch( ulEventCode ) + { + case 1: + pSoftEvent->ulEventType = cOCT6100_TONE_PRESENT; + break; + case 2: + pSoftEvent->ulEventType = cOCT6100_TONE_STOP; + break; + case 3: + /* This one is a little tricky. We first */ + /* generate the "PRESENT" event and then generate the "STOP" event. */ + + pSoftEvent->ulEventType = cOCT6100_TONE_PRESENT; + pSoftEvent->ulChannelHandle = cOCT6100_HNDL_TAG_CHANNEL | (pEchoChannel->byEntryOpenCnt << cOCT6100_ENTRY_OPEN_CNT_SHIFT) | usChannelIndex; + pSoftEvent->ulUserChanId = pEchoChannel->ulUserChanId; + pSoftEvent->ulToneDetected = pSharedInfo->ImageInfo.aToneInfo[ ulToneCnt ].ulToneID; + /* We want the timestamp not to be equal to the "STOP" event, so we subtract one to the detector's value. */ + pSoftEvent->ulTimestamp = ( ulBaseTimestamp + ((( ausReadData[ j ] >> 13 ) & 0x7) * cOCT6100_LOCAL_TIMESTAMP_INCREMENT ) ) - 1; + pSoftEvent->ulExtToneDetectionPort = ulExtToneDetectionPort; + + /* Update the control variables of the buffer. */ + pSharedInfo->SoftBufs.ulToneEventBufferWritePtr++; + if ( pSharedInfo->SoftBufs.ulToneEventBufferWritePtr == pSharedInfo->SoftBufs.ulToneEventBufferSize ) + pSharedInfo->SoftBufs.ulToneEventBufferWritePtr = 0; + + /* If enough space for the "STOP" event. */ + if ( ((pSharedInfo->SoftBufs.ulToneEventBufferWritePtr + 1) != pSharedInfo->SoftBufs.ulToneEventBufferReadPtr) && + ((pSharedInfo->SoftBufs.ulToneEventBufferWritePtr + 1) != pSharedInfo->SoftBufs.ulToneEventBufferSize || pSharedInfo->SoftBufs.ulToneEventBufferReadPtr != 0) ) + { + mOCT6100_GET_TONE_EVENT_BUF_PNT( pSharedInfo, pSoftEvent ) + pSoftEvent += pSharedInfo->SoftBufs.ulToneEventBufferWritePtr; + + pSoftEvent->ulEventType = cOCT6100_TONE_STOP; + } + else + { + /* Set the overflow flag of the buffer. */ + pSharedInfo->SoftBufs.ulToneEventBufferOverflowCnt++; + + /* We continue in the loop in order to empty the hardware buffer. */ + continue; + } + + break; + case 4: + pSoftEvent->ulEventType = cOCT6100_TONE_PRESENT; + break; + default: + pSharedInfo->ErrorStats.ulToneDetectorErrorCnt++; + /* do not process this packet*/ + continue; + } - pSoftEvent->ulEventType = cOCT6100_TONE_PRESENT; pSoftEvent->ulChannelHandle = cOCT6100_HNDL_TAG_CHANNEL | (pEchoChannel->byEntryOpenCnt << cOCT6100_ENTRY_OPEN_CNT_SHIFT) | usChannelIndex; pSoftEvent->ulUserChanId = pEchoChannel->ulUserChanId; pSoftEvent->ulToneDetected = pSharedInfo->ImageInfo.aToneInfo[ ulToneCnt ].ulToneID; - /* We want the timestamp not to be equal to the "STOP" event, so we subtract one to the detector's value. */ - pSoftEvent->ulTimestamp = ( ulBaseTimestamp + ((( ausReadData[ j ] >> 13 ) & 0x7) * cOCT6100_LOCAL_TIMESTAMP_INCREMENT ) ) - 1; + pSoftEvent->ulTimestamp = ulBaseTimestamp + ((( ausReadData[ j ] >> 13 ) & 0x7) * cOCT6100_LOCAL_TIMESTAMP_INCREMENT ); pSoftEvent->ulExtToneDetectionPort = ulExtToneDetectionPort; /* Update the control variables of the buffer. */ @@ -626,55 +682,17 @@ UINT32 Oct6100ApiTransferToneEvents( if ( pSharedInfo->SoftBufs.ulToneEventBufferWritePtr == pSharedInfo->SoftBufs.ulToneEventBufferSize ) pSharedInfo->SoftBufs.ulToneEventBufferWritePtr = 0; - /* If enough space for the "STOP" event. */ - if ( ((pSharedInfo->SoftBufs.ulToneEventBufferWritePtr + 1) != pSharedInfo->SoftBufs.ulToneEventBufferReadPtr) && - ((pSharedInfo->SoftBufs.ulToneEventBufferWritePtr + 1) != pSharedInfo->SoftBufs.ulToneEventBufferSize || pSharedInfo->SoftBufs.ulToneEventBufferReadPtr != 0) ) - { - mOCT6100_GET_TONE_EVENT_BUF_PNT( pSharedInfo, pSoftEvent ) - pSoftEvent += pSharedInfo->SoftBufs.ulToneEventBufferWritePtr; - - pSoftEvent->ulEventType = cOCT6100_TONE_STOP; - } - else - { - /* Set the overflow flag of the buffer. */ - pSharedInfo->SoftBufs.ulToneEventBufferOverflowCnt++; - - /* We continue in the loop in order to empty the hardware buffer. */ - continue; - } - - break; - case 4: - pSoftEvent->ulEventType = cOCT6100_TONE_PRESENT; - break; - default: - pSharedInfo->ErrorStats.ulToneDetectorErrorCnt++; - /* do not process this packet*/ - continue; + /* Set the interrupt manager such that the user knows that some tone events */ + /* are pending in the software Q. */ + pSharedInfo->IntrptManage.fToneEventsPending = TRUE; } + else + { + /* Set the overflow flag of the buffer. */ + pSharedInfo->SoftBufs.ulToneEventBufferOverflowCnt++; - pSoftEvent->ulChannelHandle = cOCT6100_HNDL_TAG_CHANNEL | (pEchoChannel->byEntryOpenCnt << cOCT6100_ENTRY_OPEN_CNT_SHIFT) | usChannelIndex; - pSoftEvent->ulUserChanId = pEchoChannel->ulUserChanId; - pSoftEvent->ulToneDetected = pSharedInfo->ImageInfo.aToneInfo[ ulToneCnt ].ulToneID; - pSoftEvent->ulTimestamp = ulBaseTimestamp + ((( ausReadData[ j ] >> 13 ) & 0x7) * cOCT6100_LOCAL_TIMESTAMP_INCREMENT ); - pSoftEvent->ulExtToneDetectionPort = ulExtToneDetectionPort; - - /* Update the control variables of the buffer. */ - pSharedInfo->SoftBufs.ulToneEventBufferWritePtr++; - if ( pSharedInfo->SoftBufs.ulToneEventBufferWritePtr == pSharedInfo->SoftBufs.ulToneEventBufferSize ) - pSharedInfo->SoftBufs.ulToneEventBufferWritePtr = 0; - - /* Set the interrupt manager such that the user knows that some tone events */ - /* are pending in the software Q. */ - pSharedInfo->IntrptManage.fToneEventsPending = TRUE; - } - else - { - /* Set the overflow flag of the buffer. */ - pSharedInfo->SoftBufs.ulToneEventBufferOverflowCnt++; - - /* We continue in the loop in order to empty the hardware buffer. */ + /* We continue in the loop in order to empty the hardware buffer. */ + } } } else @@ -691,7 +709,7 @@ UINT32 Oct6100ApiTransferToneEvents( if ( fSSTone == TRUE ) { /* Check if this is a "PRESENT" or "STOP" event */ - switch( ( ( ausReadData[ j ] >> 8 ) & 0x7 ) ) + switch( ulEventCode ) { case 1: /* This is a signaling system present event. Keep this in the instance memory. */ @@ -710,39 +728,94 @@ UINT32 Oct6100ApiTransferToneEvents( } } ulToneCnt++; - + /* Check the other tone of this word. */ - if ( ( ausReadData[ j ] & 0x7 ) != 0x0 ) + ulEventCode = ausReadData[ j ] & 0x7; + + if ( ulEventCode != 0x0 ) { if ((( pEchoChannel->aulToneConf[ ulToneCnt / 32 ] >> ( 31 - ( ulToneCnt % 32 ))) & 0x1) == 1 ) { - /* If enough space. */ - if ( ((pSharedInfo->SoftBufs.ulToneEventBufferWritePtr + 1) != pSharedInfo->SoftBufs.ulToneEventBufferReadPtr) && - ((pSharedInfo->SoftBufs.ulToneEventBufferWritePtr + 1) != pSharedInfo->SoftBufs.ulToneEventBufferSize || pSharedInfo->SoftBufs.ulToneEventBufferReadPtr != 0) ) + BOOL f2100Tone; + + /* Check if it is a 2100 Tone STOP and if the user wants receive those events*/ + ulResult = Oct6100ApiIs2100Tone(f_pApiInstance, + pSharedInfo->ImageInfo.aToneInfo[ ulToneCnt ].ulToneID, + &f2100Tone); + if ( ulResult != cOCT6100_ERR_OK ) + return ulResult; + + if ( (f2100Tone == FALSE) || + ( (f2100Tone == TRUE) && (ulEventCode != 2) ) || + ( (f2100Tone == TRUE) && pSharedInfo->ChipConfig.fEnable2100StopEvent == TRUE ) ) { - /* The tone event is not masked, The API can create a soft tone event. */ - mOCT6100_GET_TONE_EVENT_BUF_PNT( pSharedInfo, pSoftEvent ) - pSoftEvent += pSharedInfo->SoftBufs.ulToneEventBufferWritePtr; - - /* Decode the event type. */ - switch(( ausReadData[ j ] ) & 0x7 ) + + /* If enough space. */ + if ( ((pSharedInfo->SoftBufs.ulToneEventBufferWritePtr + 1) != pSharedInfo->SoftBufs.ulToneEventBufferReadPtr) && + ((pSharedInfo->SoftBufs.ulToneEventBufferWritePtr + 1) != pSharedInfo->SoftBufs.ulToneEventBufferSize || pSharedInfo->SoftBufs.ulToneEventBufferReadPtr != 0) ) { - case 1: - pSoftEvent->ulEventType = cOCT6100_TONE_PRESENT; - break; - case 2: - pSoftEvent->ulEventType = cOCT6100_TONE_STOP; - break; - case 3: - /* This one is a little tricky. We first */ - /* generate the "PRESENT" event and then generate the "STOP" event. */ + /* The tone event is not masked, The API can create a soft tone event. */ + mOCT6100_GET_TONE_EVENT_BUF_PNT( pSharedInfo, pSoftEvent ) + pSoftEvent += pSharedInfo->SoftBufs.ulToneEventBufferWritePtr; + + /* Decode the event type. */ + switch( ulEventCode ) + { + case 1: + pSoftEvent->ulEventType = cOCT6100_TONE_PRESENT; + break; + case 2: + pSoftEvent->ulEventType = cOCT6100_TONE_STOP; + break; + case 3: + /* This one is a little tricky. We first */ + /* generate the "PRESENT" event and then generate the "STOP" event. */ + + pSoftEvent->ulEventType = cOCT6100_TONE_PRESENT; + pSoftEvent->ulChannelHandle = cOCT6100_HNDL_TAG_CHANNEL | (pEchoChannel->byEntryOpenCnt << cOCT6100_ENTRY_OPEN_CNT_SHIFT) | usChannelIndex; + pSoftEvent->ulUserChanId = pEchoChannel->ulUserChanId; + pSoftEvent->ulToneDetected = pSharedInfo->ImageInfo.aToneInfo[ ulToneCnt ].ulToneID; + /* We want the timestamp not to be equal to the "STOP" event, so we subtract one to the detector's value. */ + pSoftEvent->ulTimestamp = ( ulBaseTimestamp + ((( ausReadData[ j ] >> 5 ) & 0x7) * cOCT6100_LOCAL_TIMESTAMP_INCREMENT ) ) - 1; + pSoftEvent->ulExtToneDetectionPort = ulExtToneDetectionPort; + + /* Update the control variables of the buffer. */ + pSharedInfo->SoftBufs.ulToneEventBufferWritePtr++; + if ( pSharedInfo->SoftBufs.ulToneEventBufferWritePtr == pSharedInfo->SoftBufs.ulToneEventBufferSize ) + pSharedInfo->SoftBufs.ulToneEventBufferWritePtr = 0; + + /* If enough space for the "STOP" event. */ + if ( ((pSharedInfo->SoftBufs.ulToneEventBufferWritePtr + 1) != pSharedInfo->SoftBufs.ulToneEventBufferReadPtr) && + ((pSharedInfo->SoftBufs.ulToneEventBufferWritePtr + 1) != pSharedInfo->SoftBufs.ulToneEventBufferSize || pSharedInfo->SoftBufs.ulToneEventBufferReadPtr != 0) ) + { + mOCT6100_GET_TONE_EVENT_BUF_PNT( pSharedInfo, pSoftEvent ) + pSoftEvent += pSharedInfo->SoftBufs.ulToneEventBufferWritePtr; + + pSoftEvent->ulEventType = cOCT6100_TONE_STOP; + } + else + { + /* Set the overflow flag of the buffer. */ + pSharedInfo->SoftBufs.ulToneEventBufferOverflowCnt++; + + /* We continue in the loop in order to empty the hardware buffer. */ + continue; + } + + break; + case 4: + pSoftEvent->ulEventType = cOCT6100_TONE_PRESENT; + break; + default: + pSharedInfo->ErrorStats.ulToneDetectorErrorCnt++; + /* Do not process this packet. */ + continue; + } - pSoftEvent->ulEventType = cOCT6100_TONE_PRESENT; pSoftEvent->ulChannelHandle = cOCT6100_HNDL_TAG_CHANNEL | (pEchoChannel->byEntryOpenCnt << cOCT6100_ENTRY_OPEN_CNT_SHIFT) | usChannelIndex; pSoftEvent->ulUserChanId = pEchoChannel->ulUserChanId; pSoftEvent->ulToneDetected = pSharedInfo->ImageInfo.aToneInfo[ ulToneCnt ].ulToneID; - /* We want the timestamp not to be equal to the "STOP" event, so we subtract one to the detector's value. */ - pSoftEvent->ulTimestamp = ( ulBaseTimestamp + ((( ausReadData[ j ] >> 5 ) & 0x7) * cOCT6100_LOCAL_TIMESTAMP_INCREMENT ) ) - 1; + pSoftEvent->ulTimestamp = ulBaseTimestamp + ((( ausReadData[ j ] >> 5 ) & 0x7) * cOCT6100_LOCAL_TIMESTAMP_INCREMENT ); pSoftEvent->ulExtToneDetectionPort = ulExtToneDetectionPort; /* Update the control variables of the buffer. */ @@ -750,56 +823,18 @@ UINT32 Oct6100ApiTransferToneEvents( if ( pSharedInfo->SoftBufs.ulToneEventBufferWritePtr == pSharedInfo->SoftBufs.ulToneEventBufferSize ) pSharedInfo->SoftBufs.ulToneEventBufferWritePtr = 0; - /* If enough space for the "STOP" event. */ - if ( ((pSharedInfo->SoftBufs.ulToneEventBufferWritePtr + 1) != pSharedInfo->SoftBufs.ulToneEventBufferReadPtr) && - ((pSharedInfo->SoftBufs.ulToneEventBufferWritePtr + 1) != pSharedInfo->SoftBufs.ulToneEventBufferSize || pSharedInfo->SoftBufs.ulToneEventBufferReadPtr != 0) ) - { - mOCT6100_GET_TONE_EVENT_BUF_PNT( pSharedInfo, pSoftEvent ) - pSoftEvent += pSharedInfo->SoftBufs.ulToneEventBufferWritePtr; - - pSoftEvent->ulEventType = cOCT6100_TONE_STOP; - } - else - { - /* Set the overflow flag of the buffer. */ - pSharedInfo->SoftBufs.ulToneEventBufferOverflowCnt++; + /* Set the interrupt manager such that the user knows that some tone events */ + /* are pending in the software Q. */ + pSharedInfo->IntrptManage.fToneEventsPending = TRUE; - /* We continue in the loop in order to empty the hardware buffer. */ - continue; - } - - break; - case 4: - pSoftEvent->ulEventType = cOCT6100_TONE_PRESENT; - break; - default: - pSharedInfo->ErrorStats.ulToneDetectorErrorCnt++; - /* Do not process this packet. */ - continue; } + else + { + /* Set the overflow flag of the buffer. */ + pSharedInfo->SoftBufs.ulToneEventBufferOverflowCnt++; - pSoftEvent->ulChannelHandle = cOCT6100_HNDL_TAG_CHANNEL | (pEchoChannel->byEntryOpenCnt << cOCT6100_ENTRY_OPEN_CNT_SHIFT) | usChannelIndex; - pSoftEvent->ulUserChanId = pEchoChannel->ulUserChanId; - pSoftEvent->ulToneDetected = pSharedInfo->ImageInfo.aToneInfo[ ulToneCnt ].ulToneID; - pSoftEvent->ulTimestamp = ulBaseTimestamp + ((( ausReadData[ j ] >> 5 ) & 0x7) * cOCT6100_LOCAL_TIMESTAMP_INCREMENT ); - pSoftEvent->ulExtToneDetectionPort = ulExtToneDetectionPort; - - /* Update the control variables of the buffer. */ - pSharedInfo->SoftBufs.ulToneEventBufferWritePtr++; - if ( pSharedInfo->SoftBufs.ulToneEventBufferWritePtr == pSharedInfo->SoftBufs.ulToneEventBufferSize ) - pSharedInfo->SoftBufs.ulToneEventBufferWritePtr = 0; - - /* Set the interrupt manager such that the user knows that some tone events */ - /* are pending in the software Q. */ - pSharedInfo->IntrptManage.fToneEventsPending = TRUE; - - } - else - { - /* Set the overflow flag of the buffer. */ - pSharedInfo->SoftBufs.ulToneEventBufferOverflowCnt++; - - /* We continue in the loop in order to empty the hardware buffer. */ + /* We continue in the loop in order to empty the hardware buffer. */ + } } } else @@ -816,7 +851,7 @@ UINT32 Oct6100ApiTransferToneEvents( if ( fSSTone == TRUE ) { /* Check if this is a "PRESENT" event. */ - switch ( ( ausReadData[ j ] ) & 0x7 ) + switch ( ulEventCode ) { case 1: /* This is a signaling system present event. Keep this in the instance memory. */ diff --git a/software/octdeviceapi/oct6100api/oct6100_api/oct6100_interrupts.c b/software/octdeviceapi/oct6100api/oct6100_api/oct6100_interrupts.c index 6900dfd..4d0cf79 100644 --- a/software/octdeviceapi/oct6100api/oct6100_api/oct6100_interrupts.c +++ b/software/octdeviceapi/oct6100api/oct6100_api/oct6100_interrupts.c @@ -2,7 +2,7 @@ File: oct6100_interrupts.c - Copyright (c) 2001-2006 Octasic Inc. + Copyright (c) 2001-2007 Octasic Inc. Description: @@ -23,9 +23,9 @@ You should have received a copy of the GNU General Public License along with the OCT6100 GPL API; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -$Octasic_Release: OCT612xAPI-01.00-PR47 $ +$Octasic_Release: OCT612xAPI-01.00-PR48 $ -$Octasic_Revision: 75 $ +$Octasic_Revision: 78 $ \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ @@ -330,7 +330,7 @@ UINT32 Oct6100ApiIsrHwInit( return ulResult; WriteParams.ulWriteAddress = 0x504; - WriteParams.usWriteData = 0x0001; + WriteParams.usWriteData = 0x0002; mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) if ( ulResult != cOCT6100_ERR_OK ) return ulResult; @@ -441,6 +441,12 @@ UINT32 Oct6100InterruptConfigureSer( f_pIntrptConfig->ulErrorH100Timeout = ((f_pIntrptConfig->ulErrorH100Timeout + 9) / 10) * 10; pIntrptConfig->ulErrorH100TimeoutMclk = f_pIntrptConfig->ulErrorH100Timeout * pIntrptManage->ulNumMclkCyclesIn1Ms; + + /*Clear all interrupts that were already enabled*/ + ulResult = Oct6100ApiClearEnabledInterrupts( f_pApiInstance ); + if ( ulResult != cOCT6100_ERR_OK ) + return ulResult; + /* Before writing the new configuration to the chip's registers, make sure that any */ /* interrupts which are either disabled or have no timeout period are not on the */ /* disabled interrupt list. */ @@ -495,6 +501,7 @@ UINT32 Oct6100InterruptConfigureSer( pIntrptManage->byErrorH100State = cOCT6100_INTRPT_ACTIVE; } + /* Write to the interrupt registers to update the state of each interrupt group. */ ulResult = Oct6100ApiWriteIeRegs( f_pApiInstance ); if ( ulResult != cOCT6100_ERR_OK ) @@ -504,6 +511,104 @@ UINT32 Oct6100InterruptConfigureSer( } #endif +/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ + +Function: Oct6100ApiClearEnabledInterrupts + +Description: Disabled interruption are not reported but still available. This + function will clear the interrupts that were disabled and wish + to enable now. + +------------------------------------------------------------------------------- +| Argument | Description +------------------------------------------------------------------------------- +f_pApiInstance Pointer to API instance. This memory is used to keep + the present state of the chip and all its resources. + +f_pIntrptConfig Pointer to interrupt configuration structure. +f_pIntrptManage Pointer to interrupt manager structure. +\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ + +#if !SKIP_Oct6100ApiClearEnabledInterrupts +UINT32 Oct6100ApiClearEnabledInterrupts( + IN tPOCT6100_INSTANCE_API f_pApiInstance ) +{ + + tPOCT6100_SHARED_INFO pSharedInfo; + tOCT6100_WRITE_PARAMS WriteParams; + tPOCT6100_API_INTRPT_CONFIG pIntrptConfig; + tPOCT6100_API_INTRPT_MANAGE pIntrptManage; + UINT32 ulResult; + + /* Get local pointer to shared portion of instance. */ + pSharedInfo = f_pApiInstance->pSharedInfo; + + /* Set the process context and user chip ID parameters once and for all. */ + WriteParams.pProcessContext = f_pApiInstance->pProcessContext; + + WriteParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; + + /* Copy the configuration to the API instance. */ + pIntrptConfig = &f_pApiInstance->pSharedInfo->IntrptConfig; + pIntrptManage = &f_pApiInstance->pSharedInfo->IntrptManage; + + if ( pIntrptConfig->byFatalGeneralConfig != cOCT6100_INTERRUPT_DISABLE && + pIntrptManage->byFatalGeneralState != cOCT6100_INTRPT_DISABLED ) + { + WriteParams.ulWriteAddress = 0x102; + WriteParams.usWriteData = cOCT6100_INTRPT_MASK_REG_102H; + mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) + if ( ulResult != cOCT6100_ERR_OK ) + return ulResult; + + WriteParams.ulWriteAddress = 0x202; + WriteParams.usWriteData = 0x1800; + mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) + if ( ulResult != cOCT6100_ERR_OK ) + return ulResult; + + WriteParams.ulWriteAddress = 0x502; + WriteParams.usWriteData = cOCT6100_INTRPT_MASK_REG_502H; + mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) + if ( ulResult != cOCT6100_ERR_OK ) + return ulResult; + } + + if ( pIntrptConfig->byErrorMemoryConfig != cOCT6100_INTERRUPT_DISABLE && + pIntrptManage->byErrorMemoryState != cOCT6100_INTRPT_DISABLED ) + { + WriteParams.ulWriteAddress = 0x202; + WriteParams.usWriteData = cOCT6100_INTRPT_MASK_REG_202H; + mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) + if ( ulResult != cOCT6100_ERR_OK ) + return ulResult; + } + + if ( pIntrptConfig->byErrorH100Config != cOCT6100_INTERRUPT_DISABLE && + pIntrptManage->byErrorH100State != cOCT6100_INTRPT_DISABLED ) + { + WriteParams.ulWriteAddress = 0x302; + WriteParams.usWriteData = cOCT6100_INTRPT_MASK_REG_302H; + mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) + if ( ulResult != cOCT6100_ERR_OK ) + return ulResult; + } + + if ( pIntrptConfig->byErrorOverflowToneEventsConfig != cOCT6100_INTERRUPT_DISABLE && + pIntrptManage->byErrorOverflowToneEventsState != cOCT6100_INTRPT_DISABLED ) + { + WriteParams.ulWriteAddress = 0x702; + WriteParams.usWriteData = cOCT6100_INTRPT_MASK_REG_702H; + mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) + if ( ulResult != cOCT6100_ERR_OK ) + return ulResult; + } + + + return cOCT6100_ERR_OK; + +} +#endif /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ diff --git a/software/octdeviceapi/oct6100api/oct6100_api/oct6100_memory.c b/software/octdeviceapi/oct6100api/oct6100_api/oct6100_memory.c index 93edd54..8580249 100644 --- a/software/octdeviceapi/oct6100api/oct6100_api/oct6100_memory.c +++ b/software/octdeviceapi/oct6100api/oct6100_api/oct6100_memory.c @@ -2,7 +2,7 @@ File: oct6100_memory.c - Copyright (c) 2001-2006 Octasic Inc. + Copyright (c) 2001-2007 Octasic Inc. Description: @@ -23,7 +23,7 @@ You should have received a copy of the GNU General Public License along with the OCT6100 GPL API; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -$Octasic_Release: OCT612xAPI-01.00-PR47 $ +$Octasic_Release: OCT612xAPI-01.00-PR48 $ $Octasic_Revision: 42 $ diff --git a/software/octdeviceapi/oct6100api/oct6100_api/oct6100_miscellaneous.c b/software/octdeviceapi/oct6100api/oct6100_api/oct6100_miscellaneous.c index 107ba76..0648d31 100644 --- a/software/octdeviceapi/oct6100api/oct6100_api/oct6100_miscellaneous.c +++ b/software/octdeviceapi/oct6100api/oct6100_api/oct6100_miscellaneous.c @@ -2,7 +2,7 @@ File: oct6100_miscellaneous.c - Copyright (c) 2001-2006 Octasic Inc. + Copyright (c) 2001-2007 Octasic Inc. Description: @@ -22,7 +22,7 @@ You should have received a copy of the GNU General Public License along with the OCT6100 GPL API; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -$Octasic_Release: OCT612xAPI-01.00-PR47 $ +$Octasic_Release: OCT612xAPI-01.00-PR48 $ $Octasic_Revision: 35 $ diff --git a/software/octdeviceapi/oct6100api/oct6100_api/oct6100_mixer.c b/software/octdeviceapi/oct6100api/oct6100_api/oct6100_mixer.c index c6edcba..d88e706 100644 --- a/software/octdeviceapi/oct6100api/oct6100_api/oct6100_mixer.c +++ b/software/octdeviceapi/oct6100api/oct6100_api/oct6100_mixer.c @@ -2,7 +2,7 @@ File: oct6100_mixer.c - Copyright (c) 2001-2006 Octasic Inc. + Copyright (c) 2001-2007 Octasic Inc. Description: @@ -23,7 +23,7 @@ You should have received a copy of the GNU General Public License along with the OCT6100 GPL API; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -$Octasic_Release: OCT612xAPI-01.00-PR47 $ +$Octasic_Release: OCT612xAPI-01.00-PR48 $ $Octasic_Revision: 42 $ diff --git a/software/octdeviceapi/oct6100api/oct6100_api/oct6100_phasing_tsst.c b/software/octdeviceapi/oct6100api/oct6100_api/oct6100_phasing_tsst.c index 0165060..2f1ac92 100644 --- a/software/octdeviceapi/oct6100api/oct6100_api/oct6100_phasing_tsst.c +++ b/software/octdeviceapi/oct6100api/oct6100_api/oct6100_phasing_tsst.c @@ -2,7 +2,7 @@ File: oct6100_phasing_tsst.c - Copyright (c) 2001-2006 Octasic Inc. + Copyright (c) 2001-2007 Octasic Inc. Description: @@ -22,7 +22,7 @@ You should have received a copy of the GNU General Public License along with the OCT6100 GPL API; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -$Octasic_Release: OCT612xAPI-01.00-PR47 $ +$Octasic_Release: OCT612xAPI-01.00-PR48 $ $Octasic_Revision: 46 $ diff --git a/software/octdeviceapi/oct6100api/oct6100_api/oct6100_playout_buf.c b/software/octdeviceapi/oct6100api/oct6100_api/oct6100_playout_buf.c index 9f87d83..5c3bdbf 100644 --- a/software/octdeviceapi/oct6100api/oct6100_api/oct6100_playout_buf.c +++ b/software/octdeviceapi/oct6100api/oct6100_api/oct6100_playout_buf.c @@ -2,7 +2,7 @@ File: oct6100_playout_buf.c - Copyright (c) 2001-2006 Octasic Inc. + Copyright (c) 2001-2007 Octasic Inc. Description: @@ -22,7 +22,7 @@ You should have received a copy of the GNU General Public License along with the OCT6100 GPL API; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -$Octasic_Release: OCT612xAPI-01.00-PR47 $ +$Octasic_Release: OCT612xAPI-01.00-PR48 $ $Octasic_Revision: 109 $ diff --git a/software/octdeviceapi/oct6100api/oct6100_api/oct6100_remote_debug.c b/software/octdeviceapi/oct6100api/oct6100_api/oct6100_remote_debug.c index 0bed078..1c7e9f0 100644 --- a/software/octdeviceapi/oct6100api/oct6100_api/oct6100_remote_debug.c +++ b/software/octdeviceapi/oct6100api/oct6100_api/oct6100_remote_debug.c @@ -2,7 +2,7 @@ File: oct6100_remote_debug.c - Copyright (c) 2001-2006 Octasic Inc. + Copyright (c) 2001-2007 Octasic Inc. Description: @@ -22,7 +22,7 @@ You should have received a copy of the GNU General Public License along with the OCT6100 GPL API; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -$Octasic_Release: OCT612xAPI-01.00-PR47 $ +$Octasic_Release: OCT612xAPI-01.00-PR48 $ $Octasic_Revision: 35 $ diff --git a/software/octdeviceapi/oct6100api/oct6100_api/oct6100_tlv.c b/software/octdeviceapi/oct6100api/oct6100_api/oct6100_tlv.c index 4ecc81e..3569865 100644 --- a/software/octdeviceapi/oct6100api/oct6100_api/oct6100_tlv.c +++ b/software/octdeviceapi/oct6100api/oct6100_api/oct6100_tlv.c @@ -2,7 +2,7 @@ File: oct6100_tlv.c - Copyright (c) 2001-2006 Octasic Inc. + Copyright (c) 2001-2007 Octasic Inc. Description: @@ -24,9 +24,9 @@ You should have received a copy of the GNU General Public License along with the OCT6100 GPL API; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -$Octasic_Release: OCT612xAPI-01.00-PR47 $ +$Octasic_Release: OCT612xAPI-01.00-PR48 $ -$Octasic_Revision: 112 $ +$Octasic_Revision: 113 $ \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ @@ -1916,54 +1916,6 @@ UINT32 Oct6100ApiInterpretTlvEntry( break; - case cOCT6100_TLV_TYPE_RESET_RIN_ALC_ON_TONES_BOFF: - - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_RESET_RIN_ALC_ON_TONES_BOFF, - cOCT6100_TLV_MAX_LENGTH_RESET_RIN_ALC_ON_TONES_BOFF ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.ResetRinAlcOnTonesFieldOfst ); - - f_pApiInstance->pSharedInfo->ImageInfo.fResetRinAlcOnTones = TRUE; - } - - break; - - case cOCT6100_TLV_TYPE_RESET_SOUT_ALC_ON_TONES_BOFF: - - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_RESET_SOUT_ALC_ON_TONES_BOFF, - cOCT6100_TLV_MAX_LENGTH_RESET_SOUT_ALC_ON_TONES_BOFF ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.ResetSoutAlcOnTonesFieldOfst ); - - f_pApiInstance->pSharedInfo->ImageInfo.fResetSoutAlcOnTones = TRUE; - } - - break; - - case cOCT6100_TLV_TYPE_ALC_NOISE_BLEED_OUT_TIME_BOFF: - - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_ALC_NOISE_BLEED_OUT_TIME_BOFF, - cOCT6100_TLV_MAX_LENGTH_ALC_NOISE_BLEED_OUT_TIME_BOFF ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.AlcNoiseBleedOutTimeFieldOfst ); - - f_pApiInstance->pSharedInfo->ImageInfo.fAlcNoiseBleedOutTime = TRUE; - } - - break; - default: /* Unknown TLV type field... check default length and nothing else. */ ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, diff --git a/software/octdeviceapi/oct6100api/oct6100_api/oct6100_tone_detection.c b/software/octdeviceapi/oct6100api/oct6100_api/oct6100_tone_detection.c index 280f4e2..acefeae 100644 --- a/software/octdeviceapi/oct6100api/oct6100_api/oct6100_tone_detection.c +++ b/software/octdeviceapi/oct6100api/oct6100_api/oct6100_tone_detection.c @@ -2,7 +2,7 @@ File: oct6100_tone_detection.c - Copyright (c) 2001-2006 Octasic Inc. + Copyright (c) 2001-2007 Octasic Inc. Description: @@ -23,9 +23,9 @@ You should have received a copy of the GNU General Public License along with the OCT6100 GPL API; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -$Octasic_Release: OCT612xAPI-01.00-PR47 $ +$Octasic_Release: OCT612xAPI-01.00-PR48 $ -$Octasic_Revision: 50 $ +$Octasic_Revision: 51 $ \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ @@ -1041,3 +1041,48 @@ UINT32 Oct6100ApiIsSSTone( } #endif +/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ + +Function: Oct6100ApiIsSSTone + +Description: Check if specified tone number is a 2100 special signaling + system tone. + +------------------------------------------------------------------------------- +| Argument | Description +------------------------------------------------------------------------------- +f_pApiInstance Pointer to API instance. This memory is used to keep the + present state of the chip and all its resources. + +f_ulToneEventNumber Tone event number to be checked against. + +\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ +#if !SKIP_Oct6100ApiIs2100Tone +UINT32 Oct6100ApiIs2100Tone( + IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, + IN UINT32 f_ulToneEventNumber, + OUT PBOOL f_fIs2100Tone ) +{ + *f_fIs2100Tone = FALSE; + + switch( f_ulToneEventNumber ) + { + case cOCT6100_TONE_ROUT_G168_2100GB_ON : + case cOCT6100_TONE_ROUT_G168_2100GB_WSPR : + case cOCT6100_TONE_ROUT_G168_2100GB_ON_WIDE_A : + case cOCT6100_TONE_ROUT_G168_2100GB_ON_WIDE_B : + case cOCT6100_TONE_ROUT_G168_2100GB_WSPR_WIDE : + case cOCT6100_TONE_SOUT_G168_2100GB_ON : + case cOCT6100_TONE_SOUT_G168_2100GB_WSPR : + case cOCT6100_TONE_SOUT_G168_2100GB_ON_WIDE_A : + case cOCT6100_TONE_SOUT_G168_2100GB_ON_WIDE_B : + case cOCT6100_TONE_SOUT_G168_2100GB_WSPR_WIDE : + *f_fIs2100Tone = TRUE; + break; + default: + break; + } + + return cOCT6100_ERR_OK; +} +#endif diff --git a/software/octdeviceapi/oct6100api/oct6100_api/oct6100_tsi_cnct.c b/software/octdeviceapi/oct6100api/oct6100_api/oct6100_tsi_cnct.c index 83738cc..6c4c540 100644 --- a/software/octdeviceapi/oct6100api/oct6100_api/oct6100_tsi_cnct.c +++ b/software/octdeviceapi/oct6100api/oct6100_api/oct6100_tsi_cnct.c @@ -2,7 +2,7 @@ File: oct6100_tsi_cnct.c - Copyright (c) 2001-2006 Octasic Inc. + Copyright (c) 2001-2007 Octasic Inc. Description: @@ -22,7 +22,7 @@ You should have received a copy of the GNU General Public License along with the OCT6100 GPL API; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -$Octasic_Release: OCT612xAPI-01.00-PR47 $ +$Octasic_Release: OCT612xAPI-01.00-PR48 $ $Octasic_Revision: 38 $ diff --git a/software/octdeviceapi/oct6100api/oct6100_api/oct6100_tsst.c b/software/octdeviceapi/oct6100api/oct6100_api/oct6100_tsst.c index 1add50d..4468e35 100644 --- a/software/octdeviceapi/oct6100api/oct6100_api/oct6100_tsst.c +++ b/software/octdeviceapi/oct6100api/oct6100_api/oct6100_tsst.c @@ -2,7 +2,7 @@ File: oct6100_tsst.c - Copyright (c) 2001-2006 Octasic Inc. + Copyright (c) 2001-2007 Octasic Inc. Description: @@ -23,7 +23,7 @@ You should have received a copy of the GNU General Public License along with the OCT6100 GPL API; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -$Octasic_Release: OCT612xAPI-01.00-PR47 $ +$Octasic_Release: OCT612xAPI-01.00-PR48 $ $Octasic_Revision: 39 $ diff --git a/software/octdeviceapi/oct6100api/oct6100_api/oct6100_user.c b/software/octdeviceapi/oct6100api/oct6100_api/oct6100_user.c index ee506f9..5d57695 100644 --- a/software/octdeviceapi/oct6100api/oct6100_api/oct6100_user.c +++ b/software/octdeviceapi/oct6100api/oct6100_api/oct6100_user.c @@ -2,7 +2,7 @@ File: oct6100_user.c - Copyright (c) 2001-2006 Octasic Inc. + Copyright (c) 2001-2007 Octasic Inc. Description: @@ -22,7 +22,7 @@ You should have received a copy of the GNU General Public License along with the OCT6100 GPL API; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -$Octasic_Release: OCT612xAPI-01.00-PR47 $ +$Octasic_Release: OCT612xAPI-01.00-PR48 $ $Octasic_Revision: 28 $ |