]> 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_arm_cs.c
PRSDK-5267 Add support to enable SMP mode
[keystone-rtos/edma3_lld.git] / packages / ti / sdo / edma3 / drv / sample / src / sample_arm_cs.c
old mode 100644 (file)
new mode 100755 (executable)
index e118006..3a6c2bd
@@ -6,7 +6,7 @@
  * These implementations MUST be provided by the user / application, using the
  * EDMA3 driver, for its correct functioning.
  *
- * Copyright (C) 2009 Texas Instruments Incorporated - http://www.ti.com/
+ * Copyright (C) 2009 - 2019 Texas Instruments Incorporated - http://www.ti.com/
  *
  *
  *  Redistribution and use in source and binary forms, with or without
 */
 
 #include <ti/sysbios/hal/Cache.h>
+
 #include <ti/sysbios/hal/Hwi.h>
 #include <ti/sysbios/knl/Task.h>
 #include <ti/sysbios/knl/Semaphore.h>
 
 #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
@@ -75,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
         {
@@ -95,7 +96,7 @@ void edma3OsProtectEntry (unsigned int edma3InstanceId,
 
             /* Disable scheduler */
             case EDMA3_OS_PROTECT_SCHEDULER :
-                                       Task_disable();
+                        Task_disable();
                 break;
 
             /* Disable EDMA3 transfer completion interrupt only */
@@ -135,6 +136,7 @@ void edma3OsProtectEntry (unsigned int edma3InstanceId,
                 break;
             }
         }
+        return;
     }
 
 
@@ -155,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)
         {
@@ -182,7 +184,7 @@ void edma3OsProtectExit (unsigned int edma3InstanceId,
 
         /* Enable EDMA3 TC error interrupt only */
         case EDMA3_OS_PROTECT_INTERRUPT_TC_ERROR :
-            switch (intState)
+            switch ((int32_t)intState)
                 {
                 case 0:
                 case 1:
@@ -226,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",
@@ -242,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;
@@ -267,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",
@@ -283,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;
@@ -309,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)
     {
@@ -367,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)
         {
@@ -380,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((Semaphore_Handle)hSem, (uint32_t)mSecTimeout)) == FALSE)
             {
             semTakeResult = EDMA3_DRV_E_SEMAPHORE;
             }
@@ -397,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)
         {
@@ -409,7 +409,7 @@ EDMA3_DRV_Result edma3OsSemGive(EDMA3_OS_Sem_Handle hSem)
         }
     else
         {
-               Semaphore_post(hSem);
+               Semaphore_post((Semaphore_Handle)hSem);
         }
 
     return semGiveResult;