]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - processor-sdk/performance-audio-sr.git/blobdiff - pasdk/test_dsp/io/ioData.c
Merge remote-tracking branch 'origin/dev_pasdk1_3_integration' into dev_pasdk_frank_p...
[processor-sdk/performance-audio-sr.git] / pasdk / test_dsp / io / ioData.c
index 4c5c673c71f82f9c30a0fe528568cd1125ff1591..0baa780745d74900fa7c9b7d8492257687985afb 100644 (file)
@@ -29,7 +29,7 @@
 #define IODATA_SYNC_THD             0x16
 
 #define IODATA_MIN_NUM_ZEROS_BEFORE_PA   2
-#define IODATA_PREAMBLE_MAX_LEN          8          // TBD
+#define IODATA_PREAMBLE_MAX_LEN          16 // TBD
 #define IODATA_HEADER_LENGTH_IEC         4
 #define IODATA_HEADER_CHECK_LENGTH_IEC   2  // For IEC, only look at 2 words to check SYNC.
 
@@ -329,7 +329,10 @@ int ioDataControl(ioDataHandle_t ioDataHandle, ioDataCtl_t *ioDataCtl)
     case IODATA_CTL_GET_AUTODET_STATUS:
       ioDataCtl->param.autoDetStats.syncState     = pIoDataInst->autoDet.syncState;
       ioDataCtl->param.autoDetStats.deliverZeros  = pIoDataInst->deliverZeros;
-      ioDataCtl->param.autoDetStats.bitStreamInfo = pIoDataInst->autoDet.bitStreamInfo;
+      ioDataCtl->param.autoDetStats.streamInfo.IEC_PC = pIoDataInst->autoDet.bitStreamInfo & IODATA_SYNC_PC_MASK;
+      ioDataCtl->param.autoDetStats.streamInfo.frameLength = pIoDataInst->autoDet.frameLength;
+      ioDataCtl->param.autoDetStats.streamInfo.dataLength  =  pIoDataInst->autoDet.frameLength
+                                                            - pIoDataInst->autoDet.headerLength;
       ioDataCtl->param.autoDetStats.syncTimeOut   = pIoDataInst->syncTimeOut;
       break;
 /*
@@ -446,6 +449,7 @@ void autoDetection(ioDataInst_t * pIoDataInst)
          /* Check if a full frame has been received and if so, check if SYNC is maintained */
       if(pIoDataInst->autoDet.completeFrameRcvd) {
                if(pIoDataInst->autoDet.syncDetected) {
+          pIoDataInst->dbgStats.numFramesRcvd += 1;
                  pIoDataInst->autoDet.syncState = IODATA_SYNC_BITSTREAM;
          pIoDataInst->autoDet.completeFrameRcvd = FALSE;
 
@@ -458,7 +462,6 @@ void autoDetection(ioDataInst_t * pIoDataInst)
 
          // Store the beginning address of data in current frame (not including the preamble)
          pIoDataInst->autoDet.frameDataStartConfirm = pIoDataInst->autoDet.frameDataStartTemp;
-         pIoDataInst->dbgStats.numFramesRcvd += 1;
 
          // re-initialize for SYNC check
                  syncCheckInit(pIoDataInst);
@@ -529,6 +532,16 @@ void syncCheckInit(ioDataInst_t * pIoDataInst)
        uint_least16_t pc = pIoDataInst->autoDet.bitStreamInfo & IODATA_SYNC_PC_MASK;
 
        pIoDataInst->autoDet.frameLength    = pIoDataInst->IECframeLengths[pc];
+
+    if (pc == 1) {
+        pIoDataInst->autoDet.frameLength = 4288;
+    }
+    else if (pc == IODATA_SYNC_SUBTYPE_DTSHD) {
+        int DTSHDSubType = (pIoDataInst->autoDet.bitStreamInfo & IODATA_SYNC_SUBTYPE_MASK)
+                           >> IODATA_SYNC_SUBTYPE_SHIFT;
+        pIoDataInst->autoDet.frameLength = pIoDataInst->IECframeLengths[pc] << DTSHDSubType;
+    }
+
        pIoDataInst->autoDet.distToFrameEnd = pIoDataInst->autoDet.frameLength
                                                      - pIoDataInst->autoDet.numElementsRcvd;
 
@@ -722,6 +735,9 @@ void syncScan(void *buff, size_t size, int8_t elementSize, autoDet_t *pDet)
                 //pDevExt->headerSize = IEC_HEADER_SIZE;
                 pDet->preambleRef[3]  = tail; /* save this word for sync check */
                pDet->headerLength    = IODATA_HEADER_LENGTH_IEC;
+                if( (pDet->bitStreamInfo & 0x1F) == 0x11) { // DTSHD subtype
+                    pDet->headerLength += 6;
+                }
                pDet->headerCheckLen  = IODATA_HEADER_CHECK_LENGTH_IEC;
                 scanState = SCANNED_IEC_PD;