diff --git a/packages/ti/sdo/edma3/drv/src/edma3_drv_basic.c b/packages/ti/sdo/edma3/drv/src/edma3_drv_basic.c
index 5d5123003921073bda05cb56264f14f00922acbd..2a6ab6e155c0a32f2f4645c8272e49596810e663 100755 (executable)
if (EDMA3_DRV_SOK == result)
if (EDMA3_DRV_SOK == result)
+ {
+ if(channelId < EDMA3_MAX_LOGICAL_CH)
{
{
- if (chType == EDMA3_DRV_CHANNEL_TYPE_LINK)
- {
- /* LINK Channel */
- resObj.type = EDMA3_RM_RES_PARAM_SET;
+ if (chType == EDMA3_DRV_CHANNEL_TYPE_LINK)
+ {
+ /* LINK Channel */
+ resObj.type = EDMA3_RM_RES_PARAM_SET;
- /* Get the PaRAM id from the book-keeping info. */
- resObj.resId = (uint32_t)(edma3DrvChBoundRes[edma3Id][channelId].paRAMId);
+ /* Get the PaRAM id from the book-keeping info. */
+ resObj.resId = (uint32_t)(edma3DrvChBoundRes[edma3Id][channelId].paRAMId);
- result = EDMA3_RM_freeResource(drvInst->resMgrInstance,
- (EDMA3_RM_ResDesc *)&resObj);
+ result = EDMA3_RM_freeResource(drvInst->resMgrInstance,
+ (EDMA3_RM_ResDesc *)&resObj);
- if (EDMA3_DRV_SOK == result)
- {
- edma3DrvChBoundRes[edma3Id][channelId].paRAMId = -1;
- }
- }
- else
- {
- /* DMA/QDMA Channel */
- paRAMId = edma3DrvChBoundRes[edma3Id][channelId].paRAMId;
- tcc = edma3DrvChBoundRes[edma3Id][channelId].tcc;
-
- /* Check the paRAMId and tcc values first */
- if ((paRAMId < 0) || (paRAMId >= drvObject->gblCfgParams.numPaRAMSets))
- {
- result = EDMA3_DRV_E_INVALID_PARAM;
+ if (EDMA3_DRV_SOK == result)
+ {
+ edma3DrvChBoundRes[edma3Id][channelId].paRAMId = -1;
+ }
}
}
-
- if (tcc >= drvObject->gblCfgParams.numTccs)
+ else
{
{
- result = EDMA3_DRV_E_INVALID_PARAM;
- }
+ /* DMA/QDMA Channel */
+ paRAMId = edma3DrvChBoundRes[edma3Id][channelId].paRAMId;
+ tcc = edma3DrvChBoundRes[edma3Id][channelId].tcc;
- if (EDMA3_DRV_SOK == result)
- {
- /* Disable the transfer and remove various mappings. */
- result = edma3RemoveMapping(hEdma, channelId);
- }
+ /* Check the paRAMId and tcc values first */
+ if ((paRAMId < 0) || (paRAMId >= drvObject->gblCfgParams.numPaRAMSets))
+ {
+ result = EDMA3_DRV_E_INVALID_PARAM;
+ }
- if (EDMA3_DRV_SOK == result)
- {
- /* Now Free the PARAM set and TCC */
- resObj.type = EDMA3_RM_RES_PARAM_SET;
- resObj.resId = (uint32_t)paRAMId;
- result = EDMA3_RM_freeResource(drvInst->resMgrInstance, (EDMA3_RM_ResDesc *)&resObj);
+ if (tcc >= drvObject->gblCfgParams.numTccs)
+ {
+ result = EDMA3_DRV_E_INVALID_PARAM;
+ }
if (EDMA3_DRV_SOK == result)
{
if (EDMA3_DRV_SOK == result)
{
- /* PaRAM Set Freed */
- edma3DrvChBoundRes[edma3Id][channelId].paRAMId = -1;
-
- /* Free the TCC */
- resObj.type = EDMA3_RM_RES_TCC;
- resObj.resId = tcc;
- result = EDMA3_RM_freeResource(drvInst->resMgrInstance,
- (EDMA3_RM_ResDesc *)&resObj);
+ /* Disable the transfer and remove various mappings. */
+ result = edma3RemoveMapping(hEdma, channelId);
}
if (EDMA3_DRV_SOK == result)
{
}
if (EDMA3_DRV_SOK == result)
{
- /* TCC Freed. */
- edma3DrvChBoundRes[edma3Id][channelId].tcc = EDMA3_MAX_TCC;
+ /* Now Free the PARAM set and TCC */
+ resObj.type = EDMA3_RM_RES_PARAM_SET;
+ resObj.resId = (uint32_t)paRAMId;
+ result = EDMA3_RM_freeResource(drvInst->resMgrInstance, (EDMA3_RM_ResDesc *)&resObj);
- /* Now free the DMA/QDMA Channel in the end. */
- if (chType == EDMA3_DRV_CHANNEL_TYPE_QDMA)
+ if (EDMA3_DRV_SOK == result)
{
{
- resObj.type = EDMA3_RM_RES_QDMA_CHANNEL;
- resObj.resId = (channelId - edma3_qdma_ch_min_val[edma3Id]);
+ /* PaRAM Set Freed */
+ edma3DrvChBoundRes[edma3Id][channelId].paRAMId = -1;
+
+ /* Free the TCC */
+ resObj.type = EDMA3_RM_RES_TCC;
+ resObj.resId = tcc;
result = EDMA3_RM_freeResource(drvInst->resMgrInstance,
(EDMA3_RM_ResDesc *)&resObj);
}
result = EDMA3_RM_freeResource(drvInst->resMgrInstance,
(EDMA3_RM_ResDesc *)&resObj);
}
- else
+
+ if (EDMA3_DRV_SOK == result)
{
{
- resObj.type = EDMA3_RM_RES_DMA_CHANNEL;
- resObj.resId = channelId;
- result = EDMA3_RM_freeResource(drvInst->resMgrInstance,
- (EDMA3_RM_ResDesc *)&resObj);
+ /* TCC Freed. */
+ edma3DrvChBoundRes[edma3Id][channelId].tcc = EDMA3_MAX_TCC;
+
+ /* Now free the DMA/QDMA Channel in the end. */
+ if (chType == EDMA3_DRV_CHANNEL_TYPE_QDMA)
+ {
+ resObj.type = EDMA3_RM_RES_QDMA_CHANNEL;
+ resObj.resId = (channelId - edma3_qdma_ch_min_val[edma3Id]);
+ result = EDMA3_RM_freeResource(drvInst->resMgrInstance,
+ (EDMA3_RM_ResDesc *)&resObj);
+ }
+ else
+ {
+ resObj.type = EDMA3_RM_RES_DMA_CHANNEL;
+ resObj.resId = channelId;
+ result = EDMA3_RM_freeResource(drvInst->resMgrInstance,
+ (EDMA3_RM_ResDesc *)&resObj);
+ }
}
}
}
}
}
}
- }
}
}
+ }
#ifdef EDMA3_INSTRUMENTATION_ENABLED
EDMA3_LOG_EVENT(&DVTEvent_Log,"EDMA3",
#ifdef EDMA3_INSTRUMENTATION_ENABLED
EDMA3_LOG_EVENT(&DVTEvent_Log,"EDMA3",
edma3OsProtectEntry(edma3Id, (int32_t)EDMA3_OS_PROTECT_INTERRUPT, &intState);
if (channelId <= edma3_dma_ch_max_val [edma3Id])
edma3OsProtectEntry(edma3Id, (int32_t)EDMA3_OS_PROTECT_INTERRUPT, &intState);
if (channelId <= edma3_dma_ch_max_val [edma3Id])
+ {
+ if((channelId >> 3U) < 8)
{
{
- /* DMA channel */
+ /* DMA channel */
#ifndef EDMA3_PROGRAM_QUEUE_NUM_REGISTER_INIT_TIME
#ifndef EDMA3_PROGRAM_QUEUE_NUM_REGISTER_INIT_TIME
- /* Remove the channel to Event Queue mapping */
- globalRegs->DMAQNUM[channelId >> 3U] &=
- EDMA3_DRV_DMAQNUM_CLR_MASK(channelId);
+ /* Remove the channel to Event Queue mapping */
+ globalRegs->DMAQNUM[channelId >> 3U] &=
+ EDMA3_DRV_DMAQNUM_CLR_MASK(channelId);
#endif
#endif
- /**
- * If DMA channel to PaRAM Set mapping exists,
- * remove it too.
- */
- if (TRUE == drvObject->gblCfgParams.dmaChPaRAMMapExists)
- {
- globalRegs->DCHMAP[channelId] &=
- EDMA3_RM_DCH_PARAM_CLR_MASK;
- }
+ /**
+ * If DMA channel to PaRAM Set mapping exists,
+ * remove it too.
+ */
+ if (TRUE == drvObject->gblCfgParams.dmaChPaRAMMapExists)
+ {
+ globalRegs->DCHMAP[channelId] &=
+ EDMA3_RM_DCH_PARAM_CLR_MASK;
+ }
}
}
+ else
+ {
+ result = EDMA3_DRV_E_INVALID_PARAM;
+ }
+ }
else
{
/* QDMA channel */
else
{
/* QDMA channel */