Misra C Fixes
authorSunil MS <x0190988@ti.com>
Wed, 17 Sep 2014 13:40:10 +0000 (19:10 +0530)
committerSunil MS <x0190988@ti.com>
Thu, 9 Oct 2014 14:11:33 +0000 (19:41 +0530)
MISRA.BUILTIN_NUMERIC
MISRA.CVALUE.IMPL.CAST
MISRA.DEFINE.BADEXP
MISRA.DEFINE.WRONGNAME.UNDERSCORE
MISRA.FUNC.PARAMS.IDENT
MISRA.IF.NO_COMPOUND
MISRA.LOGIC.OPERATOR.NOT_BOOL
MISRA.RETURN.NOT_LAST

Sample files of DRV
Signed-off-by: Sunil MS <x0190988@ti.com>
Change-Id: Ib938f9849461d1ab0f1ab015bb78b6a2f7cdcbba
Signed-off-by: Sunil MS <x0190988@ti.com>
packages/ti/sdo/edma3/drv/sample/bios6_edma3_drv_sample.h
packages/ti/sdo/edma3/drv/sample/src/sample_arm_cs.c
packages/ti/sdo/edma3/drv/sample/src/sample_arm_init.c
packages/ti/sdo/edma3/drv/sample/src/sample_cs.c
packages/ti/sdo/edma3/drv/sample/src/sample_init.c
packages/ti/sdo/edma3/rm/edma3_common.h

index 0e15bb974b150f951acb770ad95ba3efd8ef846f..099ccdab248837f8abadfca17cd3b0d6b6617ea4 100755 (executable)
@@ -36,8 +36,8 @@
  *\r
 */\r
 \r
-#ifndef _BIOS6_EDMA3_DRV_SAMPLE_H_\r
-#define _BIOS6_EDMA3_DRV_SAMPLE_H_\r
+#ifndef BIOS6_EDMA3_DRV_SAMPLE_H_\r
+#define BIOS6_EDMA3_DRV_SAMPLE_H_\r
 \r
 #include <stdio.h>\r
 #include <ti/sysbios/knl/Semaphore.h>\r
