summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 40f1b30)
raw | patch | inline | side by side (parent: 40f1b30)
author | Sunil MS <x0190988@ti.com> | |
Wed, 17 Sep 2014 13:40:10 +0000 (19:10 +0530) | ||
committer | Sunil 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>
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>
diff --git a/packages/ti/sdo/edma3/drv/sample/bios6_edma3_drv_sample.h b/packages/ti/sdo/edma3/drv/sample/bios6_edma3_drv_sample.h
index 0e15bb974b150f951acb770ad95ba3efd8ef846f..099ccdab248837f8abadfca17cd3b0d6b6617ea4 100755 (executable)
*\r
*/\r
\r
*\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
\r
#include <stdio.h>\r
#include <ti/sysbios/knl/Semaphore.h>\r
* 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
* 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
\r
/* Error returned in case of buffers are not aligned on the cache boundary */\r
#define EDMA3_NON_ALIGNED_BUFFERS_ERROR (-1)\r
* \return EDMA3_DRV_Handle: If successfully opened, the API will return the\r
* associated driver's instance handle.\r
*/\r
* \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
\r
/**\r
* \brief EDMA3 De-initialization\r
* edma3init().\r
* \return EDMA3_DRV_SOK if success, else error code\r
*/\r
* 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
\r
\r
/**\r
* may or may not require the below implementation and\r
* should modify it according to her need.\r
*/\r
* 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
\r
\r
\r
* may or may not require the below implementation and\r
* should modify it according to her need.\r
*/\r
* 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
\r
\r
\r
* semaphore.\r
* \return EDMA3_DRV_SOK if successful, else a suitable error code.\r
*/\r
* 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
const Semaphore_Params *semParams,\r
EDMA3_OS_Sem_Handle *hSem);\r
\r
diff --git a/packages/ti/sdo/edma3/drv/sample/src/sample_arm_cs.c b/packages/ti/sdo/edma3/drv/sample/src/sample_arm_cs.c
index bdb9b900a31d16ae8aad5ee19645f73213e7837b..3da2d919cc0d938052080face0c883f0f8ce8718 100644 (file)
#include <ti/sdo/edma3/drv/sample/bios6_edma3_drv_sample.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.
*/
/**
* 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
/**
* \brief EDMA3 OS Protect Entry
* \return None
*/
void edma3OsProtectEntry (uint32_t edma3InstanceId,
* \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))
{
{
if (((level == EDMA3_OS_PROTECT_INTERRUPT)
|| (level == EDMA3_OS_PROTECT_INTERRUPT_TC_ERROR))
&& (intState == NULL))
{
- return;
+ /* Nothing to be done here */
}
else
{
}
else
{
/* Disable scheduler */
case EDMA3_OS_PROTECT_SCHEDULER :
/* Disable scheduler */
case EDMA3_OS_PROTECT_SCHEDULER :
- Task_disable();
+ Task_disable();
break;
/* Disable EDMA3 transfer completion interrupt only */
break;
/* Disable EDMA3 transfer completion interrupt only */
break;
}
}
break;
}
}
+ return;
}
}
* may or may not require the below implementation and
* should modify it according to her need.
*/
* 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 */
{
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",
{
#ifdef EDMA3_DRV_DEBUG
EDMA3_DRV_PRINTF("\r\n Cache : Memory is not %d bytes alinged\r\n",
}
else
{
}
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;
}
return cacheInvResult;
* may or may not require the below implementation and
* should modify it according to her need.
*/
* 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 */
{
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",
{
#ifdef EDMA3_DRV_DEBUG
EDMA3_DRV_PRINTF("\r\n Cache : Memory is not %d bytes alinged\r\n",
}
else
{
}
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;
}
return cacheFlushResult;
* semaphore
* \return EDMA3_DRV_SOK if succesful, else a suitable error code.
*/
* 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)
{
const Semaphore_Params *semParams,
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
* 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)
{
if(NULL == hSem)
{
}
else
{
}
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;
}
{
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
* 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)
{
if(NULL == hSem)
{
diff --git a/packages/ti/sdo/edma3/drv/sample/src/sample_arm_init.c b/packages/ti/sdo/edma3/drv/sample/src/sample_arm_init.c
index aa6607034c1717cea43277fad6565fce3d71d43d..e06d0bf000cd510c0387c87f0db89b9df0606623 100644 (file)
#include <ti/sdo/edma3/drv/sample/bios6_edma3_drv_sample.h>
/** @brief EDMA3 Driver Instance specific Semaphore handle */
#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. */
/** 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. */
/** 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# */
/* 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.
/**
* To check whether the global EDMA3 configuration is required or not.
* by one of the masters. Hence this function will return TRUE only once
* and FALSE for all other masters.
*/
* 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.
*/
/**
* 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.
*/
/**
* 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 */
/* Number of EDMA3 controllers present in the system */
-extern const unsigned int numEdma3Instances;
+extern const uint32_t numEdma3Instances;
/* External Global Configuration Structure */
/* External Global Configuration Structure */
-extern EDMA3_DRV_GblConfigParams sampleEdma3GblCfgParams[];
+extern EDMA3_DRV_GblConfigParams sampleEdma3GblCfgParams[EDMA3_MAX_EDMA3_INSTANCES];
/* External Instance Specific Configuration Structure */
/* 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
#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
/**
#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
*/
*
* \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;
{
EDMA3_DRV_Result edma3Result = EDMA3_DRV_E_INVALID_PARAM;
Semaphore_Params semParams;
EDMA3_DRV_Handle hEdma = NULL;
if ((edma3Id >= numEdma3Instances) || (errorCode == NULL))
EDMA3_DRV_Handle hEdma = NULL;
if ((edma3Id >= numEdma3Instances) || (errorCode == NULL))
- return hEdma;
-
+ {
+ hEdma = NULL;
+ }
+ else
+ {
/* DSP instance number */
dsp_num = determineProcId();
/* DSP instance number */
dsp_num = determineProcId();
Semaphore_Params_init(&semParams);
initCfg.drvSemHandle = NULL;
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)
}
if (edma3Result == EDMA3_DRV_SOK)
@@ -160,13 +163,13 @@ EDMA3_DRV_Handle edma3init (unsigned int edma3Id, EDMA3_DRV_Result *errorCode)
#ifdef DMA_XBAR_AVAILABLE
{
#ifdef DMA_XBAR_AVAILABLE
{
- if(hEdma && (edma3Result == EDMA3_DRV_SOK))
+ if((hEdma != NULL) && (edma3Result == EDMA3_DRV_SOK))
{
edma3Result = sampleInitXbarEvt(hEdma, edma3Id);
}
}
#endif
{
edma3Result = sampleInitXbarEvt(hEdma, edma3Id);
}
}
#endif
- if(hEdma && (edma3Result == EDMA3_DRV_SOK))
+ if((hEdma != NULL) && (edma3Result == EDMA3_DRV_SOK))
{
/**
* Register Interrupt Handlers for various interrupts
{
/**
* Register Interrupt Handlers for various interrupts
registerEdma3Interrupts(edma3Id);
}
registerEdma3Interrupts(edma3Id);
}
- *errorCode = edma3Result;
- return hEdma;
+ *errorCode = edma3Result;
+ }
+ return hEdma;
}
}
*
* \return EDMA3_DRV_SOK if success, else error code
*/
*
* \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;
{
EDMA3_DRV_Result edma3Result = EDMA3_DRV_E_INVALID_PARAM;
diff --git a/packages/ti/sdo/edma3/drv/sample/src/sample_cs.c b/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>
#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.
*/
/**
* 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
/**
* \brief EDMA3 OS Protect Entry
* for EDMA3_OS_PROTECT_INTERRUPT protection level).
* \return None
*/
* 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))
{
{
if (((level == EDMA3_OS_PROTECT_INTERRUPT)
|| (level == EDMA3_OS_PROTECT_INTERRUPT_TC_ERROR))
&& (intState == NULL))
{
- return;
+ /* Nothing to be done here */
}
else
{
}
else
{
break;
}
}
break;
}
}
- }
+ return;
+ }
/**
/**
* for EDMA3_OS_PROTECT_INTERRUPT protection level).
* \return None
*/
* 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)
{
{
switch (level)
{
* may or may not require the below implementation and
* should modify it according to her need.
*/
* 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 */
{
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",
{
#ifdef EDMA3_DRV_DEBUG
EDMA3_DRV_PRINTF("\r\n Cache : Memory is not %d bytes alinged\r\n",
}
else
{
}
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;
}
return cacheInvResult;
* may or may not require the below implementation and
* should modify it according to her need.
*/
* 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 */
{
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",
{
#ifdef EDMA3_DRV_DEBUG
EDMA3_DRV_PRINTF("\r\n Cache : Memory is not %d bytes alinged\r\n",
}
else
{
}
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;
}
return cacheFlushResult;
* semaphore
* \return EDMA3_DRV_SOK if succesful, else a suitable error code.
*/
* 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)
{
const Semaphore_Params *semParams,
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
* 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)
{
if(NULL == hSem)
{
}
else
{
}
else
{
- semPendResult = Semaphore_pend(hSem, mSecTimeout);
- if (semPendResult == FALSE)
+ if((Semaphore_pend(hSem, (uint32_t)mSecTimeout)) == FALSE)
{
semTakeResult = EDMA3_DRV_E_SEMAPHORE;
}
{
semTakeResult = EDMA3_DRV_E_SEMAPHORE;
}
* This function gives or relinquishes an already
* acquired semaphore token
* \param hSem [IN] is the handle of the specified semaphore
* 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)
{
if(NULL == hSem)
{
diff --git a/packages/ti/sdo/edma3/drv/sample/src/sample_init.c b/packages/ti/sdo/edma3/drv/sample/src/sample_init.c
index b4d7b7f92a0e6836fb44013cd29f0de03b494fef..b8f0b6295423b30a6484ada92b28c3ffa008f187 100755 (executable)
#include <ti/sdo/edma3/drv/sample/bios6_edma3_drv_sample.h>
/** @brief EDMA3 Driver Instance specific Semaphore handle */
#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. */
/** 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. */
/** 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# */
/* 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.
/**
* To check whether the global EDMA3 configuration is required or not.
* by one of the masters. Hence this function will return TRUE only once
* and FALSE for all other masters.
*/
* 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.
*/
/**
* 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.
*/
/**
* 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 */
/* Number of EDMA3 controllers present in the system */
-extern const unsigned int numEdma3Instances;
+extern const uint32_t numEdma3Instances;
/* External Global Configuration Structure */
/* External Global Configuration Structure */
-extern EDMA3_DRV_GblConfigParams sampleEdma3GblCfgParams[];
+extern EDMA3_DRV_GblConfigParams sampleEdma3GblCfgParams[EDMA3_MAX_EDMA3_INSTANCES];
/* External Instance Specific Configuration Structure */
/* 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
#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
/**
#endif
/**
*
* \return EDMA3_DRV_SOK if success, else error code
*/
*
* \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;
{
EDMA3_DRV_Result edma3Result = EDMA3_DRV_E_INVALID_PARAM;
Semaphore_Params semParams;
EDMA3_DRV_Handle hEdma = NULL;
if ((edma3Id >= numEdma3Instances) || (errorCode == NULL))
EDMA3_DRV_Handle hEdma = NULL;
if ((edma3Id >= numEdma3Instances) || (errorCode == NULL))
- return hEdma;
-
+ {
+ hEdma = NULL;
+ }
+ else
+ {
/* DSP instance number */
dsp_num = determineProcId();
/* DSP instance number */
dsp_num = determineProcId();
Semaphore_Params_init(&semParams);
initCfg.drvSemHandle = NULL;
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)
}
if (edma3Result == EDMA3_DRV_SOK)
@@ -161,13 +164,13 @@ EDMA3_DRV_Handle edma3init (unsigned int edma3Id, EDMA3_DRV_Result *errorCode)
#ifdef DMA_XBAR_AVAILABLE
{
#ifdef DMA_XBAR_AVAILABLE
{
- if(hEdma && (edma3Result == EDMA3_DRV_SOK))
+ if((hEdma != NULL) && (edma3Result == EDMA3_DRV_SOK))
{
edma3Result = sampleInitXbarEvt(hEdma, edma3Id);
}
}
#endif
{
edma3Result = sampleInitXbarEvt(hEdma, edma3Id);
}
}
#endif
- if(hEdma && (edma3Result == EDMA3_DRV_SOK))
+ if((hEdma != NULL) && (edma3Result == EDMA3_DRV_SOK))
{
/**
* Register Interrupt Handlers for various interrupts
{
/**
* Register Interrupt Handlers for various interrupts
registerEdma3Interrupts(edma3Id);
}
registerEdma3Interrupts(edma3Id);
}
- *errorCode = edma3Result;
- return hEdma;
+ *errorCode = edma3Result;
+ }
+ return hEdma;
}
}
*
* \return EDMA3_DRV_SOK if success, else error code
*/
*
* \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;
{
EDMA3_DRV_Result edma3Result = EDMA3_DRV_E_INVALID_PARAM;
index abddc147a7e6ac727b4d6b9c6deda179f796a8bd..262cd0a8f1388c4eed10b29c266cd8f4458985a7 100755 (executable)
\***************************************************************/
#include <stddef.h>
\***************************************************************/
#include <stddef.h>
+/***************************************************************\
+* Standard Definition Header File For Bool Datatype *
+\***************************************************************/
+#include <stdbool.h>
+
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __cplusplus
extern "C" {
#endif