Misra C Fixes EDMA
authorSunil MS <x0190988@ti.com>
Wed, 3 Sep 2014 05:46:35 +0000 (11:16 +0530)
committerSunil MS <x0190988@ti.com>
Thu, 9 Oct 2014 14:11:26 +0000 (19:41 +0530)
Fixed Rules 10.1,10.6 and 14.9
Signed-off-by: Sunil MS <x0190988@ti.com>
Change-Id: If50cd5c524fef2c70f2255ff631777d3e41a943b

packages/ti/sdo/edma3/drv/src/edma3.h
packages/ti/sdo/edma3/drv/src/edma3_drv_basic.c
packages/ti/sdo/edma3/drv/src/edma3_drv_init.c

index c2339c7958c91114411e5738009a63e99e7e4188..ec5a703f7cf63f927ddc5b7fba3239f6294061ef 100755 (executable)
@@ -54,17 +54,17 @@ extern "C" {
 /** OPT-SAM bit Clear */
 #define EDMA3_DRV_OPT_SAM_CLR_MASK                  (~EDMA3_CCRL_OPT_SAM_MASK)
 /** OPT-SAM bit Set */
-#define EDMA3_DRV_OPT_SAM_SET_MASK(mode)            (((EDMA3_CCRL_OPT_SAM_MASK >> EDMA3_CCRL_OPT_SAM_SHIFT) & (mode)) << EDMA3_CCRL_OPT_SAM_SHIFT)
+#define EDMA3_DRV_OPT_SAM_SET_MASK(mode)            ((((uint32_t)(EDMA3_CCRL_OPT_SAM_MASK >> EDMA3_CCRL_OPT_SAM_SHIFT)) & (mode)) << EDMA3_CCRL_OPT_SAM_SHIFT)
 
 /** OPT-DAM bit Clear */
 #define EDMA3_DRV_OPT_DAM_CLR_MASK                  (~EDMA3_CCRL_OPT_DAM_MASK)
 /** OPT-DAM bit Set */
-#define EDMA3_DRV_OPT_DAM_SET_MASK(mode)            (((EDMA3_CCRL_OPT_DAM_MASK >> EDMA3_CCRL_OPT_DAM_SHIFT) & (mode)) << EDMA3_CCRL_OPT_DAM_SHIFT)
+#define EDMA3_DRV_OPT_DAM_SET_MASK(mode)            ((((uint32_t)(EDMA3_CCRL_OPT_DAM_MASK >> EDMA3_CCRL_OPT_DAM_SHIFT)) & (mode)) << EDMA3_CCRL_OPT_DAM_SHIFT)
 
 /** OPT-SYNCDIM bit Clear */
 #define EDMA3_DRV_OPT_SYNCDIM_CLR_MASK              (~EDMA3_CCRL_OPT_SYNCDIM_MASK)
 /** OPT-SYNCDIM bit Set */
-#define EDMA3_DRV_OPT_SYNCDIM_SET_MASK(synctype)    (((EDMA3_CCRL_OPT_SYNCDIM_MASK >> EDMA3_CCRL_OPT_SYNCDIM_SHIFT) & (synctype)) << EDMA3_CCRL_OPT_SYNCDIM_SHIFT)
+#define EDMA3_DRV_OPT_SYNCDIM_SET_MASK(synctype)    ((((uint32_t)(EDMA3_CCRL_OPT_SYNCDIM_MASK >> EDMA3_CCRL_OPT_SYNCDIM_SHIFT)) & (synctype)) << EDMA3_CCRL_OPT_SYNCDIM_SHIFT)
 
 /** OPT-STATIC bit Clear */
 #define EDMA3_DRV_OPT_STATIC_CLR_MASK               (~EDMA3_CCRL_OPT_STATIC_MASK)
@@ -74,7 +74,7 @@ extern "C" {
 /** OPT-FWID bitfield Clear */
 #define EDMA3_DRV_OPT_FWID_CLR_MASK                 (~EDMA3_CCRL_OPT_FWID_MASK)
 /** OPT-FWID bitfield Set */
-#define EDMA3_DRV_OPT_FWID_SET_MASK(width)          (((EDMA3_CCRL_OPT_FWID_MASK >> EDMA3_CCRL_OPT_FWID_SHIFT) & (width)) << EDMA3_CCRL_OPT_FWID_SHIFT)
+#define EDMA3_DRV_OPT_FWID_SET_MASK(width)          ((((uint32_t)(EDMA3_CCRL_OPT_FWID_MASK >> EDMA3_CCRL_OPT_FWID_SHIFT)) & (width)) << EDMA3_CCRL_OPT_FWID_SHIFT)
 
 /** OPT-TCCMODE bit Clear */
 #define EDMA3_DRV_OPT_TCCMODE_CLR_MASK              (~EDMA3_CCRL_OPT_TCCMODE_MASK)
@@ -143,12 +143,12 @@ extern "C" {
 /** DCHMAP-PaRAMEntry bitfield Clear */
 #define EDMA3_DRV_DCH_PARAM_CLR_MASK                (~EDMA3_CCRL_DCHMAP_PAENTRY_MASK)
 /** DCHMAP-PaRAMEntry bitfield Set */
-#define EDMA3_DRV_DCH_PARAM_SET_MASK(paRAMId)       (((EDMA3_CCRL_DCHMAP_PAENTRY_MASK >> EDMA3_CCRL_DCHMAP_PAENTRY_SHIFT) & (paRAMId)) << EDMA3_CCRL_DCHMAP_PAENTRY_SHIFT)
+#define EDMA3_DRV_DCH_PARAM_SET_MASK(paRAMId)       ((((uint32_t)(EDMA3_CCRL_DCHMAP_PAENTRY_MASK >> EDMA3_CCRL_DCHMAP_PAENTRY_SHIFT)) & (paRAMId)) << EDMA3_CCRL_DCHMAP_PAENTRY_SHIFT)
 
 /** QCHMAP-PaRAMEntry bitfield Clear */
 #define EDMA3_DRV_QCH_PARAM_CLR_MASK                (~EDMA3_CCRL_QCHMAP_PAENTRY_MASK)
 /** QCHMAP-PaRAMEntry bitfield Set */
-#define EDMA3_DRV_QCH_PARAM_SET_MASK(paRAMId)       (((EDMA3_CCRL_QCHMAP_PAENTRY_MASK >> EDMA3_CCRL_QCHMAP_PAENTRY_SHIFT) & (paRAMId)) << EDMA3_CCRL_QCHMAP_PAENTRY_SHIFT)
+#define EDMA3_DRV_QCH_PARAM_SET_MASK(paRAMId)       ((((uint32_t)(EDMA3_CCRL_QCHMAP_PAENTRY_MASK >> EDMA3_CCRL_QCHMAP_PAENTRY_SHIFT)) & (paRAMId)) << EDMA3_CCRL_QCHMAP_PAENTRY_SHIFT)
 /** QCHMAP-TrigWord bitfield Clear */
 #define EDMA3_DRV_QCH_TRWORD_CLR_MASK               (~EDMA3_CCRL_QCHMAP_TRWORD_MASK)
 /** QCHMAP-TrigWord bitfield Set */
index 519880c31c90f3c895eb0f98eba96da97f6fc391..25323b610e50fe8a7755eb92827bb161bd5e86f9 100755 (executable)
@@ -587,13 +587,13 @@ EDMA3_DRV_Result EDMA3_DRV_requestChannel (EDMA3_DRV_Handle hEdma,
                                                {
 #ifndef EDMA3_PROGRAM_QUEUE_NUM_REGISTER_INIT_TIME
                                                uint32_t intState = 0;
-                        edma3OsProtectEntry(edma3Id, EDMA3_OS_PROTECT_INTERRUPT,
+                        edma3OsProtectEntry(edma3Id, (int32_t)EDMA3_OS_PROTECT_INTERRUPT,
                                                                                        &intState);
                         /* Step 5: Associate QDMA Channel to Event Queue */
                         globalRegs->QDMAQNUM &= EDMA3_DRV_QDMAQNUM_CLR_MASK(qdmaChannel);
                         globalRegs->QDMAQNUM |= EDMA3_DRV_QDMAQNUM_SET_MASK(qdmaChannel, evtQueue);
 
-                        edma3OsProtectExit(edma3Id, EDMA3_OS_PROTECT_INTERRUPT,
+                        edma3OsProtectExit(edma3Id, (int32_t)EDMA3_OS_PROTECT_INTERRUPT,
                                                                                        intState);
 #endif
 
index f5f6203e3fe083928ca8f305a732b63a5f9a2a03..050ab448e1613ec909fc71ba0fe1ea8dfdd3dc3d 100755 (executable)
@@ -350,9 +350,6 @@ EDMA3_DRV_Result EDMA3_DRV_delete(uint32_t phyCtrllerInstId,
     {
     EDMA3_DRV_Result result = EDMA3_DRV_SOK;
 
-    /*to remove CCS remark: parameter "param" was never referenced */
-    (void)param;
-
        /* If parameter checking is enabled... */
 #ifndef EDMA3_DRV_PARAM_CHECK_DISABLE
     if (phyCtrllerInstId >= EDMA3_MAX_EDMA3_INSTANCES)
@@ -502,7 +499,7 @@ EDMA3_DRV_Handle EDMA3_DRV_open (uint32_t phyCtrllerInstId,
                                         sizeof (EDMA3_DRV_InstanceInitConfig));
 
             /* Flag to remember that driver has passed config info to RM */
-            flag = 1u;
+            flag = 1U;
             }
 
         if (NULL == drvObject->gblCfgParams.globalRegs)
@@ -527,18 +524,20 @@ EDMA3_DRV_Handle EDMA3_DRV_open (uint32_t phyCtrllerInstId,
                 {
                 drvObject->state = EDMA3_DRV_OPENED;
                 edma3OsProtectEntry (phyCtrllerInstId,
-                                                                       EDMA3_OS_PROTECT_INTERRUPT,
+                                                                       (int32_t)EDMA3_OS_PROTECT_INTERRUPT,
                                                                        &intState);
                 drvObject->numOpens++;
                 edma3OsProtectExit (phyCtrllerInstId,
-                                                                       EDMA3_OS_PROTECT_INTERRUPT,
+                                                                       (int32_t)EDMA3_OS_PROTECT_INTERRUPT,
                                                                        intState);
                 }
             }
         }
 
        if (errorCode)
-               *errorCode = result;
+        {
+            *errorCode = result;
+        }
     return (EDMA3_DRV_Handle)drvInstanceHandle;
     }
 
@@ -550,9 +549,6 @@ EDMA3_DRV_Result EDMA3_DRV_close(EDMA3_DRV_Handle hEdma,
     EDMA3_DRV_Instance *drvInst = NULL;
     EDMA3_DRV_Object *drvObject = NULL;
 
-    /*to remove CCS remark: parameter "param" was never referenced */
-    (void)param;
-
        /* If parameter checking is enabled... */
 #ifndef EDMA3_DRV_PARAM_CHECK_DISABLE
     if (hEdma == NULL)
@@ -596,7 +592,7 @@ EDMA3_DRV_Result EDMA3_DRV_close(EDMA3_DRV_Handle hEdma,
                     drvInst->shadowRegs = NULL;
 
                     edma3OsProtectEntry (drvObject->phyCtrllerInstId,
-                                                                               EDMA3_OS_PROTECT_INTERRUPT,
+                                                                               (int32_t)EDMA3_OS_PROTECT_INTERRUPT,
                                                                                &intState);
                     /* Decrease the Number of Opens */
                     --drvObject->numOpens;
@@ -605,7 +601,7 @@ EDMA3_DRV_Result EDMA3_DRV_close(EDMA3_DRV_Handle hEdma,
                         drvObject->state = EDMA3_DRV_CLOSED;
                         }
                     edma3OsProtectExit (drvObject->phyCtrllerInstId,
-                                                                               EDMA3_OS_PROTECT_INTERRUPT,
+                                                                               (int32_t)EDMA3_OS_PROTECT_INTERRUPT,
                                                                                intState);
                     }
                 }
@@ -627,7 +623,7 @@ static EDMA3_DRV_Result edma3OpenResMgr (uint32_t instId,
     EDMA3_RM_InstanceInitConfig rmInstanceCfg;
     EDMA3_RM_Handle hResMgr = NULL;
     EDMA3_RM_Result rmResult;
-    uint32_t resMgrIdx = 0u;
+    uint32_t resMgrIdx = 0U;
     EDMA3_RM_Instance *temp_rm_instance = NULL;
 
        assert ((instId < EDMA3_MAX_EDMA3_INSTANCES)
@@ -646,7 +642,7 @@ static EDMA3_DRV_Result edma3OpenResMgr (uint32_t instId,
     initParam.gblerrCbParams.gblerrCb = drvInstance[instId][regionId].gblerrCbParams.gblerrCb;
     initParam.gblerrCbParams.gblerrData = drvInstance[instId][regionId].gblerrCbParams.gblerrData;
 
-    if (flag == 1u)
+    if (flag == 1U)
         {
         /**
          * User has passed the instance initialization specific info,
@@ -688,7 +684,7 @@ static EDMA3_DRV_Result edma3OpenResMgr (uint32_t instId,
              * just returned, to fetch the correct config info from  the
              * userInitConfig[].
              */
-            for (resMgrIdx = 0u; resMgrIdx < EDMA3_MAX_RM_INSTANCES; resMgrIdx++)
+            for (resMgrIdx = 0U; resMgrIdx < EDMA3_MAX_RM_INSTANCES; resMgrIdx++)
                 {
                 temp_rm_instance = ((EDMA3_RM_Instance *)(ptrRMIArray) + (instId*EDMA3_MAX_RM_INSTANCES) + resMgrIdx);