PASDK-71:Add PFP for (1) ASIT decode processing and (2) ASOT output processing
authorFrank Livingston <frank-livingston@ti.com>
Thu, 27 Apr 2017 02:34:27 +0000 (21:34 -0500)
committerFrank Livingston <frank-livingston@ti.com>
Thu, 27 Apr 2017 02:34:27 +0000 (21:34 -0500)
pasdk/common/pfp_app.h
pasdk/test_arm/framework/audioStreamDecodeProc.c
pasdk/test_arm/framework/audioStreamDecodeProc.h
pasdk/test_dsp/framework/audioStreamInpProc.c
pasdk/test_dsp/framework/audioStreamInpProc.h
pasdk/test_dsp/framework/audioStreamOutProc.c
pasdk/test_dsp/framework/audioStreamOutProc.h

index e5d3525b05e1a3e459152b027f1688e5fe48635d..fa35075439abc1947a62b12d2067a962d6c18961 100644 (file)
@@ -14,7 +14,7 @@
 #ifdef _TMS320C6X
 /* Define all PFP ID's */
 #define PFP_ID_MAIN     0
-#define PFP_ID_TASK0_1  1   /* ASIT, input processing */
+#define PFP_ID_TASK0_1  1   /* ASIT, decode processing */
 #define PFP_ID_TASK0_2  2   
 #define PFP_ID_TASK1_1  3   /* ASOT, output processing */
 #define PFP_ID_TASK1_2  4   /* ASP */
