From 0a89f0f91b24fff8f68d780a8e0586442be167d2 Mon Sep 17 00:00:00 2001 From: Chitresh Gupta Date: Fri, 14 Apr 2017 15:07:05 +0530 Subject: [PATCH 1/1] PASDK-183: merged latest framework updates. --- pasdk/test_dsp/framework/audioStreamInpProc.c | 116 ++++++++++++------ pasdk/test_dsp/framework/systemInit.c | 8 +- pasdk/test_dsp/sap/sap.c | 92 +++++++++----- 3 files changed, 144 insertions(+), 72 deletions(-) diff --git a/pasdk/test_dsp/framework/audioStreamInpProc.c b/pasdk/test_dsp/framework/audioStreamInpProc.c index a00036d9..264e929b 100644 --- a/pasdk/test_dsp/framework/audioStreamInpProc.c +++ b/pasdk/test_dsp/framework/audioStreamInpProc.c @@ -298,13 +298,21 @@ PAF_ASIT_Config gPAF_ASIT_config = { }; // Global debug counters */ -UInt32 gTaskAsipCnt=0; // debug -UInt32 gAsipInitCnt =0; -UInt32 gAsipInfo1Cnt =0; -UInt32 gAsipInfo2Cnt =0; -UInt32 gAsipDecodeCnt =0; -UInt32 gAsipFinalCnt =0; -UInt32 gAsipQuitCnt =0; +UInt32 gTaskAsipCnt =0; +UInt32 gAsipInitCnt =0; +UInt32 gAsipInfo1Cnt =0; +UInt32 gAsipInfo2Cnt =0; +UInt32 gAsipDecodeCnt =0; +UInt32 gAsipDecodeErrCnt =0; +UInt32 gAsipFinalCnt =0; +UInt32 gAsipQuitCnt =0; +UInt32 gAsipInfo1_PrimaryErrCnt =0; +UInt32 gAsipInfo1_ErrCnt =0; +UInt32 gAsipInfo2_PrimaryErrCnt =0; +UInt32 gAsipInfo2_ErrCnt =0; +UInt32 gCapIbReset_cnt =0; +UInt32 gCapIb_cnt =0; +UInt32 gCbWrtAfErrCnt =0; // decoder output circular buffer write error count (returned from ARM to DSP) #include "dbgDib.h" extern struct { @@ -339,13 +347,9 @@ Void taskAsipFxn( #ifdef NON_CACHE_STATUS Int8 tempVar8; #endif + Task_Handle taskHandle; Log_info0("Enter taskAsipFxn()"); - -#ifdef SIMULATE_SIO - /* Start simulation */ - simStart(); -#endif // SIMULATE_SIO // // Audio Framework Parameters & Patch (*pP, *pQ) @@ -375,6 +379,8 @@ Void taskAsipFxn( pAstCfg->as = as; TRACE_TERSE1("TaskAsip: Started with AS%d.", as); + taskHandle = Task_self(); + // // Initialize message log trace and line number reporting // @@ -874,8 +880,9 @@ Void taskAsipFxn( // FL: debug, reset IB capture buffer capIbReset(); + gCapIbReset_cnt++; Log_info0("capIbReset()"); - + // FL: send source select message to slave pAspMsg = (ASP_Msg *)MessageQ_alloc(hAspMsgMaster->heapId, hAspMsgMaster->msgSize); /* allocate message */ MessageQ_setReplyQueue(hAspMsgMaster->masterQue, (MessageQ_Msg)pAspMsg); /* set the return address in the message header */ @@ -922,6 +929,9 @@ Void taskAsipFxn( TRACE_VERBOSE1(procName[sourceProgram], as+zMS); + // Reduce priority level since autodetection complete + Task_setPri(taskHandle, Task_getPri(taskHandle)-1); + TRACE_VERBOSE0("TaskAsip: calling decodeProcessing."); errno = pP->fxns->decodeProcessing(pP, pQ, pC, sourceSelect); if (errno) @@ -933,6 +943,9 @@ Void taskAsipFxn( TRACE_VERBOSE0("TaskAsip: decodeProcessing complete with no error."); } + // Increase priority level since decoding complete + Task_setPri(taskHandle, Task_getPri(taskHandle)+1); + // FL: send dec exit message to slave pAspMsg = (ASP_Msg *)MessageQ_alloc(hAspMsgMaster->heapId, hAspMsgMaster->msgSize); /* allocate message */ MessageQ_setReplyQueue(hAspMsgMaster->masterQue, (MessageQ_Msg)pAspMsg); /* set the return address in the message header */ @@ -1922,6 +1935,10 @@ PAF_ASIT_autoProcessing( return errno; } //PAF_ASIT_autoProcessing +UInt32 gProbe1Err=0; +UInt32 gProbe2Err=0; +UInt32 gMajorAuMissed=0; + // ----------------------------------------------------------------------------- // ASIT Processing Function - Decode Processing // @@ -2013,7 +2030,7 @@ PAF_ASIT_decodeProcessing( Int frame; // decoder input frame count Int block; // (***) FL: formerly -- decoder output block count / input frame #ifdef NON_CACHE_STATUS - Int8 tempVar8, tempVar8_2; + Int8 tempVar8, temp2Var8; #endif pAstCfg = pC->pAstCfg; // get pointer to common (shared) configuration @@ -2042,6 +2059,10 @@ PAF_ASIT_decodeProcessing( for (;;) { + statusOp_read(&tempVar8, + &(pAstCfg->xDec[zMD].decodeStatus.sourceSelect), + sizeof(tempVar8), + GATEMP_INDEX_DEC); if (tempVar8 == PAF_SOURCE_NONE) { #else @@ -2161,6 +2182,7 @@ PAF_ASIT_decodeProcessing( // Establish primary timing if (errno = pP->fxns->decodeInfo(pP, pQ, pC, frame, block)) { + gAsipInfo1_PrimaryErrCnt++; TRACE_TERSE1("INFO1: errno 0x%x after decodeInfo, primary timing", errno); break; } @@ -2178,19 +2200,15 @@ PAF_ASIT_decodeProcessing( &(pAstCfg->xDec[zMD].decodeStatus.sourceDecode), sizeof(tempVar8), GATEMP_INDEX_DEC); - - statusOp_read(&tempVar8_2, + statusOp_read(&temp2Var8, &(pAstCfg->xDec[zMD].decodeStatus.sampleRate), sizeof(tempVar8), GATEMP_INDEX_DEC); // Don't start decode until major access unit is found. if (((tempVar8 == PAF_SOURCE_THD) || (tempVar8 == PAF_SOURCE_DXP) || - (tempVar8 == PAF_SOURCE_DTSHD)) - && - //(pAstCfg->xStr[zMS].pAudioFrame->sampleRate == PAF_SAMPLERATE_UNKNOWN) - (tempVar8_2 == PAF_SAMPLERATE_UNKNOWN) // debug chitresh as per govind - ) + (tempVar8 == PAF_SOURCE_DTSHD)) && + (temp2Var8 == PAF_SAMPLERATE_UNKNOWN)) #else // Don't start decode until major access unit is found. if (((pAstCfg->xDec[zMD].decodeStatus.sourceDecode == PAF_SOURCE_THD) || @@ -2218,12 +2236,14 @@ PAF_ASIT_decodeProcessing( if (SIO_issue(pAstCfg->xInp[zI].hRxSio, &pAstCfg->xInp[zI].inpBufConfig, sizeof(pAstCfg->xInp[zI].inpBufConfig), PAF_SIO_REQUEST_NEWFRAME)) { + gProbe2Err++; TRACE_TERSE0("PAF_ASIT_decodeProcessing. %d: INFO1, return (ASPERR_ISSUE)"); return (ASPERR_ISSUE); } } } TRACE_VERBOSE1("PAF_ASIT_decodeProcessing: INFO1: frame %d, not major access unit", frame); + gMajorAuMissed++; // debug frame++; state = INFO1; continue; @@ -2234,6 +2254,7 @@ PAF_ASIT_decodeProcessing( if (errno = pP->fxns->decodeInfo1(pP, pQ, pC, frame, block)) { TRACE_VERBOSE1("PAF_ASIT_decodeProcessing: INFO1, errno 0x%x. break after decodeInfo1", errno); + gAsipInfo1_ErrCnt++; break; } @@ -2262,6 +2283,7 @@ PAF_ASIT_decodeProcessing( if (errno = pP->fxns->decodeInfo(pP, pQ, pC, frame, block)) { TRACE_TERSE1("PAF_ASIT_decodeProcessing: INFO2 break on decodeInfo. errno 0x%x", errno); + gAsipInfo2_PrimaryErrCnt++; break; } @@ -2275,6 +2297,7 @@ PAF_ASIT_decodeProcessing( if (errno = pP->fxns->decodeInfo2(pP, pQ, pC, frame, block)) { TRACE_TERSE1("PAF_ASIT_decodeProcessing. %d: INFO2 break on decodeInfo2. errno 0x%x", errno); + gAsipInfo2_ErrCnt++; break; } @@ -2295,6 +2318,7 @@ PAF_ASIT_decodeProcessing( if (errno = pP->fxns->decodeDecode(pP, pQ, pC, sourceSelect, frame, block)) { + gAsipDecodeErrCnt++; TRACE_TERSE1("PAF_ASIT_decodeProcessing: state: DECODE. decodeDecode err 0x%04x", errno); break; } @@ -2487,7 +2511,6 @@ PAF_ASIT_decodeInit( Int zMI; ASP_Msg* pAspMsg; /* Messaging */ Int argIdx; - Int decErrno; Int status; #ifdef NON_CACHE_STATUS Int8 tempVar8; @@ -2647,14 +2670,13 @@ PAF_ASIT_decodeInit( TRACE_MSG1("decErrno=%d", pAspMsg->buf[0]); argIdx = 0; // get decErrno - decErrno = *(Int32 *)&pAspMsg->buf[argIdx]; - if (decErrno != 0) - { - return decErrno; - } + errno = *(Int32 *)&pAspMsg->buf[argIdx]; } else { + // + // Invalid message received + // TRACE_TERSE3("ERROR: Rx ASP message: procId=%d, cmd=%d, messageId=0x%04x", pAspMsg->procId, pAspMsg->cmd, pAspMsg->messageId); SW_BREAKPOINT; // temporary return -1; // temporary @@ -2665,11 +2687,11 @@ PAF_ASIT_decodeInit( { SW_BREAKPOINT; } - + // (***) FL: revisit // invalidate Dec configuration Cache_inv(&pAstCfg->xDec[z], sizeof(PAF_AST_Decode), Cache_Type_ALLD, 0); - Cache_wait(); + Cache_wait(); #if 0 // FL: decoder reset call, slave if (dec->fxns->reset @@ -2677,6 +2699,10 @@ PAF_ASIT_decodeInit( &pC->xDec[z].decodeControl, &pC->xDec[z].decodeStatus))) return errno; #endif + if (errno != 0) + { + return errno; + } #ifdef NON_CACHE_STATUS gear = 0; // due to size difference @@ -3004,15 +3030,26 @@ PAF_ASIT_decodeInfo( SW_BREAKPOINT; return -1; // temporary } - if ((pAspMsg->procId != hAspMsgMaster->slaveProcId) || - (pAspMsg->cmd != ASP_MASTER_DEC_INFO_DONE) || - (pAspMsg->messageId != (hAspMsgMaster->messageId | ((UInt32)1<<31)))) + if ((pAspMsg->procId == hAspMsgMaster->slaveProcId) && + (pAspMsg->cmd == ASP_MASTER_DEC_INFO_DONE) && + (pAspMsg->messageId == (hAspMsgMaster->messageId | ((UInt32)1<<31)))) + { + hAspMsgMaster->messageId = (hAspMsgMaster->messageId + 1) & ~(1<<31); + TRACE_TERSE3("Rx ASP message: procId=%d, cmd=%d, messageId=0x%04x", pAspMsg->procId, pAspMsg->cmd, pAspMsg->messageId); + TRACE_MSG1("decErrno=%d", pAspMsg->buf[0]); + + argIdx = 0; // get decErrno + errno = *(Int32 *)&pAspMsg->buf[argIdx]; + } + else { + // + // Invalid message received + // TRACE_TERSE3("ERROR: Rx ASP message: procId=%d, cmd=%d, messageId=0x%04x", pAspMsg->procId, pAspMsg->cmd, pAspMsg->messageId); SW_BREAKPOINT; // temporary - } - hAspMsgMaster->messageId = (hAspMsgMaster->messageId + 1) & ~(1<<31); - TRACE_MSG3("Rx ASP message: procId=%d, cmd=%d, messageId=0x%04x", pAspMsg->procId, pAspMsg->cmd, pAspMsg->messageId); + return -1; // temporary + } // free the message status = MessageQ_free((MessageQ_Msg)pAspMsg); /* free the message */ if (status != MessageQ_S_SUCCESS) @@ -3037,6 +3074,7 @@ PAF_ASIT_decodeInfo( TRACE_TERSE1("return error errno 0x%x.", errno); return errno; } + #ifdef NON_CACHE_STATUS statusOp_read(&tempVar, &(pAstCfg->xDec[z].decodeStatus.frameCount), @@ -3397,18 +3435,22 @@ PAF_ASIT_decodeDecode( hAspMsgMaster->messageId = (hAspMsgMaster->messageId + 1) & ~(1<<31); TRACE_MSG3("Rx ASP message: procId=%d, cmd=%d, messageId=0x%04x", pAspMsg->procId, pAspMsg->cmd, pAspMsg->messageId); - argIdx = 0; + argIdx = 0; // get decErrno errno = *(Int32 *)&pAspMsg->buf[argIdx]; - argIdx += sizeof(Int32); + argIdx += sizeof(Int32); // get cbErrno cbErrno = *(Int32 *)&pAspMsg->buf[argIdx]; if (cbErrno != 0) { + gCbWrtAfErrCnt++; TRACE_TERSE1("CB write error=%d", cbErrno); SW_BREAKPOINT; // temporary } } else { + // + // Invalid message received + // TRACE_TERSE3("ERROR: Rx ASP message: procId=%d, cmd=%d, messageId=0x%04x", pAspMsg->procId, pAspMsg->cmd, pAspMsg->messageId); SW_BREAKPOINT; // temporary } diff --git a/pasdk/test_dsp/framework/systemInit.c b/pasdk/test_dsp/framework/systemInit.c index 365b6cb8..ead1e735 100644 --- a/pasdk/test_dsp/framework/systemInit.c +++ b/pasdk/test_dsp/framework/systemInit.c @@ -72,11 +72,11 @@ extern PAF_ASOT_Fxns PAF_ASOT_params_fxns; Int gSysInit=0; -#define TASK_AFP_PRI ( 1 )//( 1 ) // (***) FL: temporary fix for PASDK-64 -#define TASK_AIP_PRI ( 2 )//( 2 ) +#define TASK_AFP_PRI ( 2 ) +#define TASK_AIP_PRI ( 3 ) #define TASK_SSP_PRI ( 1 ) -#define TASK_ASIP_PRI ( 3 )//( 3 ) -#define TASK_ASOP_PRI ( 3 )//( 3 ) +#define TASK_ASIP_PRI ( 5 ) //( 4 ) +#define TASK_ASOP_PRI ( 4 ) #define __TASK_NAME__ "TaskSysInit" diff --git a/pasdk/test_dsp/sap/sap.c b/pasdk/test_dsp/sap/sap.c index aff66f8a..83cffcfe 100644 --- a/pasdk/test_dsp/sap/sap.c +++ b/pasdk/test_dsp/sap/sap.c @@ -67,12 +67,7 @@ All rights reserved. #define EDMA_HINV NULL -#ifdef SAP_PORT_MCASP #include "sap_mcasp.h" -#else -#error "No port defined" -#endif - #include // This works to set a breakpoint @@ -103,27 +98,46 @@ void swapHdmi(Ptr, int); //#define TEST_MULTICHANNEL -#ifdef TEST_MULTICHANNEL -#define SAP_UNDER_LEN 16 -//#define SAP_UNDER_LEN 1024 // GJ: experiment -#else -#define SAP_UNDER_LEN 1024 -#endif + +#define SAP_UNDER_LEN 8 + 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) { - unsigned int *ptrPARAM_BASE = (unsigned int *)0x02704000; - unsigned int *ptrPARAM0x18 = (unsigned int *)0x02704300; // ((*((EDMA3_CCRL_Regs *) 0x02700000)).PARAMENTRY)[24] + //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] + 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 *ptrPARAM0x44 = (unsigned int *)0x02704910; // ((*((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): 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("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("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("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_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("PARAM0x44a(%d): ITCINTEN: 0x%02x, TCINTEN: 0x%02x, TCC: 0x%02x, TCCMODE: %d", tag_place, ((ptrPARAM0x44[0] & 0x200000) >> 21), ((ptrPARAM0x44[0] & 0x100000) >> 20), ((ptrPARAM0x44[0] & 0x3F000) >> 12), ((ptrPARAM0x44[0] & 0x800) >> 11)); + Log_info5("PARAM0x44b(%d): SRC: 0x%08x, A_B_CNT: 0x%08x, DST: 0x%08x, SRC_DST_BIDX: 0x%08x", tag_place, ptrPARAM0x44[1], ptrPARAM0x44[2], ptrPARAM0x44[3], ptrPARAM0x44[4]); + Log_info4("PARAM0x44b(%d): LINK_BCNTRLD: 0x%08x, SRC_DST_CIDX: 0x%08x, CCNT: 0x%08x", tag_place, ptrPARAM0x44[5], ptrPARAM0x44[6], ptrPARAM0x44[7]); //Log_info1("TCC0: ERR reg %x", *((unsigned int *)0x02760120)); //DJDBG } #endif @@ -225,7 +239,7 @@ 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)); @@ -275,10 +289,24 @@ 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; + } + + 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; @@ -602,7 +630,7 @@ Int SAP_start (DEV2_Handle device) // 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"); + Log_info1 ("SAP: %d, SAP_start runState=1 & ENABLE TRANSFERS", __LINE__); // enable interrupts and event servicing for this channel EDMA3_DRV_enableTransfer (hEdma, pDevExt->activeEdma, EDMA3_DRV_TRIG_MODE_EVENT); @@ -705,8 +733,8 @@ 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); + 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)) { @@ -792,6 +820,7 @@ Int SAP_reclaim (DEV2_Handle device) // 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; } @@ -807,6 +836,7 @@ Int SAP_reclaim (DEV2_Handle device) } //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) { @@ -814,6 +844,7 @@ Int SAP_reclaim (DEV2_Handle device) //TRACE_TERSE((&TR_MOD, "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 @@ -1167,8 +1198,6 @@ Void SAP_watchDog (Void) 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 (); @@ -1402,7 +1431,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 +1464,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); @@ -1460,7 +1489,8 @@ 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); + Log_info5("SAP: Inside SAP_EDMA_setupParam with 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 with aCnt=0x%x, bCnt = 0x%x, destBIdx = 0x%x destCIdx: 0x%x and bCntReload=0x%x", edmaConfig.aCnt, edmaConfig.bCnt, edmaConfig.destBIdx, edmaConfig.destCIdx, edmaConfig.bCntReload); EDMA3_DRV_setPaRAM (hEdma, targetEdma, &edmaConfig); -- 2.39.2