]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - processor-sdk/performance-audio-sr.git/blobdiff - pasdk/test_dsp/sap/sap.c
Fixed problem of input task being stuck when input stream stops:
[processor-sdk/performance-audio-sr.git] / pasdk / test_dsp / sap / sap.c
index f31f1c6043f6c3381bbf9388545c5d777f1d71bb..3ac2e5b175ed4a5801818bda00f63b2b107b1e2b 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
-Copyright (c) 2016, Texas Instruments Incorporated - http://www.ti.com/
+Copyright (c) 2017, Texas Instruments Incorporated - http://www.ti.com/
 All rights reserved.
 
 * Redistribution and use in source and binary forms, with or without 
@@ -41,7 +41,7 @@ All rights reserved.
 //
 
 #ifndef SAP_CACHE_SUPPORT
-  // if you rebuild dap.c in your project without this defined, 
+  // if you rebuild sap.c in your project without this defined,
   // the result is quite hard to find:  Occasional glitches in the sound.
   #define SAP_CACHE_SUPPORT  // typically defined in the project
 #endif
@@ -66,24 +66,19 @@ All rights reserved.
 #include <ti/csl/cslr_device.h>
 
 #define EDMA_HINV NULL
+#define EDMA_NUM_PARAMS 6
 
-#ifdef SAP_PORT_MCASP
 #include "sap_mcasp.h"
-#else
-#error "No port defined"
-#endif
-
 #include <pafsio.h>
 
 // This works to set a breakpoint
 #define SW_BREAKPOINT       asm( " SWBP 0" );
-/* Software Breakpoint to Code Composer */
-// SW_BREAKPOINT;
 
 // global allocated in bios_edma3_drv_sample_init.c
 extern EDMA3_DRV_Handle hEdma0;
 extern EDMA3_DRV_Handle hEdma1;
 
+// global variables for debug-assist
 int gStartError;
 int gIsrInputCnt;
 int gIsrOutputCnt;
@@ -100,31 +95,82 @@ typedef xdc_Short MdInt;
 
 void swapHdmi(Ptr, int);
 
-//#define TEST_MULTICHANNEL
-
+#define SAP_UNDER_LEN 8
 
-#ifdef TEST_MULTICHANNEL
-#define SAP_UNDER_LEN 16
-//#define SAP_UNDER_LEN 1024 // GJ: experiment
-#else
-#define SAP_UNDER_LEN 1024
-#endif
+#pragma DATA_SECTION(sap_UNDER, ".sap_UNDER");
 int sap_UNDER[SAP_UNDER_LEN]; // used for underrun
-int sap_OVER = 0;     // used for overrun
+int sap_OVER_1LANE = 0;     // used for overrun
+int sap_OVER_4LANE[4] = {0,0,0,0};      // used for overrun
 
 #ifdef DEBUG
