From 8d2d06a050b1a5de0c5139733ae5216a8a8f2632 Mon Sep 17 00:00:00 2001 From: Octasic Inc Date: Fri, 11 Sep 2009 14:38:52 +0300 Subject: importing OCT612x-01.03.00 --- .../oct6100api/oct6100_api/oct6100_chip_open.c | 142 ++++++++++++--------- 1 file changed, 82 insertions(+), 60 deletions(-) (limited to 'software/octdeviceapi/oct6100api/oct6100_api/oct6100_chip_open.c') diff --git a/software/octdeviceapi/oct6100api/oct6100_api/oct6100_chip_open.c b/software/octdeviceapi/oct6100api/oct6100_api/oct6100_chip_open.c index af0fda6..da82fb6 100644 --- a/software/octdeviceapi/oct6100api/oct6100_api/oct6100_chip_open.c +++ b/software/octdeviceapi/oct6100api/oct6100_api/oct6100_chip_open.c @@ -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.02.04 $ +$Octasic_Release: OCT612xAPI-01.03.00 $ -$Octasic_Revision: 367 $ +$Octasic_Revision: 374 $ \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ @@ -183,6 +183,7 @@ UINT32 Oct6100ChipOpenDef( + /* Set the tail displacement to zero. */ f_pChipOpen->ulTailDisplacement = 0; @@ -223,6 +224,7 @@ UINT32 Oct6100ChipOpenDef( f_pChipOpen->InterruptConfig.ulFatalGeneralConfig = cOCT6100_INTERRUPT_NO_TIMEOUT; f_pChipOpen->InterruptConfig.ulFatalMemoryConfig = cOCT6100_INTERRUPT_NO_TIMEOUT; + f_pChipOpen->InterruptConfig.ulErrorH100Config = cOCT6100_INTERRUPT_NO_TIMEOUT; f_pChipOpen->InterruptConfig.ulErrorOverflowToneEventsConfig = cOCT6100_INTERRUPT_NO_TIMEOUT; @@ -435,7 +437,7 @@ UINT32 Oct6100ChipOpen( if ( ulResult != cOCT6100_ERR_OK ) return ulResult; - /* Initialize the mixer memory. */ + /* Initialize the recorder. */ ulResult = Oct6100ApiInitRecordResources( f_pApiInstance ); if ( ulResult != cOCT6100_ERR_OK ) return ulResult; @@ -448,7 +450,7 @@ UINT32 Oct6100ChipOpen( - /*Clear all interrupts that could have occured during startup*/ + /* Clear all interrupts that could have occured during startup */ ulResult = Oct6100ApiClearInterrupts( f_pApiInstance ); if ( ulResult != cOCT6100_ERR_OK ) return ulResult; @@ -464,8 +466,10 @@ UINT32 Oct6100ChipOpen( ) return cOCT6100_WARNING_OPEN_FUNCTIONAL_BIST_FAILED; - else - return cOCT6100_ERR_OK; + + + + return cOCT6100_ERR_OK; } @@ -1052,12 +1056,14 @@ UINT32 Oct6100ApiCheckChipConfiguration( if ( f_pChipOpen->pbyImageFile == NULL ) return cOCT6100_ERR_OPEN_IMAGE_FILE; - ulTempVar = Oct6100ApiCheckImageFileHeader(f_pChipOpen); - if (ulTempVar != cOCT6100_ERR_OK) + 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 ) @@ -1357,6 +1363,7 @@ UINT32 Oct6100ApiCopyChipConfiguration( + pSharedInfo->ChipConfig.usTailDisplacement = (UINT16)( f_pChipOpen->ulTailDisplacement & 0xFFFF ); pSharedInfo->ChipConfig.fEnableAcousticEcho = (UINT8)( f_pChipOpen->fEnableAcousticEcho & 0xFF ); /* Resource allocation parameters. */ @@ -1472,6 +1479,7 @@ UINT32 Oct6100ApiInitializeMiscellaneousVariables( pSharedInfo->MiscVars.usCodepoint = 0; pSharedInfo->MiscVars.usCpuLsuWritePtr = 0; + /* Pouch counter not present until TLVs are read. */ pSharedInfo->DebugInfo.fPouchCounter = FALSE; pSharedInfo->DebugInfo.fIsIsrCalledField = FALSE; @@ -2029,14 +2037,13 @@ f_pApiInstance Pointer to API instance. This memory is used to keep the UINT32 Oct6100ApiCheckImageFileHeader( IN tPOCT6100_CHIP_OPEN f_pChipOpen ) { - - PUINT8 pszImageInfoStart = NULL; - UINT32 ulStrLen; + UINT32 ulStrLen; + PUINT8 pszImageVersion; ulStrLen = Oct6100ApiStrLen( (PUINT8)cOCT6100_IMAGE_START_STRING ); - pszImageInfoStart = Oct6100ApiStrStr(f_pChipOpen->pbyImageFile,(PUINT8)cOCT6100_IMAGE_START_STRING, - f_pChipOpen->pbyImageFile + ulStrLen); - if (pszImageInfoStart == NULL) + pszImageVersion = Oct6100ApiStrStr( f_pChipOpen->pbyImageFile, (PUINT8)cOCT6100_IMAGE_START_STRING, + f_pChipOpen->pbyImageFile + ulStrLen ); + if ( pszImageVersion == NULL ) return cOCT6100_ERR_OPEN_INVALID_IMAGE_FILE; return cOCT6100_ERR_OK; @@ -2062,11 +2069,16 @@ UINT32 Oct6100ApiDecodeKeyAndBist( tPOCT6100_API_CHIP_CONFIG pChipConfig; tOCT6100_WRITE_PARAMS WriteParams; tOCT6100_READ_PARAMS ReadParams; - UINT16 ausBistData[ 3 ]; + tOCT6100_READ_BURST_PARAMS ReadBurstParams; + UINT16 ausBistData[ 6 ]; UINT16 usReadData; UINT32 ulResult; BOOL fBitEqual; UINT32 i; + UINT32 ulBistIndex = 0; + UINT32 aulBistTypes[] = { + + 0 /* Memory clear */ }; /* Get local pointer to shared portion of instance. */ pSharedInfo = f_pApiInstance->pSharedInfo; @@ -2085,8 +2097,13 @@ UINT32 Oct6100ApiDecodeKeyAndBist( ReadParams.ulUserChipId = pChipConfig->ulUserChipId; + /* Set the process context and user chip ID parameters once and for all. */ + ReadBurstParams.pProcessContext = f_pApiInstance->pProcessContext; + + ReadBurstParams.ulUserChipId = pChipConfig->ulUserChipId; + /* Write key in CPU internal memory. */ - for(i=0; i<8; i++) + for( i=0; i<8; i++ ) { WriteParams.ulWriteAddress = 0x150; WriteParams.usWriteData = 0x0000; @@ -2114,7 +2131,7 @@ UINT32 Oct6100ApiDecodeKeyAndBist( } /* Write one in CPU internal memory. */ - for(i=0; i<8; i++) + for( i=0; i<8; i++ ) { WriteParams.ulWriteAddress = 0x150; if (i == 0) @@ -2154,62 +2171,65 @@ UINT32 Oct6100ApiDecodeKeyAndBist( /* Run BISTs and key decode. */ WriteParams.ulWriteAddress = 0x160; - WriteParams.usWriteData = 0x0081; - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - /* Wait for the key decode PC to clear. */ - ulResult = Oct6100ApiWaitForPcRegisterBit( f_pApiInstance, 0x160, 0, 0, 100000, &fBitEqual ); - if ( TRUE != fBitEqual ) - return cOCT6100_ERR_FATAL_13; + + /* Activate BIST and key decode. */ + WriteParams.usWriteData = 0x0081; - /* Read the key valid bit to make sure everything is ok. */ - ReadParams.ulReadAddress = 0x160; - ReadParams.pusReadData = &usReadData; + /* Set BIST type. */ + WriteParams.usWriteData |= aulBistTypes[ ulBistIndex ] << 4; + + mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); + if ( ulResult != cOCT6100_ERR_OK ) + return ulResult; - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; + /* Wait for the key decode PC to clear. */ + ulResult = Oct6100ApiWaitForPcRegisterBit( f_pApiInstance, 0x160, 0, 0, 100000, &fBitEqual ); + if ( TRUE != fBitEqual ) + return cOCT6100_ERR_FATAL_13; - /* The channel capacity pins of the chip do not match what the firmware is expecting. */ - if ( ( usReadData & 0x4 ) == 0 ) - return cOCT6100_ERR_OPEN_INVALID_FIRMWARE_OR_CAPACITY_PINS; + /* Read the key valid bit to make sure everything is ok. */ + ReadParams.ulReadAddress = 0x160; + ReadParams.pusReadData = &usReadData; - /* Read the result of the internal memory bist. */ - ReadParams.ulReadAddress = 0x110; - ReadParams.pusReadData = &ausBistData[ 0 ]; + mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); + if ( ulResult != cOCT6100_ERR_OK ) + return ulResult; - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; + /* The channel capacity pins of the chip do not match what the firmware is expecting. */ + if ( ( usReadData & 0x4 ) == 0 ) + return cOCT6100_ERR_OPEN_INVALID_FIRMWARE_OR_CAPACITY_PINS; - ReadParams.ulReadAddress = 0x114; - ReadParams.pusReadData = &ausBistData[ 1 ]; + /* Read the result of the internal memory BIST. */ + ReadBurstParams.ulReadAddress = 0x110; + ReadBurstParams.pusReadData = ausBistData; + ReadBurstParams.ulReadLength = 6; - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - ReadParams.ulReadAddress = 0x118; - ReadParams.pusReadData = &ausBistData[ 2 ]; + mOCT6100_DRIVER_READ_BURST_API( ReadBurstParams, ulResult ); + if ( ulResult != cOCT6100_ERR_OK ) + return ulResult; - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; + /* Check if an error was reported. */ + for ( i=0; i<6; i++ ) + { + if ( ausBistData[ i ] != 0x0000 ) + { + if ( aulBistTypes[ ulBistIndex ] == 0 ) + return cOCT6100_ERR_OPEN_INTERNAL_MEMORY_BIST; - /* Check if an error was reported. */ - if (ausBistData[0] != 0x0000 || ausBistData[1] != 0x0000 || ausBistData[2] != 0x0000) - return cOCT6100_ERR_OPEN_INTERNAL_MEMORY_BIST; + } + } + + /* Put key decoder in powerdown. */ + WriteParams.ulWriteAddress = 0x160; + WriteParams.usWriteData = 0x00AA; + + mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); + if ( ulResult != cOCT6100_ERR_OK ) + return ulResult; - /* Put key decoder in powerdown. */ - WriteParams.ulWriteAddress = 0x160; - WriteParams.usWriteData = 0x008A; - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; return cOCT6100_ERR_OK; } @@ -5189,6 +5209,8 @@ UINT32 Oct6100ApiInitChannels( && ( pSharedInfo->ImageInfo.usMaxNumberOfChannels < cOCT6100_MAX_ECHO_CHANNELS ) && ( pSharedInfo->ChipConfig.usMaxChannels == pSharedInfo->ImageInfo.usMaxNumberOfChannels ) ) return cOCT6100_ERR_NOT_SUPPORTED_OPEN_MAX_ECHO_CHANNELS_VALUE; + + /* Initialize the memory for all required channels. */ for( i = 0; i < f_pApiInstance->pSharedInfo->ChipConfig.usMaxChannels; i++ ) -- cgit v1.2.3