源码:
#include <stdio.h>
#include <csl.h>
#include <csl_cache.h>
#include <csl_edma.h>
#include <csl_timer.h>
#include <csl_irq.h>
#include "DEC6713.h"
#define TCCINTNUM 10
#define BUFF_SZ 256
#define FCPU 150000000
#define SRATE 8000
#define TPRD (FCPU/(4*SRATE))
#define TRANSFER_CNT 20
#pragma DATA_ALIGN (ping,128)
#pragma DATA_ALIGN (pong,128);
#pragma DATA_ALIGN (outbuff,128);
int ping[BUFF_SZ];
int pong[BUFF_SZ];
int outbuff[BUFF_SZ];
#pragma DATA_ALIGN(ping_data,128);
#pragma DATA_ALIGN(pong_data,128);
static int ping_data;
static int pong_data;
static int pingpong=0;
volatile int transferCount=0;
extern far void vectors();
void setupInterrupts(void);
void stopEdma(void);
void processsbuff(int );
TIMER_Handle hTimer;
EDMA_Handle hEdma;
EDMA_Handle hEdmaPing;
EDMA_Handle hEdmaPong;
EDMA_Config cfgEdma;
EDMA_Config cfgEdmaPing=
{
EDMA_OPT_RMK(
EDMA_OPT_PRI_LOW,
//EDMA_OPT_PRI_LOW,
//EDMA_OPT_PRI_HIGH,
EDMA_OPT_ESIZE_32BIT,
EDMA_OPT_2DS_NO,
EDMA_OPT_SUM_NONE,
EDMA_OPT_2DD_NO,
EDMA_OPT_DUM_INC,
EDMA_OPT_TCINT_YES,
EDMA_OPT_TCC_OF(TCCINTNUM),
EDMA_OPT_LINK_YES,
EDMA_OPT_FS_NO
),
EDMA_SRC_OF(&ping_data),
EDMA_CNT_OF(BUFF_SZ),
EDMA_DST_OF(ping),
EDMA_IDX_OF(0x00000004),
EDMA_IDX_OF(0x00000000),
};
EDMA_Config cfgEdmaPong=
{
EDMA_OPT_RMK(
EDMA_OPT_PRI_LOW,
EDMA_OPT_ESIZE_32BIT,
EDMA_OPT_2DS_NO,
EDMA_OPT_SUM_NONE,
EDMA_OPT_2DD_NO,
EDMA_OPT_DUM_INC,
EDMA_OPT_TCINT_YES,
EDMA_OPT_TCC_OF(TCCINTNUM),
EDMA_OPT_LINK_YES,
EDMA_OPT_FS_NO
),
EDMA_SRC_OF(&pong_data),
EDMA_CNT_OF(BUFF_SZ),
EDMA_DST_OF(pong),
EDMA_IDX_OF(0x00000004),
EDMA_RLD_OF(0x00000000),
};
void main()
{
*(int *)0x0184000=(*(int *)0x01840000 & 0x00000000);
CSL_init();
DEC6713_init();
ping_data=0x00000000;
pong_data=0x80000000;
CACHE_wbInvL2(&ping_data,4,CACHE_WAIT);
CACHE_wbInvL2(&pong_data,4,CACHE_WAIT);
setupInterrupts();
EDMA_clearPram(0x00000000);
hTimer=TIMER_open(TIMER_DEV1,TIMER_OPEN_RESET);
hEdma=EDMA_open(EDMA_CHA_TINT1,EDMA_OPEN_RESET);
hEdmaPing=EDMA_allocTable(-1);
hEdmaPong=EDMA_allocTable(-1);
cfgEdma = cfgEdmaPing;
cfgEdmaPing.rld=EDMA_RLD_RMK(0,hEdmaPing);
cfgEdmaPong.rld=EDMA_RLD_RMK(0,hEdmaPong);
cfgEdma.rld =EDMA_RLD_RMK(0,hEdmaPong);
cfgEdmaPing.rld =EDMA_RLD_RMK(0,hEdmaPong);
EDMA_config(hEdma,&cfgEdma);
EDMA_config(hEdmaPing,&cfgEdmaPing);
EDMA_config(hEdmaPong,&cfgEdmaPong);
TIMER_configArgs(hTimer,
TIMER_CTL_OF(0x00000200),
TIMER_PRD_OF(TPRD),
TIMER_CNT_OF(0)
);
IRQ_enable(IRQ_EVT_EDMAINT);
EDMA_intDisable(TCCINTNUM);
EDMA_intClear(TCCINTNUM);
EDMA_intEnable(TCCINTNUM);
EDMA_enableChannel(hEdma);
TIMER_start(hTimer);
TIMER_start(hTimer);
while(transferCount<=TRANSFER_CNT);
}
void processbuff(int arg)
{
int *inbuff;
int x;
printf("\n %2d -",transferCount);
if(pingpong)
{
inbuff=ping;
printf(" Ping ");
}
else
{
inbuff=pong;
printf(" Pong ");
}
transferCount++;
for(x=0;x<BUFF_SZ;x++)
{
outbuff[x]=inbuff[x];
}
CACHE_wbInvL2(outbuff,(BUFF_SZ << 2 ),CACHE_WAIT);
CACHE_clean(CACHE_L2,inbuff,(BUFF_SZ << 2));
}
void setupInterrupts(void)
{
IRQ_setVecs(vectors);
IRQ_nmiEnable();
IRQ_globalEnable();
IRQ_map(IRQ_EVT_EDMAINT,8);
IRQ_reset(IRQ_EVT_EDMAINT);
}
interrupt void
c_int08(void )
{
EDMA_intClear(TCCINTNUM);
pingpong=(pingpong+1) & 1;
if(transferCount >= TRANSFER_CNT)
{
TIMER_pause(hTimer);
stopEdma();
TIMER_close(hTimer);
printf("\nDone…..");
//exit(0);
}
if(pingpong)
{
ping_data++;
CACHE_wbInvL2(&ping_data,4,CACHE_WAIT);
EDMA_link(hEdma,hEdmaPing);
}
else
{
pong_data++;
CACHE_wbInvL2(&pong_data,4,CACHE_WAIT);
EDMA_link(hEdma,hEdmaPong);
}
processbuff(0);
return;
}
void stopEdma(void)
{
IRQ_disable(IRQ_EVT_EDMAINT);
EDMA_RSET(CCER,0x00000000);
EMDA_disableChannel(hEdma);
EDMA_intDisable(TCCINTNUM);
EDMA_intClear(TCCINTNUM);
EDMA_close(hEdma);
EDMA_resetAll();
EDMA_RSET(CIPR,0xFFFFFFFF);
EDMA_RSET(ECR,0xFFFFFFFF);
}
出现错误:
undefined first referenced
symbol in file ——— —————-
CACHE_clean ./main.obj CACHE_wbInvL2 ./main.obj CSL6713_LIB_ ./main.obj DEC6713_init ./main.obj EDMA_allocTable ./main.obj EDMA_clearPram ./main.obj EDMA_close ./main.obj EDMA_config ./main.obj EDMA_enableChannel ./main.obj EDMA_intClear ./main.obj EDMA_intDisable ./main.obj EDMA_intEnable ./main.obj EDMA_link ./main.obj EDMA_open ./main.obj EDMA_resetAll ./main.obj EMDA_disableChannel ./main.obj IRQ_disable ./main.obj IRQ_enable ./main.obj IRQ_globalEnable ./main.obj IRQ_map ./main.obj IRQ_nmiEnable ./main.obj IRQ_reset ./main.obj IRQ_setVecs ./main.obj TIMER_close ./main.obj TIMER_configArgs ./main.obj TIMER_open ./main.obj TIMER_pause ./main.obj TIMER_start ./main.obj _CSL_init ./main.obj vectors ./main.obj
error #10234-D: unresolved symbols remain
error #10010: errors encountered during linking; "new11.out" not built
按照网上的方法:添加了ti.csl.ae66, ti.csl.intc.ae66库文件和C6678的pdk路径
依旧弹出错误!!!!求大神解答
Andy Yin1:
你代码里有#include "DEC6713.h",是使用6713芯片么,那后面怎么加的是6678的lib,另外你这里提示的很多函数如EDMA及TIMER的都不是pdk及csl lib中提供的函数。
tao wu4:
回复 Andy Yin1:
你好,非常感谢您的回答!这个是我在书上看到的程序。我也觉得问题可能像你所说的那样,出在库文件上,我尝试了一些方法还是没搞定。
请问您有调试好的edma程序可供新手参考一下嘛?不甚感激