-void DJDBG_SAP_EDMA_dumpParams(int tag_place)
+void SAP_EDMA_dumpParams(int tag_place)
 {
-       unsigned int *ptrPARAM_BASE = (unsigned int *)0x02704000;
+       //unsigned int *ptrPARAM_BASE = (unsigned int *)0x02704000;
        unsigned int *ptrPARAM0x18 = (unsigned int *)0x02704300; // ((*((EDMA3_CCRL_Regs *) 0x02700000)).PARAMENTRY)[24]
-       unsigned int *ptrPARAM0x19 = (unsigned int *)0x02704320; // ((*((EDMA3_CCRL_Regs *) 0x02700000)).PARAMENTRY)[24]
-
-       Log_info5("PARAM0x18a(%d): 0x%x 0x%x 0x%x 0x%x", tag_place, ptrPARAM0x18[0], ptrPARAM0x18[1], ptrPARAM0x18[2], ptrPARAM0x18[3]);
-       Log_info5("PARAM0x18b(%d): 0x%x 0x%x 0x%x 0x%x", tag_place, ptrPARAM0x18[4], ptrPARAM0x18[5], ptrPARAM0x18[6], ptrPARAM0x18[7]);
-
-       Log_info5("PARAM0x19a(%d): 0x%x 0x%x 0x%x 0x%x", tag_place, ptrPARAM0x19[0], ptrPARAM0x19[1], ptrPARAM0x19[2], ptrPARAM0x19[3]);
-       Log_info5("PARAM0x19b(%d): 0x%x 0x%x 0x%x 0x%x", tag_place, ptrPARAM0x19[4], ptrPARAM0x19[5], ptrPARAM0x19[6], ptrPARAM0x19[7]);
-    //Log_info1("TCC0: ERR reg %x", *((unsigned int *)0x02760120)); //DJDBG
+       //unsigned int *ptrPARAM0x19 = (unsigned int *)0x02704320; // ((*((EDMA3_CCRL_Regs *) 0x02700000)).PARAMENTRY)[24]
+       //unsigned int *ptrPARAM0x41 = (unsigned int *)0x027048A0; // ((*((EDMA3_CCRL_Regs *) 0x02700000)).PARAMENTRY)[24]
+       //unsigned int *ptrPARAM0x42 = (unsigned int *)0x027048C0; // ((*((EDMA3_CCRL_Regs *) 0x02700000)).PARAMENTRY)[24]
+       //unsigned int *ptrPARAM0x43 = (unsigned int *)0x027048E0; // ((*((EDMA3_CCRL_Regs *) 0x02700000)).PARAMENTRY)[24]
+       //unsigned int *ptrPARAM0x48 = (unsigned int *)0x02704910; // ((*((EDMA3_CCRL_Regs *) 0x02700000)).PARAMENTRY)[24]
+       unsigned int *ptrPARAM0x45 = (unsigned int *)0x027048A0; // ((*((EDMA3_CCRL_Regs *) 0x02700000)).PARAMENTRY)[69]
+       unsigned int *ptrPARAM0x46 = (unsigned int *)0x027048C0; // ((*((EDMA3_CCRL_Regs *) 0x02700000)).PARAMENTRY)[70]
+       unsigned int *ptrPARAM0x47 = (unsigned int *)0x027048E0; // ((*((EDMA3_CCRL_Regs *) 0x02700000)).PARAMENTRY)[71]
+       unsigned int *ptrPARAM0x48 = (unsigned int *)0x02704900; // ((*((EDMA3_CCRL_Regs *) 0x02700000)).PARAMENTRY)[72]
+       unsigned int *ptrPARAM0x49 = (unsigned int *)0x02704920; // ((*((EDMA3_CCRL_Regs *) 0x02700000)).PARAMENTRY)[73]
+       unsigned int *ptrPARAM0x4A = (unsigned int *)0x02704940; // ((*((EDMA3_CCRL_Regs *) 0x02700000)).PARAMENTRY)[74]
+
+       //Log_info5("PARAM0x18a(%d): 0x%x 0x%x 0x%x 0x%x", tag_place, ptrPARAM0x18[0], ptrPARAM0x18[1], ptrPARAM0x18[2], ptrPARAM0x18[3]);
+       //Log_info5("PARAM0x18b(%d): 0x%x 0x%x 0x%x 0x%x", tag_place, ptrPARAM0x18[4], ptrPARAM0x18[5], ptrPARAM0x18[6], ptrPARAM0x18[7]);
+
+       /*Log_info5("PARAM0x19a(%d): ITCINTEN: 0x%02x, TCINTEN: 0x%02x, TCC: 0x%02x, TCCMODE: %d", tag_place, ((ptrPARAM0x19[0] & 0x200000) >> 21), ((ptrPARAM0x19[0] & 0x100000) >> 20), ((ptrPARAM0x19[0] & 0x3F000) >> 12), ((ptrPARAM0x19[0] & 0x800) >> 11));
+       Log_info5("PARAM0x19b(%d): SRC: 0x%08x, A_B_CNT: 0x%08x, DST: 0x%08x,  SRC_DST_BIDX: 0x%08x", tag_place, ptrPARAM0x19[1], ptrPARAM0x19[2], ptrPARAM0x19[3], ptrPARAM0x19[4]);
+       Log_info4("PARAM0x19b(%d): LINK_BCNTRLD: 0x%08x, SRC_DST_CIDX: 0x%08x, CCNT: 0x%08x", tag_place, ptrPARAM0x19[5], ptrPARAM0x19[6], ptrPARAM0x19[7]);
+
+       Log_info5("PARAM0x41a(%d): ITCINTEN: 0x%02x, TCINTEN: 0x%02x, TCC: 0x%02x, TCCMODE: %d", tag_place, ((ptrPARAM0x41[0] & 0x200000) >> 21), ((ptrPARAM0x41[0] & 0x100000) >> 20), ((ptrPARAM0x41[0] & 0x3F000) >> 12), ((ptrPARAM0x41[0] & 0x800) >> 11));
+       Log_info5("PARAM0x41b(%d): SRC: 0x%08x, A_B_CNT: 0x%08x, DST: 0x%08x,  SRC_DST_BIDX: 0x%08x", tag_place, ptrPARAM0x41[1], ptrPARAM0x41[2], ptrPARAM0x41[3], ptrPARAM0x41[4]);
+       Log_info4("PARAM0x41b(%d): LINK_BCNTRLD: 0x%08x, SRC_DST_CIDX: 0x%08x, CCNT: 0x%08x", tag_place, ptrPARAM0x41[5], ptrPARAM0x41[6], ptrPARAM0x41[7]);
+
+       Log_info5("PARAM0x42a(%d): ITCINTEN: 0x%02x, TCINTEN: 0x%02x, TCC: 0x%02x, TCCMODE: %d", tag_place, ((ptrPARAM0x42[0] & 0x200000) >> 21), ((ptrPARAM0x42[0] & 0x100000) >> 20), ((ptrPARAM0x42[0] & 0x3F000) >> 12), ((ptrPARAM0x42[0] & 0x800) >> 11));
+       Log_info5("PARAM0x42b(%d): SRC: 0x%08x, A_B_CNT: 0x%08x, DST: 0x%08x,  SRC_DST_BIDX: 0x%08x", tag_place, ptrPARAM0x42[1], ptrPARAM0x42[2], ptrPARAM0x42[3], ptrPARAM0x42[4]);
+       Log_info4("PARAM0x42b(%d): LINK_BCNTRLD: 0x%08x, SRC_DST_CIDX: 0x%08x, CCNT: 0x%08x", tag_place, ptrPARAM0x42[5], ptrPARAM0x42[6], ptrPARAM0x42[7]);
+
+       Log_info5("PARAM0x43a(%d): ITCINTEN: 0x%02x, TCINTEN: 0x%02x, TCC: 0x%02x, TCCMODE: %d", tag_place, ((ptrPARAM0x43[0] & 0x200000) >> 21), ((ptrPARAM0x43[0] & 0x100000) >> 20), ((ptrPARAM0x43[0] & 0x3F000) >> 12), ((ptrPARAM0x43[0] & 0x800) >> 11));
+       Log_info5("PARAM0x43b(%d): SRC: 0x%08x, A_B_CNT: 0x%08x, DST: 0x%08x,  SRC_DST_BIDX: 0x%08x", tag_place, ptrPARAM0x43[1], ptrPARAM0x43[2], ptrPARAM0x43[3], ptrPARAM0x43[4]);
+       Log_info4("PARAM0x43b(%d): LINK_BCNTRLD: 0x%08x, SRC_DST_CIDX: 0x%08x, CCNT: 0x%08x", tag_place, ptrPARAM0x43[5], ptrPARAM0x43[6], ptrPARAM0x43[7]);
+
+       Log_info5("PARAM0x48a(%d): ITCINTEN: 0x%02x, TCINTEN: 0x%02x, TCC: 0x%02x, TCCMODE: %d", tag_place, ((ptrPARAM0x48[0] & 0x200000) >> 21), ((ptrPARAM0x48[0] & 0x100000) >> 20), ((ptrPARAM0x48[0] & 0x3F000) >> 12), ((ptrPARAM0x48[0] & 0x800) >> 11));
+       Log_info5("PARAM0x48b(%d): SRC: 0x%08x, A_B_CNT: 0x%08x, DST: 0x%08x,  SRC_DST_BIDX: 0x%08x", tag_place, ptrPARAM0x48[1], ptrPARAM0x48[2], ptrPARAM0x48[3], ptrPARAM0x48[4]);
+       Log_info4("PARAM0x48b(%d): LINK_BCNTRLD: 0x%08x, SRC_DST_CIDX: 0x%08x, CCNT: 0x%08x", tag_place, ptrPARAM0x48[5], ptrPARAM0x48[6], ptrPARAM0x48[7]);*/
+
+       Log_info5("PARAM0x18a(%d): ITCINTEN: 0x%02x, TCINTEN: 0x%02x, TCC: 0x%02x, TCCMODE: %d", tag_place, ((ptrPARAM0x18[0] & 0x200000) >> 21), ((ptrPARAM0x18[0] & 0x100000) >> 20), ((ptrPARAM0x18[0] & 0x3F000) >> 12), ((ptrPARAM0x18[0] & 0x800) >> 11));
+       Log_info5("PARAM0x18b(%d): SRC: 0x%08x, A_B_CNT: 0x%08x, DST: 0x%08x,  SRC_DST_BIDX: 0x%08x", tag_place, ptrPARAM0x18[1], ptrPARAM0x18[2], ptrPARAM0x18[3], ptrPARAM0x18[4]);
+       Log_info4("PARAM0x18c(%d): LINK_BCNTRLD: 0x%08x, SRC_DST_CIDX: 0x%08x, CCNT: 0x%08x", tag_place, ptrPARAM0x18[5], ptrPARAM0x18[6], ptrPARAM0x18[7]);
+
+       Log_info5("PARAM0x45a(%d): ITCINTEN: 0x%02x, TCINTEN: 0x%02x, TCC: 0x%02x, TCCMODE: %d", tag_place, ((ptrPARAM0x45[0] & 0x200000) >> 21), ((ptrPARAM0x45[0] & 0x100000) >> 20), ((ptrPARAM0x45[0] & 0x3F000) >> 12), ((ptrPARAM0x45[0] & 0x800) >> 11));
+       Log_info5("PARAM0x45b(%d): SRC: 0x%08x, A_B_CNT: 0x%08x, DST: 0x%08x,  SRC_DST_BIDX: 0x%08x", tag_place, ptrPARAM0x45[1], ptrPARAM0x45[2], ptrPARAM0x45[3], ptrPARAM0x45[4]);
+       Log_info4("PARAM0x45c(%d): LINK_BCNTRLD: 0x%08x, SRC_DST_CIDX: 0x%08x, CCNT: 0x%08x", tag_place, ptrPARAM0x45[5], ptrPARAM0x45[6], ptrPARAM0x45[7]);
+
+       Log_info5("PARAM0x46a(%d): ITCINTEN: 0x%02x, TCINTEN: 0x%02x, TCC: 0x%02x, TCCMODE: %d", tag_place, ((ptrPARAM0x46[0] & 0x200000) >> 21), ((ptrPARAM0x46[0] & 0x100000) >> 20), ((ptrPARAM0x46[0] & 0x3F000) >> 12), ((ptrPARAM0x46[0] & 0x800) >> 11));
+       Log_info5("PARAM0x46b(%d): SRC: 0x%08x, A_B_CNT: 0x%08x, DST: 0x%08x,  SRC_DST_BIDX: 0x%08x", tag_place, ptrPARAM0x46[1], ptrPARAM0x46[2], ptrPARAM0x46[3], ptrPARAM0x46[4]);
+       Log_info4("PARAM0x46c(%d): LINK_BCNTRLD: 0x%08x, SRC_DST_CIDX: 0x%08x, CCNT: 0x%08x", tag_place, ptrPARAM0x46[5], ptrPARAM0x46[6], ptrPARAM0x46[7]);
+
+       Log_info5("PARAM0x47a(%d): ITCINTEN: 0x%02x, TCINTEN: 0x%02x, TCC: 0x%02x, TCCMODE: %d", tag_place, ((ptrPARAM0x47[0] & 0x200000) >> 21), ((ptrPARAM0x47[0] & 0x100000) >> 20), ((ptrPARAM0x47[0] & 0x3F000) >> 12), ((ptrPARAM0x47[0] & 0x800) >> 11));
+       Log_info5("PARAM0x47b(%d): SRC: 0x%08x, A_B_CNT: 0x%08x, DST: 0x%08x,  SRC_DST_BIDX: 0x%08x", tag_place, ptrPARAM0x47[1], ptrPARAM0x47[2], ptrPARAM0x47[3], ptrPARAM0x47[4]);
+       Log_info4("PARAM0x47c(%d): LINK_BCNTRLD: 0x%08x, SRC_DST_CIDX: 0x%08x, CCNT: 0x%08x", tag_place, ptrPARAM0x47[5], ptrPARAM0x47[6], ptrPARAM0x47[7]);
+
+       Log_info5("PARAM0x48a(%d): ITCINTEN: 0x%02x, TCINTEN: 0x%02x, TCC: 0x%02x, TCCMODE: %d", tag_place, ((ptrPARAM0x48[0] & 0x200000) >> 21), ((ptrPARAM0x48[0] & 0x100000) >> 20), ((ptrPARAM0x48[0] & 0x3F000) >> 12), ((ptrPARAM0x48[0] & 0x800) >> 11));
+       Log_info5("PARAM0x48b(%d): SRC: 0x%08x, A_B_CNT: 0x%08x, DST: 0x%08x,  SRC_DST_BIDX: 0x%08x", tag_place, ptrPARAM0x48[1], ptrPARAM0x48[2], ptrPARAM0x48[3], ptrPARAM0x48[4]);
+       Log_info4("PARAM0x48c(%d): LINK_BCNTRLD: 0x%08x, SRC_DST_CIDX: 0x%08x, CCNT: 0x%08x", tag_place, ptrPARAM0x48[5], ptrPARAM0x48[6], ptrPARAM0x48[7]);
+
+       Log_info5("PARAM0x49a(%d): ITCINTEN: 0x%02x, TCINTEN: 0x%02x, TCC: 0x%02x, TCCMODE: %d", tag_place, ((ptrPARAM0x49[0] & 0x200000) >> 21), ((ptrPARAM0x49[0] & 0x100000) >> 20), ((ptrPARAM0x49[0] & 0x3F000) >> 12), ((ptrPARAM0x49[0] & 0x800) >> 11));
+       Log_info5("PARAM0x49b(%d): SRC: 0x%08x, A_B_CNT: 0x%08x, DST: 0x%08x,  SRC_DST_BIDX: 0x%08x", tag_place, ptrPARAM0x49[1], ptrPARAM0x49[2], ptrPARAM0x49[3], ptrPARAM0x49[4]);
+       Log_info4("PARAM0x49c(%d): LINK_BCNTRLD: 0x%08x, SRC_DST_CIDX: 0x%08x, CCNT: 0x%08x", tag_place, ptrPARAM0x49[5], ptrPARAM0x49[6], ptrPARAM0x49[7]);
+
+       Log_info5("PARAM0x4Aa(%d): ITCINTEN: 0x%02x, TCINTEN: 0x%02x, TCC: 0x%02x, TCCMODE: %d", tag_place, ((ptrPARAM0x4A[0] & 0x200000) >> 21), ((ptrPARAM0x4A[0] & 0x100000) >> 20), ((ptrPARAM0x4A[0] & 0x3F000) >> 12), ((ptrPARAM0x4A[0] & 0x800) >> 11));
+       Log_info5("PARAM0x4Ab(%d): SRC: 0x%08x, A_B_CNT: 0x%08x, DST: 0x%08x,  SRC_DST_BIDX: 0x%08x", tag_place, ptrPARAM0x4A[1], ptrPARAM0x4A[2], ptrPARAM0x4A[3], ptrPARAM0x4A[4]);
+       Log_info4("PARAM0x4Ac(%d): LINK_BCNTRLD: 0x%08x, SRC_DST_CIDX: 0x%08x, CCNT: 0x%08x", tag_place, ptrPARAM0x4A[5], ptrPARAM0x4A[6], ptrPARAM0x4A[7]);
+
+       Log_info1("TCC0: ERR reg %x", *((unsigned int *)0x02760120));
 }
 #endif
 // .............................................................................
