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.c44
1 files changed, 41 insertions, 3 deletions
diff --git a/software/octdeviceapi/oct6100api/oct6100_api/oct6100_debug.c b/software/octdeviceapi/oct6100api/oct6100_api/oct6100_debug.c
index 5fc5e3d..f9cb3ed 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-2007 Octasic Inc.
+ Copyright (c) 2001-2008 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-PR49 $
+$Octasic_Release: OCT612xAPI-01.01.01 $
-$Octasic_Revision: 65 $
+$Octasic_Revision: 66 $
\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
@@ -511,6 +511,8 @@ UINT32 Oct6100DebugGetDataSer(
UINT32 ulStreamIndexMax;
UINT32 ulTempData;
UINT32 ulMask;
+ UINT32 ulDiff;
+ UINT32 ulLastTimestamp = 0;
BOOL fResetRemainingDataFlag = FALSE;
/* Get local pointer(s). */
@@ -712,6 +714,42 @@ UINT32 Oct6100DebugGetDataSer(
else
pSharedInfo->DebugInfo.usNumEvents++;
+ /* If this event was valid.. */
+ if ( pSharedInfo->DebugInfo.usNumEvents != 0 )
+ {
+ /* The HOT channel timestamp for the event is stored at offset 0x0 (word offset) */
+ ReadBurstParams.ulReadAddress = pSharedInfo->DebugInfo.ulMatrixBaseAddress + ulReadPointer;
+ ReadBurstParams.ulReadLength = 2;
+ ReadBurstParams.pusReadData = ausWriteData;
+
+ mOCT6100_DRIVER_READ_BURST_API( ReadBurstParams, ulResult );
+ if ( ulResult != cOCT6100_ERR_OK )
+ return ulResult;
+
+ /* Recreate timestamp at the time of the event. */
+ ulTimestamp = ( ausWriteData[ 0 ] << 16 );
+ ulTimestamp |= ausWriteData[ 1 ];
+
+ /* TDM time for 1 event (512 ms) */
+ ulTimestamp = ( ulTimestamp >> 12 );
+ ulDiff = ulTimestamp - ulLastTimestamp;
+
+ /* Check if difference makes some sense. */
+ if ( pSharedInfo->DebugInfo.usNumEvents > 1 )
+ {
+ /* Check if the current timestamp is one less then the previous one. */
+ if ( ulDiff != 1 )
+ {
+ pSharedInfo->DebugInfo.usNumEvents = 0; /* If it is not a difference of 1, throw this event. */
+ }
+ ulLastTimestamp = ulTimestamp;
+ }
+ else
+ {
+ ulLastTimestamp = ulTimestamp;
+ }
+ }
+
/* Increment read pointer to get next event. */
ulReadPointer = ( ulReadPointer + pSharedInfo->DebugInfo.ulDebugChanStatsByteSize ) % ( ( pSharedInfo->DebugInfo.usMatrixCBMask + 1 ) * pSharedInfo->DebugInfo.ulDebugChanStatsByteSize );
}