TI中文支持网
TI专业的中文技术问题搜集分享网站

请教Tony Tang有关6748 eDMA的中断问题

Tony Tang

         你好。参考你给的文档,写了DMA传输的代码,现在可以实现ping-pong传输,但是完成后,只产生一次中断(中断服务程序的ping通道),第二次中断进不来(中断服务程序pong通道进不了),不知道是什么原因,麻烦你帮俺瞅瞅。中断标志也清除了,中断服务代码也是按照你发的手册上面来写的,真是奇了怪了,数据传输完成后,我看了下,数据也是正确的,就是第二次中断进不来。谢谢!以下是代码:

#include "types.h"
#include "stdio.h"
#include "mcasp_edma3.h"
#include "test_audio.h"
#include <string.h>
#include "edma.h"
#define EDMA_CC_BASE (0x01C00000) /* Check address for other devices. */
#define DCHMAP0 *((volatile unsigned int *)(EDMA_CC_BASE + 0x0100))
#define DMAQNUM0 *((volatile unsigned int *)(EDMA_CC_BASE + 0x0240))
#define QUEPRI *((volatile unsigned int *)(EDMA_CC_BASE + 0x0284))
#define EMCR *((volatile unsigned int *)(EDMA_CC_BASE + 0x0308))
#define EMCRH *((volatile unsigned int *)(EDMA_CC_BASE + 0x030C))
#define QEMCR *((volatile unsigned int *)(EDMA_CC_BASE + 0x0314))
#define CCERRCLR *((volatile unsigned int *)(EDMA_CC_BASE + 0x031C))
#define QWMTHRA *((volatile unsigned int *)(EDMA_CC_BASE + 0x0620))
#define ESR *((volatile unsigned int *)(EDMA_CC_BASE + 0x1010))
#define IPR *((volatile unsigned int *)(EDMA_CC_BASE + 0x1068))
#define ICR *((volatile unsigned int *)(EDMA_CC_BASE + 0x1070))
#define IESR *((volatile unsigned int *)(EDMA_CC_BASE + 0x1060))
#define IECR *((volatile unsigned int *)(EDMA_CC_BASE + 0x1058))
#define DRAE1 *((volatile unsigned int *)(EDMA_CC_BASE + 0x348))

#define EDMA_RCV_PING_TCC 1
#define EDMA_RCV_PONG_TCC 2
#define EDMA_XMT_PING_TCC 3
#define EDMA_XMT_PONG_TCC 4

#define EDMA3_CHA_TX  0

#define EDMA_XMTPING 12
#define EDMA_XMTPONG 13
#define EDMA_RCVPING 14
#define EDMA_RCVPONG 15

/* Allocate srcBuff and dstBuff. Do a cache flush and cache invalidate,if required. */
unsigned int srcBuff[512];
unsigned int dstBuff[512];
unsigned int src_ping[256];
unsigned int src_pong[256];
unsigned int dst_ping[256];
unsigned int dst_pong[256];
//—————————————————————————–
// \brief entry point for bsl test code.
//
// \param none.
//
// \return none.
//—————————————————————————–
void main(void)
{ USTIMER_init();
//TEST_audio();
unsigned int i;
for(i=0;i<512;i++)
{
srcBuff[i]=i+512;
}

/* Step 1: EDMA initialization */
EDMA3Initialize( );
SetupInt( );
RegisterEdma3Interrupts( );
//EDMA Manual interrupt initialization
DRAE1=0x01f;
IECR=0x00;
IESR=0x01f;
ICR=0xffffffff;
// RequestEDMA3Channels( );
// EDMA3EnableDmaEvt(SOC_EDMA30CC_0_REGS,EDMA3_CHA_TX);
// EDMA3EnableEvtIntr(SOC_EDMA30CC_0_REGS,EDMA3_CHA_TX);
/* Step 2: Programming DMA Channel (and Param set) */
EdmaConfig((unsigned int)srcBuff,(unsigned int)dst_ping,(unsigned int) dst_pong);
/* Step 3: Triggering the Transfer and Waiting for Transfer Completion */

/* Transfer has completed, clear the status register. */
// EDMA3ClrIntr(SOC_EDMA30CC_0_REGS,EDMA3_CHA_TX);
//audio_tsk_fxn();
while(1);

}

参数列表初始化代码