@@ -145,13 +191,11 @@ SAP_DriverObject sapDrv;
 // needed since SAP_watchDog is called before SAP_init
 Int SAP_initialized = 0;
 
-//Int  SAP_close(DEV2_Handle);
 Int  SAP_ctrl(DEV2_Handle, Uns, Arg);
 Int  SAP_idle(DEV2_Handle, Bool);
 Int  SAP_issue(DEV2_Handle);
 Int  SAP_open(DEV2_Handle, String);
 void SAP_isrCallback (Uint32 tcc, EDMA3_RM_TccStatus status, Ptr context);
-//Bool SAP_ready(DEV2_Handle, SEM_Handle);
 Int  SAP_reclaim(DEV2_Handle);
 Int  SAP_shutdown(DEV2_Handle);
 Int  SAP_start(DEV2_Handle);
@@ -221,11 +265,17 @@ Void SAP_init (Void)
 
 // -----------------------------------------------------------------------------
 
+int gSapInput_ControlOpen = 0;
+int gSapOutput_ControlOpen = 0;
+
+int gSapInput_ControlClose = 0;
+int gSapOutput_ControlClose = 0;
+
 Int SAP_ctrl (DEV2_Handle device, Uns code, Arg arg)
 {
     SAP_DeviceExtension *pDevExt = (SAP_DeviceExtension *)device->object;
     const SAP_Params *pParams;
-    Int result = SIO2_OK;
+    Int i, result = SIO2_OK;
     EDMA3_DRV_Handle   hEdma;
     //TRACE_GEN((&TR_MOD, "SAP_ctrl.%d (0x%x) code = 0x%x", __LINE__, device, code));
 
@@ -252,6 +302,11 @@ Int SAP_ctrl (DEV2_Handle device, Uns code, Arg arg)
             if (!( pParams = (const SAP_Params *) arg ))
                 return SIO2_OK;
 
+            if(device->mode == DEV2_OUTPUT)
+               gSapOutput_ControlOpen++;
+            else
+               gSapInput_ControlOpen++;
+
             if (result = SAP_FTABLE_config (device, pParams))
                 return result;
 
@@ -275,10 +330,29 @@ Int SAP_ctrl (DEV2_Handle device, Uns code, Arg arg)
                                hEdma = hEdma0;
                        else if (pParams->sio.moduleNum == 1 || pParams->sio.moduleNum == 2)
                                hEdma = hEdma1;
+
             if (pDevExt->activeEdma != EDMA_HINV) {
                                EDMA3_DRV_freeChannel (hEdma, pDevExt->activeEdma);
-                            pDevExt->activeEdma = EDMA_HINV;
-                        }
+                               pDevExt->activeEdma = EDMA_HINV;
+                       }
+
+            if(device->mode == DEV2_INPUT)
+               gSapInput_ControlClose++;
+            else
+               gSapOutput_ControlClose++;
+
+            for (i=0; i < pDevExt->numEdmaParams; i++) {
+               if (pDevExt->edmaParams[i].hEdmaParam != EDMA_HINV)
+               {
+                       EDMA3_DRV_freeChannel (hEdma, pDevExt->edmaParams[i].hEdmaParam);
+                       pDevExt->edmaParams[i].hEdmaParam = EDMA_HINV;
+               }
+            }
+
+            if (pDevExt->errorEdma != EDMA_HINV) {
+                               EDMA3_DRV_freeChannel (hEdma, pDevExt->errorEdma);
+                               pDevExt->errorEdma = EDMA_HINV;
+                       }
 
             if (!(pParams = pDevExt->pParams))
                 return SIO2_OK;
