diff --git a/packages/ti/sdo/edma3/rm/sample/src/sample_arm_init.c b/packages/ti/sdo/edma3/rm/sample/src/sample_arm_init.c
index 7ba5151e1fbc1996e86a968b76342e7e8bed1794..e25564bebea9a819ca5dae49875c5c023c237c02 100644 (file)
#include <ti/sdo/edma3/rm/sample/bios6_edma3_rm_sample.h>
/** @brief EDMA3 Driver Instance specific Semaphore handle */
-extern EDMA3_OS_Sem_Handle rmSemHandle[];
+extern EDMA3_OS_Sem_Handle rmSemHandle[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.
* 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_num 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_RM_GblConfigParams sampleEdma3GblCfgParams[];
+extern EDMA3_RM_GblConfigParams sampleEdma3GblCfgParams[EDMA3_MAX_EDMA3_INSTANCES];
/* External Instance Specific Configuration Structure */
-extern EDMA3_RM_InstanceInitConfig sampleInstInitConfig[][EDMA3_MAX_REGIONS];
+extern EDMA3_RM_InstanceInitConfig sampleInstInitConfig[EDMA3_MAX_EDMA3_INSTANCES][EDMA3_MAX_REGIONS];
+
+#ifdef DMA_XBAR_AVAILABLE
+extern EDMA3_DRV_Result sampleInitXbarEvt(EDMA3_DRV_Handle hEdma, uint32_t edma3Id);
+#endif
/**
* \brief EDMA3 Initialization
*
* \return EDMA3_RM_SOK if success, else error code
*/
-EDMA3_RM_Handle edma3init (unsigned int edma3Id, EDMA3_RM_Result *errorCode)
+EDMA3_RM_Handle edma3init (uint32_t edma3Id, EDMA3_RM_Result *errorCode)
{
EDMA3_RM_Param initParam;
EDMA3_RM_Result edma3Result = EDMA3_RM_SOK;
EDMA3_RM_Handle hEdmaResMgr = NULL;
if ((edma3Id >= numEdma3Instances) || (errorCode == NULL))
- return hEdmaResMgr;
-
+ {
+ hEdmaResMgr = NULL;
+ }
+ else
+ {
/* DSP instance number */
dsp_num = determineProcId();
Semaphore_Params_init(&semParams);
initParam.rmSemHandle = NULL;
- edma3Result = edma3OsSemCreate(1, &semParams, &initParam.rmSemHandle);
+ edma3Result = edma3OsSemCreate((int32_t)1, &semParams, &initParam.rmSemHandle);
}
if (edma3Result == EDMA3_DRV_SOK)
&edma3Result);
}
-#if (defined (CHIP_TI814X)||defined (CHIP_C6A811X))
+#ifdef DMA_XBAR_AVAILABLE
{
- if(hEdmaResMgr && (edma3Result == EDMA3_RM_SOK))
+ if((hEdmaResMgr != NULL) && (edma3Result == EDMA3_RM_SOK))
{
edma3Result = sampleInitXbarEvt(hEdmaResMgr, edma3Id);
}
}
#endif
- if(hEdmaResMgr && (edma3Result == EDMA3_DRV_SOK))
+ if((hEdmaResMgr != NULL) && (edma3Result == EDMA3_DRV_SOK))
{
/**
* Register Interrupt Handlers for various interrupts
registerEdma3Interrupts(edma3Id);
}
- *errorCode = edma3Result;
+ *errorCode = edma3Result;
+ }
return hEdmaResMgr;
}
*
* \return EDMA3_RM_SOK if success, else error code
*/
-EDMA3_RM_Result edma3deinit (unsigned int edma3Id, EDMA3_RM_Handle hEdmaResMgr)
+EDMA3_RM_Result edma3deinit (uint32_t edma3Id, EDMA3_RM_Handle hEdma)
{
EDMA3_RM_Result edma3Result = EDMA3_RM_SOK;
rmSemHandle[edma3Id] = NULL;
/* Now, close the EDMA3 RM Instance */
- edma3Result = EDMA3_RM_close (hEdmaResMgr, NULL);
+ edma3Result = EDMA3_RM_close (hEdma, NULL);
}
if (EDMA3_RM_SOK == edma3Result)