嵌入式开发者社区

标题: edma3中断只能进去一次 [打印本页]

作者: silent123    时间: 2015-4-22 22:01
标题: edma3中断只能进去一次
使用mcsdk中的edma3lld库写的edma3驱动,在omapl138的dsp核运行,但是中断函数只能进去一次,路过的朋友帮忙看看,感谢万分。代码如下:3 i/ v; [7 Z/ L5 H
#define  PING_PONG_ACNT          1' `+ w# h% i* H) |7 ^
#define  PING_PONG_BCNT          8*32*40 2 |# c( B# K& V
//#define  PING_PONG_BCNT       1
/ [8 p6 J; _! c* A#define  PING_PONG_CCNT          16 z  A" M! e8 V$ S$ _' @- L# V
#define  MCASP_BASEADDR          0x01D00000
5 e& {6 F% v. }* D#define  Mcasp_RXEVENTQUE        (0u)
; S7 f" E, t2 g% Q" ~. }' T& r! L
/ l8 s+ ?* A3 n& H$ d  d/* OPT Field specific defines */
6 _3 w1 b4 B* V5 \. a#define OPT_SYNCDIM_SHIFT                   (0x00000002u): ~/ }" g' e2 z* O4 h3 m
#define OPT_TCC_MASK                        (0x0003F000u)% i0 H5 s+ o7 n/ @
#define OPT_TCC_SHIFT                       (0x0000000Cu)
3 K1 m3 \! z+ C" m3 h/ u$ W#define OPT_ITCINTEN_SHIFT                  (0x00000015u)+ u4 Z0 X  K# K! A* s5 `4 `) {
#define OPT_TCINTEN_SHIFT                   (0x00000014u)/ y: u$ m% Z# A! ]8 r; g/ p

$ \' A! J; N/ j. s7 @char ping_buffer[PING_PONG_BCNT];* e' N/ V5 ^) ^
char pong_buffer[PING_PONG_BCNT];
! h; g' [0 J0 Q3 l7 m5 K! u
8 [1 t) K0 I+ a: G8 B8 T, K; n, W# \% F9 H* b+ F
+ G$ H- _2 N' k$ E

) h9 N" d. W3 d0 H8 b7 Ystatic void ys_edma3_init()
  _/ j- H3 I+ E3 w9 b{" d' y- O& b" J
        EDMA3_DRV_PaRAMRegs paramSet = {0,0,0,0,0,0,0,0,0,0,0,0};* f$ W3 V7 R% K1 V
        EDMA3_DRV_Result result = EDMA3_DRV_SOK;+ n+ ?( P4 _/ F* {; ?3 ^
        EDMA3_DRV_Handle hEdma;3 n) ^& `( S% p# r
    uint32_t chId   = 0;& i  K  m2 t. g9 V" g  v1 W
    uint32_t tcc    = 0;* d' h- w* r3 z/ J: ~
2 a; R' x1 w! Y- }. X% K& m7 a
    print2arm("edma3 driver init...",0);
7 _# ]" V: }) b# A) Z7 }, G' ~' o' \5 j2 N
        hEdma = edma3init(0,&result);
* _0 R! c3 g& L& ~& B        if(hEdma)
+ n& q* y! A: ?: `        {% [" X* t0 R; ~' b/ p" S
                print2arm("edma3init() Passed.",0);
7 C' f) t( X( y$ n3 o: ?  C        }1 y" |1 W, E8 S& y9 ?4 }, i, P
        else
9 R5 `" E: v8 |% o9 |        {5 o1 K( V  @  s+ R9 L0 S
                print2arm("edma3init() Failed.",0);
# v8 \9 [% N5 i; w" ~6 p% I  k. c        }- }! F! C* V8 h  z8 s2 K0 o- Y
       
$ R" |5 ^9 g% W( O9 C: @        if (result == EDMA3_DRV_SOK)0 C! a5 J: y6 J1 i
    {
% O1 S$ \9 v& M# s4 n+ v                result = EDMA3_DRV_requestChannel (hEdma, &chId, &tcc,
1 o2 h/ a" h, Z& }                                                       (EDMA3_RM_EventQueue)0,) G; O8 m1 U1 Y9 A- B9 J+ M4 m
                                                            &edma3_isr, NULL);
+ ?  D1 l; B& d1 W$ w, O    }
$ t% k0 Z1 ]' {9 p9 h" |5 V       
4 n% _& m" v$ D4 x        if(result == EDMA3_DRV_SOK); f2 k. D8 n. s  @6 N) T
        {1 k) L7 ]( H9 S4 N* Z9 ]) y' Y
                paramSet.srcBIdx    = 0;& T/ t, Q, ?/ M! P) B# C0 _
                paramSet.destBIdx   = 1;3 G# `; K2 p: \4 o* w) g' g
                paramSet.srcCIdx    = 0;' F$ ~! K* e7 V1 r; E; {
                paramSet.destCIdx   = 0;
. K" H- ]6 g* i                paramSet.aCnt       = PING_PONG_ACNT;
9 J0 p. d  T* N* h3 V) z                paramSet.bCnt       = PING_PONG_BCNT;' |- m* Y  c3 a+ l
                paramSet.cCnt       = PING_PONG_CCNT;5 V, T, n7 U9 h$ A( d
                - F" v3 z+ j( i- |
                /* For AB-synchronized transfers, BCNTRLD is not used. */6 e8 Z3 V! V* S2 [
                paramSet.bCntReload = PING_PONG_BCNT;
4 I4 r5 e7 Z0 }0 [  S$ f
* @1 L; l9 z) s4 I                /* Src in constant mode Dest in INCR modes */
' G2 N9 K( G# f  P. N                paramSet.opt &= 0xFFFFFFFDu;
- x; E+ z0 p  B% {% y                //paramSet.opt &= 0xFFFFFFFCu;1 C% W$ L; J( h0 x
                4 ]0 L/ |' u8 k2 A4 s6 b
                /* Program the TCC */2 @7 Z; [5 Z% X! g- o/ D) K9 P( [
                paramSet.opt |= ((tcc << OPT_TCC_SHIFT) & OPT_TCC_MASK);' G/ A" V) ?; R
1 S/ K1 G0 M5 n, f9 b
                /* Enable Intermediate & Final transfer completion interrupt */# m8 e( Z3 h; q: {" n* X$ Y2 i
                paramSet.opt |= (1 << OPT_ITCINTEN_SHIFT);
' u4 `% u" C  i+ N2 E                paramSet.opt |= (1 << OPT_TCINTEN_SHIFT);
3 E7 {. G! }5 q- P
. j, o" z' A7 s0 g) y6 _$ r                /* AB Sync Transfer Mode */
$ V0 l6 G5 L$ b( u9 u                paramSet.opt |= (1 << OPT_SYNCDIM_SHIFT);
. {/ r6 N. S) h2 ~                * u4 s0 e/ @7 i: m0 S% ~0 p1 b
                /* Program the source and dest addresses for master DMA channel */
7 Y: k- |8 L! G1 m. x: F: `                paramSet.srcAddr    = (uint32_t)(MCASP_BASEADDR+0X029C);8 E3 E: I! b7 M/ e% H7 ?2 z  [! \  ?
                paramSet.destAddr   = (uint32_t)(ping_buffer);; P( {6 E2 z5 P) _. t9 h/ p

- z1 X% R8 U1 ]+ a8 N2 ~                /* Write to the master DMA channel first. */+ W0 f8 Y8 j! g0 \; d# w
                result = EDMA3_DRV_setPaRAM(hEdma, chId, &paramSet);' L$ A$ |. P# H' z/ S
    }      
! c( k6 \. d- C" e. @, e! r5 c: ?* P
. B8 E- p$ f+ `# n8 @4 V. i        result = EDMA3_DRV_enableTransfer(hEdma,chId,EDMA3_DRV_TRIG_MODE_EVENT);3 D' z* I: _* a# {: |- n3 d1 ~
       
& Y! M, Y' ~$ W' r4 {    if(result == EDMA3_DRV_SOK)
9 V2 g; T" p# c    {
' W0 k: n0 J. K* D# C8 V            print2arm("edma3 driver init success.",0);
1 B$ V6 K" E/ y# A, m1 r1 }8 ?    }
1 x$ o  T2 D4 ^}
/ K% ?& ]" o4 J6 A
+ d5 M" T& b2 X
9 ?" x( ]+ Y. V) K, ]8 @1 MEDMA3的配置就这个函数,是由MCASP接收事件触发EDMA3传输的,中断函数edma3_isr只能进去一次,请大家帮忙看看哪里有问题。。。
4 e4 D& R5 h6 s& y! h. W
3 w& Z0 E! H7 D4 h) s% N$ B7 I/ b5 R7 V  p& y. g# |6 y

作者: Lewis    时间: 2015-4-24 10:47
每次DMA传输完成后都要再次使能传输
作者: silent123    时间: 2015-4-29 23:25
Lewis 发表于 2015-4-24 10:47, f* `. w6 A- X$ Z: F3 j+ D
每次DMA传输完成后都要再次使能传输
# u; d/ e. v% M9 m( D$ ?
原来是这样,我明天去试试,谢谢了!




欢迎光临 嵌入式开发者社区 (https://www.51ele.net/) Powered by Discuz! X3.4