Split ASIP and ASOP initialization into separate routines.
[processor-sdk/performance-audio-sr.git] / pasdk / test_dsp / framework / audioStreamOutProc.c
index daafbc014501680768613a4a4e7a16d6db528bbc..e744cd2a7b02ce31c0e60d0fb084e27924c9e26e 100644 (file)
@@ -317,11 +317,10 @@ UInt32 gAsopOutSioUpdateCnt         =0;
 UInt32 gAsopQuitCnt                 =0;
 
 /*
- *  ======== taskAsopFxn ========
- *  Audio Stream Output Processing task function
+ *  ======== taskAsopFxnInit ========
+ *  Audio Stream Output Processing initialization function
  */
-Void taskAsopFxn(
-//    Int betaPrimeValue, // FL: revisit
+Void taskAsopFxnInit(
     const PAF_ASOT_Params *pP,
     const PAF_ASOT_Patchs *pQ
 )
@@ -332,25 +331,13 @@ Void taskAsopFxn(
     Int z;                          /* input/encode/stream/decode/output counter */
     Int i;                          /* phase */
     Int zMS;
-    Int errno;                      // error number
-    Int8 procSleep;                 // whether to sleep: 0: No, 1: Yes
-    Int8 procOutDevSel;             // whether to perform output device selection: 0: No, 1:Yes
-    Int outSel;                     // whether output device selected
-    enum { INIT_OUT_PROC_STATE, 
-           INITSYNC_DEC_RESET_STATE, INITSYNC_DEC_INFO1_STATE, INITSYNC_DEC_DECODE1_STATE, 
-           INITSYNC_RESYNC_STATE, 
-           OUT_PROC_STATE } state;
-    PAF_AudioFrame decResetAf;
-    PAF_AudioFrame decInfo1Af;
-    Int loopCount = 0;              // used to stop trace to see startup behavior.
-    
 
-    Log_info0("Enter taskAsopFxn()");    
+    Log_info0("Enter taskAsopFxnInit()");
 
     //
     // Audio Stream Output Task Parameters & Patch (*pP, *pQ)
     //
-    if (!pP) 
+    if (!pP)
     {
         TRACE_TERSE0("TaskAsop: No Parameters defined. Exiting.");
         LINNO_RPRT(TaskAsop, -1);
@@ -362,7 +349,7 @@ Void taskAsopFxn(
         TRACE_TERSE0("TaskAsop: No Patchs defined. Exiting.");
         LINNO_RPRT(TaskAsop, -1);
         return;
-    }    
+    }
 
     //
     // Audio Stream Output Task Configuration (*pAsotCfg):
@@ -371,7 +358,7 @@ Void taskAsopFxn(
     pAsotCfg->taskHandle = Task_self(); // set task handle
     pAstCfg = pAsotCfg->pAstCfg;        // get pointer to AST common (shared) configuration
 
-    /* Obtain Audio Stream Number (1, 2, etc.) */    
+    /* Obtain Audio Stream Number (1, 2, etc.) */
     as = pAstCfg->as;
     TRACE_TERSE1("TaskAsop: Started with AS%d.", as);
 
@@ -383,7 +370,7 @@ Void taskAsopFxn(
         TRACE_TERSE1("TaskAsop: AS%d: initiated", as+z);
     }
     LINNO_RPRT(TaskAsop, -1);
-    
+
     //
     // Determine stream index
     //
@@ -408,29 +395,73 @@ Void taskAsopFxn(
         if (pP->fxns->initPhase[i])
         {
             linno = pP->fxns->initPhase[i](pP, pQ, pAsotCfg);
-            if (linno) 
+            if (linno)
             {
                 LINNO_RPRT(TaskAsop, linno);
                 return;
             }
         }
-        else 
+        else
         {
             TRACE_TERSE1("TaskAsop: AS%d: initialization phase - null", as+zMS);
         }
         TRACE_TERSE2("TaskAsop: AS%d: initialization phase - %d completed", as+zMS, i);
         LINNO_RPRT(TaskAsop, -i-3);
     }
-  
+
     //
     // End of Initialization -- display memory usage report.
     //
     if (pP->fxns->memStatusPrint)
     {
         pP->fxns->memStatusPrint("ASOT MEMSTAT REPORT",
-            HEAP_INTERNAL, HEAP_INTERNAL1, HEAP_EXTERNAL, 
+            HEAP_INTERNAL, HEAP_INTERNAL1, HEAP_EXTERNAL,
             HEAP_INTERNAL1_SHM, HEAP_EXTERNAL_SHM, HEAP_EXTERNAL_NONCACHED_SHM);
     }
+} /* taskAsopFxnInit */
+
+
+/*
+ *  ======== taskAsopFxn ========
+ *  Audio Stream Output Processing task function
+ */
+Void taskAsopFxn(
+//    Int betaPrimeValue, // FL: revisit
+    const PAF_ASOT_Params *pP,
+    const PAF_ASOT_Patchs *pQ
+)
+{
+    PAF_ASOT_Config *pAsotCfg;      /* ASOT configuration pointer */
+    PAF_AST_Config *pAstCfg;        /* Common (shared) configuration pointer */
+    Int as;                         /* Audio Stream Number (1, 2, etc.) */
+    Int z;                          /* input/encode/stream/decode/output counter */
+    Int zMS;
+    Int errno;                      // error number
+    Int8 procSleep;                 // whether to sleep: 0: No, 1: Yes
+    Int8 procOutDevSel;             // whether to perform output device selection: 0: No, 1:Yes
+    Int outSel;                     // whether output device selected
+    enum { INIT_OUT_PROC_STATE, 
+           INITSYNC_DEC_RESET_STATE, INITSYNC_DEC_INFO1_STATE, INITSYNC_DEC_DECODE1_STATE, 
+           INITSYNC_RESYNC_STATE, 
+           OUT_PROC_STATE } state;
+    PAF_AudioFrame decResetAf;
+    PAF_AudioFrame decInfo1Af;
+    Int loopCount = 0;              // used to stop trace to see startup behavior.
+
+    Log_info0("Enter taskAsopFxn()");
+
+    taskAsopFxnInit(pP, pQ);    // initialization of output task
+
+    //
+    // Audio Stream Output Task Configuration (*pAsotCfg):
+    //
+    pAsotCfg = &gPAF_ASOT_config;       // initialize pointer to task configuration
+    pAstCfg = pAsotCfg->pAstCfg;        // get pointer to AST common (shared) configuration
+
+    /* Obtain Audio Stream Number (1, 2, etc.) */    
+    as = pAstCfg->as;
+    
+    zMS = pAstCfg->masterStr;
 
     //
     // Main processing loop