omapl138 dsp 核的edma3驱动 中断函数只能进去一次
时间:10-02
整理:3721RD
点击:
使用mcsdk中的edma3lld库写的edma3驱动,在omapl138的dsp核运行,但是中断函数只能进去一次,路过的朋友帮忙看看,感谢万分。代码如下:
#define PING_PONG_ACNT 1
#define PING_PONG_BCNT 8*32*40
//#define PING_PONG_BCNT 1
#define PING_PONG_CCNT 1
#define MCASP_BASEADDR 0x01D00000
#define Mcasp_RXEVENTQUE (0u)
/* OPT Field specific defines */
#define OPT_SYNCDIM_SHIFT (0x00000002u)
#define OPT_TCC_MASK (0x0003F000u)
#define OPT_TCC_SHIFT (0x0000000Cu)
#define OPT_ITCINTEN_SHIFT (0x00000015u)
#define OPT_TCINTEN_SHIFT (0x00000014u)
char ping_buffer[PING_PONG_BCNT];
char pong_buffer[PING_PONG_BCNT];
static void ys_edma3_init()
{
EDMA3_DRV_PaRAMRegs paramSet = {0,0,0,0,0,0,0,0,0,0,0,0};
EDMA3_DRV_Result result = EDMA3_DRV_SOK;
EDMA3_DRV_Handle hEdma;
uint32_t chId = 0;
uint32_t tcc = 0;
print2arm("edma3 driver init...",0);
hEdma = edma3init(0,&result);
if(hEdma)
{
print2arm("edma3init() Passed.",0);
}
else
{
print2arm("edma3init() Failed.",0);
}
if (result == EDMA3_DRV_SOK)
{
result = EDMA3_DRV_requestChannel (hEdma, &chId, &tcc,
(EDMA3_RM_EventQueue)0,
&edma3_isr, NULL);
}
if(result == EDMA3_DRV_SOK)
{
paramSet.srcBIdx = 0;
paramSet.destBIdx = 1;
paramSet.srcCIdx = 0;
paramSet.destCIdx = 0;
paramSet.aCnt = PING_PONG_ACNT;
paramSet.bCnt = PING_PONG_BCNT;
paramSet.cCnt = PING_PONG_CCNT;
/* For AB-synchronized transfers, BCNTRLD is not used. */
paramSet.bCntReload = PING_PONG_BCNT;
/* Src in constant mode Dest in INCR modes */
paramSet.opt &= 0xFFFFFFFDu;
//paramSet.opt &= 0xFFFFFFFCu;
/* Program the TCC */
paramSet.opt |= ((tcc << OPT_TCC_SHIFT) & OPT_TCC_MASK);
/* Enable Intermediate & Final transfer completion interrupt */
paramSet.opt |= (1 << OPT_ITCINTEN_SHIFT);
paramSet.opt |= (1 << OPT_TCINTEN_SHIFT);
/* AB Sync Transfer Mode */
paramSet.opt |= (1 << OPT_SYNCDIM_SHIFT);
/* Program the source and dest addresses for master DMA channel */
paramSet.srcAddr = (uint32_t)(MCASP_BASEADDR+0X029C);
paramSet.destAddr = (uint32_t)(ping_buffer);
/* Write to the master DMA channel first. */
result = EDMA3_DRV_setPaRAM(hEdma, chId, ¶mSet);
}
result = EDMA3_DRV_enableTransfer(hEdma,chId,EDMA3_DRV_TRIG_MODE_EVENT);
if(result == EDMA3_DRV_SOK)
{
print2arm("edma3 driver init success.",0);
}
}
EDMA3的配置就这个函数,是由MCASP接收事件触发EDMA3传输的,中断函数edma3_isr只能进去一次,请大家帮忙看看哪里有问题。
#define PING_PONG_ACNT 1
#define PING_PONG_BCNT 8*32*40
//#define PING_PONG_BCNT 1
#define PING_PONG_CCNT 1
#define MCASP_BASEADDR 0x01D00000
#define Mcasp_RXEVENTQUE (0u)
/* OPT Field specific defines */
#define OPT_SYNCDIM_SHIFT (0x00000002u)
#define OPT_TCC_MASK (0x0003F000u)
#define OPT_TCC_SHIFT (0x0000000Cu)
#define OPT_ITCINTEN_SHIFT (0x00000015u)
#define OPT_TCINTEN_SHIFT (0x00000014u)
char ping_buffer[PING_PONG_BCNT];
char pong_buffer[PING_PONG_BCNT];
static void ys_edma3_init()
{
EDMA3_DRV_PaRAMRegs paramSet = {0,0,0,0,0,0,0,0,0,0,0,0};
EDMA3_DRV_Result result = EDMA3_DRV_SOK;
EDMA3_DRV_Handle hEdma;
uint32_t chId = 0;
uint32_t tcc = 0;
print2arm("edma3 driver init...",0);
hEdma = edma3init(0,&result);
if(hEdma)
{
print2arm("edma3init() Passed.",0);
}
else
{
print2arm("edma3init() Failed.",0);
}
if (result == EDMA3_DRV_SOK)
{
result = EDMA3_DRV_requestChannel (hEdma, &chId, &tcc,
(EDMA3_RM_EventQueue)0,
&edma3_isr, NULL);
}
if(result == EDMA3_DRV_SOK)
{
paramSet.srcBIdx = 0;
paramSet.destBIdx = 1;
paramSet.srcCIdx = 0;
paramSet.destCIdx = 0;
paramSet.aCnt = PING_PONG_ACNT;
paramSet.bCnt = PING_PONG_BCNT;
paramSet.cCnt = PING_PONG_CCNT;
/* For AB-synchronized transfers, BCNTRLD is not used. */
paramSet.bCntReload = PING_PONG_BCNT;
/* Src in constant mode Dest in INCR modes */
paramSet.opt &= 0xFFFFFFFDu;
//paramSet.opt &= 0xFFFFFFFCu;
/* Program the TCC */
paramSet.opt |= ((tcc << OPT_TCC_SHIFT) & OPT_TCC_MASK);
/* Enable Intermediate & Final transfer completion interrupt */
paramSet.opt |= (1 << OPT_ITCINTEN_SHIFT);
paramSet.opt |= (1 << OPT_TCINTEN_SHIFT);
/* AB Sync Transfer Mode */
paramSet.opt |= (1 << OPT_SYNCDIM_SHIFT);
/* Program the source and dest addresses for master DMA channel */
paramSet.srcAddr = (uint32_t)(MCASP_BASEADDR+0X029C);
paramSet.destAddr = (uint32_t)(ping_buffer);
/* Write to the master DMA channel first. */
result = EDMA3_DRV_setPaRAM(hEdma, chId, ¶mSet);
}
result = EDMA3_DRV_enableTransfer(hEdma,chId,EDMA3_DRV_TRIG_MODE_EVENT);
if(result == EDMA3_DRV_SOK)
{
print2arm("edma3 driver init success.",0);
}
}
EDMA3的配置就这个函数,是由MCASP接收事件触发EDMA3传输的,中断函数edma3_isr只能进去一次,请大家帮忙看看哪里有问题。
中断退出的时候,检查中断使能位,中断标志位,总中断使能位
支持!
看看看看看看看看,看看看看看看看看