]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - keystone-rtos/edma3_lld.git/blobdiff - packages/ti/sdo/edma3/drv/sample/src/sample_cs.c
Misra C Fixes
[keystone-rtos/edma3_lld.git] / packages / ti / sdo / edma3 / drv / sample / src / sample_cs.c
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)
         {