@@ -390,14 +464,9 @@ Int SAP_ctrl (DEV2_Handle device, Uns code, Arg arg)
             Log_info0 ("SAP PAF_SIO_CONTROL_IDLE_WITH_CLOCKS; PAF_SIO_ERROR_IDLE_STAGE1");
             pDevExt->errorState = PAF_SIO_ERROR_IDLE_STAGE1;
 
-#if 1
-            //DJDBG, if below enableTransfer() is commented, input side continuous working.
-     if (pDevExt->activeEdma != EDMA_HINV) {
-               //EDMA3_DRV_disableTransfer (hEdma0, pDevExt->activeEdma, EDMA3_DRV_TRIG_MODE_EVENT);
-            //if(*((unsigned int *)0x02701000) & 0x01000000) *((unsigned int *)0x02701008) = 0x01000000; //Clear pending even in bit 24! //DJDBG
-            EDMA3_DRV_enableTransfer (hEdma, pDevExt->activeEdma, EDMA3_DRV_TRIG_MODE_EVENT);
-     }
-#endif
+            if (pDevExt->activeEdma != EDMA_HINV)
+               EDMA3_DRV_enableTransfer (hEdma, pDevExt->activeEdma, EDMA3_DRV_TRIG_MODE_EVENT);
+
             //TRACE_GEN((&TR_MOD, "SAP_ctrl.%d: (0x%x) errorState = PAF_SIO_ERROR_IDLE_STAGE1 0x%x.", __LINE__, device, PAF_SIO_ERROR_IDLE_STAGE1));
 
             break;
@@ -531,10 +600,12 @@ Int SAP_idle (DEV2_Handle device, Bool flush)
    if (pDevExt->activeEdma != EDMA_HINV)
           EDMA3_DRV_disableTransfer (hEdma, pDevExt->activeEdma, EDMA3_DRV_TRIG_MODE_EVENT);
 
