嵌入式开发者社区

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

作者: silent123    时间: 2015-4-22 22:01
标题: edma3中断只能进去一次
使用mcsdk中的edma3lld库写的edma3驱动,在omapl138的dsp核运行,但是中断函数只能进去一次,路过的朋友帮忙看看,感谢万分。代码如下:
) n# M+ R1 m& Z8 D/ y2 q! K6 H#define  PING_PONG_ACNT          1/ j5 O) [; l9 t2 ~! n( j/ l
#define  PING_PONG_BCNT          8*32*40
9 G: e" u- L& I* r9 B//#define  PING_PONG_BCNT       1
) g2 F- T' A2 n4 l% [" e#define  PING_PONG_CCNT          10 R8 r1 Z5 |, @  G" N: @6 R
#define  MCASP_BASEADDR          0x01D00000+ }; b# x3 k: j7 O
#define  Mcasp_RXEVENTQUE        (0u): a; o1 `6 u3 L9 ^! \

* t5 I% g/ ^' I+ D, G7 u3 n/* OPT Field specific defines */
9 [) |- i* t1 j$ y4 c#define OPT_SYNCDIM_SHIFT                   (0x00000002u)5 @; d8 s1 L0 p2 O3 T# y; l3 A. L
#define OPT_TCC_MASK                        (0x0003F000u)$ r; q4 a6 {/ s& J+ E" g
#define OPT_TCC_SHIFT                       (0x0000000Cu)
7 j) C2 d, u& D. p( l#define OPT_ITCINTEN_SHIFT                  (0x00000015u)
7 [6 X2 y  k5 X) H#define OPT_TCINTEN_SHIFT                   (0x00000014u)( H3 E# Y2 O! E& W, ]
/ Y, t8 S% Z8 |# `  V5 u0 l5 H/ {4 }
char ping_buffer[PING_PONG_BCNT];2 l/ A! S% `5 n  r" m
char pong_buffer[PING_PONG_BCNT];( ~/ |7 x' a' |2 U

, ~/ r' y2 f7 Q* W) X' Z. x/ T" t. E% V5 Q& v1 M, P$ ?9 h

; l: ?6 P: K3 a& A; A& J$ U1 f( g! M3 X+ q5 R/ W  ~
static void ys_edma3_init()
! [; a" G: [" v{* I. Q( `& {5 `* S
        EDMA3_DRV_PaRAMRegs paramSet = {0,0,0,0,0,0,0,0,0,0,0,0};+ r7 ?. a( ]7 m
        EDMA3_DRV_Result result = EDMA3_DRV_SOK;% T' q0 f! z) _; V# X. }' D
        EDMA3_DRV_Handle hEdma;
+ q$ G4 Q" u) c- J/ }+ v" F    uint32_t chId   = 0;
% J9 B  K* |( s6 U/ g- f2 |& C    uint32_t tcc    = 0;5 t9 F! B% }3 n% O/ S% F  O4 u
1 r. {; V% I6 p8 j" e) H
    print2arm("edma3 driver init...",0);- M$ l9 [3 _- c# G6 G3 b0 B
! W1 Y! l& R# V+ f
        hEdma = edma3init(0,&result);
( Y9 Y+ B- L' u        if(hEdma)
9 L  y, J; ?' }  E& D( G5 U: H, N        {0 c; R1 t9 `8 x/ A8 _/ U7 l
                print2arm("edma3init() Passed.",0);# ~  K3 T: m& [. v$ A
        }
$ b, u% k# K' m/ t9 k( ^        else
7 c' H# @' B' [* c: D$ B( A        {+ P% b2 M( Q$ h+ D6 M, u
                print2arm("edma3init() Failed.",0);) H: ]8 f6 O" K7 `8 k" }1 M
        }
