我想使用PDT传输,将FPGA内FIFO里的数据传送到DSP CE0外扩的SDRAM里,但是就是读不到数据,SDRAM里的数据全变成了一个值,不知道问题出在哪里,有没有朋友做过这方面的啊?
我写的代码如下:
#include <csl.h>
#include <csl_edma.h>
#include <csl_emifa.h>
#include <csl_emifb.h>
#include <csl_irq.h>
//#include <c6416cfg.h>
#include <stdio.h>
#include "stdlib.h"
#define EMIFA_PDTCTL 0x01800040
#define FIFO_ADDR 0x80000000
//#define FIFO_SOURCE 0Xa0000000
#define BUFF_ADDR1 0x80000000
#define BUFF_ADDR2 0x00011000
#define EL_COUNT 0x00100100
//#define TCCINTNUM 10
#define FIFO_DEPTH 256
#define NUM_FRAMES 8
//interrupt void ext_isr6();
//interrupt void c_int07();
//int fifo_halffull();
int num_frames = NUM_FRAMES;
int done = 0;
int flag = 0;
EDMA_Handle hEdma; //Handle for the EDMA channel
//EDMA_Handle hEdmaPing; //Handle for the ping EDMA reload parameters
//EDMA_Handle hEdmaPong; //Handle for the pong EDMA reload parameters
EMIFA_Config C6416Config = {
0x000000A0, // gblctl ECLKOUT2不使能
0x00000080, // Acectl0 CE0,接了32bit SDRAM*2
//(0x0<<31)|(0x0<<27)|(0x0<<21)|(0x0<<19)|(0x0<<15)|(0x0<<13)|(0x0<<7)|(0x1<<3)|(0x3), // cectl1 外扩32位接口=0x23
//依次表示:WRSETUP,WRSTRB, WRHLD, RESETUP, TA, RDSTRB, MTYPE, WRHLDMSB, RDHLD
//0x00020101,
//0x00020302,
//0x00020302,
//0x00000000,
//0x00000000,
//0x00000000,
0x23,
(0x0<<28)|(0x0<<22)|(0x0<<20)|(0x0<<16)|(0x0<<14)|(0x0<<8)|(0x2<<4)|(0x0<<3)|(0x3), // cectl2 外扩32位接口=0x23
(0x0<<28)|(0x0<<22)|(0x0<<20)|(0x0<<16)|(0x0<<14)|(0x0<<8)|(0x2<<4)|(0x0<<3)|(0x3), // cectl3外扩32位接口=0x23
0x07126000, // sdctl
0x0000061A, // sdtim
0x54529, // sdext
0x00000000, // cesec0
0x00000000, // cesec1
0x00000000, // cesec2
0x00000000 // cesec3
};
EMIFB_Config MyEmifb ={
0x000000A0, // gblctl
0x00000040, // cectl0
0xffffff03, // cectl1 接了8位的FLash,其他没用,不用管
0x00000030, // cectl2
0x00000030, // cectl3
0x0, // sdctl
0x0, // sdtim
0x00000000, // sdext
0x00000000, // cesec0
0x00000000, // cesec1
0x00000000, // cesec2
0x00000000 // cesec3
};
EDMA_Config my_edma =
{
EDMA_OPT_RMK(
EDMA_OPT_PRI_HIGH,
EDMA_OPT_ESIZE_8BIT,
EDMA_OPT_2DS_NO,
EDMA_OPT_SUM_INC,
EDMA_OPT_2DD_NO,
EDMA_OPT_DUM_INC,
EDMA_OPT_TCINT_YES,
EDMA_OPT_TCC_DEFAULT,
EDMA_OPT_TCCM_DEFAULT,
EDMA_OPT_ATCINT_NO,
EDMA_OPT_ATCC_DEFAULT,
EDMA_OPT_PDTS_DISABLE,
EDMA_OPT_PDTD_ENABLE,
EDMA_OPT_LINK_NO,
EDMA_OPT_FS_YES
),
//0x613A0005,
EDMA_SRC_OF(0x80000000),
EDMA_CNT_OF(EL_COUNT),
EDMA_DST_OF(0x80000000),
EDMA_IDX_OF(0x0),
EDMA_RLD_OF(0x0)
};
extern far void vectors();
void setupInterrupts(void);
void main()
{
//char buff[128];
int i;
int a=1;
CSL_init();
EMIFA_config(&C6416Config);
EMIFB_config(&MyEmifb);
//*(int *)0x80000001=15;
// *(int *)0x80000000=4;
*(int *)EMIFA_PDTCTL = 0x00000000;
setupInterrupts();
while(1)
{
}
// printf("Done
");
}
// Function to sets up interrupts to service EDMA transfers
void setupInterrupts()
{
IRQ_setVecs(vectors);
IRQ_globalDisable();
IRQ_reset(IRQ_EVT_EXTINT6);
IRQ_nmiDisable();
IRQ_RSET(EXTPOL,0x0E);
IRQ_nmiEnable();
IRQ_map(IRQ_EVT_EXTINT6,6);
IRQ_enable(IRQ_EVT_EXTINT6);
IRQ_globalEnable();
}
/*
int fifo_halffull()
{
int half_full;
half_full = TINT_GET(0);
return half_full;
}
*/
interrupt void ext_isr6()
{
IRQ_disable(IRQ_EVT_EXTINT6);
flag = 1;
hEdma = EDMA_open(EDMA_CHA_EXTINT6,EDMA_OPEN_RESET);
EDMA_config(hEdma,&my_edma);
EDMA_enableChannel(hEdma);
EDMA_setChannel(hEdma);
}
此帖出自
小平头技术问答
一周热门 更多>