-    pDevExt->numQueued = 0;
+   Log_info0("SAP_idle:Before pDevExt->numQueued = 0");
+   pDevExt->numQueued = 0;
 
     // signal stopped
     pDevExt->runState = 0;
+    Log_info0("SAP_idle: runState = 0");
 
     // reset errorState
     pDevExt->errorState = PAF_SIO_ERROR_NONE;
@@ -556,15 +627,8 @@ Int SAP_start (DEV2_Handle device)
     int result;
     EDMA3_DRV_Handle hEdma;
 
-    //TRACE_GEN((&TR_MOD, "SAP_start.%d (0x%x)", __LINE__, device));
+    Log_info2("SAP_start.%d (0x%x)", __LINE__, (xdc_IArg)device);
 
-    // signal we have started
-    //    we change the state here since we have already moved a frame from the 
-    //    todevice queue to the xferQue. If an error occurs during one of the 
-    //    following resets/enables then we need to have runState !=0 in order
-    //    for SAP_idle to properly cleanup. Moreover, the following resets/enables
-    //    do not (and are now required not to) depend on runState being 0.
-    //pDevExt->runState = 1;
     // Assume todevice queue is not empty -- how else could we be here?
     pFrame = (DEV2_Frame *) Queue_get (device->todevice);
 
@@ -589,20 +653,22 @@ Int SAP_start (DEV2_Handle device)
     }
 
     // enable DMA processing
-
+    if (device->mode == DEV2_OUTPUT)
+       Log_info3("SAP_start.%d, pDevExt->activeEdma 0x%x (pDevExt->errorEdma = 0x%x)",
+                           __LINE__, pDevExt->activeEdma, pDevExt->errorEdma);
     // config active xfer for this buffer
     result = SAP_EDMA_setupXfer(device, pDevExt->activeEdma, EDMA_HINV, pDevExt->errorEdma, pFrame);
 
-    //Log_info3("SAP_start.%d, pDevExt->activeEdma 0x%x (pDevExt->errorEdma = 0x%x)",
-      //              __LINE__, pDevExt->activeEdma, pDevExt->errorEdma);
+
        // signal we have started -- this must come before last enable to prevent a race
        // condition where the initial EDMA transfer is very small (e.g. due to startClocks)
        // and completes before any further instructions in this thread are executed.
        // This comes before the EDMA enable since, if the # of samples is 1, then the EDMA
        // will be serviced and generate an interrupt even before the McASP is enabled.
-       pDevExt->runState = 1;
-       pDevExt->shutDown = 0;
-       //Log_info0 ("SAP_start runState=1 & ENABLE TRANSFERS");
+    pDevExt->runState = 1;
+    pDevExt->shutDown = 0;
+    if (device->mode == DEV2_OUTPUT)
+       Log_info2 ("SAP: %d, SAP_start runState=1 & ENABLE TRANSFERS for activeEdma = 0x%x", __LINE__, pDevExt->activeEdma);
        // enable interrupts and event servicing for this channel
        EDMA3_DRV_enableTransfer (hEdma, pDevExt->activeEdma, EDMA3_DRV_TRIG_MODE_EVENT);
 
@@ -630,7 +696,8 @@ Int SAP_issue (DEV2_Handle device)
     SAP_EDMA_Param *pParam;
     XDAS_UInt32 parentEdma;
 
-    //TRACE_GEN((&TR_MOD, "SAP_issue.%d (0x%x)", __LINE__, device));
+    if (device->mode == DEV2_OUTPUT)
+       Log_info3("SAP_issue for output device with pDevExt->errorState = 0x%x, pDevExt->runState = 0x%x, pDevExt->numQueued = 0x%x", pDevExt->errorState, pDevExt->runState, pDevExt->numQueued);
 
     if ((device->mode == DEV2_OUTPUT) && (pDevExt->errorState >= PAF_SIO_ERROR_ERRBUF_XFER))
     {
@@ -676,6 +743,9 @@ Int SAP_issue (DEV2_Handle device)
            parentEdma = ((SAP_EDMA_Param *) tail->misc)->hEdmaParam;
        }
 
+       //if (device->mode == DEV2_OUTPUT)
+          Log_info2("SAP_issue: Determined Parent = 0x%x for device = 0x%x", parentEdma, device->mode );
+
     // get frame and parameter table to use; ints off => non-atomic OK
     //     dont need to check for empty queues since were here then todevice
     //     must have a frame placed there by the SIO_issue layer.
@@ -688,7 +758,7 @@ Int SAP_issue (DEV2_Handle device)
     pParam = (SAP_EDMA_Param *) Queue_dequeue (Queue_handle(&pDevExt->paramQue));
 
     if (pParam->hEdmaParam == NULL)
-       Log_info0("SAP_issue: hEdma value is NULL");
+       Log_info1("SAP_issue: hEdma value is NULL for device = 0x%x", device->mode);
     // set misc argument to pParam so get enqueue later
     pFrame->misc = (Arg) pParam;
 
@@ -705,15 +775,11 @@ Int SAP_issue (DEV2_Handle device)
     pDevExt->numQueued += 1;
 
     result = SAP_EDMA_setupXfer (device, pParam->hEdmaParam, parentEdma, pDevExt->errorEdma, pFrame);
-    //Log_info4("SAP_issue.%d, EDMA_setupXfer: Target EDMA: 0x%x, Parent Edma: 0x%x Error Edma: 0x%x",
-    //                __LINE__, pParam->hEdma, parentEdma, pDevExt->errorEdma);
-
-    /*if ((device->mode != DEV2_INPUT) && (gDmaParamsidx <=16))
-       {
-       gDmaParamsarray[gDmaParamsidx][0] = pParam->hEdma;
-               gDmaParamsarray[gDmaParamsidx][1] = parentEdma;
-               gDmaParamsarray[gDmaParamsidx++][2] = gisrOutput;
-       } */
+    if (device->mode == DEV2_OUTPUT)
+    {
+       Log_info4("SAP_issue.%d, EDMA_setupXfer: Target EDMA: 0x%x, Parent Edma: 0x%x Error Edma: 0x%x",
+                           __LINE__, pParam->hEdmaParam, parentEdma, pDevExt->errorEdma);
+    }
 
        if ((pDevExt->errorState == PAF_SIO_ERROR_IDLE_STAGE1) && (device->mode == DEV2_OUTPUT))
                pDevExt->errorState = PAF_SIO_ERROR_NONE;
