summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 4ebaa3d)
raw | patch | inline | side by side (parent: 4ebaa3d)
author | Govind Jeyaram <govind.j@ti.com> | |
Tue, 17 Jan 2017 21:14:51 +0000 (13:14 -0800) | ||
committer | Frank Livingston <frank-livingston@ti.com> | |
Fri, 27 Jan 2017 23:18:10 +0000 (17:18 -0600) |
1. (sap.c) - Add debug counters; reduce underrun frame-length (impacts outputStartClocks); remove unnecessary Edma3_CacheFlush call.
Remove context-protection around swapHdmi, experimentally - to unblock UART intr mainly.
Remove TEST_MULTICHANNEL from the file-level.
2. (mib.c, mob.c) Fix Queue API usage, to remove compiler warnings about unsavoury typecasting.
3. (audioStreamInpProc.c) minor cleanup for removing compiler warnings.
Remove context-protection around swapHdmi, experimentally - to unblock UART intr mainly.
Remove TEST_MULTICHANNEL from the file-level.
2. (mib.c, mob.c) Fix Queue API usage, to remove compiler warnings about unsavoury typecasting.
3. (audioStreamInpProc.c) minor cleanup for removing compiler warnings.
diff --git a/pasdk/test_dsp/framework/audioStreamInpProc.c b/pasdk/test_dsp/framework/audioStreamInpProc.c
index 937b61ca2c732b34b9a85628f99173b5f320609e..000c4b10616b41a8f0e254199517a82bf0703431 100644 (file)
Int tempVar;
#endif
// FL: revisit
- Int size;
- PAF_InpBufConfig *pIpBufConfig;
+ //Int size;
+ //PAF_InpBufConfig *pIpBufConfig;
pAstCfg = pC->pAstCfg; // get pointer to common (shared) configuration
as = pAstCfg->as;
index ebb5d688d303c2479918abbc0000888f0d8a3fb0..43327b34661badfbe9151895e6ede5ccd29617e3 100644 (file)
--- a/pasdk/test_dsp/mib/mib.c
+++ b/pasdk/test_dsp/mib/mib.c
typedef xdc_Char SmInt;
typedef xdc_UChar SmUns;
+#define SW_BREAKPOINT asm( " SWBP 0" );
extern const ti_sysbios_heaps_HeapMem_Handle heapMemDdr3;
#define HEAPMALLOC (IHeap_Handle)heapMemDdr3
if (!pBufConfig || !pBufConfig->pBufStatus)
return SIO2_EINVAL;
- Queue_put (device->fromdevice, srcFrame);
+ Queue_put (device->fromdevice, (Queue_Elem *)srcFrame);
+//GJ: PAF_SIO_REQUEST_AUTO, Not Supported, yet.
if (srcFrame->arg == PAF_SIO_REQUEST_AUTO) {
-
+#if 0
// if not yet running, prime input buffer
if (pDevExt->syncState == SYNC_NONE) {
status = DIB_FTABLE_issueChild (device, &pDevExt->bufConfig, pDevExt->autoRequestSize, 0);
if (status)
return status;
+#endif
}
else if (srcFrame->arg == PAF_SIO_REQUEST_NEWFRAME) {
// .........................................................................
if (dstFrame->arg == PAF_SIO_REQUEST_AUTO) {
-
+//GJ: PAF_SIO_REQUEST_AUTO - not supported, yet.
+#if 0
Log_info0("DIB: At case = PAF_SIO_REQUEST_AUTO"); // GJ Debug
// verify set up by prior DIB_issue()
if (status)
return status;
}
+
+#endif
} //dstFrame->arg == PAF_SIO_REQUEST_AUTO
// .........................................................................
Queue_enqueue (device->fromdevice, Queue_dequeue (device->todevice));
while (!Queue_empty (device->fromdevice))
- Queue_enqueue (&((SIO2_Handle) device)->framelist, Queue_dequeue (device->fromdevice));
+ Queue_enqueue (Queue_handle(&((SIO2_Handle) device)->framelist), Queue_dequeue (device->fromdevice));
status = DIB_FTABLE_reset (device, NULL);
if (status)
frame = DEV2_mkframe (0, 0, 0);
if (!frame)
return SYS_EALLOC;
- Queue_put (&((SIO2_Handle)pChild)->framelist, frame);
+ Queue_put (Queue_handle(&((SIO2_Handle)pChild)->framelist), (Queue_Elem *) frame);
}
// open underlying device
// syncScan makes this assumption in order to perform an efficient scan.
{
int sizeofStride = pBufConfig->sizeofElement*pBufConfig->stride*pDevExt->pcmFrameLength;
- pBufConfig->sizeofBuffer = pBufConfig->allocation/sizeofStride*sizeofStride;
+ pBufConfig->sizeofBuffer = (pBufConfig->allocation)/sizeofStride*sizeofStride;
}
if (pDevExt->sourceSelect == PAF_SOURCE_DSD1 || pDevExt->sourceSelect == PAF_SOURCE_DSD2 ||
@@ -1111,11 +1117,13 @@ Int DIB_issueChild (DEV2_Handle device, PAF_InpBufConfig *pBufConfig, int size,
// the buffer is a multiple of 8 and so, by using this single statement, we
// ensure all requests are a mulitple 8 even if they need to be split across
// the buffer wrap point.
- if (pBufConfig->stride == 8)
- size = (size + 7) & ~0x7;
+
+ /* GJ: The below is dMAX specific & unnecessary now w/ EDMA*/
+ //if (pBufConfig->stride == 8)
+ //size = (size + 7) & ~0x7;
// convert to bytes
- size = (size * pBufConfig->sizeofElement); //To Do: +2 GJ : Temporary, to get past initial hiccup. // GJ Debug
+ size *= pBufConfig->sizeofElement;
//size *= 4;
// if request crosses circular buffer boundary then split into two requests
@@ -1140,14 +1148,14 @@ Int DIB_issueChild (DEV2_Handle device, PAF_InpBufConfig *pBufConfig, int size,
for (i=0; i < 2; i++) {
if (sizes[i]) {
- dstFrame = Queue_get (&((SIO2_Handle) pChild)->framelist);
+ dstFrame = Queue_get (Queue_handle(&((SIO2_Handle) pChild)->framelist));
if (dstFrame == (DEV2_Frame *)&((SIO2_Handle) pChild)->framelist)
return DIBERR_UNSPECIFIED;
dstFrame->arg = (Arg) pBufConfig;
dstFrame->addr = pBufConfig->futureHead.pVoid;
dstFrame->size = sizes[i];
- Queue_put (pChild->todevice, dstFrame);
+ Queue_put (pChild->todevice, (Queue_Elem *)dstFrame);
status = DEV2_issue (pChild);
if (status)
return DIBERR_UNSPECIFIED;
srcFrame = Queue_get (pChild->fromdevice);
//Log_info2("DIB_reclaimChild.%d calling Queue_put(), srcFrame = 0x%x", __LINE__, srcFrame); // GJ Debug
//TRACE((&TR_MOD, "DIB_reclaimChild.%d calling Queue_put(), srcFrame = 0x%x\n", __LINE__, srcFrame));
- Queue_put (&((SIO2_Handle) pChild)->framelist, srcFrame);
+ Queue_put (Queue_handle(&((SIO2_Handle) pChild)->framelist), (Queue_Elem *)srcFrame);
// Only for non-fill requests do we update ptrs
if (srcFrame->addr != NULL) {
// compute and use *effective buffer size*
sizeofStride = pBufConfig->sizeofElement*pBufConfig->stride;
- pBufConfig->sizeofBuffer = pBufConfig->allocation/sizeofStride*sizeofStride;
+ pBufConfig->sizeofBuffer = (pBufConfig->allocation)/sizeofStride*sizeofStride; //GJ: Debug - Account for EDMA padding
//hack -- save status context for use in close
pDevExt->pInpBufStatus = pBufConfig->pBufStatus;
@@ -1426,7 +1434,7 @@ Int DIB_syncScan (DEV2_Handle device, PAF_InpBufConfig *pBufConfig, XDAS_UInt32
scanState = pDevExt->scanState;
pSync = pDevExt->pSync.pMdInt;
- Log_info3("DIB: Entered DIB_syncScan with zeroCount = %d & scanState = %d, pSync = 0x%x", zeroCount, scanState, pSync); // GJ Debug
+ Log_info4("DIB: Entered DIB_syncScan with zeroCount = %d & scanState = %d, stride = %d, pSync = 0x%x", zeroCount, scanState, stride, pSync); // GJ Debug
// scan until out of available data or a sync found
for (i=0; i < numLeft; i++) {
index aa1eca1e8bd50a440c94aa7c0b79198ce746f6a1..184a23d61dc77239f607f4dca992159baba5739d 100644 (file)
--- a/pasdk/test_dsp/mob/mob.c
+++ b/pasdk/test_dsp/mob/mob.c
return (SIO2_EBADIO);
} // DOB_close
+// GJ Debug Counters
+Uint32 gMobStart_Idle=0;
+Uint32 gMobIdle_ClocksElse=0;
+Uint32 gMobIdle_ClocksIf=0;
+Uint32 gMobOutRateX_Cnt=0;
+Uint32 gMobStart_Open=0;
+Uint32 gMobStart_Clocks=0;
+Uint32 gMobRateXChanged=0;
// -----------------------------------------------------------------------------
Int DOB_ctrl (DEV2_Handle device, Uns code, Arg arg)
return status;
status = DOB_FTABLE_startClocks (device);
+ gMobStart_Idle++;
}
break;
//TODO: check that we are idle?
pDevExt->rateX = 1.;
status = DEV2_ctrl (pChild, code, arg);
+ gMobStart_Open++;
if (status)
return status;
break;
float rateX = *(float *)arg;
int errno = SYS_OK;
+ gMobOutRateX_Cnt++;
+
if (pDevExt->rateX != rateX) {
- status = DEV2_idle (device,0);
+ status = DEV2_idle (device,0);
+ gMobRateXChanged++;
if (status)
return status;
errno = DOBERR_RATECHANGE;
if (arg) {
// flush data (and keep clocks)
DOB_FTABLE_shutdown (device);
+ gMobIdle_ClocksIf++;
status = DEV2_ctrl (pChild, PAF_SIO_CONTROL_IDLE_WITH_CLOCKS, arg);
if (!status)
pDevExt->state = DOB_STATE_CLOCKING;
// truncate data (stops clocks)
DEV2_idle (device, 0);
status = DEV2_ctrl (pChild, code, arg);
+ gMobIdle_ClocksElse++;
}
break;
return status;
} // DOB_idle
-static Queue_Handle dobFrameQue;
+static Queue_Struct dobFrameQue;
// -----------------------------------------------------------------------------
// This function is called before main and hence no devices yet running.
Error_init(&eb);
- dobFrameQue = Queue_create (NULL, &eb);
- if (!dobFrameQue) {
- Log_info1 ("DOB_init failed after Queue_create:", SYS_EALLOC);
+ //dobFrameQue = Queue_create (NULL, &eb);
+ Queue_construct (&dobFrameQue, NULL);
+ if (Queue_handle(&dobFrameQue) == NULL) {
+ Log_info1 ("DOB_init failed after Queue_construct:", SYS_EALLOC);
return;
}
if (!pParentFrame->addr)
return SIO2_EINVAL;
pBufConfig = (PAF_OutBufConfig *) pParentFrame->addr;
- Queue_put (device->fromdevice, pParentFrame);
+ Queue_put (device->fromdevice, (Queue_Elem *)pParentFrame);
Log_info0("Still In MOB Issue - 1");
// will be <= this size. Effectively each DEV2_Frame is assigned a unique
// segment of the buffer. This simplifies bookeeping and limits passing
// side information between issue and reclaim.
- pChildFrame = Queue_head (&((SIO2_Handle)pChild)->framelist);
+ pChildFrame = Queue_head (Queue_handle(&((SIO2_Handle)pChild)->framelist));
for (i=0; i < pDevExt->maxNumBuf; i++) {
pChildFrame->arg = (Arg) ((int) pBufConfig->pntr.pVoid + i*pBufConfig->sizeofBuffer/pDevExt->maxNumBuf);
pChildFrame = Queue_next ((Queue_Elem *) pChildFrame);
return DOB_FTABLE_issueIEC (device, pBufConfig);
for (i=0; i < numXfers; i++) {
- pChildFrame = Queue_get (&((SIO2_Handle)pChild)->framelist);
+ pChildFrame = Queue_get (Queue_handle(&((SIO2_Handle)pChild)->framelist));
if (pChildFrame == (DEV2_Frame *)&((SIO2_Handle)pChild)->framelist)
return SIO2_EBADIO;
pChildFrame->addr = (Ptr) pChildFrame->arg;
pChildFrame->size = xferSize;
- Queue_put (pChild->todevice, pChildFrame);
+ Queue_put (pChild->todevice, (Queue_Elem *)pChildFrame);
status = DEV2_issue(pChild);
if (status != SYS_OK)
return status;
numBytes = pBufConfig->head.pSmInt - pBufConfig->pntr.pSmInt;
- pChildFrame = Queue_get (&((SIO2_Handle)pChild)->framelist);
+ pChildFrame = Queue_get (Queue_handle(&((SIO2_Handle)pChild)->framelist));
if (pChildFrame == (DEV2_Frame *)&((SIO2_Handle)pChild)->framelist)
return SIO2_EBADIO;
pChildFrame->addr = NULL; // send zero data
}
- Queue_put (pChild->todevice, pChildFrame);
+ Queue_put (pChild->todevice, (Queue_Elem *)pChildFrame);
status = DEV2_issue(pChild);
if (status != SYS_OK)
return status;
else {
// when kick-started send nbufs of zeroes
for (i=0; i < pChild->nbufs; i++) {
- pChildFrame = Queue_get (&((SIO2_Handle)pChild)->framelist);
+ pChildFrame = Queue_get (Queue_handle(&((SIO2_Handle)pChild)->framelist));
if (pChildFrame == (DEV2_Frame *)&((SIO2_Handle)pChild)->framelist)
return SIO2_EBADIO;
pChildFrame->size = xferSize;
pChildFrame->addr = NULL; // send zero data
- Queue_put (pChild->todevice, pChildFrame);
+ Queue_put (pChild->todevice, (Queue_Elem *)pChildFrame);
status = DEV2_issue(pChild);
if (status != SYS_OK)
return status;
return DOBERR_NOTRUNNING;
// if no available frames then wait for one to free o/w pull one from queue
- if (Queue_empty (&((SIO2_Handle)pChild)->framelist)) {
+ if (Queue_empty (Queue_handle(&((SIO2_Handle)pChild)->framelist))) {
status = DEV2_reclaim (pChild);
if (status != SYS_OK)
return status;
// place frame at end of queue to be used later by issue
// since queue was empty this will place it on the head of the queue
- Queue_put (&((SIO2_Handle)pChild)->framelist, pChildFrame);
+ Queue_put (Queue_handle(&((SIO2_Handle)pChild)->framelist), (Queue_Elem *)pChildFrame);
}
else
// since queue is not empty then get head of queue which will be the next one used by issue
- pChildFrame = Queue_head (&((SIO2_Handle)pChild)->framelist);
+ pChildFrame = Queue_head (Queue_handle(&((SIO2_Handle)pChild)->framelist));
// if in IEC mode then don't update ptrs (this is done by issueIEC),
// otherwise we assume encoder is PCE and we need these updates
Queue_enqueue (device->fromdevice, Queue_dequeue(device->todevice));
while (!Queue_empty(device->fromdevice))
- Queue_enqueue(&((SIO2_Handle) device)->framelist, Queue_dequeue(device->fromdevice));
+ Queue_enqueue(Queue_handle(&((SIO2_Handle) device)->framelist), Queue_dequeue(device->fromdevice));
return SYS_OK;
} // DOB_shutdown
//xferSize = numChan * wordSize * 1;
xferSize = numChan * wordSize * 4; // GJ: Experiment with longer startup transfers
- pChildFrame = Queue_get (&((SIO2_Handle)pChild)->framelist);
+ pChildFrame = Queue_get (Queue_handle(&((SIO2_Handle)pChild)->framelist));
if (pChildFrame == (DEV2_Frame *)&((SIO2_Handle)pChild)->framelist)
return SIO2_EBADIO;
pChildFrame->arg = NULL;
pChildFrame->size = xferSize;
- Queue_put (pChild->todevice, pChildFrame);
+ Queue_put (pChild->todevice, (Queue_Elem *)pChildFrame);
status = DEV2_issue (pChild);
if (status != SYS_OK)
return status;
pDevExt->state = DOB_STATE_CLOCKING;
+ gMobStart_Clocks++;
+ Log_info0("Leaving DOB_startClocks with DOB_STATE_CLOCKING");
+
return status;
} // DOB_startClocks
{
DOB_DeviceExtension *pDevExt = (DOB_DeviceExtension *)device->object;
DEV2_Handle pChild = (DEV2_Handle)&pDevExt->child;
- Queue_Handle pChildQue = &((SIO2_Handle)pChild)->framelist;
+ Queue_Handle pChildQue = Queue_handle(&((SIO2_Handle)pChild)->framelist);
DEV2_Frame *pFrame;
Int i;
// first pull off any frames from the child frame queue and place in holder
while (!Queue_empty (pChildQue)) {
pFrame = (DEV2_Frame *) Queue_get (pChildQue);
- Queue_put (dobFrameQue, (Queue_Elem *) pFrame);
+ Queue_put (Queue_handle(&dobFrameQue), (Queue_Elem *) pFrame);
}
// next pull frames from holder and place onto child queue. If there aren't
// enough in the holder then allocate from memory. We only support
// ISSUERECLAIM mode so size = 0
for (i=0; i < pDevExt->maxNumBuf; i++) {
- if (Queue_empty (dobFrameQue))
+ if (Queue_empty (Queue_handle(&dobFrameQue)))
pFrame = DEV2_mkframe (0, 0, 0);
else
- pFrame = (DEV2_Frame *) Queue_get (dobFrameQue);
+ pFrame = (DEV2_Frame *) Queue_get (Queue_handle(&dobFrameQue));
if (!pFrame)
return SYS_EALLOC;
index 6797dcc6273e67061ba4fce6226608af439dbe08..f98c6fe24725685558458ef1042e3102dad9ecfc 100644 (file)
--- a/pasdk/test_dsp/sap/sap.c
+++ b/pasdk/test_dsp/sap/sap.c
void swapHdmi(Ptr, int);
-#define TEST_MULTICHANNEL
+//#define TEST_MULTICHANNEL
#ifdef TEST_MULTICHANNEL
-#define SAP_UNDER_LEN 4
+#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
+
+#ifdef DEBUG
void DJDBG_SAP_EDMA_dumpParams(int tag_place)
{
unsigned int *ptrPARAM_BASE = (unsigned int *)0x02704000;
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
}
+#endif
// .............................................................................
// notes:
// . add control function to PORT table
Int SAP_shutdown(DEV2_Handle);
Int SAP_start(DEV2_Handle);
Int SAP_config(DEV2_Handle device, const SAP_Params *pParams);
-Int SAP_EDMA_setupParam (DEV2_Handle device, XDAS_UInt32 targetEdma, XDAS_UInt32 childEdma, unsigned int addr, unsigned int size);
+Int SAP_EDMA_setupParam (DEV2_Handle device, XDAS_UInt32 targetEdma, XDAS_UInt32 childEdma, XDAS_UInt32 addr, XDAS_UInt32 size);
Int SAP_EDMA_setupXfer (DEV2_Handle device, XDAS_UInt32 targetEdma, XDAS_UInt32 parentEdma, XDAS_UInt32 childEdma, DEV2_Frame *pFrame);
// .............................................................................
} // SAP_start
int gDmaParamsarray[17][3];
-int gDmaParamsidx=0;
+int gDmaParamsidx=0, gSAPSpecialCase=0;
// -----------------------------------------------------------------------------
Int SAP_issue (DEV2_Handle device)
pFrame = Queue_dequeue (device->todevice);
pParam = (SAP_EDMA_Param *) Queue_dequeue (Queue_handle(&pDevExt->paramQue));
- /* if (pFrame->addr == NULL)
- SW_BREAKPOINT; */
if (pParam->hEdmaParam == NULL)
Log_info0("SAP_issue: hEdma value is NULL");
// set misc argument to pParam so get enqueue later
// special case enables when not yet started
if (pDevExt->runState == 0) {
+ gSAPSpecialCase++;
result = SAP_FTABLE_start (device);
if (result) {
//SAP_DMA_FTABLE_unlock (device);
- Hwi_enable ();
+ Hwi_restore (key);
return result;
}
}
}
- Log_info3("SAP: Exiting swapHdmi with Frame->Addr: 0x%x, p1->addr: 0x%x, p2->addr: 0x%x ", (MdInt *)Input, p1, p2);
-
- /**p2++ = 0xF872;
- *p2++ = 0x4E1F;
- *p2++ = 0x0016;
- *p2++ = 0xEFF0;
- *p2++ = 0x079E;
- *p2++ = 0x0003;
- *p2++ = 0x8401;
- *p2++ = 0x0101; */
+ Log_info3("SAP: Exiting swapHdmi with Frame->Addr: 0x%x, p1->addr: 0x%x, p2->addr: 0x%x ", (xdc_IArg)Input, p1, p2);
return;
}
Int SAP_reclaim (DEV2_Handle device)
{
SAP_DeviceExtension *pDevExt = (SAP_DeviceExtension *)(device->object);
- Int result, i, oldMask;
#ifdef SAP_CACHE_SUPPORT
DEV2_Frame *pFrame;
#endif
{
Cache_inv (pFrame->addr, pFrame->size, Cache_Type_ALL, 0);
Cache_wait();
- //note: size here is in # of bytes, so incrementing by 4X32b words ( or 8X16b)
- //for(i=0; i<(pFrame->size)/(4*4); i+=16)
- //{
- // Hwi_disable commented since it used to affect other interrupts
- // max HWI disable duration ~1ms observed
- //oldMask = Hwi_disable ();
- swapHdmi(pFrame->addr, pFrame->size);
- //Hwi_restore(oldMask);
-
- Cache_wb (pFrame->addr, pFrame->size, Cache_Type_ALL, 0);
- Cache_wait();
- //}
+
+ // max HWI disable duration ~1ms observed
+ //unsigned int key = Hwi_disable (); // GJ: Revisit, along with other context protections here.
+ swapHdmi(pFrame->addr, pFrame->size);
+ //Hwi_restore(key);
}
}
SAP_DeviceExtension *pDevExt = (SAP_DeviceExtension *)(device->object);
SIO2_Handle stream = (SIO2_Handle) device;
DEV2_Frame *pFrame;
- Int result,i;
+ Int i;
EDMA3_DRV_Handle hEdma;
//TRACE_GEN((&TR_MOD, "SAP_shutdown.%d (0x%x)", __LINE__, device));
// -----------------------------------------------------------------------------
int gSapWatchDogThrottle = 0; //DJDBG
+int gSapWatchDogIn =0;
+int gSapWatchDogOut = 0;
+int gSapWatchDogInSemPost = 0;
+int gSapWatchDogOutSemPost = 0;
+
Void SAP_watchDog (Void)
{
DEV2_Handle device;
return;
}
+
// 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));
for (i=0; i < sapDrv.numDevices; i++) {
// set errorState which will force owner thread
// to clean up via SIO_idle()
pDevExt->errorState = PAF_SIO_ERROR_FATAL;
+ if(device->mode == DEV2_INPUT)
+ gSapWatchDogIn++;
+ else
+ gSapWatchDogOut++;
+
//TRACE_TERSE((&TR_MOD, "SAP_watchDog.%d, PAF_SIO_ERROR_FATAL: 0x%x", __LINE__, pDevExt->errorState));
/* if(gSapWatchDogThrottle == 0) //DJDBG
{
if(gSapWatchDogThrottle > 10) gSapWatchDogThrottle = 0; */
// if outstanding pend then post to free owner thead
if (!Semaphore_pend(pDevExt->sync, 0))
- Semaphore_post (pDevExt->sync);
+ {
+ if(device->mode == DEV2_INPUT)
+ gSapWatchDogInSemPost++;
+ else
+ gSapWatchDogOutSemPost++;
+ Semaphore_post (pDevExt->sync);
+ }
}
}
+
// renable interrupts and task manager.
// If we posted to the semaphore then the TSK_enable call will lead to
// an immediate task switch to the associated audio thread.
device = (DEV2_Handle) context;
pDevExt = (SAP_DeviceExtension *)(device->object);
- if (pDevExt->pParams == NULL)
- return SIO2_EINVAL;
+ //if (pDevExt->pParams == NULL)
+ //return SIO2_EINVAL;
if (pDevExt->pParams->sio.moduleNum == 0)
hEdma = hEdma0;
pDevExt->numQueued -= 1;
//gIsrCnt++;
if (device->mode == 1)
- gisrOutput++;
-
+ gIsrOutputCnt++;
+ else
+ gIsrInputCnt++;
// place frame onto user queue and signal user thread
Queue_enqueue (device->fromdevice, (Ptr) pFrame);
- Log_info2("Before SEM_post for device: 0x%x gIsrOutput: %d", device->mode, gisrOutput);
+ //Log_info2("Before SEM_post for device: 0x%x gIsrOutput: %d", device->mode, gisrOutput);
// signal user thread
Semaphore_post (pDevExt->sync);
#if 0
@@ -1344,7 +1349,7 @@ Int SAP_EDMA_setupXfer (DEV2_Handle device, XDAS_UInt32 targetEdma, XDAS_UInt32
{
Log_info0("pFrame has NULL address?");
}
- SAP_DMA_FTABLE_setupParam (device, targetEdma, childEdma, pFrame->addr, pFrame->size);
+ SAP_DMA_FTABLE_setupParam (device, targetEdma, childEdma, (XDAS_UInt32) pFrame->addr, pFrame->size);
if (parentEdma != EDMA_HINV)
EDMA3_DRV_linkChannel (hEdma, parentEdma, targetEdma);
@@ -1358,7 +1363,7 @@ Int SAP_EDMA_setupXfer (DEV2_Handle device, XDAS_UInt32 targetEdma, XDAS_UInt32
// -----------------------------------------------------------------------------
// Configure EDMA3 parameter entry
-Int SAP_EDMA_setupParam (DEV2_Handle device, XDAS_UInt32 targetEdma, XDAS_UInt32 childEdma, unsigned int addr, unsigned int size)
+Int SAP_EDMA_setupParam (DEV2_Handle device, XDAS_UInt32 targetEdma, XDAS_UInt32 childEdma, XDAS_UInt32 addr, XDAS_UInt32 size)
{
SAP_DeviceExtension *pDevExt = (SAP_DeviceExtension *)device->object;
EDMA3_DRV_Handle hEdma;
@@ -1372,7 +1377,7 @@ Int SAP_EDMA_setupParam (DEV2_Handle device, XDAS_UInt32 targetEdma, XDAS_UInt32
else if (pDevExt->pParams->sio.moduleNum == 1 || pDevExt->pParams->sio.moduleNum == 2)
hEdma = hEdma1;
MCASP_Handle hPort = sapMcaspDrv.hPort[pDevExt->pParams->sio.moduleNum];
- volatile Uint32 *base = (volatile Uint32 *)(hPort->baseAddr);
+ // volatile Uint32 *base = (volatile Uint32 *)(hPort->baseAddr);
//Log_info3("%s.%d: Entered SAP_EDMA_setupParam for Target: 0x%x.\n", (xdc_IArg)__FUNCTION__, __LINE__, targetEdma);
@@ -1422,7 +1427,7 @@ Int SAP_EDMA_setupParam (DEV2_Handle device, XDAS_UInt32 targetEdma, XDAS_UInt32
edmaConfig.destAddr = addr;
edmaConfig.destCIdx = pDevExt->edmaWordSize * pDevExt->numSers ;
if(pDevExt->edmaWordSize == 2)
- edmaConfig.cCnt= (size)/((edmaConfig.aCnt * edmaConfig.bCnt)/2); // GJ: Account for additional 2-bytes.
+ edmaConfig.cCnt= (size)/((edmaConfig.aCnt * edmaConfig.bCnt)/2);
}
else {
//if(pDevExt->edmaWordSize == 2)
@@ -1439,14 +1444,14 @@ Int SAP_EDMA_setupParam (DEV2_Handle device, XDAS_UInt32 targetEdma, XDAS_UInt32
edmaConfig.srcBIdx = pDevExt->edmaWordSize;
edmaConfig.srcCIdx = pDevExt->edmaWordSize * pDevExt->numSers ;
edmaConfig.srcAddr = addr;
- Edma3_CacheFlush ((unsigned int) addr, (size+3)/4);
+ //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 = 512; //DJDBG, if underrun have frame of silence
+ edmaConfig.cCnt = SAP_UNDER_LEN; //DJDBG, if underrun have frame of silence
#endif
}
}