Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

DMA call_back function isn't working winth efm32 µc

Status
Not open for further replies.

sabra88

Newbie level 2
Newbie level 2
Joined
Aug 1, 2014
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Visit site
Activity points
121
I really need to know what is wrong with my call back function??????

this is my DMA config :
void SetupDma(void)
{
CMU_ClockEnable(cmuClock_DMA, true);

/* Initialization structs */
DMA_Init_TypeDef dmaInit;
DMA_CfgChannel_TypeDef WriteChannelConfig;
DMA_CfgChannel_TypeDef ReadChannelConfig;
DMA_CfgDescr_TypeDef WriteDescriptorConfig;
DMA_CfgDescr_TypeDef ReadDescriptorConfig;
/* DMA callback structure */
DMA_CB_TypeDef SF_WriteCallBack;

/* Initializing the DMA */
dmaInit.hprot = 0;
dmaInit.controlBlock = dmaControlBlock; //Pointer to the controlblock in memory holding descriptors
DMA_Init(&dmaInit);

/* Setup WRITE call-back function */
SF_WriteCallBack.cbFunc = DmaWriteComplete;
SF_WriteCallBack.userPtr = NULL;

/* Setting up WRITE channel */
WriteChannelConfig.highPri = true;
WriteChannelConfig.enableInt = true;
WriteChannelConfig.select = 0;
WriteChannelConfig.cb = &SF_WriteCallBack;
DMA_CfgChannel(DMA_CHANNEL_WRITE, &WriteChannelConfig);

/* Setting up WRITE channel descriptor */
WriteDescriptorConfig.dstInc = dmaDataInc1;
WriteDescriptorConfig.srcInc = dmaDataInc1;
WriteDescriptorConfig.size = dmaDataSize1;
WriteDescriptorConfig.arbRate = dmaArbitrate1;
WriteDescriptorConfig.hprot = 0;
DMA_CfgDescr(DMA_CHANNEL_WRITE, true, &WriteDescriptorConfig);

/* Setting up READ channel */
ReadChannelConfig.highPri = false;
ReadChannelConfig.enableInt = true;
ReadChannelConfig.select = DMAREQ_USART1_TXBL;
ReadChannelConfig.cb = &SF_WriteCallBack;
DMA_CfgChannel(DMA_CHANNEL_READ, &ReadChannelConfig);

/* Setting up READ channel descriptor */
ReadDescriptorConfig.dstInc = dmaDataIncNone;
ReadDescriptorConfig.srcInc = dmaDataInc1;
ReadDescriptorConfig.size = dmaDataSize1;
ReadDescriptorConfig.arbRate = dmaArbitrate1;
ReadDescriptorConfig.hprot = 0;
DMA_CfgDescr(DMA_CHANNEL_READ, true, &ReadDescriptorConfig);
}

and this is my call-back function:

void DmaWriteComplete (unsigned int channel, bool primary, void *user)
{
(void) primary;
(void) user;

/* Clear flag to indicate complete transfer */
if (channel == DMA_CHANNEL_WRITE)
{
WriteTransferActive = false;
}
else if (channel == DMA_CHANNEL_READ)
{
ReadTransferActive = false;
}
}
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top