@@ -725,12 +791,11 @@ Int SAP_issue (DEV2_Handle device)
        gSAPSpecialCase++;
         result = SAP_FTABLE_start (device);
         if (result) {
-            //SAP_DMA_FTABLE_unlock (device);
                  Hwi_restore (key);
             return result;
         }
     }
-    Hwi_restore (key); //DJDBG
+    Hwi_restore (key);
 
     return result;
 } // SAP_issue
@@ -769,7 +834,7 @@ void swapHdmi(Ptr Input, int size)
 
        }
 
-       Log_info3("SAP: Exiting swapHdmi with Frame->Addr: 0x%x, p1->addr: 0x%x, p2->addr: 0x%x ", (xdc_IArg)Input, p1, p2);
+       Log_info3("SAP: Exiting swapHdmi with Frame->Addr: 0x%x, p1->addr: 0x%x, p2->addr: 0x%x ", (xdc_IArg)Input, (xdc_IArg)p1, (xdc_IArg)p2);
 
        return;
 }
@@ -782,21 +847,16 @@ Int SAP_reclaim (DEV2_Handle device)
 #endif
 
     //TRACE_GEN((&TR_MOD, "SAP_reclaim.%d (0x%x)", __LINE__, device));
-
+    if (device->mode == DEV2_OUTPUT)
+               Log_info3("SAP_reclaim for output device with pDevExt->errorState = 0x%x, runState: 0x%x & pDevExt->numQueued = 0x%x", pDevExt->errorState, pDevExt->runState, pDevExt->numQueued);
     // must be running and  error free 
     if ((!pDevExt->runState) || (pDevExt->errorState))
     {
-        //TRACE_GEN((&TR_MOD, "SAP_reclaim.%d, not runState: 0x%x", __LINE__, pDevExt->errorState));
+        Log_info3("SAP_reclaim.%d, error-state: 0x%x, mode = 0x%x", __LINE__, pDevExt->errorState, device->mode);
         return SIO2_EBADIO;
     }
 
-    // idle if necessary
-        if (pDevExt->errorState == PAF_SIO_ERROR_FATAL) {
-            DEV2_idle (device, 1);
-            return SIO2_EBADIO;
-        }
-
-       // Log_info0("SAP_reclaim: Before SEM Pend");
+    Log_info1("SAP_reclaim: Before SEM Pend for mode: 0x%x", device->mode);
 
     // wait for ISR to signal block completion
     //TRACE_VERBOSE((&TR_MOD, "SAP_reclaim.%d wait for ISR to signal block completion", __LINE__));
@@ -805,13 +865,13 @@ Int SAP_reclaim (DEV2_Handle device)
        Log_info0("SAP_reclaim, SYS_ETIMEOUT");
         return SIO2_ETIMEOUT;
     }
-    //Log_info1("SAP_reclaim: After SEM Pend for mode: 0x%x", device->mode);
+    Log_info1("SAP_reclaim: After SEM Pend for mode: 0x%x", device->mode);
 
     // return error (owner must idle)
     if (pDevExt->errorState == PAF_SIO_ERROR_FATAL)
     {
        DEV2_idle (device, 1);
-        //TRACE_TERSE((&TR_MOD, "SAP_reclaim.%d, PAF_SIO_ERROR_FATAL: 0x%x", __LINE__, pDevExt->errorState));
+        Log_info2("SAP_reclaim.%d, PAF_SIO_ERROR_FATAL: 0x%x", __LINE__, pDevExt->errorState);
         return PAF_SIO_ERROR_FATAL;
     }
 
@@ -820,7 +880,7 @@ Int SAP_reclaim (DEV2_Handle device)
     //    Dont clean if was for fill.
     // since pend returned we know that head of fromdevice is valid
     pFrame = Queue_head (device->fromdevice);
-    Log_info2("SAP: Inside SAP_Reclaim with From Device Frame->Addr: 0x%x and Frame->Size: %d", pFrame->addr, pFrame->size);
+    Log_info2("SAP: Inside SAP_Reclaim with From Device Frame->Addr: 0x%x and Frame->Size: %d", (xdc_IArg)pFrame->addr, pFrame->size);
     if ((device->mode == DEV2_INPUT) && (pFrame->addr != NULL))
     {
         if(pDevExt->edmaWordSize == 2 && pDevExt->numSers == 4)
@@ -829,9 +889,12 @@ Int SAP_reclaim (DEV2_Handle device)
             Cache_wait();
 
             // max HWI disable duration ~1ms observed
-            //unsigned int key = Hwi_disable();                                        // GJ: Revisit, along with other context protections here.
+            //unsigned int key = Hwi_disable ();                    // GJ: Revisit, along with other context protections here.
             swapHdmi(pFrame->addr, pFrame->size);
             //Hwi_restore(key);
+
+            Cache_wb (pFrame->addr, pFrame->size, Cache_Type_ALL, 0);
+            Cache_wait();
         }
     }
 
@@ -839,6 +902,7 @@ Int SAP_reclaim (DEV2_Handle device)
     /*if ((device->mode == DEV2_OUTPUT) && (pFrame->addr == NULL))
        SW_BREAKPOINT; */
 
+    Log_info1("SAP_reclaim: Exiting with SIO2_OK for device 0x%x  ", device->mode);
     //TRACE_VERBOSE((&TR_MOD, "SAP_reclaim.%d, exit SIO2_OK", __LINE__));
     return SIO2_OK;
 } // SAP_reclaim
@@ -883,7 +947,8 @@ Int SAP_open (DEV2_Handle device, String name)
     pDevExt->firstTCC = 0;
     pDevExt->optLevel = 0;
     pDevExt->numParamSetup = 0;
-    pDevExt->numEdmaParams = 4;
+    pDevExt->numEdmaParams = EDMA_NUM_PARAMS;          // We need more than 4 spare params to handle the immediate transition from Unknown
+                                                                                               // to a Known program. Cheap resource to spend.
 
     // use dev match to fetch function table pointer for SAP
     DEV2_match(SAP_NAME, &entry);
@@ -937,7 +1002,7 @@ Int SAP_config (DEV2_Handle device, const SAP_Params *pParams)
     EDMA3_DRV_Result     edmaResult;
     Uint32                                     reqTcc;
     EDMA3_DRV_Handle   hEdma;
-    Log_info2("SAP_config.%d (0x%x)", __LINE__, device);
+    Log_info2("SAP_config.%d (0x%x)", __LINE__, (xdc_IArg)device);
 
     // cannot configure if transfer started
     if (pDevExt->runState == 1)
