嵌入式开发者社区

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

作者: silent123    时间: 2015-4-22 22:01
标题: edma3中断只能进去一次
使用mcsdk中的edma3lld库写的edma3驱动,在omapl138的dsp核运行,但是中断函数只能进去一次,路过的朋友帮忙看看,感谢万分。代码如下:' _# Y/ R! d/ ^6 s9 ]5 z
#define  PING_PONG_ACNT          1
7 J1 [% ?0 M' j( S4 c1 z4 _4 f#define  PING_PONG_BCNT          8*32*40 $ H  P# k# o/ {, x+ i
//#define  PING_PONG_BCNT       1 " y: z1 r1 _' v: R$ B4 q
#define  PING_PONG_CCNT          1  S5 z% U  Y4 E2 b* ~. w
#define  MCASP_BASEADDR          0x01D00000
+ A& ~' G9 o  Q" d& s: c/ U/ v5 _/ d#define  Mcasp_RXEVENTQUE        (0u)/ h$ K' ^, w  q+ H( m" ~5 O$ b4 [

$ H) _/ f+ L" N& N/* OPT Field specific defines */3 \; f" v5 V! C7 R2 }, |+ [
#define OPT_SYNCDIM_SHIFT                   (0x00000002u)/ B) f9 C# c0 f$ U8 {( C
#define OPT_TCC_MASK                        (0x0003F000u); p# o  o2 T1 p  ]
#define OPT_TCC_SHIFT                       (0x0000000Cu)
) B! h+ j; L; Z0 Z' x#define OPT_ITCINTEN_SHIFT                  (0x00000015u)3 ^6 [( ]- d% R
#define OPT_TCINTEN_SHIFT                   (0x00000014u)
; F8 r& O, y. E6 j6 N0 B: \5 r* b
& F& T3 ?: b; @8 _char ping_buffer[PING_PONG_BCNT];
! ?, ], U6 w# C* M: qchar pong_buffer[PING_PONG_BCNT];
9 S$ `7 ~# g1 p. f9 f- U5 a
3 |0 K" p6 y% X$ q" V; i9 \$ O; d+ f
  Y% t9 ^7 _; s5 |$ ^8 x

( z9 x: g2 Y7 P, I* ]" D1 ~static void ys_edma3_init()4 d: \0 `3 X; E
{4 E7 Q" j, k( L- L
        EDMA3_DRV_PaRAMRegs paramSet = {0,0,0,0,0,0,0,0,0,0,0,0};
8 r1 b0 J& m# o) ?2 X        EDMA3_DRV_Result result = EDMA3_DRV_SOK;. X' W5 X/ ^7 z1 ]  V
        EDMA3_DRV_Handle hEdma;
: `* p. q" K. V6 a7 u# J    uint32_t chId   = 0;
: n; i7 K( l/ ?: ?3 @2 ^0 w    uint32_t tcc    = 0;% U8 Q/ t' \7 d- f! p( K" O
. _7 {* ]5 C* E# [6 e, {( V* Y
    print2arm("edma3 driver init...",0);/ `4 |! u& x# D/ [
1 b+ ]# A$ G  e& v. N/ Y9 @+ y
        hEdma = edma3init(0,&result);1 t6 i9 A! G2 m% w" g; g
        if(hEdma)
1 U" G6 c) J& @, Q% z        {
2 L* s% `; w5 H& C                print2arm("edma3init() Passed.",0);
+ ~2 K: d; g* d. w" U( ?        }7 d2 i3 T7 U) n  [" |
        else
: S9 H; L2 J$ |        {
* n+ S& o& M  g- R/ Q                print2arm("edma3init() Failed.",0);
/ L2 e4 N. R) }/ e* S- T# k        }$ t( l4 n" k4 m/ G8 Z" ~$ _
        : L- W; H5 j: I7 h- U
        if (result == EDMA3_DRV_SOK)# L6 Y1 H% X3 r
    {( Q; @. U0 V* \
                result = EDMA3_DRV_requestChannel (hEdma, &chId, &tcc,
6 V+ p3 N# \& y4 u4 z                                                       (EDMA3_RM_EventQueue)0,/ q! F1 U7 |1 I6 {' `, r) i
                                                            &edma3_isr, NULL);. w) h. f# u& w6 |
    }7 I7 O4 x3 N* l' W
        $ ]. h1 Y0 l6 w2 r! A
        if(result == EDMA3_DRV_SOK)% w& o. R* N+ W
        {
' G. q2 ]" s, L6 b                paramSet.srcBIdx    = 0;8 G: b" t. i- r) s4 `( \7 T7 G4 `
                paramSet.destBIdx   = 1;- B) a7 }; p9 M0 x$ S
                paramSet.srcCIdx    = 0;
