嵌入式开发者社区

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

作者: silent123    时间: 2015-4-22 22:01
标题: edma3中断只能进去一次
使用mcsdk中的edma3lld库写的edma3驱动,在omapl138的dsp核运行,但是中断函数只能进去一次,路过的朋友帮忙看看,感谢万分。代码如下:  _0 C2 u6 I3 g5 j; S' i% a
#define  PING_PONG_ACNT          1" ^+ T+ o5 R' x/ l7 R9 W* y# p
#define  PING_PONG_BCNT          8*32*40
$ y9 V  A# i& _2 e//#define  PING_PONG_BCNT       1 : |* ^- y" T# \( u# a
#define  PING_PONG_CCNT          1. I6 |4 }5 f9 T7 Z& n* I0 |# H3 e
#define  MCASP_BASEADDR          0x01D00000
& z0 t. J7 c2 J#define  Mcasp_RXEVENTQUE        (0u)
/ g8 ~) i) z% s8 C& G  _/ Z
* w, S- M2 [: ?' d$ S% z  @  x0 T' D6 y/* OPT Field specific defines */( C* s7 p2 K) D6 _
#define OPT_SYNCDIM_SHIFT                   (0x00000002u)! ]+ {% L) k+ G9 U* `8 k+ [
#define OPT_TCC_MASK                        (0x0003F000u)( ]9 P& z0 P0 W+ \% k' y% V
#define OPT_TCC_SHIFT                       (0x0000000Cu)5 y: f: y% Q# A$ Y
#define OPT_ITCINTEN_SHIFT                  (0x00000015u)/ S! g+ e) _; `9 J1 @: B  h
#define OPT_TCINTEN_SHIFT                   (0x00000014u)
( z% I; a# V$ J" m5 v
! `. ~" U2 S/ m8 A; lchar ping_buffer[PING_PONG_BCNT];
7 E' d0 }6 l2 f6 ?char pong_buffer[PING_PONG_BCNT];
6 h, i4 ~, z. P0 I( p0 u* W
7 A7 _; ^% T* p
; d. H2 P3 `0 M  e* R, p! v6 d& W+ w4 _

( b/ \, N/ B: [4 Gstatic void ys_edma3_init()
' ?8 |3 \& D* ]+ |( U8 T, Z9 N{6 P# I% f+ ~. }7 \
        EDMA3_DRV_PaRAMRegs paramSet = {0,0,0,0,0,0,0,0,0,0,0,0};" h. M* p5 I) i  q1 _, F: m$ \3 d
        EDMA3_DRV_Result result = EDMA3_DRV_SOK;
" N" T0 s+ |% n6 S+ o; V1 W; U        EDMA3_DRV_Handle hEdma;
; o+ Y( H; I4 @2 h6 Y    uint32_t chId   = 0;
6 w2 X$ `; ~) V8 \& Q( h9 B! s    uint32_t tcc    = 0;6 H: ^5 N  `$ }7 n% k5 D# [
6 X  s2 ^& r' b+ J7 y, @6 y
    print2arm("edma3 driver init...",0);: y# r2 K! Z5 }: p
4 Z5 h0 ^( b: G$ e5 K, ~
        hEdma = edma3init(0,&result);7 C/ U3 k: S+ v& M8 I+ D3 N
        if(hEdma)5 V1 C8 W: U) b$ l- p* i
        {( z! J  m1 A* X* p
                print2arm("edma3init() Passed.",0);+ P8 ?0 i9 L3 B6 Z
        }9 y" k7 ]( @; Q2 w) N
        else
2 V; a6 j- ?4 i" H- x, A. P        {2 h" \! U" s: `. k; ~
                print2arm("edma3init() Failed.",0);% ], q5 I* S* K1 ?% }2 h! j8 ]' U
        }" K3 K- D$ I/ ~) [
       
4 R; n# I$ l0 y' t, m* P8 b        if (result == EDMA3_DRV_SOK)  Z( T# w# O# H5 `2 o
    {
0 e5 G8 t* I, r; s" U3 O: i                result = EDMA3_DRV_requestChannel (hEdma, &chId, &tcc,
! T" `( h( k: r( X1 f1 q                                                       (EDMA3_RM_EventQueue)0,: P8 X& R8 S( T" t. V" Z0 x4 B& A
                                                            &edma3_isr, NULL);
. K" e, J5 U9 s/ m8 n7 `9 }8 g    }
1 x' T- `) c( m% }  i       
5 B5 v! t4 d$ X" p2 ?8 ]; q        if(result == EDMA3_DRV_SOK)
8 J# U" @. @3 S. S8 Y5 c  q        {
8 T3 B  Z5 O# w1 G5 a& r                paramSet.srcBIdx    = 0;
7 U# G4 n- i# R  N, W, P4 e6 v                paramSet.destBIdx   = 1;- ~5 u  g# `  J9 x
                paramSet.srcCIdx    = 0;& t/ H8 y% f' h* o1 t, _3 ]
                paramSet.destCIdx   = 0;. W+ Y$ C- i' E/ A
                paramSet.aCnt       = PING_PONG_ACNT;$ {8 x1 p: z4 B; y# Q6 U* l
                paramSet.bCnt       = PING_PONG_BCNT;# X3 `6 I& _- {' v
                paramSet.cCnt       = PING_PONG_CCNT;
0 V6 R( o3 u; U8 b- Z               
+ u  _/ L; _- X                /* For AB-synchronized transfers, BCNTRLD is not used. */( c5 l! A( ?- O- @
                paramSet.bCntReload = PING_PONG_BCNT;
  ^' ^4 y5 L: v' H; C: f7 q4 b: F: B- t4 V1 ?
                /* Src in constant mode Dest in INCR modes */
8 a& X, K% W& k4 U$ Q8 ^                paramSet.opt &= 0xFFFFFFFDu;
/ [+ y9 o5 T4 H; _* G                //paramSet.opt &= 0xFFFFFFFCu;
( y8 m" x/ d3 U( m( r" B               
4 o) k* _4 Z' ]$ B5 J, y                /* Program the TCC */+ C% u9 s2 N- Q: C4 d5 C! n( d
                paramSet.opt |= ((tcc << OPT_TCC_SHIFT) & OPT_TCC_MASK);
1 O% h8 i6 K8 j7 I$ j" k$ H4 x7 H7 G9 _3 S% {+ |
                /* Enable Intermediate & Final transfer completion interrupt */5 j3 b; y" ]. E6 w$ P" L1 u
                paramSet.opt |= (1 << OPT_ITCINTEN_SHIFT);/ D( l' n+ t: Z4 B
                paramSet.opt |= (1 << OPT_TCINTEN_SHIFT);( k" n' k# h% Q
; C( d% T- S; s( q: J
                /* AB Sync Transfer Mode */
$ y& `7 X: _: r; k/ e- y* S* p& K                paramSet.opt |= (1 << OPT_SYNCDIM_SHIFT);  V; L4 W0 y% V; L$ |- ~8 R
                3 s8 `* m6 E4 L, j
                /* Program the source and dest addresses for master DMA channel */3 K( P; {8 v" y0 z5 y
                paramSet.srcAddr    = (uint32_t)(MCASP_BASEADDR+0X029C);/ j$ i( i# j; H- X( _+ k0 O
                paramSet.destAddr   = (uint32_t)(ping_buffer);$ r& ]& R* A1 ~0 S5 A" g" a" {

3 Q2 \* k5 H# m0 \' O                /* Write to the master DMA channel first. *// f! g; x5 l  P* ]; x: T, L; C
                result = EDMA3_DRV_setPaRAM(hEdma, chId, &paramSet);
8 k9 K7 o7 U( P    }      
2 k6 D( F, w9 T" b$ a5 [2 b  R
. e2 l  h4 m3 C2 p0 y# ^        result = EDMA3_DRV_enableTransfer(hEdma,chId,EDMA3_DRV_TRIG_MODE_EVENT);  I1 q7 l6 t0 O1 x  K
        # H. U, r8 f4 G9 O
    if(result == EDMA3_DRV_SOK) ; Q) o9 P+ m! j' C/ w* [
    {
2 z$ E0 Q: f3 y% L& I2 m' X0 m( R            print2arm("edma3 driver init success.",0);5 C+ {& d0 q: q& D: E4 B
    }
/ _# D  @# G( p}% v( P6 R; s1 b8 Y
% M% H& z5 c0 G1 n3 V
+ q& Z* K3 u% Y* K8 G
EDMA3的配置就这个函数,是由MCASP接收事件触发EDMA3传输的,中断函数edma3_isr只能进去一次,请大家帮忙看看哪里有问题。。。/ H, O+ {! p( R3 _
. S" c  C3 }. f& ~1 L

. i' B# m' V6 o) e. x
作者: Lewis    时间: 2015-4-24 10:47
每次DMA传输完成后都要再次使能传输
作者: silent123    时间: 2015-4-29 23:25
Lewis 发表于 2015-4-24 10:47& r. D) @7 L2 e; o2 T. R/ M( t
每次DMA传输完成后都要再次使能传输
/ S- n9 _8 E( E/ y3 x
原来是这样,我明天去试试,谢谢了!




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