@@ -971,7 +1036,7 @@ Int SAP_config (DEV2_Handle device, const SAP_Params *pParams)
        }
        else
        {
-               Que_num = 1;
+               Que_num = 0;
                pDevExt->activeEdma = CSL_EDMACC_0_McASP_0_XEVT;
        }
     }
@@ -986,7 +1051,7 @@ Int SAP_config (DEV2_Handle device, const SAP_Params *pParams)
                }
                else
                {
-                       Que_num = 1;
+                       Que_num = 0;
                        pDevExt->activeEdma = CSL_EDMACC_1_McASP_1_XEVT;
                }
     }
@@ -1001,7 +1066,7 @@ Int SAP_config (DEV2_Handle device, const SAP_Params *pParams)
                }
                else
                {
-                       Que_num = 1;
+                       Que_num = 0;
                        pDevExt->activeEdma = CSL_EDMACC_1_McASP_2_XEVT;
                }
     }
@@ -1117,8 +1182,11 @@ Int SAP_shutdown (DEV2_Handle device)
     // reset counter
     pDevExt->numQueued = 0;
 
+    Log_info0("SAP_shutdown: After pDevExt->numQueued = 0 ");
+
+    //SAP_EDMA_dumpParams(8);
     // make sure active is linked to error
-        EDMA3_DRV_linkChannel (hEdma, pDevExt->activeEdma, pDevExt->errorEdma);
+    EDMA3_DRV_linkChannel (hEdma, pDevExt->activeEdma, pDevExt->errorEdma);
 
     // think this is better (from SIO_idle for standard model )
     // refill frame list -- so user needn't call reclaim, which may cause Rx underrun.
@@ -1131,19 +1199,12 @@ Int SAP_shutdown (DEV2_Handle device)
     
     pDevExt->shutDown = 1;
     pDevExt->numParamSetup = 0;
-    
-    /*result = SAP_DMA_FTABLE_unlock (device);
-    if (result)
-    {
-        //TRACE_TERSE((&TR_MOD, "%s.%d: SAP_DMA_FTABLE_unlock returned %d.\n", __FUNCTION__, __LINE__, result));
-        return result;
-    } */
 
     return SIO2_OK;
 } // SAP_shutdown
 
 // -----------------------------------------------------------------------------
-int gSapWatchDogThrottle = 0; //DJDBG
+int gSapWatchDogThrottle = 0;
 int gSapWatchDogIn =0;
 int gSapWatchDogOut = 0;
 int gSapWatchDogInSemPost = 0;
@@ -1160,25 +1221,21 @@ Void SAP_watchDog (Void)
     // do nothing if SAP_init not yet called
     if (!SAP_initialized)
     {
-        Log_info2("%s.%d: SAP_init not yet called.\n", __FUNCTION__, __LINE__);
+        Log_info2("%s.%d: SAP_init not yet called.\n", (xdc_IArg)__FUNCTION__, __LINE__);
         return;
     }
 
-    // GJ: Revisit, along with other context protections here.
-    // GJ: Is this architecture ok?
     // protect context
     Task_disable (); // needed since we may call SEM_post
-    // Hwi_disable commented since it used to affect other interrupts
-    // max HWI disable duration ~4ms observed
     //oldMask = Hwi_disable ();
 
 
