嵌入式开发者社区

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

作者: silent123    时间: 2015-4-22 22:01
标题: edma3中断只能进去一次
使用mcsdk中的edma3lld库写的edma3驱动,在omapl138的dsp核运行,但是中断函数只能进去一次,路过的朋友帮忙看看,感谢万分。代码如下:
1 b. B1 D; A: C4 _#define  PING_PONG_ACNT          1, l- V2 F+ V: L9 W6 v
#define  PING_PONG_BCNT          8*32*40 : @2 U& m6 ]% V* w' S. K/ w
//#define  PING_PONG_BCNT       1
% x" ?4 `5 r( Z; J+ q#define  PING_PONG_CCNT          1$ @; b8 G) b7 E, Q+ E) t; N3 E
#define  MCASP_BASEADDR          0x01D00000
. y8 W8 j. i0 x: z0 l8 s% l( Q$ i#define  Mcasp_RXEVENTQUE        (0u)0 N! x; p0 r- L5 A$ i

) L* F, s+ w3 ]" k/* OPT Field specific defines */# {# U& J) N. d) w) W8 @
#define OPT_SYNCDIM_SHIFT                   (0x00000002u)
% [% X  W2 @1 g5 T1 M! _#define OPT_TCC_MASK                        (0x0003F000u)
0 }3 C" z+ k/ t) p. i% `6 Z#define OPT_TCC_SHIFT                       (0x0000000Cu)
2 }  f3 E8 w: D( v#define OPT_ITCINTEN_SHIFT                  (0x00000015u)& v( f- c  i+ S2 T8 V$ E
#define OPT_TCINTEN_SHIFT                   (0x00000014u)- @& _6 B/ ?$ r  K" {
4 s# H# c% J& ~
char ping_buffer[PING_PONG_BCNT];
. o1 _+ k% ]- ?. @char pong_buffer[PING_PONG_BCNT];) m: h. z- a( y
0 Y' J5 z# ]4 p' y- h
; K, D8 N7 f& C' ^/ g# f7 p
' P& ~1 B, k% M+ G: k8 A; J
; n" q; v+ L7 y* J1 n$ k  p- x
static void ys_edma3_init()( t6 n: Z( c- T0 }
{$ I, J6 X0 D' S$ Z- p4 m
        EDMA3_DRV_PaRAMRegs paramSet = {0,0,0,0,0,0,0,0,0,0,0,0};
1 W9 {6 H$ M  m# F& p0 U        EDMA3_DRV_Result result = EDMA3_DRV_SOK;
( O& m( @1 Z" Q7 y5 T        EDMA3_DRV_Handle hEdma;6 N/ [# B: E, N% W2 i; W" M
    uint32_t chId   = 0;0 j( z7 r! P/ u! W: j+ A
    uint32_t tcc    = 0;
1 l3 c0 W3 B' V* g( ]1 v& ]4 s- }' z5 f
    print2arm("edma3 driver init...",0);2 v9 q( Q: W6 f# U! c4 I0 T' v4 G

5 X, H  H, @- K& @& `; G        hEdma = edma3init(0,&result);6 `6 ^+ V$ T. j0 K( E% H
        if(hEdma)
* ?. I) x* j  o! ]2 x. G# V% m        {
+ @3 q" h$ V, @" j5 u0 ^! @$ Q                print2arm("edma3init() Passed.",0);
! K0 w6 u+ m7 f) _" |        }9 W' e3 v9 o+ Q, [, c. [2 \3 J
        else, K8 n4 S3 [6 K- R3 G/ s
        {7 K8 p: u2 m8 Z" {" a& s3 S
                print2arm("edma3init() Failed.",0);
' S! G# J: Q; I" y        }9 j/ P0 X/ o4 X, W) U
        4 c7 \) ?9 f& S2 J5 e% [/ i& V
        if (result == EDMA3_DRV_SOK)4 n6 T& V, u2 E$ V* @
    {
7 V- L, @4 I7 r/ ?* g+ D                result = EDMA3_DRV_requestChannel (hEdma, &chId, &tcc,
$ T- ^% p1 e1 M9 h. O                                                       (EDMA3_RM_EventQueue)0,8 T: h/ a4 _7 I* |# {& d
                                                            &edma3_isr, NULL);( Z9 k" V$ W  L# t, ?
    }
8 N& H4 J2 z& [! T1 @8 \$ V       
) [2 c$ W5 e- G0 N" h9 ~7 A. u- d        if(result == EDMA3_DRV_SOK)& Y8 a- c  C+ z! M% X6 S4 a
        {$ l$ h4 p+ J( i9 \5 Z0 P( L2 w
                paramSet.srcBIdx    = 0;5 N& Q( M% m2 b+ f
                paramSet.destBIdx   = 1;8 Q- B! G! t/ x1 X
                paramSet.srcCIdx    = 0;& u8 o" [7 g, c
                paramSet.destCIdx   = 0;
9 F. z# ]# M: I                paramSet.aCnt       = PING_PONG_ACNT;- @9 b: M9 d2 u7 O* `$ z' @6 H
                paramSet.bCnt       = PING_PONG_BCNT;2 h! ?, R* s" L( q' Q
                paramSet.cCnt       = PING_PONG_CCNT;8 e6 b$ d; Y9 C! L0 Y& d
               
: p' l1 m  _- L8 S7 \+ x9 S4 S# ]                /* For AB-synchronized transfers, BCNTRLD is not used. */6 a9 a. b! e# ^) h! ^. u2 d
                paramSet.bCntReload = PING_PONG_BCNT;% V( G: f) f! ~% q* i6 l
  n+ T% C8 k+ d( N% @/ {
                /* Src in constant mode Dest in INCR modes */& @  y' f8 L, F; x
                paramSet.opt &= 0xFFFFFFFDu;
8 }/ s  q8 P. ]2 z& g                //paramSet.opt &= 0xFFFFFFFCu;3 a( x7 U2 }( z, O2 h0 M
               
: H: g7 i1 G! t8 d. j2 g4 F                /* Program the TCC */
& U1 \  l/ J* v8 _  G5 V                paramSet.opt |= ((tcc << OPT_TCC_SHIFT) & OPT_TCC_MASK);
- B+ A. m- ?& n+ m4 n% T, a9 O" S' p* k
                /* Enable Intermediate & Final transfer completion interrupt */
5 K0 [7 g+ ?1 k' P( i' T. p0 u                paramSet.opt |= (1 << OPT_ITCINTEN_SHIFT);0 u* r) C9 C& D0 |% H
                paramSet.opt |= (1 << OPT_TCINTEN_SHIFT);
8 K: G" `  P, p. A2 t1 {  t) H( |7 @: k, ]' W& R
                /* AB Sync Transfer Mode */# H3 {# r' h5 v* o
                paramSet.opt |= (1 << OPT_SYNCDIM_SHIFT);4 f! O$ G8 ^  N* p  |
                % c% M- C3 G7 c; A& _
                /* Program the source and dest addresses for master DMA channel */. F3 @( t0 k! z3 N; g7 |
                paramSet.srcAddr    = (uint32_t)(MCASP_BASEADDR+0X029C);
8 N/ X, `) F2 @" C1 B* N                paramSet.destAddr   = (uint32_t)(ping_buffer);' H9 |/ o* }. L1 n7 W5 N. s& G0 `
/ W8 S" {0 B" I& T4 z, x! N: b/ p1 J) U3 b! s
                /* Write to the master DMA channel first. */% t+ E! A4 w" f( C, U  _: O/ f- [
                result = EDMA3_DRV_setPaRAM(hEdma, chId, &paramSet);# B7 m) U; c" d4 W+ P8 k% z
    }      
& ^2 f; `8 {. H, J* B" L% [, e0 l; h- Q# i: h  k3 w/ @! g: s) U+ {! s
        result = EDMA3_DRV_enableTransfer(hEdma,chId,EDMA3_DRV_TRIG_MODE_EVENT);
/ b' t6 t8 i* I; g" m0 B9 p        ; m# _: x. @5 K4 u9 l$ ~1 M
    if(result == EDMA3_DRV_SOK) 3 L( `7 X0 t$ t5 k; `
    {
6 ~- Y( y" S5 G5 y; a            print2arm("edma3 driver init success.",0);' m$ B0 _+ Y) D, J
    }
2 `, Z# l6 J: L9 s  u) p- }& L}* J/ ~4 m. `6 B2 Y& Q* U' W

$ Y9 }; t; z, e' Q0 }1 Y
4 y) h7 N5 N6 A+ p5 ]EDMA3的配置就这个函数,是由MCASP接收事件触发EDMA3传输的,中断函数edma3_isr只能进去一次,请大家帮忙看看哪里有问题。。。+ U+ D, ~4 d1 M3 `2 z" O. g

8 C, E2 X* g/ s' v1 o. O+ R4 Q  d& E6 X. v9 N$ G1 S

作者: Lewis    时间: 2015-4-24 10:47
每次DMA传输完成后都要再次使能传输
作者: silent123    时间: 2015-4-29 23:25
Lewis 发表于 2015-4-24 10:47
1 h; j4 C" D' f每次DMA传输完成后都要再次使能传输

5 J4 F! Q3 e: [, U原来是这样,我明天去试试,谢谢了!




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