index b3c2b44aed40f2563bbc363e8b9d68c8da95e55a..2cf9b2cb48fb958f2d4d25f558850bf8c4ab2b2a 100644 (file)
@@ -91,6 +91,7 @@ ERRNO_DEFN(TaskAsdp); /* Error number macros */
 // ASDT configuration
 PAF_ASDT_Config gPAF_ASDT_config 
 __attribute__ ((section(".globalSectionPafAsdtConfig"))) = {
+    NULL,               // taskHandle
     NULL,               // acp
     {NULL, NULL},       // decOpCircBufCtl
     &gPAF_AST_config    // ASIT/ASOT/ASDT shared configuration
@@ -150,7 +151,6 @@ Void taskAsdpFxn(
     Int argIdx;
     // Decoder output circular buffer
     PAF_AST_DecOpCircBufCtl *pCbCtl;    /* Decoder output circular buffer control */
-    //PAF_AST_DecOpCircBuf *pCb;
     PAF_AudioFrame *pAfWrt;
     Int cbErrno;    
     // Messaging
@@ -161,11 +161,9 @@ Void taskAsdpFxn(
     Int zI;
     Int bufEnd, wrapSize, currentBufSize, chunkSize;
     Int8 temp8;
-    Task_Handle asdtHandle; // For PFP
 
     Log_info0("Enter taskAsdpFxn()");
     
-    asdtHandle = Task_self(); // get task handle for PFP
     
     //
     // Audio Framework Parameters & Patch (*pP, *pQ):
@@ -187,9 +185,10 @@ Void taskAsdpFxn(
     //
     // Audio Framework Configuration (*pC):
     //
-    pC = &gPAF_ASDT_config;
-    pAstCfg = pC->pAstCfg; // get pointer to common (shared) configuration 
-    pCbCtl = &pC->decOpCircBufCtl; // get pointer to circular buffer control
+    pC = &gPAF_ASDT_config;         // initialize pointer to configuration
+    pC->taskHandle = Task_self();   // set task handle
+    pAstCfg = pC->pAstCfg;          // get pointer to common (shared) configuration 
+    pCbCtl = &pC->decOpCircBufCtl;  // get pointer to circular buffer control
 
     // wait for initialization message from master
     do {
@@ -623,7 +622,7 @@ Void taskAsdpFxn(
                     errno = 0;
                     if (dec->fxns->info)
                     {
-                        pfpBegin(PFP_ID_TASK0_1, asdtHandle);
+                        pfpBegin(PFP_ID_TASK0_1, pC->taskHandle);
                         errno = dec->fxns->info(dec, NULL, &pAstCfg->xDec[z].decodeControl, &pAstCfg->xDec[z].decodeStatus);
                         pfpEnd(PFP_ID_TASK0_1, PFP_FINISH_MEAS);
                     }
@@ -697,7 +696,7 @@ Void taskAsdpFxn(
                         // FL: debug, capture input buffer
                         //capIb(pAstCfg->xInp[z].pInpBuf);
                     
-                        pfpBegin(PFP_ID_TASK0_2, asdtHandle);
+                        pfpBegin(PFP_ID_TASK0_2, pC->taskHandle);
                         errno = dec->fxns->decode(dec, NULL, &pAstCfg->xDec[z].decodeInStruct, &pAstCfg->xDec[z].decodeOutStruct);
                         pfpEnd(PFP_ID_TASK0_2, PFP_FINISH_MEAS);
                         if (errno < 0)
index 3f5d44abc2c4191b0ee5a1ce2c8faae649bc80e2..d1dd1cd44710eaca6235cf4b27893b3671339fb1 100644 (file)
@@ -41,6 +41,7 @@ All rights reserved.
 #define _ASDP_H_
  
 #include <xdc/std.h>
+#include <ti/sysbios/knl/Task.h>
 
 #include "audioStreamProc_params.h"
 #include "audioStreamProc_patchs.h"
@@ -107,9 +108,10 @@ typedef struct PAF_ASDT_Patchs {
 // Audio Stream Decode Task (ASDT) configuration
 typedef struct PAF_ASDT_Config 
 {
-    ACP_Handle     acp;
-    PAF_AST_DecOpCircBufCtl decOpCircBufCtl; // decoder output circular buffer control
-    PAF_AST_Config *pAstCfg; // ASIT/ASOT/ASDT shared configuration
+    Task_Handle taskHandle;                     // ASDT handle
+    ACP_Handle acp;                             // ASDT local ACP handle
+    PAF_AST_DecOpCircBufCtl decOpCircBufCtl;    // decoder output circular buffer control
+    PAF_AST_Config *pAstCfg;                    // ASIT/ASOT/ASDT shared configuration
 } PAF_ASDT_Config;
 
 
index cae5dbbbdc9c63cde0659b5b45c41d336ab7a951..a381b908254b206198030f2b98e759239514e887 100644 (file)
@@ -64,13 +64,14 @@ All rights reserved.
 #include "audioStreamProc_common.h"
 #include "audioStreamProc_master.h"
 #include "audioStreamInpProc.h"
+#include "statusOp_common.h"
+
+#include "pfp/pfp.h"
+#include "pfp_app.h"        /* contains all PFP ID's */
 
-//#include "fwkPort.h"
 // FL: debug
 #include "dbgCapAf.h"
 
-#include "statusOp_common.h"
-
 
 // -----------------------------------------------------------------------------
 // Debugging Trace Control, local to this file.
@@ -306,6 +307,7 @@ ERRNO_DEFN(TaskAsip); /* Error number macros */
 // ASIT configuration
 #pragma DATA_SECTION(gPAF_ASIT_config, ".globalSectionPafAsitConfig")
 PAF_ASIT_Config gPAF_ASIT_config = {
+    NULL,               // taskHandle
     NULL,               // acp
     &gPAF_ASPM_config,  // pAspmCfg, shared ASIT/ASOT configuration
     &gPAF_AST_config    // pAstCfg, shared ASIT/ASOT/ASDT configuration
@@ -366,7 +368,6 @@ Void taskAsipFxn(
 #ifdef NON_CACHE_STATUS
     Int8 tempVar8;
 #endif
-    Task_Handle taskHandle;
 
     Log_info0("Enter taskAsipFxn()");
 
@@ -387,13 +388,12 @@ Void taskAsipFxn(
         return;
     }    
     
-    taskHandle = Task_self();
-    
     //
     // Audio Framework Configuration (*pC):
     //
-    pC = &gPAF_ASIT_config;
-    pAstCfg = pC->pAstCfg;
+    pC = &gPAF_ASIT_config;         // initialize pointer to task configuration
+    pC->taskHandle = Task_self();   // set task handle
+    pAstCfg = pC->pAstCfg;          // get pointer to common (shared) configuration
 
     /* Set Audio Stream Number (1, 2, etc.) */
     as = gBetaPrimeValue + 1;
@@ -947,9 +947,9 @@ Void taskAsipFxn(
         TRACE_VERBOSE1(procName[sourceProgram], as+zMS);
 
         // Reduce priority level since autodetection complete
-        Task_setPri(taskHandle, Task_getPri(taskHandle)-1);
+        Task_setPri(pC->taskHandle, Task_getPri(pC->taskHandle)-1);
         
-        gAspProfileEnable=1; // start ASP profiling
+        gAspProfileEnable=1; // enable ASP profiling
         
         TRACE_VERBOSE0("TaskAsip: calling decodeProcessing.");
         errno = pP->fxns->decodeProcessing(pP, pQ, pC, sourceSelect);
@@ -962,10 +962,10 @@ Void taskAsipFxn(
             TRACE_VERBOSE0("TaskAsip: decodeProcessing complete with no error.");
         }        
 
-        gAspProfileEnable=0; // stop ASP profiling
+        gAspProfileEnable=0; // disable ASP profiling
         
         // Increase priority level since decoding complete
-        Task_setPri(taskHandle, Task_getPri(taskHandle)+1);
+        Task_setPri(pC->taskHandle, Task_getPri(pC->taskHandle)+1);
 
         // FL: send dec exit message to slave
         pAspMsg = (ASP_Msg *)MessageQ_alloc(hAspMsgMaster->heapId, hAspMsgMaster->msgSize); /* allocate message */
@@ -2092,6 +2092,11 @@ PAF_ASIT_decodeProcessing(
 
     for (;;) 
     {
+        // Measure cycles in decode processing loop.
+        // Only measures cycles spent in loop.
+        pfpEnd(PFP_ID_TASK0_1, PFP_FINISH_MEAS);
+        pfpBegin(PFP_ID_TASK0_1, pC->taskHandle);
+        
         statusOp_read(&tempVar8,
                       &(pAstCfg->xDec[zMD].decodeStatus.sourceSelect),
                     sizeof(tempVar8),
index 29774cee795926cf4029924583a1e71e499ed6c1..d3d1e4c1e9f886eff914c395d4bc229c5a91c83e 100644 (file)
@@ -41,6 +41,7 @@ All rights reserved.
 #define _ASIP_H_
  
 #include <xdc/std.h>
+#include <ti/sysbios/knl/Task.h>
 
 #include "audioStreamProc_params.h"
 #include "audioStreamProc_patchs.h"
@@ -166,7 +167,8 @@ typedef struct PAF_ASIT_Patchs {
 
 // Audio Stream Input Task (ASIT) configuration
 typedef struct PAF_ASIT_Config {
-    ACP_Handle acp;
+    Task_Handle taskHandle;     // ASIT handle
+    ACP_Handle acp;             // ASIT local ACP handle
     PAF_ASPM_Config *pAspmCfg;  // ASIT/ASOT shared configuration
     PAF_AST_Config *pAstCfg;    // ASIT/ASOT/ASDT shared configuration
 } PAF_ASIT_Config;
index 74be20318b3b5a108f82ea0ed7df3a575427c0c9..41731b4933c5955aa38600b52939a4d7c1463691 100644 (file)
@@ -121,6 +121,7 @@ ERRNO_DEFN(TaskAsop); /* Error number macros */
 // ASOT configuration
 #pragma DATA_SECTION(gPAF_ASOT_config, ".globalSectionPafAsotConfig")
 PAF_ASOT_Config gPAF_ASOT_config = {
+    NULL,               // taskHandle
     NULL,               // acp
     &gPAF_ASPM_config,  // pAspmCfg
     &gPAF_AST_config    // pAstCfg
@@ -182,8 +183,9 @@ Void taskAsopFxn(
     //
     // Audio Framework Configuration (*pC):
     //
-    pC = &gPAF_ASOT_config;
-    pAstCfg = pC->pAstCfg;
+    pC = &gPAF_ASOT_config;         // initialize pointer to task configuration
+    pC->taskHandle = Task_self();   // set task handle
+    pAstCfg = pC->pAstCfg;          // get pointer to common (shared) configuration
 
     /* Obtain Audio Stream Number (1, 2, etc.) */    
     as = pAstCfg->as;
@@ -1343,11 +1345,15 @@ PAF_ASOT_decodeProcessing(
     Int block; // decoder output block count / input frame
     Int outSioUpdate;
     
-    
     pAstCfg = pC->pAstCfg; // get pointer to common (shared) configuration
 
     for (;;) 
     {
+        // Measure cycles in output processing loop.
+        // Only measures cycles spent in loop.
+        pfpEnd(PFP_ID_TASK1_1, PFP_FINISH_MEAS);
+        pfpBegin(PFP_ID_TASK1_1, pC->taskHandle);
+
         // FL: Check if any change in output SIO, e.g. from Output shortcut.
         // Changes will break FSM and allow Output reconfiguration.
         if (errno = checkOutSio(pP, pC, &outSioUpdate))
index c9df1352cb14ef85bd81e632ea83066b5d1f0de9..c261a64ce045083672807b164b4a0af090c29924 100644 (file)
@@ -41,6 +41,7 @@ All rights reserved.
 #define _ASOP_H_
  
 #include <xdc/std.h>
+#include <ti/sysbios/knl/Task.h>
 
 #include "audioStreamProc_params.h"
 #include "audioStreamProc_patchs.h"
@@ -166,7 +167,8 @@ typedef struct PAF_ASOT_Patchs {
 
 // Audio Stream Input Task (ASOT) configuration
 typedef struct PAF_ASOT_Config {
-    ACP_Handle acp;
+    Task_Handle taskHandle;     // ASOT handle
+    ACP_Handle acp;             // ASOT local ACP handle
     PAF_ASPM_Config *pAspmCfg;  // ASIT/ASOT shared configuration
     PAF_AST_Config *pAstCfg;    // ASIT/ASOT/ASDT shared configuration
 } PAF_ASOT_Config;