summaryrefslogtreecommitdiff
path: root/software/octdeviceapi/oct6100api/oct6100_api/oct6100_debug.c
diff options
context:
space:
mode:
Diffstat (limited to 'software/octdeviceapi/oct6100api/oct6100_api/oct6100_debug.c')
-rw-r--r--software/octdeviceapi/oct6100api/oct6100_api/oct6100_debug.c616
1 files changed, 355 insertions, 261 deletions
diff --git a/software/octdeviceapi/oct6100api/oct6100_api/oct6100_debug.c b/software/octdeviceapi/oct6100api/oct6100_api/oct6100_debug.c
index 45e9aee..bd23716 100644
--- a/software/octdeviceapi/oct6100api/oct6100_api/oct6100_debug.c
+++ b/software/octdeviceapi/oct6100api/oct6100_api/oct6100_debug.c
@@ -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-PR40 $
+$Octasic_Release: OCT612xAPI-01.00-PR41 $
-$Octasic_Revision: 59 $
+$Octasic_Revision: 62 $
\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
@@ -146,6 +146,7 @@ UINT32 Oct6100DebugGetDataDef(
tPOCT6100_DEBUG_GET_DATA f_pGetData )
{
f_pGetData->ulGetDataMode = cOCT6100_DEBUG_GET_DATA_MODE_120S_LITE;
+ f_pGetData->ulGetDataContent = cOCT6100_DEBUG_GET_DATA_CONTENT_COMPLETE;
f_pGetData->ulRemainingNumBytes = cOCT6100_INVALID_VALUE;
f_pGetData->ulTotalNumBytes = cOCT6100_INVALID_VALUE;
f_pGetData->ulMaxBytes = cOCT6100_INVALID_VALUE;
@@ -364,7 +365,10 @@ UINT32 Oct6100DebugSelectChannelSer(
usChanIndex = cOCT6100_INVALID_INDEX;
}
- if ( pSharedInfo->ChipConfig.fEnableChannelRecording == TRUE )
+ /* Set law of newly selected hot channel. */
+ if ( ( pSharedInfo->ChipConfig.fEnableChannelRecording == TRUE )
+ && ( f_pSelectDebugChan->ulChannelHndl != cOCT6100_INVALID_HANDLE )
+ && ( pChanEntry != NULL ) )
{
/* Set the PCM law of the debug channel. */
/* Let's program the channel memory. */
@@ -377,23 +381,11 @@ UINT32 Oct6100DebugSelectChannelSer(
TempChanOpen.VqeConfig.fRinDcOffsetRemoval = FALSE;
TempChanOpen.VqeConfig.lDefaultErlDb = 0;
- if ( ( f_pSelectDebugChan->ulChannelHndl != cOCT6100_INVALID_HANDLE )
- && ( pChanEntry != NULL ) )
- {
- /* Use the law of the channel being recorded. */
- TempChanOpen.TdmConfig.ulRinPcmLaw = pChanEntry->TdmConfig.byRinPcmLaw;
- TempChanOpen.TdmConfig.ulSinPcmLaw = pChanEntry->TdmConfig.bySinPcmLaw;
- TempChanOpen.TdmConfig.ulRoutPcmLaw = pChanEntry->TdmConfig.byRoutPcmLaw;
- TempChanOpen.TdmConfig.ulSoutPcmLaw = pChanEntry->TdmConfig.bySoutPcmLaw;
- }
- else
- {
- /* Hard-code this to u-Law. */
- TempChanOpen.TdmConfig.ulRinPcmLaw = cOCT6100_PCM_U_LAW;
- TempChanOpen.TdmConfig.ulSinPcmLaw = cOCT6100_PCM_U_LAW;
- TempChanOpen.TdmConfig.ulRoutPcmLaw = cOCT6100_PCM_U_LAW;
- TempChanOpen.TdmConfig.ulSoutPcmLaw = cOCT6100_PCM_U_LAW;
- }
+ /* Use the law of the channel being recorded. */
+ TempChanOpen.TdmConfig.ulRinPcmLaw = pChanEntry->TdmConfig.byRinPcmLaw;
+ TempChanOpen.TdmConfig.ulSinPcmLaw = pChanEntry->TdmConfig.bySinPcmLaw;
+ TempChanOpen.TdmConfig.ulRoutPcmLaw = pChanEntry->TdmConfig.byRoutPcmLaw;
+ TempChanOpen.TdmConfig.ulSoutPcmLaw = pChanEntry->TdmConfig.bySoutPcmLaw;
ulResult = Oct6100ApiWriteDebugChanMemory( f_pApiInstance,
&TempChanOpen.TdmConfig,
@@ -423,6 +415,7 @@ UINT32 Oct6100DebugSelectChannelSer(
/* Cancel data dump request, if there was one. */
pSharedInfo->DebugInfo.fDebugDataBeingDumped = FALSE;
+ pSharedInfo->DebugInfo.ulDebugDataTotalNumBytes = cOCT6100_INVALID_VALUE;
/* Call from remote client. */
if ( f_fCheckChannelRecording == FALSE )
@@ -472,7 +465,7 @@ UINT32 Oct6100DebugGetDataSer(
UINT32 ulReadPointer;
UINT32 ulUserBufWriteIndex = 0;
UINT32 ulTimestamp;
- UINT32 ulDebugEventIndex;
+ UINT32 ulDebugEventIndex = 0;
UINT32 ulStreamIndex;
UINT32 ulPcmSampleIndex;
UINT32 ulNumAfEvents;
@@ -482,8 +475,11 @@ UINT32 Oct6100DebugGetDataSer(
UINT32 ulFeatureBytesOffset;
UINT32 ulFeatureBitOffset;
UINT32 ulFeatureFieldLength;
+ UINT32 ulStreamIndexMin;
+ UINT32 ulStreamIndexMax;
UINT32 ulTempData;
UINT32 ulMask;
+ BOOL fResetRemainingDataFlag = FALSE;
/* Get local pointer(s). */
pSharedInfo = f_pApiInstance->pSharedInfo;
@@ -534,6 +530,13 @@ UINT32 Oct6100DebugGetDataSer(
&& ( f_pGetData->ulGetDataMode != cOCT6100_DEBUG_GET_DATA_MODE_120S ) )
return cOCT6100_ERR_DEBUG_GET_DATA_MODE;
+ /* Check dump content. */
+ if ( ( f_pGetData->ulGetDataContent != cOCT6100_DEBUG_GET_DATA_CONTENT_COMPLETE )
+ && ( f_pGetData->ulGetDataContent != cOCT6100_DEBUG_GET_DATA_CONTENT_RIN_PCM )
+ && ( f_pGetData->ulGetDataContent != cOCT6100_DEBUG_GET_DATA_CONTENT_SIN_PCM )
+ && ( f_pGetData->ulGetDataContent != cOCT6100_DEBUG_GET_DATA_CONTENT_SOUT_PCM ) )
+ return cOCT6100_ERR_DEBUG_GET_DATA_CONTENT;
+
/* Check if can accomodate the 120 seconds dump. */
if ( ( f_pGetData->ulGetDataMode == cOCT6100_DEBUG_GET_DATA_MODE_120S_LITE )
|| ( f_pGetData->ulGetDataMode == cOCT6100_DEBUG_GET_DATA_MODE_120S ) )
@@ -551,13 +554,13 @@ UINT32 Oct6100DebugGetDataSer(
/* Check if this is the first time this function is called since the hot channel was set. */
if ( pSharedInfo->DebugInfo.fDebugDataBeingDumped == FALSE )
{
- pSharedInfo->DebugInfo.fDebugDataBeingDumped = TRUE;
-
/* Check that the channel is not in POWER_DOWN. When the channel is in POWER_DOWN, */
/* the debug events are not recorded correctly in external memory. */
if ( pChanEntry->byEchoOperationMode == cOCT6100_ECHO_OP_MODE_POWER_DOWN )
return cOCT6100_ERR_DEBUG_CHANNEL_IN_POWER_DOWN;
-
+
+ pSharedInfo->DebugInfo.fDebugDataBeingDumped = TRUE;
+
/* Flag the hot channel that it must stop recording. The data is being transfered. */
/* This also tells the remote client not to do anything right now. */
@@ -683,29 +686,48 @@ UINT32 Oct6100DebugGetDataSer(
while ( ( pSharedInfo->DebugInfo.usLastAfLogReadPtr % ( cOCT6100_INTERNAL_SUPER_ARRAY_SIZE / 8 ) ) != 0 )
pSharedInfo->DebugInfo.usLastAfLogReadPtr++;
- /* Remember first AF Event Read Pointer. */
- f_pGetData->pbyData[ ulUserBufWriteIndex++ ] = (UINT8)( ( pSharedInfo->DebugInfo.usLastAfLogReadPtr ) & 0xFF );
- f_pGetData->pbyData[ ulUserBufWriteIndex++ ] = (UINT8)( ( pSharedInfo->DebugInfo.usLastAfLogReadPtr >> 8 ) & 0xFF );
+ /* Remember the data mode for later checks. Also, the user cannot change this "mode". */
+ pSharedInfo->DebugInfo.ulCurrentGetDataMode = f_pGetData->ulGetDataMode;
+ }
+ else
+ {
+ /* Check that the user did not change the current data mode. */
+ if ( pSharedInfo->DebugInfo.ulCurrentGetDataMode != f_pGetData->ulGetDataMode )
+ return cOCT6100_ERR_DEBUG_GET_DATA_MODE_CANNOT_CHANGE;
+ }
- /* Remember the AF Event Write Pointer. */
- f_pGetData->pbyData[ ulUserBufWriteIndex++ ] = (UINT8)( ( pSharedInfo->DebugInfo.usAfLogWritePtr ) & 0xFF );
- f_pGetData->pbyData[ ulUserBufWriteIndex++ ] = (UINT8)( ( pSharedInfo->DebugInfo.usAfLogWritePtr >> 8 ) & 0xFF );
+ /* Check if this is the first pass here. */
+ if ( pSharedInfo->DebugInfo.ulDebugDataTotalNumBytes == cOCT6100_INVALID_VALUE )
+ {
+ /* Calculate how many bytes of data will be returned with respect to the selected data content. */
+
+ /* Check what content type the user requested. */
+ if ( f_pGetData->ulGetDataContent == cOCT6100_DEBUG_GET_DATA_CONTENT_COMPLETE )
+ {
+ /* Remember first AF Event Read Pointer. */
+ f_pGetData->pbyData[ ulUserBufWriteIndex++ ] = (UINT8)( ( pSharedInfo->DebugInfo.usLastAfLogReadPtr ) & 0xFF );
+ f_pGetData->pbyData[ ulUserBufWriteIndex++ ] = (UINT8)( ( pSharedInfo->DebugInfo.usLastAfLogReadPtr >> 8 ) & 0xFF );
- /* Remember law and hot channel */
- f_pGetData->pbyData[ ulUserBufWriteIndex++ ] = (UINT8)( pChanEntry->TdmConfig.bySinPcmLaw | ( ( pSharedInfo->DebugInfo.usCurrentDebugChanIndex >> 2 ) & 0xFE ) );
- f_pGetData->pbyData[ ulUserBufWriteIndex++ ] = (UINT8)( pChanEntry->TdmConfig.bySoutPcmLaw );
+ /* Remember the AF Event Write Pointer. */
+ f_pGetData->pbyData[ ulUserBufWriteIndex++ ] = (UINT8)( ( pSharedInfo->DebugInfo.usAfLogWritePtr ) & 0xFF );
+ f_pGetData->pbyData[ ulUserBufWriteIndex++ ] = (UINT8)( ( pSharedInfo->DebugInfo.usAfLogWritePtr >> 8 ) & 0xFF );
- /* Insert light or heavy mode in array. */
- if ( ( f_pGetData->ulGetDataMode == cOCT6100_DEBUG_GET_DATA_MODE_16S_LITE )
- || ( f_pGetData->ulGetDataMode == cOCT6100_DEBUG_GET_DATA_MODE_120S_LITE ) )
- {
- f_pGetData->pbyData[ ulUserBufWriteIndex - 1 ] |= 0x80;
- }
- f_pGetData->pbyData[ ulUserBufWriteIndex++ ] = (UINT8)( pChanEntry->TdmConfig.byRinPcmLaw | ( ( pSharedInfo->DebugInfo.usCurrentDebugChanIndex & 0x1F ) << 3 ) );
+ /* Remember law and hot channel */
+ f_pGetData->pbyData[ ulUserBufWriteIndex++ ] = (UINT8)( pChanEntry->TdmConfig.bySinPcmLaw | ( ( pSharedInfo->DebugInfo.usCurrentDebugChanIndex >> 2 ) & 0xFE ) );
+ f_pGetData->pbyData[ ulUserBufWriteIndex++ ] = (UINT8)( pChanEntry->TdmConfig.bySoutPcmLaw );
- /* Remember usNumEvents */
- f_pGetData->pbyData[ ulUserBufWriteIndex++ ] = (UINT8)( ( pSharedInfo->DebugInfo.usNumEvents ) & 0xFF );
- f_pGetData->pbyData[ ulUserBufWriteIndex++ ] = (UINT8)( ( pSharedInfo->DebugInfo.usNumEvents >> 8 ) & 0xFF );
+ /* Insert light or heavy mode in array. */
+ if ( ( f_pGetData->ulGetDataMode == cOCT6100_DEBUG_GET_DATA_MODE_16S_LITE )
+ || ( f_pGetData->ulGetDataMode == cOCT6100_DEBUG_GET_DATA_MODE_120S_LITE ) )
+ {
+ f_pGetData->pbyData[ ulUserBufWriteIndex - 1 ] |= 0x80;
+ }
+ f_pGetData->pbyData[ ulUserBufWriteIndex++ ] = (UINT8)( pChanEntry->TdmConfig.byRinPcmLaw | ( ( pSharedInfo->DebugInfo.usCurrentDebugChanIndex & 0x1F ) << 3 ) );
+
+ /* Remember usNumEvents */
+ f_pGetData->pbyData[ ulUserBufWriteIndex++ ] = (UINT8)( ( pSharedInfo->DebugInfo.usNumEvents ) & 0xFF );
+ f_pGetData->pbyData[ ulUserBufWriteIndex++ ] = (UINT8)( ( pSharedInfo->DebugInfo.usNumEvents >> 8 ) & 0xFF );
+ }
/* Last indexes set to '0'! */
pSharedInfo->DebugInfo.usLastDebugEventIndex = 0;
@@ -721,37 +743,46 @@ UINT32 Oct6100DebugGetDataSer(
/* Estimate the total size of the buffer that will be returned. */
f_pGetData->ulTotalNumBytes = ulUserBufWriteIndex;
- /* Add the matrix events. */
- if ( ( f_pGetData->ulGetDataMode == cOCT6100_DEBUG_GET_DATA_MODE_16S )
- || ( f_pGetData->ulGetDataMode == cOCT6100_DEBUG_GET_DATA_MODE_120S ) )
+ /* If the full content is requested, add all the debug data. */
+ if ( f_pGetData->ulGetDataContent == cOCT6100_DEBUG_GET_DATA_CONTENT_COMPLETE )
{
- /* Heavy mode! Grab everything! */
- f_pGetData->ulTotalNumBytes += pSharedInfo->DebugInfo.usNumEvents * pSharedInfo->DebugInfo.ulDebugChanStatsByteSize;
- }
- else
- {
- /* Lite mode! Only the most important stuff. */
- f_pGetData->ulTotalNumBytes += pSharedInfo->DebugInfo.usNumEvents * pSharedInfo->DebugInfo.ulDebugChanLiteStatsByteSize;
- }
+ /* Add the matrix events. */
+ if ( ( f_pGetData->ulGetDataMode == cOCT6100_DEBUG_GET_DATA_MODE_16S )
+ || ( f_pGetData->ulGetDataMode == cOCT6100_DEBUG_GET_DATA_MODE_120S ) )
+ {
+ /* Heavy mode! Grab everything! */
+ f_pGetData->ulTotalNumBytes += pSharedInfo->DebugInfo.usNumEvents * pSharedInfo->DebugInfo.ulDebugChanStatsByteSize;
+ }
+ else
+ {
+ /* Lite mode! Only the most important stuff. */
+ f_pGetData->ulTotalNumBytes += pSharedInfo->DebugInfo.usNumEvents * pSharedInfo->DebugInfo.ulDebugChanLiteStatsByteSize;
+ }
- /* Add the PCM samples. */
- f_pGetData->ulTotalNumBytes += pSharedInfo->DebugInfo.usNumEvents * pSharedInfo->DebugInfo.ulRecordedPcmEventByteSize * 3;
+ /* Add the PCM samples. */
+ f_pGetData->ulTotalNumBytes += pSharedInfo->DebugInfo.usNumEvents * pSharedInfo->DebugInfo.ulRecordedPcmEventByteSize * 3;
- /* If requested, add the AF log events. */
- if ( ( f_pGetData->ulGetDataMode == cOCT6100_DEBUG_GET_DATA_MODE_16S )
- || ( f_pGetData->ulGetDataMode == cOCT6100_DEBUG_GET_DATA_MODE_120S ) )
- {
- f_pGetData->ulTotalNumBytes += (UINT32)( ( pSharedInfo->DebugInfo.usAfLogWritePtr - pSharedInfo->DebugInfo.usLastAfLogReadPtr ) & 0xFFFF ) * 16;
- }
+ /* If requested, add the AF log events. */
+ if ( ( f_pGetData->ulGetDataMode == cOCT6100_DEBUG_GET_DATA_MODE_16S )
+ || ( f_pGetData->ulGetDataMode == cOCT6100_DEBUG_GET_DATA_MODE_120S ) )
+ {
+ f_pGetData->ulTotalNumBytes += (UINT32)( ( pSharedInfo->DebugInfo.usAfLogWritePtr - pSharedInfo->DebugInfo.usLastAfLogReadPtr ) & 0xFFFF ) * 16;
+ }
- /* Add the tone events strings. */
- f_pGetData->ulTotalNumBytes += cOCT6100_TLV_MAX_TONE_NAME_SIZE * pSharedInfo->ImageInfo.byNumToneDetectors;
+ /* Add the tone events strings. */
+ f_pGetData->ulTotalNumBytes += cOCT6100_TLV_MAX_TONE_NAME_SIZE * pSharedInfo->ImageInfo.byNumToneDetectors;
- /* Add the image version string. */
- f_pGetData->ulTotalNumBytes += 512;
+ /* Add the image version string. */
+ f_pGetData->ulTotalNumBytes += 512;
- /* Add the API version string. */
- f_pGetData->ulTotalNumBytes += sizeof( cOCT6100_API_VERSION );
+ /* Add the API version string. */
+ f_pGetData->ulTotalNumBytes += sizeof( cOCT6100_API_VERSION );
+ }
+ else /* if ( f_pGetData->ulGetDataContent != cOCT6100_DEBUG_GET_DATA_CONTENT_COMPLETE ) */
+ {
+ /* Add one PCM stream. */
+ f_pGetData->ulTotalNumBytes += pSharedInfo->DebugInfo.usNumEvents * pSharedInfo->DebugInfo.ulRecordedPcmEventByteSize;
+ }
/* Save this in the instance for further calls. */
pSharedInfo->DebugInfo.ulDebugDataTotalNumBytes = f_pGetData->ulTotalNumBytes;
@@ -773,87 +804,99 @@ UINT32 Oct6100DebugGetDataSer(
ulReadPointer += pSharedInfo->DebugInfo.ulDebugChanStatsByteSize * pSharedInfo->DebugInfo.usLastDebugEventIndex;
ulReadPointer %= ( ( pSharedInfo->DebugInfo.usMatrixCBMask + 1 ) * pSharedInfo->DebugInfo.ulDebugChanStatsByteSize );
- /* Copy the debug events in the user buffer. */
- for( ulDebugEventIndex = pSharedInfo->DebugInfo.usLastDebugEventIndex; ulDebugEventIndex < pSharedInfo->DebugInfo.usNumEvents; ulDebugEventIndex ++ )
+ if ( f_pGetData->ulGetDataContent == cOCT6100_DEBUG_GET_DATA_CONTENT_COMPLETE )
{
- ReadBurstParams.ulReadAddress = pSharedInfo->DebugInfo.ulMatrixBaseAddress + ulReadPointer;
-
- /* Check if we are in light or heavy mode. The burst size is not the same. */
- if ( ( f_pGetData->ulGetDataMode == cOCT6100_DEBUG_GET_DATA_MODE_16S )
- || ( f_pGetData->ulGetDataMode == cOCT6100_DEBUG_GET_DATA_MODE_120S ) )
- {
- if ( ( f_pGetData->ulMaxBytes - ulUserBufWriteIndex ) >= pSharedInfo->DebugInfo.ulDebugChanStatsByteSize )
- ulNumReads = pSharedInfo->DebugInfo.ulDebugChanStatsByteSize / 2;
- else
- break;
- }
- else
+ /* Copy the debug events in the user buffer. */
+ for( ulDebugEventIndex = pSharedInfo->DebugInfo.usLastDebugEventIndex; ulDebugEventIndex < pSharedInfo->DebugInfo.usNumEvents; ulDebugEventIndex ++ )
{
- if ( ( f_pGetData->ulMaxBytes - ulUserBufWriteIndex ) >= pSharedInfo->DebugInfo.ulDebugChanLiteStatsByteSize )
- ulNumReads = pSharedInfo->DebugInfo.ulDebugChanLiteStatsByteSize / 2;
- else
- break;
- }
+ ReadBurstParams.ulReadAddress = pSharedInfo->DebugInfo.ulMatrixBaseAddress + ulReadPointer;
- ulTempIndex = 0;
- while ( ulNumReads != 0 )
- {
- if ( ulNumReads >= pSharedInfo->ChipConfig.usMaxRwAccesses )
- ReadBurstParams.ulReadLength = pSharedInfo->ChipConfig.usMaxRwAccesses;
+ /* Check if we are in light or heavy mode. The burst size is not the same. */
+ if ( ( f_pGetData->ulGetDataMode == cOCT6100_DEBUG_GET_DATA_MODE_16S )
+ || ( f_pGetData->ulGetDataMode == cOCT6100_DEBUG_GET_DATA_MODE_120S ) )
+ {
+ if ( ( f_pGetData->ulMaxBytes - ulUserBufWriteIndex ) >= pSharedInfo->DebugInfo.ulDebugChanStatsByteSize )
+ ulNumReads = pSharedInfo->DebugInfo.ulDebugChanStatsByteSize / 2;
+ else
+ break;
+ }
else
- ReadBurstParams.ulReadLength = ulNumReads;
+ {
+ if ( ( f_pGetData->ulMaxBytes - ulUserBufWriteIndex ) >= pSharedInfo->DebugInfo.ulDebugChanLiteStatsByteSize )
+ ulNumReads = pSharedInfo->DebugInfo.ulDebugChanLiteStatsByteSize / 2;
+ else
+ break;
+ }
- /* Set pointer where to write data. */
- ReadBurstParams.pusReadData = pSharedInfo->MiscVars.ausSuperArray;
+ ulTempIndex = 0;
+ while ( ulNumReads != 0 )
+ {
+ if ( ulNumReads >= pSharedInfo->ChipConfig.usMaxRwAccesses )
+ ReadBurstParams.ulReadLength = pSharedInfo->ChipConfig.usMaxRwAccesses;
+ else
+ ReadBurstParams.ulReadLength = ulNumReads;
- mOCT6100_DRIVER_READ_BURST_API( ReadBurstParams, ulResult );
- if ( ulResult != cOCT6100_ERR_OK )
- return ulResult;
+ /* Set pointer where to write data. */
+ ReadBurstParams.pusReadData = pSharedInfo->MiscVars.ausSuperArray;
- /* Copy data byte per byte to avoid endianess problems. */
- for ( ulCopyIndex = 0; ulCopyIndex < ReadBurstParams.ulReadLength; ulCopyIndex ++ )
- {
- f_pGetData->pbyData[ ulUserBufWriteIndex + ulTempIndex + ( 2 * ulCopyIndex ) ] = (UINT8)( ReadBurstParams.pusReadData[ ulCopyIndex ] & 0xFF );
- f_pGetData->pbyData[ ulUserBufWriteIndex + ulTempIndex + ( 2 * ulCopyIndex ) + 1 ] = (UINT8)( ( ReadBurstParams.pusReadData[ ulCopyIndex ] >> 8 ) & 0xFF );
- }
+ mOCT6100_DRIVER_READ_BURST_API( ReadBurstParams, ulResult );
+ if ( ulResult != cOCT6100_ERR_OK )
+ return ulResult;
- /* Update indexes, temp variables, addresses. */
- ulNumReads -= ReadBurstParams.ulReadLength;
- ulTempIndex += ReadBurstParams.ulReadLength * 2;
- ReadBurstParams.ulReadAddress += ReadBurstParams.ulReadLength * 2;
- }
+ /* Copy data byte per byte to avoid endianess problems. */
+ for ( ulCopyIndex = 0; ulCopyIndex < ReadBurstParams.ulReadLength; ulCopyIndex ++ )
+ {
+ f_pGetData->pbyData[ ulUserBufWriteIndex + ulTempIndex + ( 2 * ulCopyIndex ) ] = (UINT8)( ReadBurstParams.pusReadData[ ulCopyIndex ] & 0xFF );
+ f_pGetData->pbyData[ ulUserBufWriteIndex + ulTempIndex + ( 2 * ulCopyIndex ) + 1 ] = (UINT8)( ( ReadBurstParams.pusReadData[ ulCopyIndex ] >> 8 ) & 0xFF );
+ }
- /* Store register 0x202 in the event structure. */
- f_pGetData->pbyData[ ulUserBufWriteIndex + 255 ] = (UINT8)( pSharedInfo->IntrptManage.usRegister202h & 0xFF );
- f_pGetData->pbyData[ ulUserBufWriteIndex + 256 ] = (UINT8)( ( pSharedInfo->IntrptManage.usRegister202h >> 8 ) & 0xFF );
+ /* Update indexes, temp variables, addresses. */
+ ulNumReads -= ReadBurstParams.ulReadLength;
+ ulTempIndex += ReadBurstParams.ulReadLength * 2;
+ ReadBurstParams.ulReadAddress += ReadBurstParams.ulReadLength * 2;
+ }
- /* Increment index. */
- if ( ( f_pGetData->ulGetDataMode == cOCT6100_DEBUG_GET_DATA_MODE_16S )
- || ( f_pGetData->ulGetDataMode == cOCT6100_DEBUG_GET_DATA_MODE_120S ) )
- {
- ulUserBufWriteIndex += pSharedInfo->DebugInfo.ulDebugChanStatsByteSize;
- }
- else
- {
- ulUserBufWriteIndex += pSharedInfo->DebugInfo.ulDebugChanLiteStatsByteSize;
- }
+ /* Store register 0x202 in the event structure. */
+ f_pGetData->pbyData[ ulUserBufWriteIndex + 255 ] = (UINT8)( pSharedInfo->IntrptManage.usRegister202h & 0xFF );
+ f_pGetData->pbyData[ ulUserBufWriteIndex + 256 ] = (UINT8)( ( pSharedInfo->IntrptManage.usRegister202h >> 8 ) & 0xFF );
- /* Increment read pointer to get next event. */
- ulReadPointer = ( ulReadPointer + pSharedInfo->DebugInfo.ulDebugChanStatsByteSize ) % ( ( pSharedInfo->DebugInfo.usMatrixCBMask + 1 ) * pSharedInfo->DebugInfo.ulDebugChanStatsByteSize );
+ /* Increment index. */
+ if ( ( f_pGetData->ulGetDataMode == cOCT6100_DEBUG_GET_DATA_MODE_16S )
+ || ( f_pGetData->ulGetDataMode == cOCT6100_DEBUG_GET_DATA_MODE_120S ) )
+ {
+ ulUserBufWriteIndex += pSharedInfo->DebugInfo.ulDebugChanStatsByteSize;
+ }
+ else
+ {
+ ulUserBufWriteIndex += pSharedInfo->DebugInfo.ulDebugChanLiteStatsByteSize;
+ }
- /* Save in the instance that one of the events was dumped. */
- pSharedInfo->DebugInfo.usLastDebugEventIndex ++;
+ /* Increment read pointer to get next event. */
+ ulReadPointer = ( ulReadPointer + pSharedInfo->DebugInfo.ulDebugChanStatsByteSize ) % ( ( pSharedInfo->DebugInfo.usMatrixCBMask + 1 ) * pSharedInfo->DebugInfo.ulDebugChanStatsByteSize );
+
+ /* Save in the instance that one of the events was dumped. */
+ pSharedInfo->DebugInfo.usLastDebugEventIndex ++;
+ }
}
/* Check if all debug events have been transfered. */
- if ( ulDebugEventIndex == pSharedInfo->DebugInfo.usNumEvents )
+ if ( ( ulDebugEventIndex == pSharedInfo->DebugInfo.usNumEvents )
+ || ( f_pGetData->ulGetDataContent != cOCT6100_DEBUG_GET_DATA_CONTENT_COMPLETE ) )
{
/* Fetch all streams per event. */
for ( ulPcmSampleIndex = pSharedInfo->DebugInfo.ulLastPcmSampleIndex; ulPcmSampleIndex < ( (UINT32)pSharedInfo->DebugInfo.usNumEvents * pSharedInfo->DebugInfo.ulRecordedPcmEventByteSize ); ulPcmSampleIndex ++ )
{
/* Check if enough room for this sample. */
- if ( ( f_pGetData->ulMaxBytes - ulUserBufWriteIndex ) < 3 )
- break;
+ if ( f_pGetData->ulGetDataContent != cOCT6100_DEBUG_GET_DATA_CONTENT_COMPLETE )
+ {
+ if ( ( f_pGetData->ulMaxBytes - ulUserBufWriteIndex ) < 1 )
+ break;
+ }
+ else /* if ( f_pGetData->ulGetDataContent == cOCT6100_DEBUG_GET_DATA_CONTENT_COMPLETE ) */
+ {
+ if ( ( f_pGetData->ulMaxBytes - ulUserBufWriteIndex ) < 3 )
+ break;
+ }
/* Check if must retrieve data from external memory. */
if ( ( ulPcmSampleIndex % ( cOCT6100_INTERNAL_SUPER_ARRAY_SIZE * 2 ) ) == 0x0 )
@@ -864,7 +907,28 @@ UINT32 Oct6100DebugGetDataSer(
ulReadPointer += ulPcmSampleIndex % pSharedInfo->DebugInfo.ulRecordedPcmEventByteSize;
/* Retrieve more data from external memory. */
- for ( ulStreamIndex = 0; ulStreamIndex < 3; ulStreamIndex ++ )
+ switch ( f_pGetData->ulGetDataContent )
+ {
+ case cOCT6100_DEBUG_GET_DATA_CONTENT_RIN_PCM:
+ ulStreamIndexMin = 0;
+ ulStreamIndexMax = 1;
+ break;
+ case cOCT6100_DEBUG_GET_DATA_CONTENT_SIN_PCM:
+ ulStreamIndexMin = 1;
+ ulStreamIndexMax = 2;
+ break;
+ case cOCT6100_DEBUG_GET_DATA_CONTENT_SOUT_PCM:
+ ulStreamIndexMin = 2;
+ ulStreamIndexMax = 3;
+ break;
+ case cOCT6100_DEBUG_GET_DATA_CONTENT_COMPLETE:
+ default:
+ ulStreamIndexMin = 0;
+ ulStreamIndexMax = 3;
+ break;
+ }
+
+ for ( ulStreamIndex = ulStreamIndexMin; ulStreamIndex < ulStreamIndexMax; ulStreamIndex ++ )
{
ReadBurstParams.ulReadAddress = pSharedInfo->MemoryMap.ulChanMainMemBase;
/* To get right channel information. */
@@ -906,17 +970,33 @@ UINT32 Oct6100DebugGetDataSer(
/* We now have the stream data for all streams for 1 event. */
/* Return what we can to the user. */
- if ( ulPcmSampleIndex % 2 == 0 )
+ if ( ( ulPcmSampleIndex % 2 ) == 0 )
{
- f_pGetData->pbyData[ ulUserBufWriteIndex++ ] = (UINT8)( ( pSharedInfo->MiscVars.ausSuperArray[ ( ulPcmSampleIndex / 2 ) % ( cOCT6100_INTERNAL_SUPER_ARRAY_SIZE ) ] >> 8 ) & 0xFF );
- f_pGetData->pbyData[ ulUserBufWriteIndex++ ] = (UINT8)( ( pSharedInfo->MiscVars.ausSuperArray1[ ( ulPcmSampleIndex / 2 ) % ( cOCT6100_INTERNAL_SUPER_ARRAY_SIZE ) ] >> 8 ) & 0xFF );
- f_pGetData->pbyData[ ulUserBufWriteIndex++ ] = (UINT8)( ( pSharedInfo->MiscVars.ausSuperArray2[ ( ulPcmSampleIndex / 2 ) % ( cOCT6100_INTERNAL_SUPER_ARRAY_SIZE ) ] >> 8 ) & 0xFF );
+ if ( ( f_pGetData->ulGetDataContent == cOCT6100_DEBUG_GET_DATA_CONTENT_COMPLETE )
+ || ( f_pGetData->ulGetDataContent == cOCT6100_DEBUG_GET_DATA_CONTENT_RIN_PCM ) )
+ f_pGetData->pbyData[ ulUserBufWriteIndex++ ] = (UINT8)( ( pSharedInfo->MiscVars.ausSuperArray[ ( ulPcmSampleIndex / 2 ) % ( cOCT6100_INTERNAL_SUPER_ARRAY_SIZE ) ] >> 8 ) & 0xFF );
+
+ if ( ( f_pGetData->ulGetDataContent == cOCT6100_DEBUG_GET_DATA_CONTENT_COMPLETE )
+ || ( f_pGetData->ulGetDataContent == cOCT6100_DEBUG_GET_DATA_CONTENT_SIN_PCM ) )
+ f_pGetData->pbyData[ ulUserBufWriteIndex++ ] = (UINT8)( ( pSharedInfo->MiscVars.ausSuperArray1[ ( ulPcmSampleIndex / 2 ) % ( cOCT6100_INTERNAL_SUPER_ARRAY_SIZE ) ] >> 8 ) & 0xFF );
+
+ if ( ( f_pGetData->ulGetDataContent == cOCT6100_DEBUG_GET_DATA_CONTENT_COMPLETE )
+ || ( f_pGetData->ulGetDataContent == cOCT6100_DEBUG_GET_DATA_CONTENT_SOUT_PCM ) )
+ f_pGetData->pbyData[ ulUserBufWriteIndex++ ] = (UINT8)( ( pSharedInfo->MiscVars.ausSuperArray2[ ( ulPcmSampleIndex / 2 ) % ( cOCT6100_INTERNAL_SUPER_ARRAY_SIZE ) ] >> 8 ) & 0xFF );
}
else /* if ( ulPcmSampleIndex % 2 == 1 ) */
{
+ if ( ( f_pGetData->ulGetDataContent == cOCT6100_DEBUG_GET_DATA_CONTENT_COMPLETE )
+ || ( f_pGetData->ulGetDataContent == cOCT6100_DEBUG_GET_DATA_CONTENT_RIN_PCM ) )
f_pGetData->pbyData[ ulUserBufWriteIndex++ ] = (UINT8)( ( pSharedInfo->MiscVars.ausSuperArray[ ( ulPcmSampleIndex / 2 ) % ( cOCT6100_INTERNAL_SUPER_ARRAY_SIZE ) ] >> 0 ) & 0xFF );
- f_pGetData->pbyData[ ulUserBufWriteIndex++ ] = (UINT8)( ( pSharedInfo->MiscVars.ausSuperArray1[ ( ulPcmSampleIndex / 2 ) % ( cOCT6100_INTERNAL_SUPER_ARRAY_SIZE ) ] >> 0 ) & 0xFF );
- f_pGetData->pbyData[ ulUserBufWriteIndex++ ] = (UINT8)( ( pSharedInfo->MiscVars.ausSuperArray2[ ( ulPcmSampleIndex / 2 ) % ( cOCT6100_INTERNAL_SUPER_ARRAY_SIZE ) ] >> 0 ) & 0xFF );
+
+ if ( ( f_pGetData->ulGetDataContent == cOCT6100_DEBUG_GET_DATA_CONTENT_COMPLETE )
+ || ( f_pGetData->ulGetDataContent == cOCT6100_DEBUG_GET_DATA_CONTENT_SIN_PCM ) )
+ f_pGetData->pbyData[ ulUserBufWriteIndex++ ] = (UINT8)( ( pSharedInfo->MiscVars.ausSuperArray1[ ( ulPcmSampleIndex / 2 ) % ( cOCT6100_INTERNAL_SUPER_ARRAY_SIZE ) ] >> 0 ) & 0xFF );
+
+ if ( ( f_pGetData->ulGetDataContent == cOCT6100_DEBUG_GET_DATA_CONTENT_COMPLETE )
+ || ( f_pGetData->ulGetDataContent == cOCT6100_DEBUG_GET_DATA_CONTENT_SOUT_PCM ) )
+ f_pGetData->pbyData[ ulUserBufWriteIndex++ ] = (UINT8)( ( pSharedInfo->MiscVars.ausSuperArray2[ ( ulPcmSampleIndex / 2 ) % ( cOCT6100_INTERNAL_SUPER_ARRAY_SIZE ) ] >> 0 ) & 0xFF );
}
pSharedInfo->DebugInfo.ulLastPcmSampleIndex++;
@@ -925,167 +1005,177 @@ UINT32 Oct6100DebugGetDataSer(
/* Check if we are done dumping the PCM samples! */
if ( pSharedInfo->DebugInfo.ulLastPcmSampleIndex == ( (UINT32)pSharedInfo->DebugInfo.usNumEvents * pSharedInfo->DebugInfo.ulRecordedPcmEventByteSize ) )
{
- /* Go for the AF events. The AF events are only copied in heavy mode. */
- if ( ( f_pGetData->ulGetDataMode == cOCT6100_DEBUG_GET_DATA_MODE_16S )
- || ( f_pGetData->ulGetDataMode == cOCT6100_DEBUG_GET_DATA_MODE_120S ) )
+ if ( f_pGetData->ulGetDataContent == cOCT6100_DEBUG_GET_DATA_CONTENT_COMPLETE )
{
- while ( pSharedInfo->DebugInfo.usLastAfLogReadPtr != pSharedInfo->DebugInfo.usAfLogWritePtr )
- {
- /* Check if enough room for an event. */
- if ( ( f_pGetData->ulMaxBytes - ulUserBufWriteIndex ) < 16 )
- break;
- /* Check if must fill our buffer. */
- if ( ( pSharedInfo->DebugInfo.usLastAfLogReadPtr % ( cOCT6100_INTERNAL_SUPER_ARRAY_SIZE / 8 ) ) == 0x0 )
+ /* Go for the AF events. The AF events are only copied in heavy mode. */
+ if ( ( f_pGetData->ulGetDataMode == cOCT6100_DEBUG_GET_DATA_MODE_16S )
+ || ( f_pGetData->ulGetDataMode == cOCT6100_DEBUG_GET_DATA_MODE_120S ) )
+ {
+ while ( pSharedInfo->DebugInfo.usLastAfLogReadPtr != pSharedInfo->DebugInfo.usAfLogWritePtr )
{
- ulNumAfEvents = ( pSharedInfo->DebugInfo.usAfLogWritePtr - pSharedInfo->DebugInfo.usLastAfLogReadPtr ) & 0xFFFF;
-
- /* Check for the size of the available buffer. */
- if ( ulNumAfEvents > ( cOCT6100_INTERNAL_SUPER_ARRAY_SIZE / 8 ) )
- ulNumAfEvents = ( cOCT6100_INTERNAL_SUPER_ARRAY_SIZE / 8 );
-
- /* Start at channel main base address. */
- ReadBurstParams.ulReadAddress = pSharedInfo->MemoryMap.ulChanMainMemBase;
- /* To get right channel information. */
- ReadBurstParams.ulReadAddress += ( ( pSharedInfo->DebugInfo.usRecordMemIndex + 2 ) * pSharedInfo->MemoryMap.ulChanMainMemSize );
- /* To get the right AF log. */
- ReadBurstParams.ulReadAddress += ( pSharedInfo->DebugInfo.usLastAfLogReadPtr * 16 );
+ /* Check if enough room for an event. */
+ if ( ( f_pGetData->ulMaxBytes - ulUserBufWriteIndex ) < 16 )
+ break;
- ulTempIndex = 0;
- ulNumReads = ulNumAfEvents * 8;
-
- while ( ulNumReads != 0 )
+ /* Check if must fill our buffer. */
+ if ( ( pSharedInfo->DebugInfo.usLastAfLogReadPtr % ( cOCT6100_INTERNAL_SUPER_ARRAY_SIZE / 8 ) ) == 0x0 )
{
- if ( ulNumReads >= pSharedInfo->ChipConfig.usMaxRwAccesses )
- ReadBurstParams.ulReadLength = pSharedInfo->ChipConfig.usMaxRwAccesses;
- else
- ReadBurstParams.ulReadLength = ulNumReads;
+ ulNumAfEvents = ( pSharedInfo->DebugInfo.usAfLogWritePtr - pSharedInfo->DebugInfo.usLastAfLogReadPtr ) & 0xFFFF;
- /* Set pointer where to write data. */
- ReadBurstParams.pusReadData = &pSharedInfo->MiscVars.ausSuperArray[ ulTempIndex ];
+ /* Check for the size of the available buffer. */
+ if ( ulNumAfEvents > ( cOCT6100_INTERNAL_SUPER_ARRAY_SIZE / 8 ) )
+ ulNumAfEvents = ( cOCT6100_INTERNAL_SUPER_ARRAY_SIZE / 8 );
- mOCT6100_DRIVER_READ_BURST_API( ReadBurstParams, ulResult );
- if ( ulResult != cOCT6100_ERR_OK )
- return ulResult;
+ /* Start at channel main base address. */
+ ReadBurstParams.ulReadAddress = pSharedInfo->MemoryMap.ulChanMainMemBase;
+ /* To get right channel information. */
+ ReadBurstParams.ulReadAddress += ( ( pSharedInfo->DebugInfo.usRecordMemIndex + 2 ) * pSharedInfo->MemoryMap.ulChanMainMemSize );
+ /* To get the right AF log. */
+ ReadBurstParams.ulReadAddress += ( pSharedInfo->DebugInfo.usLastAfLogReadPtr * 16 );
- /* Update indexes, temp variables, addresses. */
- ulNumReads -= ReadBurstParams.ulReadLength;
- ulTempIndex += ReadBurstParams.ulReadLength;
- ReadBurstParams.ulReadAddress += ReadBurstParams.ulReadLength * 2;
+ ulTempIndex = 0;
+ ulNumReads = ulNumAfEvents * 8;
+
+ while ( ulNumReads != 0 )
+ {
+ if ( ulNumReads >= pSharedInfo->ChipConfig.usMaxRwAccesses )
+ ReadBurstParams.ulReadLength = pSharedInfo->ChipConfig.usMaxRwAccesses;
+ else
+ ReadBurstParams.ulReadLength = ulNumReads;
+
+ /* Set pointer where to write data. */
+ ReadBurstParams.pusReadData = &pSharedInfo->MiscVars.ausSuperArray[ ulTempIndex ];
+
+ mOCT6100_DRIVER_READ_BURST_API( ReadBurstParams, ulResult );
+ if ( ulResult != cOCT6100_ERR_OK )
+ return ulResult;
+
+ /* Update indexes, temp variables, addresses. */
+ ulNumReads -= ReadBurstParams.ulReadLength;
+ ulTempIndex += ReadBurstParams.ulReadLength;
+ ReadBurstParams.ulReadAddress += ReadBurstParams.ulReadLength * 2;
+ }
}
- }
- /* Copy data byte per byte to avoid endianess problems. */
- for ( ulCopyIndex = 0; ulCopyIndex < 8; ulCopyIndex ++ )
- {
- f_pGetData->pbyData[ ulUserBufWriteIndex + ( 2 * ulCopyIndex ) ] = (UINT8)( pSharedInfo->MiscVars.ausSuperArray[ ( ( pSharedInfo->DebugInfo.usLastAfLogReadPtr % ( cOCT6100_INTERNAL_SUPER_ARRAY_SIZE / 8 ) ) * 8 ) + ulCopyIndex ] & 0xFF );
- f_pGetData->pbyData[ ulUserBufWriteIndex + ( 2 * ulCopyIndex ) + 1 ] = (UINT8)( ( pSharedInfo->MiscVars.ausSuperArray[ ( ( pSharedInfo->DebugInfo.usLastAfLogReadPtr % ( cOCT6100_INTERNAL_SUPER_ARRAY_SIZE / 8 ) ) * 8 ) + ulCopyIndex ] >> 8 ) & 0xFF );
- }
+ /* Copy data byte per byte to avoid endianess problems. */
+ for ( ulCopyIndex = 0; ulCopyIndex < 8; ulCopyIndex ++ )
+ {
+ f_pGetData->pbyData[ ulUserBufWriteIndex + ( 2 * ulCopyIndex ) ] = (UINT8)( pSharedInfo->MiscVars.ausSuperArray[ ( ( pSharedInfo->DebugInfo.usLastAfLogReadPtr % ( cOCT6100_INTERNAL_SUPER_ARRAY_SIZE / 8 ) ) * 8 ) + ulCopyIndex ] & 0xFF );
+ f_pGetData->pbyData[ ulUserBufWriteIndex + ( 2 * ulCopyIndex ) + 1 ] = (UINT8)( ( pSharedInfo->MiscVars.ausSuperArray[ ( ( pSharedInfo->DebugInfo.usLastAfLogReadPtr % ( cOCT6100_INTERNAL_SUPER_ARRAY_SIZE / 8 ) ) * 8 ) + ulCopyIndex ] >> 8 ) & 0xFF );
+ }
- ulUserBufWriteIndex += 16;
+ ulUserBufWriteIndex += 16;
- /* Increment AF log read ptr. */
- pSharedInfo->DebugInfo.usLastAfLogReadPtr = (UINT16)(( pSharedInfo->DebugInfo.usLastAfLogReadPtr + 1 ) & 0xFFFF );
+ /* Increment AF log read ptr. */
+ pSharedInfo->DebugInfo.usLastAfLogReadPtr = (UINT16)(( pSharedInfo->DebugInfo.usLastAfLogReadPtr + 1 ) & 0xFFFF );
+ }
}
- }
- /* Check if we are done with the AF events. */
- if ( pSharedInfo->DebugInfo.usLastAfLogReadPtr == pSharedInfo->DebugInfo.usAfLogWritePtr )
- {
- /* Insert the tone event information. */
- for ( ulToneEventIndex = pSharedInfo->DebugInfo.usLastToneEventIndex; ulToneEventIndex < pSharedInfo->ImageInfo.byNumToneDetectors; ulToneEventIndex++ )
+ /* Check if we are done with the AF events. */
+ if ( pSharedInfo->DebugInfo.usLastAfLogReadPtr == pSharedInfo->DebugInfo.usAfLogWritePtr )
{
- if ( ( f_pGetData->ulMaxBytes - ulUserBufWriteIndex ) < cOCT6100_TLV_MAX_TONE_NAME_SIZE )
- break;
+ /* Insert the tone event information. */
+ for ( ulToneEventIndex = pSharedInfo->DebugInfo.usLastToneEventIndex; ulToneEventIndex < pSharedInfo->ImageInfo.byNumToneDetectors; ulToneEventIndex++ )
+ {
+ if ( ( f_pGetData->ulMaxBytes - ulUserBufWriteIndex ) < cOCT6100_TLV_MAX_TONE_NAME_SIZE )
+ break;
- Oct6100UserMemCopy( &f_pGetData->pbyData[ ulUserBufWriteIndex ], pSharedInfo->ImageInfo.aToneInfo[ ulToneEventIndex ].aszToneName, cOCT6100_TLV_MAX_TONE_NAME_SIZE );
+ Oct6100UserMemCopy( &f_pGetData->pbyData[ ulUserBufWriteIndex ], pSharedInfo->ImageInfo.aToneInfo[ ulToneEventIndex ].aszToneName, cOCT6100_TLV_MAX_TONE_NAME_SIZE );
- ulUserBufWriteIndex += cOCT6100_TLV_MAX_TONE_NAME_SIZE;
+ ulUserBufWriteIndex += cOCT6100_TLV_MAX_TONE_NAME_SIZE;
- pSharedInfo->DebugInfo.usLastToneEventIndex++;
- }
+ pSharedInfo->DebugInfo.usLastToneEventIndex++;
+ }
- /* If all the tone information has been copied. */
- if ( ulToneEventIndex == pSharedInfo->ImageInfo.byNumToneDetectors )
- {
- /* Copy the image version. */
- if ( pSharedInfo->DebugInfo.fImageVersionCopied == FALSE )
+ /* If all the tone information has been copied. */
+ if ( ulToneEventIndex == pSharedInfo->ImageInfo.byNumToneDetectors )
{
- if ( ( f_pGetData->ulMaxBytes - ulUserBufWriteIndex ) >= 512 )
+ /* Copy the image version. */
+ if ( pSharedInfo->DebugInfo.fImageVersionCopied == FALSE )
{
- Oct6100UserMemCopy( &f_pGetData->pbyData[ ulUserBufWriteIndex ], pSharedInfo->ImageInfo.szVersionNumber, 512 );
-
- /* Get PLL jitter count from external memory. */
- if ( pSharedInfo->DebugInfo.fPouchCounter == TRUE )
- {
- ulFeatureBytesOffset = pSharedInfo->MemoryMap.PouchCounterFieldOfst.usDwordOffset * 4;
- ulFeatureBitOffset = pSharedInfo->MemoryMap.PouchCounterFieldOfst.byBitOffset;
- ulFeatureFieldLength = pSharedInfo->MemoryMap.PouchCounterFieldOfst.byFieldSize;
-
- ulResult = Oct6100ApiReadDword( f_pApiInstance,
- cOCT6100_POUCH_BASE + ulFeatureBytesOffset,
- &ulTempData );
-
- /* Create the mask to retrieve the appropriate value. */
- mOCT6100_CREATE_FEATURE_MASK( ulFeatureFieldLength, ulFeatureBitOffset, &ulMask );
-
- /* Mask data. */
- ulTempData &= ulMask;
- /* Move to right position. */
- ulTempData = ulTempData >> ulFeatureBitOffset;
-
- f_pGetData->pbyData[ ulUserBufWriteIndex + 510 ] = (UINT8)( ( ulTempData >> 8 ) & 0xFF );
- f_pGetData->pbyData[ ulUserBufWriteIndex + 511 ] = (UINT8)( ( ulTempData >> 0 ) & 0xFF );
- }
-
- /* Add "ISR is not called" bit. */
- if ( pSharedInfo->IntrptManage.fIsrCalled == FALSE )
+ if ( ( f_pGetData->ulMaxBytes - ulUserBufWriteIndex ) >= 512 )
{
- f_pGetData->pbyData[ ulUserBufWriteIndex + 510 ] |= 0x80;
+ Oct6100UserMemCopy( &f_pGetData->pbyData[ ulUserBufWriteIndex ], pSharedInfo->ImageInfo.szVersionNumber, 512 );
+
+ /* Get PLL jitter count from external memory. */
+ if ( pSharedInfo->DebugInfo.fPouchCounter == TRUE )
+ {
+ ulFeatureBytesOffset = pSharedInfo->MemoryMap.PouchCounterFieldOfst.usDwordOffset * 4;
+ ulFeatureBitOffset = pSharedInfo->MemoryMap.PouchCounterFieldOfst.byBitOffset;
+ ulFeatureFieldLength = pSharedInfo->MemoryMap.PouchCounterFieldOfst.byFieldSize;
+
+ ulResult = Oct6100ApiReadDword( f_pApiInstance,
+ cOCT6100_POUCH_BASE + ulFeatureBytesOffset,
+ &ulTempData );
+
+ /* Create the mask to retrieve the appropriate value. */
+ mOCT6100_CREATE_FEATURE_MASK( ulFeatureFieldLength, ulFeatureBitOffset, &ulMask );
+
+ /* Mask data. */
+ ulTempData &= ulMask;
+ /* Move to right position. */
+ ulTempData = ulTempData >> ulFeatureBitOffset;
+
+ f_pGetData->pbyData[ ulUserBufWriteIndex + 510 ] = (UINT8)( ( ulTempData >> 8 ) & 0xFF );
+ f_pGetData->pbyData[ ulUserBufWriteIndex + 511 ] = (UINT8)( ( ulTempData >> 0 ) & 0xFF );
+ }
+
+ /* Add "ISR is not called" bit. */
+ if ( pSharedInfo->IntrptManage.fIsrCalled == FALSE )
+ {
+ f_pGetData->pbyData[ ulUserBufWriteIndex + 510 ] |= 0x80;
+ }
+
+ ulUserBufWriteIndex += 512;
+
+ /* The version has been copied. */
+ pSharedInfo->DebugInfo.fImageVersionCopied = TRUE;
}
-
- ulUserBufWriteIndex += 512;
-
- /* The version has been copied. */
- pSharedInfo->DebugInfo.fImageVersionCopied = TRUE;
}
- }
- /* If the image version has been copied, proceed with the API version. */
- if ( pSharedInfo->DebugInfo.fImageVersionCopied == TRUE )
- {
- if ( pSharedInfo->DebugInfo.fApiVersionCopied == FALSE )
+ /* If the image version has been copied, proceed with the API version. */
+ if ( pSharedInfo->DebugInfo.fImageVersionCopied == TRUE )
{
- if ( ( f_pGetData->ulMaxBytes - ulUserBufWriteIndex ) >= sizeof(cOCT6100_API_VERSION) )
+ if ( pSharedInfo->DebugInfo.fApiVersionCopied == FALSE )
{
- Oct6100UserMemCopy( &f_pGetData->pbyData[ ulUserBufWriteIndex ], cOCT6100_API_VERSION, sizeof(cOCT6100_API_VERSION) );
- ulUserBufWriteIndex += sizeof(cOCT6100_API_VERSION);
-
- /* The API version has been copied. */
- pSharedInfo->DebugInfo.fApiVersionCopied = TRUE;
+ if ( ( f_pGetData->ulMaxBytes - ulUserBufWriteIndex ) >= sizeof(cOCT6100_API_VERSION) )
+ {
+ Oct6100UserMemCopy( &f_pGetData->pbyData[ ulUserBufWriteIndex ], cOCT6100_API_VERSION, sizeof(cOCT6100_API_VERSION) );
+ ulUserBufWriteIndex += sizeof(cOCT6100_API_VERSION);
+
+ /* The API version has been copied. */
+ pSharedInfo->DebugInfo.fApiVersionCopied = TRUE;
+ }
}
}
}
- }
- /* Check if we are done! */
- if ( pSharedInfo->DebugInfo.fApiVersionCopied == TRUE )
- {
- /* Done dumping. */
+ /* Check if we are done! */
+ if ( pSharedInfo->DebugInfo.fApiVersionCopied == TRUE )
+ {
+ /* Done dumping. */
- /* Reset data being dumpped flag. */
- pSharedInfo->DebugInfo.fDebugDataBeingDumped = FALSE;
+ /* Reset data being dumpped flag. */
+ pSharedInfo->DebugInfo.fDebugDataBeingDumped = FALSE;
- /* Reset data recording in the chip. */
- WriteBurstParams.ulWriteAddress = pSharedInfo->DebugInfo.ulHotChannelSelectBaseAddress;
- WriteBurstParams.ulWriteLength = 2;
- WriteBurstParams.pusWriteData = pSharedInfo->DebugInfo.ausHotChannelData;
+ /* Reset data recording in the chip. */
+ WriteBurstParams.ulWriteAddress = pSharedInfo->DebugInfo.ulHotChannelSelectBaseAddress;
+ WriteBurstParams.ulWriteLength = 2;
+ WriteBurstParams.pusWriteData = pSharedInfo->DebugInfo.ausHotChannelData;
- mOCT6100_DRIVER_WRITE_BURST_API( WriteBurstParams, ulResult );
- if ( ulResult != cOCT6100_ERR_OK )
- return ulResult;
+ mOCT6100_DRIVER_WRITE_BURST_API( WriteBurstParams, ulResult );
+ if ( ulResult != cOCT6100_ERR_OK )
+ return ulResult;
+
+ fResetRemainingDataFlag = TRUE;
+ }
}
}
+ else /* if ( f_pGetData->ulGetDataContent != cOCT6100_DEBUG_GET_DATA_CONTENT_COMPLETE ) */
+ {
+ fResetRemainingDataFlag = TRUE;
+ }
}
}
@@ -1101,5 +1191,9 @@ UINT32 Oct6100DebugGetDataSer(
/* Return total number of bytes. */
f_pGetData->ulTotalNumBytes = pSharedInfo->DebugInfo.ulDebugDataTotalNumBytes;
+ /* Check if we are done dump the requested content. */
+ if ( fResetRemainingDataFlag == TRUE )
+ pSharedInfo->DebugInfo.ulDebugDataTotalNumBytes = cOCT6100_INVALID_VALUE;
+
return cOCT6100_ERR_OK;
}