misrac fix for 4.2.0 (PRSDK-3354)
authorSuraj Das <s-das@ti.com>
Fri, 8 Dec 2017 23:05:13 +0000 (18:05 -0500)
committerSuraj Das <s-das@ti.com>
Fri, 8 Dec 2017 23:05:13 +0000 (18:05 -0500)
packages/ti/sdo/edma3/rm/src/edma3resmgr.c

index fed46ebdbe10a4dc47de5d5c3482e6eb2bd66f58..98dc8cb18195fc5b8cd0cf0c8e5a1628a2becb70 100755 (executable)
@@ -2986,28 +2986,31 @@ EDMA3_RM_Result EDMA3_RM_mapEdmaChannel (EDMA3_RM_Handle hEdmaResMgr,
     /* DMA channel and PaRAM Set should be previously allocated. */
     if (result == EDMA3_RM_SOK)
         {
-        if (((rmInstance->initParam.rmInstInitConfig->ownDmaChannels[channelId/32U])
-                                                  &
-                                                  (~(rmInstance->avlblDmaChannels[channelId/32U]))
-                                                  &
-                                                  ((uint32_t)1U << (channelId%32U))) != FALSE)
+        if(((channelId/32U) < 2) && ((paRAMId/32U) < 16))
             {
-            /* DMA channel allocated, check for the PaRAM Set */
-            if (((rmInstance->initParam.rmInstInitConfig->ownPaRAMSets[paRAMId/32U])
-                                          &
-                                          (~(rmInstance->avlblPaRAMSets[paRAMId/32U]))
-                                          &
-                                          ((uint32_t)1U << (paRAMId%32U))) == FALSE)
+            if (((rmInstance->initParam.rmInstInitConfig->ownDmaChannels[channelId/32U])
+                                                      &
+                                                      (~(rmInstance->avlblDmaChannels[channelId/32U]))
+                                                      &
+                                                      ((uint32_t)1U << (channelId%32U))) != FALSE)
                 {
-                /* PaRAM Set NOT allocated, return error */
+                /* DMA channel allocated, check for the PaRAM Set */
+                if (((rmInstance->initParam.rmInstInitConfig->ownPaRAMSets[paRAMId/32U])
+                                              &
+                                              (~(rmInstance->avlblPaRAMSets[paRAMId/32U]))
+                                              &
+                                              ((uint32_t)1U << (paRAMId%32U))) == FALSE)
+                    {
+                    /* PaRAM Set NOT allocated, return error */
+                    result = EDMA3_RM_E_RES_NOT_ALLOCATED;
+                    }
+                }
+            else
+                {
+                /* DMA channel NOT allocated, return error */
                 result = EDMA3_RM_E_RES_NOT_ALLOCATED;
                 }
             }
-        else
-            {
-            /* DMA channel NOT allocated, return error */
-            result = EDMA3_RM_E_RES_NOT_ALLOCATED;
-            }
         }
 
 
@@ -3115,28 +3118,31 @@ EDMA3_RM_Result EDMA3_RM_mapQdmaChannel (EDMA3_RM_Handle hEdmaResMgr,
     /* QDMA channel and PaRAM Set should be previously allocated. */
     if (result == EDMA3_RM_SOK)
         {
-        if (((rmInstance->initParam.rmInstInitConfig->ownQdmaChannels[channelId/32U])
-                                                  &
-                                                  (~(rmInstance->avlblQdmaChannels[channelId/32U]))
-                                                  &
-                                                  ((uint32_t)1U << (channelId%32U))) != FALSE)
+        if(((channelId/32U) < 1) && ((paRAMId/32U) < 16))
             {
-            /* QDMA channel allocated, check for the PaRAM Set */
-            if (((rmInstance->initParam.rmInstInitConfig->ownPaRAMSets[paRAMId/32U])
-                                          &
-                                          (~(rmInstance->avlblPaRAMSets[paRAMId/32U]))
-                                          &
-                                          ((uint32_t)1U << (paRAMId%32U))) == FALSE)
+            if (((rmInstance->initParam.rmInstInitConfig->ownQdmaChannels[channelId/32U])
+                                                      &
+                                                      (~(rmInstance->avlblQdmaChannels[channelId/32U]))
+                                                      &
+                                                      ((uint32_t)1U << (channelId%32U))) != FALSE)
                 {
-                /* PaRAM Set NOT allocated, return error */
+                /* QDMA channel allocated, check for the PaRAM Set */
+                if (((rmInstance->initParam.rmInstInitConfig->ownPaRAMSets[paRAMId/32U])
+                                              &
+                                              (~(rmInstance->avlblPaRAMSets[paRAMId/32U]))
+                                              &
+                                              ((uint32_t)1U << (paRAMId%32U))) == FALSE)
+                    {
+                    /* PaRAM Set NOT allocated, return error */
+                    result = EDMA3_RM_E_RES_NOT_ALLOCATED;
+                    }
+                }
+            else
+                {
+                /* QDMA channel NOT allocated, return error */
                 result = EDMA3_RM_E_RES_NOT_ALLOCATED;
                 }
             }
-        else
-            {
-            /* QDMA channel NOT allocated, return error */
-            result = EDMA3_RM_E_RES_NOT_ALLOCATED;
-            }
         }
 
     if (result == EDMA3_RM_SOK)
@@ -3585,7 +3591,7 @@ EDMA3_RM_Result EDMA3_RM_allocContiguousResource(EDMA3_RM_Handle hEdmaResMgr,
                                 resIdSet = (1U << (resAllocIdx%32U));
 
                                 /* Check whether it is owned or not */
-                                if (((rmInstance->initParam.rmInstInitConfig->ownDmaChannels[resAllocIdx/32U])&(resIdSet)) != FALSE)
+                                if (((resAllocIdx/32U) < 2) && (((rmInstance->initParam.rmInstInitConfig->ownDmaChannels[resAllocIdx/32U])&(resIdSet)) != FALSE))
                                    {
                                     /* Now check if specified resource is available presently*/
                                     if (((rmInstance->avlblDmaChannels[resAllocIdx/32U])&(resIdSet)) != FALSE)
@@ -3707,7 +3713,7 @@ EDMA3_RM_Result EDMA3_RM_allocContiguousResource(EDMA3_RM_Handle hEdmaResMgr,
                                 resIdSet = (1U << (resAllocIdx%32U));
 
                                 /* Check whether it is owned or not */
-                                if (((rmInstance->initParam.rmInstInitConfig->ownTccs[resAllocIdx/32U])&(resIdSet))!=FALSE)
+                                if (((resAllocIdx/32U) < 2) && (((rmInstance->initParam.rmInstInitConfig->ownTccs[resAllocIdx/32U])&(resIdSet))!=FALSE))
                                    {
                                     /* Now check if specified resource is available presently*/
                                     if (((rmInstance->avlblTccs[resAllocIdx/32U])&(resIdSet))!=FALSE)
@@ -3774,7 +3780,7 @@ EDMA3_RM_Result EDMA3_RM_allocContiguousResource(EDMA3_RM_Handle hEdmaResMgr,
                                 if (((rmInstance->initParam.rmInstInitConfig->ownPaRAMSets[resAllocIdx/32U])&(resIdSet))!=FALSE)
                                    {
                                     /* Now check if specified resource is available presently*/
-                                    if (((rmInstance->avlblPaRAMSets[resAllocIdx/32U])&(resIdSet))!=FALSE)
+                                    if (((resAllocIdx/32U) < 16) && (((rmInstance->avlblPaRAMSets[resAllocIdx/32U])&(resIdSet))!=FALSE))
                                         {
                                         /*
                                          * Mark the specified resource as "Not Available"