" v2 F" P+ o! _- ]7 z5 M                paramSet.destCIdx   = 0;
) V% E' ~0 D. o& M5 Q5 Y- L  Z                paramSet.aCnt       = PING_PONG_ACNT;
5 A0 Y- c' }; H/ B% {  \                paramSet.bCnt       = PING_PONG_BCNT;3 m5 K- `. n# _7 i5 Z5 u
                paramSet.cCnt       = PING_PONG_CCNT;6 Q- G  t+ j7 e8 t
                9 w+ R, |, k& I( U
                /* For AB-synchronized transfers, BCNTRLD is not used. */
2 x1 b. ]2 Y* o8 f$ b% O( |                paramSet.bCntReload = PING_PONG_BCNT;
7 I3 b5 p) m* t
6 v( D  a, t5 T+ r                /* Src in constant mode Dest in INCR modes */2 l! d. p# s* M# ~2 F4 g
                paramSet.opt &= 0xFFFFFFFDu;. J! s6 T( ~6 A$ |+ `2 m2 ^, i
                //paramSet.opt &= 0xFFFFFFFCu;, W% h. I& s( A, f1 v
                6 B! Z$ \& i7 q6 W9 \
                /* Program the TCC */
: w  u8 n0 S& x0 _6 _1 Q                paramSet.opt |= ((tcc << OPT_TCC_SHIFT) & OPT_TCC_MASK);
1 ~  e7 w+ L) w. T) }# l0 g1 a) q$ x, y9 y9 U4 g8 Y, B) k5 H
                /* Enable Intermediate & Final transfer completion interrupt */0 ]0 P/ }2 `. V) k9 I( P
                paramSet.opt |= (1 << OPT_ITCINTEN_SHIFT);% c  a, r1 L* x& Q7 \) V% Q
                paramSet.opt |= (1 << OPT_TCINTEN_SHIFT);
# B( B. U: L. z- x- ]. F% V. {3 F- |/ Y: ?) b2 {
                /* AB Sync Transfer Mode */
7 X) O! S$ C6 N! c4 X3 e" p- B" O                paramSet.opt |= (1 << OPT_SYNCDIM_SHIFT);
3 I; K( I; J" a- I. S               
3 d& h+ n% H/ |3 E, Q/ B( }# l                /* Program the source and dest addresses for master DMA channel */
& b7 t  @- C+ d/ m8 A: L3 G                paramSet.srcAddr    = (uint32_t)(MCASP_BASEADDR+0X029C);
5 l6 s! K1 g3 H( [! i) Y/ m                paramSet.destAddr   = (uint32_t)(ping_buffer);1 ]. p# X8 ]3 h7 ~' V

9 j' c+ _' R, H5 @+ c8 c                /* Write to the master DMA channel first. */
) w/ r2 Z" w# V7 b+ {# O                result = EDMA3_DRV_setPaRAM(hEdma, chId, &paramSet);
" ?5 i1 e& q+ Q    }       # ]4 G5 r7 `" ]9 A

8 Z. K2 f- u) O) i1 o. [        result = EDMA3_DRV_enableTransfer(hEdma,chId,EDMA3_DRV_TRIG_MODE_EVENT);
+ r% P+ g& I  ]5 V        : V0 {* g2 u% a( ~9 o9 u# H/ c
    if(result == EDMA3_DRV_SOK)
/ x/ U4 {5 ?0 l6 |, H3 f/ W    {
2 B$ ~; X7 A, U1 W; a8 t6 F4 \9 i            print2arm("edma3 driver init success.",0);. v; `; |: h7 N
    } 5 S: k' k2 Y7 Q6 m4 W
}" }5 Y. S8 n( o! W- m
; a+ b! B2 k5 }" W

% M. J# n4 j! J) u( H0 D- ?EDMA3的配置就这个函数,是由MCASP接收事件触发EDMA3传输的,中断函数edma3_isr只能进去一次,请大家帮忙看看哪里有问题。。。
' ?8 `3 U. A3 g% O. h6 ]' J
' q2 @: f2 m! I' |/ ^: z- E( E: E  T* V4 E9 {/ }

作者: Lewis    时间: 2015-4-24 10:47
每次DMA传输完成后都要再次使能传输
作者: silent123    时间: 2015-4-29 23:25
Lewis 发表于 2015-4-24 10:47
8 f6 L3 H6 Y, L4 n% f' \每次DMA传输完成后都要再次使能传输

" H' s* D- D" C1 Z+ ^3 e: M" g) T6 P原来是这样,我明天去试试,谢谢了!




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