TXT

EDMA

By Allen Evans,2014-09-17 10:49
10 views 0
computer science

//

    //main.c

    //测试工程;测试EDMA

    #include

    #include

    #include

    #include

    unsigned int srcbuff[128],destbuf[128]; void EDMA_int0Handler(int tccNum) {

     //do some operation.

    }

    #pragma INTERRUPT(EDMA_tc_isr) void EDMA_tc_isr(void)

    {

     EDMA_intDispatcher(); }

    extern far unsigned int vectable[8*32]; static EDMA_Handle hdownload; void main(void)

    {

     register int i;

     CSL_init();

     IRQ_globalDisable();

     IRQ_setVecs(vectable);

     IRQ_clear(IRQ_EVT_EDMAINT);

     IRQ_enable(IRQ_EVT_EDMAINT);

     IRQ_globalEnable();

     hdownload = EDMA_open(0,EDMA_OPEN_RESET);

     if(EDMA_intAlloc(10) != 10) {

     EDMA_close(hdownload);

     return;

     }

     EDMA_configArgs(hdownload,

     (EDMA_FMKS(OPT,PRI,HIGH) //高优先级

     |EDMA_FMKS(OPT,ESIZE,32BIT)//32bit位宽

     |EDMA_FMKS(OPT,2DS,NO) //1维源数据

     |EDMA_FMKS(OPT,SUM,INC) //源地址更新方式?INC

     |EDMA_FMKS(OPT,2DD,NO) //1维目的数据

     |EDMA_FMKS(OPT,DUM,INC) //目的地址更新方式?INC

     |EDMA_FMKS(OPT,TCCINT,YES) //传输完成中断使能;TCCINT这个名称可能有误;忘记了...

     |EDMA_FMK(OPT,TCCNUM,10) //传输完成代码?10TCCNUM这个名称可

    能有误;忘记了...

     |EDMA_FMKS(OPT,LINK,NO) //禁止link

     |EDMA_FMKS(OPT,FS,YES)) //使用帧同步

     ,(Uint32)srcbuff

     ,10 //仅传送10个字

     ,(Uint32)destbuf

     ,0,0);

     EDMA_intClear(10);

     EDMA_intHook(10,EDMA_int0Handler);

     for(i = 0; i < 128; i++) srcbuff[i] = i+1;//准备源数据

     memset(destbuf,0,sizeof(destbuf)); //准备目的缓冲区

     EDMA_setChannel(hdownload); //CPU触发EDMA传输

     while(1);//等待

    }

    ;

    ;vector.asm

    ;定义中断向量表

     .sect ".vectors"

     .def _vectable

    _vectable

    DSP_RESET: NOP

     NOP

     NOP

     NOP

     NOP

     NOP

     NOP

     NOP

    NMI: NOP

     NOP

     NOP

     NOP

     NOP

     NOP

     NOP

     NOP

    REV1: NOP

     NOP

     NOP

     NOP

     NOP

     NOP

     NOP

     NOP

    REV2: NOP

     NOP

     NOP

     NOP

     NOP

     NOP

     NOP

     NOP

EXTINT0: NOP

     NOP

     NOP

     NOP

     NOP

     NOP

     NOP

     NOP

EXTINT1: NOP

     NOP

     NOP

     NOP

     NOP

     NOP

     NOP

     NOP

EXTINT2: NOP

     NOP

     NOP

     NOP

     NOP

     NOP

     NOP

     NOP

EXTINT3: NOP

     NOP

     NOP

     NOP

     NOP

     NOP

     NOP

     NOP

     .ref _EDMA_tc_isr

    EDMAINT: b _EDMA_tc_isr

     NOP

     NOP

     NOP

     NOP

     NOP

     NOP

     NOP

....;其他的中断向量均是NOP;略掉。

Report this document

For any questions or suggestions please email
cust-service@docsford.com