Add more commenting and use of symbolic constants to systemStream.c
authorFrank Livingston <frank-livingston@ti.com>
Tue, 7 Feb 2017 20:11:35 +0000 (14:11 -0600)
committerFrank Livingston <frank-livingston@ti.com>
Tue, 7 Feb 2017 20:11:35 +0000 (14:11 -0600)
pasdk/test_dsp/framework/systemStream.c

index 638fd092f6c19feefdd3f97c93ce7cce58493ed3..667dafbee5a387ed607a097d2422a349683a89f3 100644 (file)
@@ -50,10 +50,7 @@ All rights reserved.
 // ... end of specific usage definitions.
 
 #include <xdc/std.h>
-//#include <std.h>
-//#include  <std.h>
-//#include <xdas.h>
-
+#include <xdc/cfg/global.h>
 #include <xdc/runtime/Log.h>
 #include <ti/sysbios/knl/Task.h>
 #include <ti/sysbios/utils/Load.h>
@@ -119,6 +116,7 @@ systemStreamMain(
         // Create an ACP algorithm instance with trace enabled
         ACP_MDS_init();
 
+        // Create ACP instance for System Stream
         if ( !(acpAlg = (ALG_Handle )ACP_MDS_create (NULL)) )
         {
             //LOG_printf(&trace, "SS%d: ACP algorithm instance creation failed",
@@ -132,12 +130,14 @@ systemStreamMain(
             (IALG_Status *) &betaPrimeOffset);
         betaPrime = betaPrimeOffset * betaPrimeValue;
 
+        // Attach System Stream status (update Beta Table entry)
         acp = (ACP_Handle )acpAlg;
         acp->fxns->attach(acp, ACP_SERIES_STD, STD_BETA_SYSIDL+betaPrime, (IALG_Status *)pStatus);
 
         acpAlg->fxns->algControl(acpAlg, ACP_SETBETAPRIMEVALUE,
             (IALG_Status *) &betaPrimeValue);
 
+        // Update System Stream configuration ACP handle
         pC->acp = acp;
 
         //LOG_printf(&trace, "SS%d: ACP processing initialized", ss);
@@ -252,7 +252,7 @@ systemStream1Compute(
 #endif
                 | ((pStatus->speakerHead & PAF_SYS_SPEAKERNUMB) ? PAF_CC_EXTMASK_LhRh : 0) ;
 #ifdef FULL_SPEAKER
-        ccr.part.extMask2 =
+            ccr.part.extMask2 =
                     ((pStatus->speakerCntrSurr & PAF_SYS_SPEAKERNUMB) ? PAF_CC_EXTMASK_Cs : 0)
                   | ((pStatus->speakerLRCntrSurr & PAF_SYS_SPEAKERNUMB) ? PAF_CC_EXTMASK_LcsRcs : 0)
                   | ((pStatus->speakerRearSurr2 & PAF_SYS_SPEAKERNUMB) ? PAF_CC_EXTMASK_Lrs2Rrs2 : 0)
@@ -333,7 +333,7 @@ systemStream1Transmit(
 
         // writeDECChannelConfigurationRequest 0xce24,0x3808
         from[0] = 0xc906;
-        from[1] = 0xce24;
+        from[1] = 0xce00 | STD_BETA_DECODE;
         from[2] = 0x3808;
         from[3] = ccr.full;
         from[4] = ccr.full >> 16;
@@ -350,7 +350,7 @@ systemStream1Transmit(
 
         // writeENCChannelConfigurationCompact(sat,sub,aux,ext0,ext2,ext3,rsvd1,rsvd2) 0xce25,0x9808
         from[0] = 0xc906;
-        from[1] = 0xce25;
+        from[1] = 0xce00 | STD_BETA_ENCODE;
         from[2] = 0x9808;
         from[3] = ccr.full;
         from[4] = ccr.full >> 16;
@@ -375,7 +375,7 @@ systemStream1Transmit(
 
         // writeDECChannelConfigurationOverride 0xce24,0x5808
         from[0] = 0xc906;
-        from[1] = 0xce24;
+        from[1] = 0xce00 | STD_BETA_DECODE;
         from[2] = 0x5808; 
         from[3] = cco.full;
         from[4] = cco.full >> 16;
@@ -423,7 +423,7 @@ systemStream2Compute(
 )
 {
     PAF_SystemStatus *pStatus = pC->pStatus;
-    Int32 oc;
+    Int32 oc; /* Output Configuration */
 
     // Determine BM Output Configuration Select (if auto mode):
 
@@ -472,14 +472,14 @@ systemStream2Transmit(
         // writeBMOCSelectOCAuto(OCNO,AUTO) 0xcb40,0x000a,
         //     ((OCNO) << 8)&0xff00+(AUTO)&0x00ff
 
-        from[1] = 0xcb40;
+        from[1] = 0xcb00 | STD_BETA_BM;
         from[2] = 0x000a;
         from[3] = (oc>>16) & 0xffff;
 
         // writeBMOCSelectChannels(CHANS) 0xca40,
         //     0x0800+((CHANS) & 0x00ff)
 
-        from[4] = 0xca40;
+        from[4] = 0xca00 | STD_BETA_BM;
         from[5] = 0x0800 + (oc & 0xff);
 
         if (errno = acp->fxns->sequence(acp, from, NULL)) 
@@ -540,7 +540,7 @@ systemStream3Compute(
 
     // readDEMFilterMode 0xc250,0x0500
     from[0] = 0xc902;
-    from[1] = 0xc250;
+    from[1] = 0xc200 | STD_BETA_DEM;
     from[2] = 0x0500;
     
     if (errno = acp->fxns->sequence(acp, from, to)) 
@@ -566,7 +566,7 @@ systemStream3Compute(
 
     // readDECEmphasis  0xc224,0x33
     from[0] = 0xc902;
-    from[1] = 0xc224;
+    from[1] = 0xc200 | STD_BETA_DECODE;
     from[2] = 0x3300;
 
     if (errno = acp->fxns->sequence(acp, from, to)) 
@@ -595,7 +595,7 @@ systemStream3Transmit(
     Int32 errno;
 
     from[0] = 0xc902;
-    from[1] = 0xca50;
+    from[1] = 0xca00 | STD_BETA_DEM;
     from[2] = 0x0600 + x[0];
 
     if (errno = acp->fxns->sequence(acp, from, NULL))