-    //TRACE_VERBOSE((&TR_MOD, "%s.%d: devices loop, numDevices = %d", __FUNCTION__, __LINE__, dapDrv.numDevices));
+    //Log_info3("%s.%d: devices loop, numDevices = %d", __FUNCTION__, __LINE__, sapDrv.numDevices);
 
     for (i=0; i < sapDrv.numDevices; i++) {
         device  = sapDrv.device[i];
 
-        //TRACE_VERBOSE((&TR_MOD, "%s.%d, devices loop start, device = 0x%x", __FUNCTION__, __LINE__, device));
+        //Log_info3("%s.%d, devices loop start, device = 0x%x", __FUNCTION__, __LINE__, device);
 
         pDevExt = (SAP_DeviceExtension *) device->object;
 
@@ -1199,15 +1256,10 @@ Void SAP_watchDog (Void)
             if(device->mode == DEV2_INPUT)
                gSapWatchDogIn++;
             else
-                gSapWatchDogOut++;
+               gSapWatchDogOut++;
 
             //TRACE_TERSE((&TR_MOD, "SAP_watchDog.%d, PAF_SIO_ERROR_FATAL: 0x%x", __LINE__, pDevExt->errorState));
-           /* if(gSapWatchDogThrottle == 0) //DJDBG
-            {
-               Log_info3("SAP_watchDog.%d (0x%x); THROTTLED result = 0x%x", __LINE__, device, result);
-            }
-            gSapWatchDogThrottle ++;
-            if(gSapWatchDogThrottle > 10) gSapWatchDogThrottle = 0; */
+
             // if outstanding pend then post to free owner thead
             if (!Semaphore_pend(pDevExt->sync, 0))
             {
@@ -1277,7 +1329,10 @@ void SAP_isrCallback (Uint32 tcc, EDMA3_RM_TccStatus status, Ptr context)
             pDevExt->numQueued -= 1;
             //gIsrCnt++;
             if (device->mode == 1)
+               {
                gIsrOutputCnt++;
+               //Log_info1("SAP isrCallback for 0x%x", pDevExt->activeEdma);
+               }
             else
                gIsrInputCnt++;
             // place frame onto user queue and signal user thread
@@ -1286,12 +1341,6 @@ void SAP_isrCallback (Uint32 tcc, EDMA3_RM_TccStatus status, Ptr context)
             //Log_info2("Before SEM_post for device: 0x%x gIsrOutput: %d", device->mode, gisrOutput);
             // signal user thread
             Semaphore_post (pDevExt->sync);
-#if 0
-            if(gIsrCnt > 10) { //DJDBG
-               Log_info1("SAP isrCallback enough interrupts! %d", gIsrCnt);
-
-            }
-#endif
         }
         else
                gIsrElseCnt++;
@@ -1339,24 +1388,29 @@ Int SAP_EDMA_setupXfer (DEV2_Handle device, XDAS_UInt32 targetEdma, XDAS_UInt32
 
     // TODO: shouldn't this just be tcc interrupt disable?
     // at least until linkage phase...
-    unsigned int key = Hwi_disable (); //DJDBG
+    unsigned int key = Hwi_disable ();
 
     if(targetEdma == NULL)
     {
        Log_info0("targetEdma is NULL");
     }
     // configure transfer
-    if(pFrame->addr == NULL) //DJDBG
+    if(pFrame->addr == NULL)
     {
         Log_info0("pFrame has NULL address?");
     }
     SAP_DMA_FTABLE_setupParam (device, targetEdma, childEdma, (XDAS_UInt32) pFrame->addr, pFrame->size);
 
+    if (device->mode == DEV2_OUTPUT)
+       Log_info4("SAP: Inside SAP_EDMA_setupXfer with childEdma=0x%x & targetEdma = 0x%x; pFrame->addr = 0x%x, pFrame->size=0x%x", childEdma, targetEdma, (xdc_IArg)pFrame->addr, pFrame->size);
+
     if (parentEdma != EDMA_HINV)
         EDMA3_DRV_linkChannel (hEdma, parentEdma, targetEdma);
 
+    if (device->mode == DEV2_OUTPUT)
+               Log_info3("SAP: Inside SAP_EDMA_setupXfer linked targetEdma = 0x%x with parentEdma=0x%x on Edma=0x%x", targetEdma, parentEdma, (xdc_IArg)hEdma);
 
-    Hwi_restore (key); //DJDBG
+    Hwi_restore (key);
 
     return SIO2_OK;
 } // SAP_setupXfer
@@ -1383,7 +1437,7 @@ Int SAP_EDMA_setupParam (DEV2_Handle device, XDAS_UInt32 targetEdma, XDAS_UInt32
    //Log_info3("%s.%d: Entered SAP_EDMA_setupParam for Target: 0x%x.\n", (xdc_IArg)__FUNCTION__, __LINE__, targetEdma);
 
     // Init opt parameter to 0 which, without being overriden, configures as:
-    //    A synchronized transfer (no FIFO mode on src or dst)
+    //    AB synchronized transfer
     //    no chaining or intermediate interrupts
     //    param is not static
     //    normal completion
@@ -1394,15 +1448,11 @@ Int SAP_EDMA_setupParam (DEV2_Handle device, XDAS_UInt32 targetEdma, XDAS_UInt32
     edmaConfig.destCIdx = 0;
     edmaConfig.srcCIdx = 0;
 
-    edmaConfig.opt |= EDMA3_DRV_OPT_SYNCDIM_SET_MASK (EDMA3_DRV_SYNC_AB); //DJDBG!
-    if (device->mode == DEV2_OUTPUT) {
-      //edmaConfig.opt |= EDMA3_DRV_OPT_DAM_SET_MASK (EDMA3_DRV_ADDR_MODE_FIFO); //DJDBG!!!
-      edmaConfig.opt |= 2;
-    }
-    else {
-       //edmaConfig.opt |= EDMA3_DRV_OPT_SAM_SET_MASK (EDMA3_DRV_ADDR_MODE_FIFO); //DJDBG!!!
-       //edmaConfig.opt |= 1;
-    }
+    edmaConfig.opt |= EDMA3_DRV_OPT_SYNCDIM_SET_MASK (EDMA3_DRV_SYNC_AB);
+    if (device->mode == DEV2_OUTPUT)
+       edmaConfig.opt |= 2;            //DAM=CONST addr mode
+    else
+       edmaConfig.opt |= 1;            //SAM=CONST addr mode
 
     // if regular transfer then enable interrupt with tcc code
     if (targetEdma != pDevExt->errorEdma) {
@@ -1431,41 +1481,37 @@ Int SAP_EDMA_setupParam (DEV2_Handle device, XDAS_UInt32 targetEdma, XDAS_UInt32
                edmaConfig.cCnt= (size)/((edmaConfig.aCnt * edmaConfig.bCnt)/2);
         }
         else {
-               //if(pDevExt->edmaWordSize == 2)
-               //edmaConfig.srcAddr= (unsigned int)edmaConfig.srcAddr+ 2;
             edmaConfig.destBIdx = 0;
-            edmaConfig.destAddr = (unsigned int) &sap_OVER;
+            edmaConfig.destAddr = (unsigned int) &sap_OVER_4LANE;
+            edmaConfig.cCnt = 1;
         }
     }
     else {
         edmaConfig.destBIdx = 0;
+        edmaConfig.srcBIdx  = pDevExt->edmaWordSize;
         edmaConfig.destAddr = (unsigned int) (hPort->xbufAddr);
-
         if (addr) {
-            edmaConfig.srcBIdx  = pDevExt->edmaWordSize;
             edmaConfig.srcCIdx  = pDevExt->edmaWordSize * pDevExt->numSers ;
             edmaConfig.srcAddr  = addr;
-            //Edma3_CacheFlush ((unsigned int) addr, (size+3)/4);
         }
         else {
             edmaConfig.srcBIdx  = 0;
             edmaConfig.srcAddr  = (unsigned int) &sap_UNDER[0];
-#if 1
-            //edmaConfig.cCnt = (SAP_UNDER_LEN * sizeof(int))/(edmaConfig.aCnt * edmaConfig.bCnt); //DJDBG
-            edmaConfig.cCnt = SAP_UNDER_LEN; //DJDBG, if underrun have frame of silence
-#endif
         }
     }
     edmaConfig.srcAddr  = (unsigned int) getGlobalAddr(edmaConfig.srcAddr);
     edmaConfig.destAddr  = (unsigned int) getGlobalAddr(edmaConfig.destAddr);
 
-    //Log_info3("SAP: Inside SAP_EDMA_setupParam with targetEdma = 0x%x linked to childEdma = 0x%x & dest-addr: 0x%x", targetEdma, childEdma, edmaConfig.destAddr);
-
     EDMA3_DRV_setPaRAM (hEdma, targetEdma, &edmaConfig);
 
     // link child xfer
     if (childEdma != EDMA_HINV)
         EDMA3_DRV_linkChannel (hEdma, targetEdma, childEdma);
 
+    if (device->mode == DEV2_OUTPUT) {
+        Log_info5("SAP: Inside SAP_EDMA_setupParam: size=0x%x, targetEdma = 0x%x, CCNT = %d with dest-addr: 0x%x and OPT=0x%x", size, targetEdma, edmaConfig.cCnt, edmaConfig.destAddr, edmaConfig.opt);
+        Log_info5("SAP: Inside SAP_EDMA_setupParam: aCnt=0x%x, bCnt = 0x%x; linked targetEdma = 0x%x with childEdma=0x%x on Edma=0x%x", edmaConfig.aCnt, edmaConfig.bCnt, targetEdma, childEdma, (xdc_IArg)hEdma );
+        }
+
     return SIO2_OK;
 } //SAP_setupParam