Hi all
I use DM8168 EVM. CCSV5.4 . the attachment is the gel file and my edma configuration code.
I use TSCL/TSCH registers to count the time consuming.
I use two different ways to count cycle, and the time consuming of each way have big different.
first way:
I add two breakpionts, one just before function edma_2d2d, one just after function edma_2d2d, the code is as:
statement; // breakpoint 1 get the value of TSCH/TSCK
edma_2d2d(); // step over
statement ; // breakpoint2 get the value of TSCH/TSCK
the cycle used in this way is about 1300-2000 cycles
sencode way:
statement; // breakpoint 1 get the value of TSCH/TSCK
edma_2d2d(); // step info inside the function ,and single-step every statements of this function,
statement ; // breakpoint2 get the value of TSCH/TSCK
the cycle used in this way is about 120-200 cycles
Why the first way consume so much cycles?
/* * dma_test.c * * Created on: 2015-3-4 * Author: Administrator */ #include "dma_test.h" int edma_init() { int chnId = 0; // clear some registers REG(EDMATPCC+EDMAECR) = 0xffffffff; // clear ER REG(EDMATPCC+EDMAECRH) = 0xffffffff; REG(EDMATPCC+EDMAIECR) = 0xffffffff; // clear IER REG(EDMATPCC+EDMAIECRH) = 0xffffffff; REG(EDMATPCC+EDMAICR) = 0xffffffff; // clear IPR REG(EDMATPCC+EDMAICRH) = 0xffffffff; // set DCHMAP for edma channel chnId = 0; REG(EDMATPCC+EDMADCHMAP0+chnId * 4) = 0; // edma channel 0 use paramset 0 chnId = 1; REG(EDMATPCC+EDMADCHMAP0+chnId * 4) = 1 << 5; // edma channel 1 use paramset 1 REG(EDMATPCC+EDMAQNUM0) = 1 << 4; // channel 1 set to EQ1 and channel 0 set to EQ0 REG(EDMATPCC+EDMAEESR) |= 3; return 0; } int qdma_init() { return 0; } int edma_wait() { int cnt = 0; while(REG(EDMATPCC+EDMAIPR) & 1 == 0) cnt++ ; REG(EDMATPCC+EDMAICR) |= 1; return 1; } int edma_2d2d(unsigned int src, unsigned int abcnt, unsigned int dst,unsigned int dstsrcbidx,unsigned int bcntrld_link,unsigned int dstsrccidx,unsigned int ccnt) { paramset *set0 = (paramset *)(EDMATPCC+EDMAPARAM); int cnt = 0; set0->opt = 0x0010000c; set0->src = src; set0->bcnt_acnt = abcnt; set0->dst = dst; set0->dstb_srcb_idx = dstsrcbidx; set0->bcntrld_link = bcntrld_link; set0->dstc_srcc_idx = dstsrccidx; set0->rsv_ccnt = ccnt; REG(EDMATPCC+EDMAESR) |= 1; return 0; } int qdma_2d2d() { return 0; }