index aff66f8a17eb23e6de178d11c7061de6f4b3a3e5..862494d54ed62c3132f2892fd8b94f73d6c96f4c 100644 (file)
--- a/pasdk/test_dsp/sap/sap.c
+++ b/pasdk/test_dsp/sap/sap.c
/*
-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
#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
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
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)); //DJDBG
}
#endif
// .............................................................................
// -----------------------------------------------------------------------------
+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));
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;
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;
// signal stopped
pDevExt->runState = 0;
+ Log_info0("SAP_idle: runState = 0");
// reset errorState
pDevExt->errorState = PAF_SIO_ERROR_NONE;
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__, 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);
}
// 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);
SAP_EDMA_Param *pParam;
XDAS_UInt32 parentEdma;
- //TRACE_GEN((&TR_MOD, "SAP_issue.%d (0x%x)", __LINE__, device));
+ if (device->mode == DEV2_OUTPUT)
+ Log_info1("SAP_issue for output device with pDevExt->errorState = 0x%x", pDevExt->errorState);
if ((device->mode == DEV2_OUTPUT) && (pDevExt->errorState >= PAF_SIO_ERROR_ERRBUF_XFER))
{
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.
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;
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_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 ((device->mode != DEV2_INPUT) && (gDmaParamsidx <=16))
{
pDevExt->shutDown = 0;
+ //if (device->mode == DEV2_OUTPUT)
+ //SAP_EDMA_dumpParams(1);
+
// special case enables when not yet started
if (pDevExt->runState == 0) {
gSAPSpecialCase++;
#endif
//TRACE_GEN((&TR_MOD, "SAP_reclaim.%d (0x%x)", __LINE__, device));
-
+ if (device->mode == DEV2_OUTPUT)
+ Log_info2("SAP_reclaim for output device with pDevExt->errorState = 0x%x & runState: 0x%x", pDevExt->errorState, pDevExt->runState);
// 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, not runState: 0x%x, mode = 0x%x", __LINE__, pDevExt->errorState, device->mode);
return SIO2_EBADIO;
}
// idle if necessary
if (pDevExt->errorState == PAF_SIO_ERROR_FATAL) {
+ Log_info1("SAP_reclaim: PAF_SIO_ERROR_FATAL, Before Idle for device 0x%x ", device->mode);
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__));
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);
+#if 1
// 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;
}
+#endif
#ifdef SAP_CACHE_SUPPORT
// invalidate CACHE region if input -- use clean since
/*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
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);
}
else
{
- Que_num = 1;
+ Que_num = 0;
pDevExt->activeEdma = CSL_EDMACC_0_McASP_0_XEVT;
}
}
}
else
{
- Que_num = 1;
+ Que_num = 0;
pDevExt->activeEdma = CSL_EDMACC_1_McASP_1_XEVT;
}
}
}
else
{
- Que_num = 1;
+ Que_num = 0;
pDevExt->activeEdma = CSL_EDMACC_1_McASP_2_XEVT;
}
}
// reset counter
pDevExt->numQueued = 0;
+ //DJDBG_SAP_EDMA_dumpParams(1);
// 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.
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
//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;
if(device->mode == DEV2_INPUT)
gSapWatchDogIn++;
else
- gSapWatchDogOut++;
+ {
+ //if (gSapWatchDogOut == 0)
+ //SAP_EDMA_dumpParams(1);
+ gSapWatchDogOut++;
+ }
//TRACE_TERSE((&TR_MOD, "SAP_watchDog.%d, PAF_SIO_ERROR_FATAL: 0x%x", __LINE__, pDevExt->errorState));
/* if(gSapWatchDogThrottle == 0) //DJDBG
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
@@ -1353,9 +1448,14 @@ Int SAP_EDMA_setupXfer (DEV2_Handle device, XDAS_UInt32 targetEdma, XDAS_UInt32
}
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, 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, hEdma);
Hwi_restore (key); //DJDBG
@@ -1402,7 +1502,7 @@ Int SAP_EDMA_setupParam (DEV2_Handle device, XDAS_UInt32 targetEdma, XDAS_UInt32
}
else {
//edmaConfig.opt |= EDMA3_DRV_OPT_SAM_SET_MASK (EDMA3_DRV_ADDR_MODE_FIFO); //DJDBG!!!
- //edmaConfig.opt |= 1;
+ edmaConfig.opt |= 1;
}
// if regular transfer then enable interrupt with tcc code
@@ -1435,15 +1535,15 @@ Int SAP_EDMA_setupParam (DEV2_Handle device, XDAS_UInt32 targetEdma, XDAS_UInt32
//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);
@@ -1451,7 +1551,7 @@ Int SAP_EDMA_setupParam (DEV2_Handle device, XDAS_UInt32 targetEdma, XDAS_UInt32
else {
edmaConfig.srcBIdx = 0;
edmaConfig.srcAddr = (unsigned int) &sap_UNDER[0];
-#if 1
+#if 0
//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
@@ -1460,13 +1560,16 @@ Int SAP_EDMA_setupParam (DEV2_Handle device, XDAS_UInt32 targetEdma, XDAS_UInt32
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, hEdma );
+ }
+
return SIO2_OK;
} //SAP_setupParam