Run-Time Interfaces/Integration Guide
A-80
/* Below are the steps required to create the Driver Object and then initialize a region specific
Driver Instance. Afterwards, if required, the application has to register the various interrupt
handlers with the underlying OS. */
/** EDMA3 Driver Handle, used to call all the Driver APIs */
EDMA3_DRV_Handle hEdma = NULL;
/** EDMA3 Driver Instance specific Semaphore handle */
static EDMA3_OS_Sem_Handle semHandle = NULL;
EDMA3_DRV_Result edma3init()
{
unsigned int edma3InstanceId = 0;
EDMA3_DRV_InitConfig initCfg;
EDMA3_DRV_Result edma3Result = EDMA3_DRV_SOK;
EDMA3_OS_SemAttrs semAttrs = {EDMA3_OS_SEMTYPE_FIFO, NULL};
if (NULL == hEdma)
{
/* configuration structure for the Driver */
initCfg.isMaster = TRUE;
initCfg.regionId = (EDMA3_RM_RegionId)1u;
initCfg.drvSemHandle = NULL;
/* Driver instance specific config NULL */
initCfg.drvInstInitConfig = NULL;
initCfg.gblerrCb = NULL;
initCfg.gblerrData = NULL;
/* Create EDMA3 Driver Object first. */
edma3Result = EDMA3_DRV_create (edma3InstanceId, NULL, NULL);
if (edma3Result != EDMA3_DRV_SOK)
{
/* Report error */
return edma3Result;
}
else
{
/**
* Driver Object created successfully.
* Create a semaphore now for driver instance.
*/
edma3Result = edma3OsSemCreate(1, &semAttrs, &initCfg.drvSemHandle);
if (edma3Result != EDMA3_DRV_SOK)
{
/* Report error */
return edma3Result;
}
else
{
/* Save the semaphore handle for future use */
semHandle = initCfg.drvSemHandle;
/* Open the Driver Instance */
hEdma = EDMA3_DRV_open (edma3InstanceId, (void *) &initCfg, &edma3Result);
if(NULL == hEdma)
{
/* Report error */
return edma3Result;
}
Summary of Contents for EDMA3
Page 12: ......
Page 17: ...EDMA3 Driver Introduction I 1 5 ...
Page 20: ......
Page 40: ...Run Time Interfaces Integration Guide A 12 EDMA3_DRV_IOCTL_MAX_IOCTL Max IOCTL ...
Page 75: ...Run Time Interfaces Integration Guide I A 47 Errors EDMA3_DRV_E_INVALID_PARAM ...
Page 107: ...Run Time Interfaces Integration Guide I A 79 ...