void EdmaConfig(unsigned int Srcaddress,unsigned int dst_ping,unsigned int dst_pong)
{
EDMA3CCPaRAMEntry paramSet;
paramSet.OPT = 0x00100000; /* only TCINTEN is set */
paramSet.SRC = (unsigned int)Srcaddress;
paramSet.A_B_CNT = ((1 << 16u) | (2048 & 0xFFFFu)); /* ACNT = 2048, BCNT = 1 */
paramSet.DST = (unsigned int)dst_ping;
paramSet.SRC_DST_BIDX = (2048 << 16u) | (2048 & 0xFFFFu); /* SRC_BIDX = ACNT, DST_BIDX = CCNT × ACNT */
paramSet.LINK_BCNTRLD = (1 << 16u) | (EDMA_RCVPONG * 0x20); /* LINK = 0xFFFF, BCNTRLD = 1 */
paramSet.SRC_DST_CIDX = (2048 << 16u) | (2048 & 0xFFFFu); /*SRCCIDX = ACNT × BCNT,DSTCIDX = ACNT*/
paramSet.CCNT = 1;

/* Program the TCC */
paramSet.OPT |= ((EDMA_RCV_PING_TCC << EDMA3CC_OPT_TCC_SHIFT) & EDMA3CC_OPT_TCC);
/* Transmission complition interrupt enable */
paramSet.OPT |= (1 << EDMA3CC_OPT_TCINTEN_SHIFT);
/* Each event triggers the transfer of BCNT arrays of ACNT bytes */
paramSet.OPT |= (1 << EDMA3CC_OPT_SYNCDIM_SHIFT);
/* 1. setup channel PaRAM Set */ EDMA3SetPaRAM(SOC_EDMA30CC_0_REGS, EDMA3_CHA_TX, &paramSet);
/* 2. setup ping PaRAM Set (to be reloaded later) */
EDMA3SetPaRAM(SOC_EDMA30CC_0_REGS, EDMA_RCVPING, &paramSet);

paramSet.DST = (unsigned int)dst_pong;
paramSet.LINK_BCNTRLD = (1 << 16u) | (EDMA_RCVPING * 0x20);
/* Program the TCC */
paramSet.OPT |= ((EDMA_RCV_PONG_TCC << EDMA3CC_OPT_TCC_SHIFT) & EDMA3CC_OPT_TCC);

/* 3. setup pong PaRAM set (to be loaded and reloaded later)*/
EDMA3SetPaRAM(SOC_EDMA30CC_0_REGS, EDMA_RCVPONG, &paramSet);

EDMA3EnableTransfer(SOC_EDMA30CC_0_REGS, EDMA3_CHA_TX, EDMA3_TRIG_MODE_MANUAL);
}

中断服务代码

void CHA_EdmaIsr(void)
{
unsigned int StatusVal = EDMA3GetIntrStatus(SOC_EDMA30CC_0_REGS);
printf( "[CHA_EdmaIsr]: receive in!\r\n");
printf( "[CHA_EdmaIsr]: StatusVal = %d \r\n",StatusVal);
if (StatusVal & (1 << EDMA_RCV_PING_TCC)) // receive channel
{
EDMA3ClrIntr(SOC_EDMA30CC_0_REGS, EDMA_RCV_PING_TCC);
while(EDMA3GetIntrStatus(SOC_EDMA30CC_0_REGS)&0x02)
{EDMA3ClrIntr(SOC_EDMA30CC_0_REGS, EDMA_RCV_PING_TCC);}
// SetPaRAM_Rec_PingConfig((unsigned int)srcBuff,(unsigned int)dst_ping);
// EDMA3EnableTransfer(SOC_EDMA30CC_0_REGS, EDMA3_CHA_TX, EDMA3_TRIG_MODE_MANUAL);
printf( "[CHA_EdmaIsr]: ping receive out!\r\n");
}
if (StatusVal & (1 << EDMA_RCV_PONG_TCC)) // receive channel (pong)
{
EDMA3ClrIntr(SOC_EDMA30CC_0_REGS, EDMA_RCV_PONG_TCC);
// SetPaRAM_Rec_PongConfig((unsigned int)srcBuff,(unsigned int)dst_pong);
// EDMA3EnableTransfer(SOC_EDMA30CC_0_REGS, EDMA3_CHA_TX, EDMA3_TRIG_MODE_MANUAL);
printf( "[CHA_EdmaIsr]: pong receive out!\r\n");
}

}

Jiang YanJun:

中断里加了一句 ,还是不行。IntEventClear(SYS_INT_EDMA3_0_CC0_INT1);

Jiang YanJun:

回复 Jiang YanJun:

搞 定了,自己给自己加加油

jianming liao:

回复 Jiang YanJun:

你好,我也遇到了相同的问题,请问你是怎么解决的?

赞(0)
未经允许不得转载:TI中文支持网 » 请教Tony Tang有关6748 eDMA的中断问题
分享到: 更多 (0)