6 P( T; x8 Q- a. F; t0 v: T          k$ o: i6 f0 ^5 [  C6 x+ q
        if (result == EDMA3_DRV_SOK). B! k/ @- r9 T9 B; x4 |; y! X
    {( p9 h" R; G, s6 I. H# c# X' k& K
                result = EDMA3_DRV_requestChannel (hEdma, &chId, &tcc,
  o$ u4 ?2 B$ n/ c" E# {                                                       (EDMA3_RM_EventQueue)0,
9 m! K2 ^2 g; y- S6 }6 f" I5 X: h                                                            &edma3_isr, NULL);. i) E( v  y+ t7 `
    }: u$ |/ X8 \$ l  y0 `) u7 D0 I* H4 v
       
: R8 y4 A  u* ^$ V        if(result == EDMA3_DRV_SOK)+ M* ]% q9 J; S# ]  P6 y
        {
0 |! x3 W( n7 D                paramSet.srcBIdx    = 0;, h* ^6 q/ F* H7 S1 \& K4 i" C
                paramSet.destBIdx   = 1;" A* S1 s4 b5 }7 C. h# W0 q
                paramSet.srcCIdx    = 0;5 ?) i" m: C5 p) ?  T
                paramSet.destCIdx   = 0;* @4 @& k2 t( S
                paramSet.aCnt       = PING_PONG_ACNT;
- P4 Q3 U9 v; d* @9 l4 A2 e                paramSet.bCnt       = PING_PONG_BCNT;) W( P: [9 j1 Y0 n7 q4 ]) G( H
                paramSet.cCnt       = PING_PONG_CCNT;4 C: _+ O& ?8 k9 z
                , a5 p! h( }6 N6 n2 Y
                /* For AB-synchronized transfers, BCNTRLD is not used. */, r3 K8 o$ g: D, ~) b7 X
                paramSet.bCntReload = PING_PONG_BCNT;  @- ~+ B: O, G: o9 u( R: N! G

4 U9 H: g5 a7 X: T8 ^                /* Src in constant mode Dest in INCR modes */
$ j: K" M! [3 h! s( `' E                paramSet.opt &= 0xFFFFFFFDu;0 I' |& S0 ^1 y* c8 r
                //paramSet.opt &= 0xFFFFFFFCu;: X; u# \( L* E4 b4 A8 w
               
" V% H+ c  G9 r* k, X' G                /* Program the TCC */0 j$ Y% s$ j9 U
                paramSet.opt |= ((tcc << OPT_TCC_SHIFT) & OPT_TCC_MASK);; ^0 d" F/ v( @. t
* U: r' _1 w4 v3 \3 _  n. K3 ?. ?
                /* Enable Intermediate & Final transfer completion interrupt */; q: N  h6 N% O+ G
                paramSet.opt |= (1 << OPT_ITCINTEN_SHIFT);2 s9 l5 i( |6 Q  V4 w( n% G
                paramSet.opt |= (1 << OPT_TCINTEN_SHIFT);
( j3 o1 C/ [9 J9 ~8 e- c* i) N, A: q& e3 c  ^
                /* AB Sync Transfer Mode */
8 X7 m& [! X" f0 F; N9 l( Y+ x- K                paramSet.opt |= (1 << OPT_SYNCDIM_SHIFT);
1 T" }! ~4 t5 `. X2 p                , H5 \; i: ~( |. j, K
                /* Program the source and dest addresses for master DMA channel */6 a, E6 V- F4 B
                paramSet.srcAddr    = (uint32_t)(MCASP_BASEADDR+0X029C);
% ]/ w3 H+ u3 |$ ]; W/ L& Q; A                paramSet.destAddr   = (uint32_t)(ping_buffer);+ m* r& C) F4 ^% N* o) _4 _5 p/ @
, T" s9 Z. e3 B8 H  l
                /* Write to the master DMA channel first. */
. T  p7 W5 P2 S0 R5 L( R                result = EDMA3_DRV_setPaRAM(hEdma, chId, &paramSet);
- \. r& U  J! _' U: R7 C* X$ j    }       4 Y' n4 L0 e6 H$ H2 a$ S5 g% J: D" Q
* B$ J+ k$ l8 a4 O" o
        result = EDMA3_DRV_enableTransfer(hEdma,chId,EDMA3_DRV_TRIG_MODE_EVENT);8 P9 }& [& |, f* d- W
       
- a4 a) M7 x* l+ B% {8 V    if(result == EDMA3_DRV_SOK)
4 z! ], Q4 S# d5 p  Z5 p# i    {
: `9 Q' d/ K" {0 x& r            print2arm("edma3 driver init success.",0);
+ F( e2 N3 S. R7 {    } ) W" z+ P8 w2 x" u2 ~8 ~( M
}. E$ c6 n0 u( |& O- e* ?
# g3 x, G( p0 f4 E+ |
; {8 a" r9 f" s
EDMA3的配置就这个函数,是由MCASP接收事件触发EDMA3传输的,中断函数edma3_isr只能进去一次,请大家帮忙看看哪里有问题。。。" o/ H' _$ h6 F$ \

+ N/ j  j5 z  j& R9 A. [7 w( e& R! B9 w( e4 h2 h6 o8 v! N

作者: Lewis    时间: 2015-4-24 10:47
每次DMA传输完成后都要再次使能传输
作者: silent123    时间: 2015-4-29 23:25
Lewis 发表于 2015-4-24 10:470 D- `  K2 [  ~( B
每次DMA传输完成后都要再次使能传输
; A$ D; f, k# h1 x
原来是这样,我明天去试试,谢谢了!




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