@@ -53,7 +53,7 @@ extern "C" {
  * Cache line size on the underlying SoC. It needs to be modified\r
  * for different cache line sizes, if the Cache is Enabled.\r
  */\r
-#define EDMA3_CACHE_LINE_SIZE_IN_BYTES      (128u)\r
+#define EDMA3_CACHE_LINE_SIZE_IN_BYTES      (128U)\r
 \r
 /* Error returned in case of buffers are not aligned on the cache boundary */\r
 #define EDMA3_NON_ALIGNED_BUFFERS_ERROR     (-1)\r
@@ -77,7 +77,7 @@ extern "C" {
  *  \return EDMA3_DRV_Handle: If successfully opened, the API will return the\r
  *                            associated driver's instance handle.\r
  */\r
-EDMA3_DRV_Handle edma3init (unsigned int edma3Id, EDMA3_DRV_Result *errorCode);\r
+EDMA3_DRV_Handle edma3init (uint32_t edma3Id, EDMA3_DRV_Result *errorCode);\r
 \r
 /**\r
  * \brief   EDMA3 De-initialization\r
@@ -95,7 +95,7 @@ EDMA3_DRV_Handle edma3init (unsigned int edma3Id, EDMA3_DRV_Result *errorCode);
  *                                                                     edma3init().\r
  *  \return  EDMA3_DRV_SOK if success, else error code\r
  */\r
-EDMA3_DRV_Result edma3deinit (unsigned int edma3Id, EDMA3_DRV_Handle hEdma);\r
+EDMA3_DRV_Result edma3deinit (uint32_t edma3Id, EDMA3_DRV_Handle hEdma);\r
 \r
 \r
 /**\r
@@ -115,8 +115,8 @@ EDMA3_DRV_Result edma3deinit (unsigned int edma3Id, EDMA3_DRV_Handle hEdma);
  * may or may not require the below implementation and\r
  * should modify it according to her need.\r
  */\r
-EDMA3_DRV_Result Edma3_CacheInvalidate(unsigned int mem_start_ptr,\r
-                           unsigned int num_bytes);\r
+EDMA3_DRV_Result Edma3_CacheInvalidate(uint32_t mem_start_ptr,\r
+                           uint32_t num_bytes);\r
 \r
 \r
 \r
@@ -137,8 +137,8 @@ EDMA3_DRV_Result Edma3_CacheInvalidate(unsigned int mem_start_ptr,
  * may or may not require the below implementation and\r
  * should modify it according to her need.\r
  */\r
-EDMA3_DRV_Result Edma3_CacheFlush(unsigned int mem_start_ptr,\r
-                      unsigned int num_bytes);\r
+EDMA3_DRV_Result Edma3_CacheFlush(uint32_t mem_start_ptr,\r
+                      uint32_t num_bytes);\r
 \r
 \r
 \r
@@ -161,7 +161,7 @@ EDMA3_DRV_Result Edma3_CacheFlush(unsigned int mem_start_ptr,
  *      semaphore.\r
  * \return  EDMA3_DRV_SOK if successful, else a suitable error code.\r
  */\r
-EDMA3_DRV_Result edma3OsSemCreate(int initVal,\r
+EDMA3_DRV_Result edma3OsSemCreate(int32_t initVal,\r
                                                        const Semaphore_Params *semParams,\r
                                                        EDMA3_OS_Sem_Handle *hSem);\r
 \r
index bdb9b900a31d16ae8aad5ee19645f73213e7837b..3da2d919cc0d938052080face0c883f0f8ce8718 100644 (file)
 
 #include <ti/sdo/edma3/drv/sample/bios6_edma3_drv_sample.h>
 
-extern unsigned int ccXferCompInt[][EDMA3_MAX_REGIONS];
-extern unsigned int ccErrorInt[];
-extern unsigned int tcErrorInt[][EDMA3_MAX_TC];
+extern uint32_t ccXferCompInt[EDMA3_MAX_EDMA3_INSTANCES][EDMA3_MAX_REGIONS];
+extern uint32_t ccErrorInt[EDMA3_MAX_EDMA3_INSTANCES];
+extern uint32_t tcErrorInt[EDMA3_MAX_EDMA3_INSTANCES][EDMA3_MAX_TC];
 
 /**
  * Shadow Region on which the executable is running. Its value is
  * populated with the DSP Instance Number here in this case.
  */
-extern unsigned int region_id;
+extern uint32_t region_id;
 
 /**
  * \brief   EDMA3 OS Protect Entry
@@ -83,13 +83,13 @@ extern unsigned int region_id;
  * \return  None
  */
 void edma3OsProtectEntry (uint32_t edma3InstanceId,
-                                                       int32_t level, uint32_t *intState)
+                            int32_t level, uint32_t *intState)
     {
     if (((level == EDMA3_OS_PROTECT_INTERRUPT)
         || (level == EDMA3_OS_PROTECT_INTERRUPT_TC_ERROR))
         && (intState == NULL))
         {
-        return;
+            /* Nothing to be done here */
         }
     else
         {
@@ -102,7 +102,7 @@ void edma3OsProtectEntry (uint32_t edma3InstanceId,
 
             /* Disable scheduler */
             case EDMA3_OS_PROTECT_SCHEDULER :
-                                       Task_disable();
+                        Task_disable();
                 break;
 
             /* Disable EDMA3 transfer completion interrupt only */
@@ -142,6 +142,7 @@ void edma3OsProtectEntry (uint32_t edma3InstanceId,
                 break;
             }
         }
+        return;
     }
 
 
@@ -233,13 +234,13 @@ void edma3OsProtectExit (uint32_t edma3InstanceId,
  * may or may not require the below implementation and
  * should modify it according to her need.
  */
-EDMA3_DRV_Result Edma3_CacheInvalidate(unsigned int mem_start_ptr,
-                           unsigned int    num_bytes)
+EDMA3_DRV_Result Edma3_CacheInvalidate(uint32_t mem_start_ptr,
+                           uint32_t    num_bytes)
     {
     EDMA3_DRV_Result cacheInvResult = EDMA3_DRV_SOK;
 
     /* Verify whether the start address is cache aligned or not */
-    if((mem_start_ptr & (EDMA3_CACHE_LINE_SIZE_IN_BYTES-1u))    !=    0)
+    if((mem_start_ptr & (EDMA3_CACHE_LINE_SIZE_IN_BYTES-1U))    !=    0)
         {
 #ifdef EDMA3_DRV_DEBUG
         EDMA3_DRV_PRINTF("\r\n Cache : Memory is not %d bytes alinged\r\n",
@@ -249,7 +250,7 @@ EDMA3_DRV_Result Edma3_CacheInvalidate(unsigned int mem_start_ptr,
         }
     else
         {
-               Cache_inv((Ptr)mem_start_ptr, num_bytes, Cache_Type_ALL, TRUE);
+            Cache_inv((Ptr)mem_start_ptr, num_bytes, Cache_Type_ALL, (Bool)TRUE);
         }
 
     return cacheInvResult;
@@ -274,13 +275,13 @@ EDMA3_DRV_Result Edma3_CacheInvalidate(unsigned int mem_start_ptr,
  * may or may not require the below implementation and
  * should modify it according to her need.
  */
-EDMA3_DRV_Result Edma3_CacheFlush(unsigned int mem_start_ptr,
-                      unsigned int num_bytes)
+EDMA3_DRV_Result Edma3_CacheFlush(uint32_t mem_start_ptr,
+                      uint32_t num_bytes)
     {
     EDMA3_DRV_Result cacheFlushResult = EDMA3_DRV_SOK;
 
     /* Verify whether the start address is cache aligned or not */
-    if((mem_start_ptr & (EDMA3_CACHE_LINE_SIZE_IN_BYTES-1u))    !=    0)
+    if((mem_start_ptr & (EDMA3_CACHE_LINE_SIZE_IN_BYTES-1U))    !=    0)
         {
 #ifdef EDMA3_DRV_DEBUG
         EDMA3_DRV_PRINTF("\r\n Cache : Memory is not %d bytes alinged\r\n",
@@ -290,7 +291,7 @@ EDMA3_DRV_Result Edma3_CacheFlush(unsigned int mem_start_ptr,
         }
     else
         {
-               Cache_wb((Ptr)mem_start_ptr, num_bytes, Cache_Type_ALL, TRUE);
+            Cache_wb((Ptr)mem_start_ptr, num_bytes, Cache_Type_ALL, (Bool)TRUE);
         }
 
     return cacheFlushResult;
@@ -316,7 +317,7 @@ EDMA3_DRV_Result Edma3_CacheFlush(unsigned int mem_start_ptr,
  *      semaphore
  * \return  EDMA3_DRV_SOK if succesful, else a suitable error code.
  */
-EDMA3_DRV_Result edma3OsSemCreate(int initVal,
+EDMA3_DRV_Result edma3OsSemCreate(int32_t initVal,
                                                        const Semaphore_Params *semParams,
                                EDMA3_OS_Sem_Handle *hSem)
     {
@@ -374,12 +375,11 @@ EDMA3_DRV_Result edma3OsSemDelete(EDMA3_OS_Sem_Handle hSem)
  *      a free semaphore.
  * \param   hSem [IN] is the handle of the specified semaphore
  * \param   mSecTimeout [IN] is wait time in milliseconds
- * \return  EDMA3_DRV_Result if successful else a suitable error code
+ * \return  EDMA3_Result if successful else a suitable error code
  */
-EDMA3_DRV_Result edma3OsSemTake(EDMA3_OS_Sem_Handle hSem, int32_t mSecTimeout)
+EDMA3_Result edma3OsSemTake(EDMA3_OS_Sem_Handle hSem, int32_t mSecTimeout)
     {
-    EDMA3_DRV_Result semTakeResult = EDMA3_DRV_SOK;
-    unsigned short semPendResult;
+    EDMA3_Result semTakeResult = EDMA3_DRV_SOK;
 
     if(NULL == hSem)
         {
@@ -387,8 +387,7 @@ EDMA3_DRV_Result edma3OsSemTake(EDMA3_OS_Sem_Handle hSem, int32_t mSecTimeout)
         }
     else
         {
-        semPendResult = Semaphore_pend((Semaphore_Handle)hSem, mSecTimeout);
-        if (semPendResult == FALSE)
+        if((Semaphore_pend((Semaphore_Handle)hSem, (uint32_t)mSecTimeout)) == FALSE)
             {
             semTakeResult = EDMA3_DRV_E_SEMAPHORE;
             }
@@ -404,11 +403,11 @@ EDMA3_DRV_Result edma3OsSemTake(EDMA3_OS_Sem_Handle hSem, int32_t mSecTimeout)
  *      This function gives or relinquishes an already
  *      acquired semaphore token
  * \param   hSem [IN] is the handle of the specified semaphore
- * \return  EDMA3_DRV_Result if successful else a suitable error code
+ * \return  EDMA3_Result if successful else a suitable error code
  */
-EDMA3_DRV_Result edma3OsSemGive(EDMA3_OS_Sem_Handle hSem)
+EDMA3_Result edma3OsSemGive(EDMA3_OS_Sem_Handle hSem)
     {
-    EDMA3_DRV_Result semGiveResult = EDMA3_DRV_SOK;
+    EDMA3_Result semGiveResult = EDMA3_DRV_SOK;
 
     if(NULL == hSem)
         {
index aa6607034c1717cea43277fad6565fce3d71d43d..e06d0bf000cd510c0387c87f0db89b9df0606623 100644 (file)
 #include <ti/sdo/edma3/drv/sample/bios6_edma3_drv_sample.h>
 
 /** @brief EDMA3 Driver Instance specific Semaphore handle */
-extern EDMA3_OS_Sem_Handle semHandle[];
+extern EDMA3_OS_Sem_Handle semHandle[EDMA3_MAX_EDMA3_INSTANCES];
 
 /**  To Register the ISRs with the underlying OS, if required. */
-extern void registerEdma3Interrupts (unsigned int edma3Id);
+extern void registerEdma3Interrupts (uint32_t edma3Id);
 /**  To Unregister the ISRs with the underlying OS, if previously registered. */
-extern void unregisterEdma3Interrupts (unsigned int edma3Id);
+extern void unregisterEdma3Interrupts (uint32_t edma3Id);
 
 /* To find out the DSP# */
-extern unsigned short determineProcId();
+extern uint16_t determineProcId(void);
 
 /**
  * To check whether the global EDMA3 configuration is required or not.
@@ -65,31 +65,31 @@ extern unsigned short determineProcId();
  * by one of the masters. Hence this function will return TRUE only once
  * and FALSE for all other masters. 
  */
-extern unsigned short isGblConfigRequired(unsigned int dspNum);
+extern uint16_t isGblConfigRequired(uint32_t dspNum);
 
 /**
  * DSP instance number on which the executable is running. Its value is
  * determined by reading the processor specific register DNUM.
  */
-unsigned int dsp_num;
+uint32_t dsp_num;
 
 /**
  * Shadow Region on which the executable is runnig. Its value is populated
  * with the DSP Instance Number here in this case.
  */
-unsigned int region_id;
+uint32_t region_id;
 
 /* Number of EDMA3 controllers present in the system */
-extern const unsigned int numEdma3Instances;
+extern const uint32_t numEdma3Instances;
 
 /* External Global Configuration Structure */
-extern EDMA3_DRV_GblConfigParams sampleEdma3GblCfgParams[];
+extern EDMA3_DRV_GblConfigParams sampleEdma3GblCfgParams[EDMA3_MAX_EDMA3_INSTANCES];
 
 /* External Instance Specific Configuration Structure */
-extern EDMA3_DRV_InstanceInitConfig sampleInstInitConfig[][EDMA3_MAX_REGIONS];
+extern EDMA3_DRV_InstanceInitConfig sampleInstInitConfig[EDMA3_MAX_EDMA3_INSTANCES][EDMA3_MAX_REGIONS];
 
 #ifdef DMA_XBAR_AVAILABLE
-extern EDMA3_DRV_Result sampleInitXbarEvt(EDMA3_DRV_Handle hEdma, unsigned int edma3Id);
+extern EDMA3_DRV_Result sampleInitXbarEvt(EDMA3_DRV_Handle hEdma, uint32_t edma3Id);
 #endif
 
 /**
@@ -100,7 +100,7 @@ extern EDMA3_DRV_Result sampleInitXbarEvt(EDMA3_DRV_Handle hEdma, unsigned int e
  *
   * \return  EDMA3_DRV_SOK if success, else error code
  */
-EDMA3_DRV_Handle edma3init (unsigned int edma3Id, EDMA3_DRV_Result *errorCode)
+EDMA3_DRV_Handle edma3init (uint32_t edma3Id, EDMA3_DRV_Result *errorCode)
     {
     EDMA3_DRV_Result edma3Result = EDMA3_DRV_E_INVALID_PARAM;
     Semaphore_Params semParams;
@@ -111,8 +111,11 @@ EDMA3_DRV_Handle edma3init (unsigned int edma3Id, EDMA3_DRV_Result *errorCode)
        EDMA3_DRV_Handle hEdma = NULL;
 
        if ((edma3Id >= numEdma3Instances) || (errorCode == NULL))
-               return hEdma;
-
+    {
+        hEdma = NULL;
+    }
+    else
+       {
     /* DSP instance number */
     dsp_num = determineProcId();
 
@@ -132,7 +135,7 @@ EDMA3_DRV_Handle edma3init (unsigned int edma3Id, EDMA3_DRV_Result *errorCode)
                Semaphore_Params_init(&semParams);
 
                initCfg.drvSemHandle = NULL;
-               edma3Result = edma3OsSemCreate(1, &semParams, &initCfg.drvSemHandle);
+               edma3Result = edma3OsSemCreate((int32_t)1, &semParams, &initCfg.drvSemHandle);
                }
 
        if (edma3Result == EDMA3_DRV_SOK)
@@ -160,13 +163,13 @@ EDMA3_DRV_Handle edma3init (unsigned int edma3Id, EDMA3_DRV_Result *errorCode)
 
 #ifdef DMA_XBAR_AVAILABLE
        {
-       if(hEdma && (edma3Result == EDMA3_DRV_SOK))
+       if((hEdma != NULL) && (edma3Result == EDMA3_DRV_SOK))
                {
                edma3Result = sampleInitXbarEvt(hEdma, edma3Id);
                }
        }
 #endif
-       if(hEdma && (edma3Result == EDMA3_DRV_SOK))
+       if((hEdma != NULL) && (edma3Result == EDMA3_DRV_SOK))
                {
                /**
                * Register Interrupt Handlers for various interrupts
@@ -176,8 +179,9 @@ EDMA3_DRV_Handle edma3init (unsigned int edma3Id, EDMA3_DRV_Result *errorCode)
                registerEdma3Interrupts(edma3Id);
                }
 
-       *errorCode = edma3Result;       
-       return hEdma;
+       *errorCode = edma3Result;
+    }
+    return hEdma;
     }
 
 
@@ -189,7 +193,7 @@ EDMA3_DRV_Handle edma3init (unsigned int edma3Id, EDMA3_DRV_Result *errorCode)
  *
   * \return  EDMA3_DRV_SOK if success, else error code
  */
-EDMA3_DRV_Result edma3deinit (unsigned int edma3Id, EDMA3_DRV_Handle hEdma)
+EDMA3_DRV_Result edma3deinit (uint32_t edma3Id, EDMA3_DRV_Handle hEdma)
     {
     EDMA3_DRV_Result edma3Result = EDMA3_DRV_E_INVALID_PARAM;
 
index 3b738525bcadc6b00d64f9f3c597bd5840f191ab..29fa2ad1696f3ac4d55364c8e4db7fd20f92abd0 100755 (executable)
 
 #include <ti/sdo/edma3/drv/sample/bios6_edma3_drv_sample.h>
 
-extern unsigned int ccXferCompInt[][EDMA3_MAX_REGIONS];
-extern unsigned int ccErrorInt[];
-extern unsigned int tcErrorInt[][EDMA3_MAX_TC];
+extern uint32_t ccXferCompInt[EDMA3_MAX_EDMA3_INSTANCES][EDMA3_MAX_REGIONS];
+extern uint32_t ccErrorInt[EDMA3_MAX_EDMA3_INSTANCES];
+extern uint32_t tcErrorInt[EDMA3_MAX_EDMA3_INSTANCES][EDMA3_MAX_TC];
 
 /**
  * Shadow Region on which the executable is running. Its value is
  * populated with the DSP Instance Number here in this case.
  */
-extern unsigned int region_id;
+extern uint32_t region_id;
 
 /**
  * \brief   EDMA3 OS Protect Entry
@@ -76,14 +76,14 @@ extern unsigned int region_id;
  *      for EDMA3_OS_PROTECT_INTERRUPT protection level).
  * \return  None
  */
-void edma3OsProtectEntry (unsigned int edma3InstanceId,
-                                                       int level, unsigned int *intState)
+void edma3OsProtectEntry (uint32_t edma3InstanceId,
+                                                       int32_t level, uint32_t *intState)
     {
     if (((level == EDMA3_OS_PROTECT_INTERRUPT)
         || (level == EDMA3_OS_PROTECT_INTERRUPT_TC_ERROR))
         && (intState == NULL))
         {
-        return;
+            /* Nothing to be done here */
         }
     else
         {
@@ -136,7 +136,8 @@ void edma3OsProtectEntry (unsigned int edma3InstanceId,
                 break;
             }
         }
-    }
+        return;
+        }
 
 
 /**
@@ -156,8 +157,8 @@ void edma3OsProtectEntry (unsigned int edma3InstanceId,
  *      for EDMA3_OS_PROTECT_INTERRUPT protection level).
  * \return  None
  */
-void edma3OsProtectExit (unsigned int edma3InstanceId,
-                        int level, unsigned int intState)
+void edma3OsProtectExit (uint32_t edma3InstanceId,
+                        int32_t level, uint32_t intState)
     {
     switch (level)
         {
@@ -227,13 +228,13 @@ void edma3OsProtectExit (unsigned int edma3InstanceId,
  * may or may not require the below implementation and
  * should modify it according to her need.
  */
-EDMA3_DRV_Result Edma3_CacheInvalidate(unsigned int mem_start_ptr,
-                           unsigned int    num_bytes)
+EDMA3_DRV_Result Edma3_CacheInvalidate(uint32_t mem_start_ptr,
+                           uint32_t    num_bytes)
     {
     EDMA3_DRV_Result cacheInvResult = EDMA3_DRV_SOK;
 
     /* Verify whether the start address is cache aligned or not */
-    if((mem_start_ptr & (EDMA3_CACHE_LINE_SIZE_IN_BYTES-1u))    !=    0)
+    if((mem_start_ptr & (EDMA3_CACHE_LINE_SIZE_IN_BYTES-1U))    !=    0)
         {
 #ifdef EDMA3_DRV_DEBUG
         EDMA3_DRV_PRINTF("\r\n Cache : Memory is not %d bytes alinged\r\n",
@@ -243,7 +244,7 @@ EDMA3_DRV_Result Edma3_CacheInvalidate(unsigned int mem_start_ptr,
         }
     else
         {
-               Cache_inv((Ptr)mem_start_ptr, num_bytes, Cache_Type_ALL, TRUE);
+               Cache_inv((Ptr)mem_start_ptr, num_bytes, Cache_Type_ALL, (Bool)TRUE);
         }
 
     return cacheInvResult;
@@ -268,13 +269,13 @@ EDMA3_DRV_Result Edma3_CacheInvalidate(unsigned int mem_start_ptr,
  * may or may not require the below implementation and
  * should modify it according to her need.
  */
-EDMA3_DRV_Result Edma3_CacheFlush(unsigned int mem_start_ptr,
-                      unsigned int num_bytes)
+EDMA3_DRV_Result Edma3_CacheFlush(uint32_t mem_start_ptr,
+                      uint32_t num_bytes)
     {
     EDMA3_DRV_Result cacheFlushResult = EDMA3_DRV_SOK;
 
     /* Verify whether the start address is cache aligned or not */
-    if((mem_start_ptr & (EDMA3_CACHE_LINE_SIZE_IN_BYTES-1u))    !=    0)
+    if((mem_start_ptr & (EDMA3_CACHE_LINE_SIZE_IN_BYTES-1U))    !=    0)
         {
 #ifdef EDMA3_DRV_DEBUG
         EDMA3_DRV_PRINTF("\r\n Cache : Memory is not %d bytes alinged\r\n",
@@ -284,7 +285,7 @@ EDMA3_DRV_Result Edma3_CacheFlush(unsigned int mem_start_ptr,
         }
     else
         {
-               Cache_wb((Ptr)mem_start_ptr, num_bytes, Cache_Type_ALL, TRUE);
+               Cache_wb((Ptr)mem_start_ptr, num_bytes, Cache_Type_ALL, (Bool)TRUE);
         }
 
     return cacheFlushResult;
@@ -310,7 +311,7 @@ EDMA3_DRV_Result Edma3_CacheFlush(unsigned int mem_start_ptr,
  *      semaphore
  * \return  EDMA3_DRV_SOK if succesful, else a suitable error code.
  */
-EDMA3_DRV_Result edma3OsSemCreate(int initVal,
+EDMA3_DRV_Result edma3OsSemCreate(int32_t initVal,
                                                        const Semaphore_Params *semParams,
                                EDMA3_OS_Sem_Handle *hSem)
     {
@@ -368,12 +369,11 @@ EDMA3_DRV_Result edma3OsSemDelete(EDMA3_OS_Sem_Handle hSem)
  *      a free semaphore.
  * \param   hSem [IN] is the handle of the specified semaphore
  * \param   mSecTimeout [IN] is wait time in milliseconds
- * \return  EDMA3_DRV_Result if successful else a suitable error code
+ * \return  EDMA3_Result if successful else a suitable error code
  */
-EDMA3_DRV_Result edma3OsSemTake(EDMA3_OS_Sem_Handle hSem, int mSecTimeout)
+EDMA3_Result edma3OsSemTake(EDMA3_OS_Sem_Handle hSem, int32_t mSecTimeout)
     {
-    EDMA3_DRV_Result semTakeResult = EDMA3_DRV_SOK;
-    unsigned short semPendResult;
+    EDMA3_Result semTakeResult = EDMA3_DRV_SOK;
 
     if(NULL == hSem)
         {
@@ -381,8 +381,7 @@ EDMA3_DRV_Result edma3OsSemTake(EDMA3_OS_Sem_Handle hSem, int mSecTimeout)
         }
     else
         {
-        semPendResult = Semaphore_pend(hSem, mSecTimeout);
-        if (semPendResult == FALSE)
+        if((Semaphore_pend(hSem, (uint32_t)mSecTimeout)) == FALSE)
             {
             semTakeResult = EDMA3_DRV_E_SEMAPHORE;
             }
@@ -398,11 +397,11 @@ EDMA3_DRV_Result edma3OsSemTake(EDMA3_OS_Sem_Handle hSem, int mSecTimeout)
  *      This function gives or relinquishes an already
  *      acquired semaphore token
  * \param   hSem [IN] is the handle of the specified semaphore
- * \return  EDMA3_DRV_Result if successful else a suitable error code
+ * \return  EDMA3_Result if successful else a suitable error code
  */
-EDMA3_DRV_Result edma3OsSemGive(EDMA3_OS_Sem_Handle hSem)
+EDMA3_Result edma3OsSemGive(EDMA3_OS_Sem_Handle hSem)
     {
-    EDMA3_DRV_Result semGiveResult = EDMA3_DRV_SOK;
+    EDMA3_Result semGiveResult = EDMA3_DRV_SOK;
 
     if(NULL == hSem)
         {
index b4d7b7f92a0e6836fb44013cd29f0de03b494fef..b8f0b6295423b30a6484ada92b28c3ffa008f187 100755 (executable)
 #include <ti/sdo/edma3/drv/sample/bios6_edma3_drv_sample.h>
 
 /** @brief EDMA3 Driver Instance specific Semaphore handle */
-extern EDMA3_OS_Sem_Handle semHandle[];
+extern EDMA3_OS_Sem_Handle semHandle[EDMA3_MAX_EDMA3_INSTANCES];
 
 /**  To Register the ISRs with the underlying OS, if required. */
-extern void registerEdma3Interrupts (unsigned int edma3Id);
+extern void registerEdma3Interrupts (uint32_t edma3Id);
 /**  To Unregister the ISRs with the underlying OS, if previously registered. */
-extern void unregisterEdma3Interrupts (unsigned int edma3Id);
+extern void unregisterEdma3Interrupts (uint32_t edma3Id);
 
 /* To find out the DSP# */
-extern unsigned short determineProcId();
+extern uint16_t determineProcId(void);
 
 /**
  * To check whether the global EDMA3 configuration is required or not.
@@ -62,31 +62,31 @@ extern unsigned short determineProcId();
  * by one of the masters. Hence this function will return TRUE only once
  * and FALSE for all other masters. 
  */
-extern unsigned short isGblConfigRequired(unsigned int dspNum);
+extern uint16_t isGblConfigRequired(uint32_t dspNum);
 
 /**
  * DSP instance number on which the executable is running. Its value is
  * determined by reading the processor specific register DNUM.
  */
-unsigned int dsp_num;
+uint32_t dsp_num;
 
 /**
  * Shadow Region on which the executable is runnig. Its value is populated
  * with the DSP Instance Number here in this case.
  */
-unsigned int region_id;
+uint32_t region_id;
 
 /* Number of EDMA3 controllers present in the system */
-extern const unsigned int numEdma3Instances;
+extern const uint32_t numEdma3Instances;
 
 /* External Global Configuration Structure */
-extern EDMA3_DRV_GblConfigParams sampleEdma3GblCfgParams[];
+extern EDMA3_DRV_GblConfigParams sampleEdma3GblCfgParams[EDMA3_MAX_EDMA3_INSTANCES];
 
 /* External Instance Specific Configuration Structure */
-extern EDMA3_DRV_InstanceInitConfig sampleInstInitConfig[][EDMA3_MAX_REGIONS];
+extern EDMA3_DRV_InstanceInitConfig sampleInstInitConfig[EDMA3_MAX_EDMA3_INSTANCES][EDMA3_MAX_REGIONS];
 
 #ifdef DMA_XBAR_AVAILABLE
-extern EDMA3_DRV_Result sampleInitXbarEvt(EDMA3_DRV_Handle hEdma, unsigned int edma3Id);
+extern EDMA3_DRV_Result sampleInitXbarEvt(EDMA3_DRV_Handle hEdma, uint32_t edma3Id);
 #endif
 
 /**
@@ -97,7 +97,7 @@ extern EDMA3_DRV_Result sampleInitXbarEvt(EDMA3_DRV_Handle hEdma, unsigned int e
  *
   * \return  EDMA3_DRV_SOK if success, else error code
  */
-EDMA3_DRV_Handle edma3init (unsigned int edma3Id, EDMA3_DRV_Result *errorCode)
+EDMA3_DRV_Handle edma3init (uint32_t edma3Id, EDMA3_DRV_Result *errorCode)
     {
     EDMA3_DRV_Result edma3Result = EDMA3_DRV_E_INVALID_PARAM;
     Semaphore_Params semParams;
@@ -107,8 +107,11 @@ EDMA3_DRV_Handle edma3init (unsigned int edma3Id, EDMA3_DRV_Result *errorCode)
        EDMA3_DRV_Handle hEdma = NULL;
 
        if ((edma3Id >= numEdma3Instances) || (errorCode == NULL))
-               return hEdma;
-
+    {
+               hEdma = NULL;
+    }
+    else
+    {
     /* DSP instance number */
     dsp_num = determineProcId();
 
@@ -128,7 +131,7 @@ EDMA3_DRV_Handle edma3init (unsigned int edma3Id, EDMA3_DRV_Result *errorCode)
                Semaphore_Params_init(&semParams);
 
                initCfg.drvSemHandle = NULL;
-               edma3Result = edma3OsSemCreate(1, &semParams, &initCfg.drvSemHandle);
+               edma3Result = edma3OsSemCreate((int32_t)1, &semParams, &initCfg.drvSemHandle);
                }
 
        if (edma3Result == EDMA3_DRV_SOK)
@@ -161,13 +164,13 @@ EDMA3_DRV_Handle edma3init (unsigned int edma3Id, EDMA3_DRV_Result *errorCode)
 
 #ifdef DMA_XBAR_AVAILABLE
        {
-       if(hEdma && (edma3Result == EDMA3_DRV_SOK))
+       if((hEdma != NULL) && (edma3Result == EDMA3_DRV_SOK))
                {
                edma3Result = sampleInitXbarEvt(hEdma, edma3Id);
                }
        }
 #endif
-       if(hEdma && (edma3Result == EDMA3_DRV_SOK))
+       if((hEdma != NULL) && (edma3Result == EDMA3_DRV_SOK))
                {
                /**
                * Register Interrupt Handlers for various interrupts
@@ -177,8 +180,9 @@ EDMA3_DRV_Handle edma3init (unsigned int edma3Id, EDMA3_DRV_Result *errorCode)
                registerEdma3Interrupts(edma3Id);
                }
 
-       *errorCode = edma3Result;       
-       return hEdma;
+       *errorCode = edma3Result;
+    }
+    return hEdma;
     }
 
 
@@ -190,7 +194,7 @@ EDMA3_DRV_Handle edma3init (unsigned int edma3Id, EDMA3_DRV_Result *errorCode)
  *
   * \return  EDMA3_DRV_SOK if success, else error code
  */
-EDMA3_DRV_Result edma3deinit (unsigned int edma3Id, EDMA3_DRV_Handle hEdma)
+EDMA3_DRV_Result edma3deinit (uint32_t edma3Id, EDMA3_DRV_Handle hEdma)
     {
     EDMA3_DRV_Result edma3Result = EDMA3_DRV_E_INVALID_PARAM;
 
index abddc147a7e6ac727b4d6b9c6deda179f796a8bd..262cd0a8f1388c4eed10b29c266cd8f4458985a7 100755 (executable)
 \***************************************************************/
 #include <stddef.h>
 
+/***************************************************************\
+* Standard Definition Header File For Bool Datatype *
+\***************************************************************/
+#include <stdbool.h>
+
 #ifdef __cplusplus
 extern "C" {
 #endif