嵌入式开发者社区

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

作者: silent123    时间: 2015-4-22 22:01
标题: edma3中断只能进去一次
使用mcsdk中的edma3lld库写的edma3驱动,在omapl138的dsp核运行,但是中断函数只能进去一次,路过的朋友帮忙看看,感谢万分。代码如下:0 H' A' @1 c& B; H" E1 F' F
#define  PING_PONG_ACNT          1: D% U, H! V: ?6 J8 a1 m8 W
#define  PING_PONG_BCNT          8*32*40 3 c! n1 a* e* i3 T% s" b# A6 t% y
//#define  PING_PONG_BCNT       1 0 t* v9 ?8 X0 @2 z$ H1 O) y
#define  PING_PONG_CCNT          1
! L5 f( {: ~, V9 L  x#define  MCASP_BASEADDR          0x01D00000# y9 X* S7 B8 @3 C) G. p% J5 f. N
#define  Mcasp_RXEVENTQUE        (0u). {3 G: p- ]. F% v2 ?

5 r( }/ w6 v1 c9 i* \/* OPT Field specific defines */
- h; {: c* W& a+ [6 [9 K4 i- q#define OPT_SYNCDIM_SHIFT                   (0x00000002u)
, y* E7 n/ K+ n4 Y#define OPT_TCC_MASK                        (0x0003F000u)2 E" o! [7 {( b' R  i
#define OPT_TCC_SHIFT                       (0x0000000Cu)% X) r% o* F: ~
#define OPT_ITCINTEN_SHIFT                  (0x00000015u)% e5 t9 e+ o% \$ l1 i
#define OPT_TCINTEN_SHIFT                   (0x00000014u)
2 Y* I! A- M+ R! F  F; B0 w8 D/ [# V: F2 x5 X: r" F+ F# }% k+ s% B2 K8 J
char ping_buffer[PING_PONG_BCNT];  A7 Y- k% q$ k: m
char pong_buffer[PING_PONG_BCNT];& ~/ Y0 r5 z* e+ x1 }6 R: @

" w: X! Y' b$ B! b: [: y! d2 }6 H: Q( J0 Q, U, j9 \  s& H% F

8 m# C9 A9 N, r5 B6 U+ L4 N- U) T+ @: ~# o
static void ys_edma3_init()1 j. L6 f& l1 z& A
{
- _& T- z! m) N& G* R6 g( ]$ j        EDMA3_DRV_PaRAMRegs paramSet = {0,0,0,0,0,0,0,0,0,0,0,0};2 \% b& n. C/ o% A- v7 W/ z
        EDMA3_DRV_Result result = EDMA3_DRV_SOK;
7 p% E) M4 |. C/ {4 u( p- W9 o        EDMA3_DRV_Handle hEdma;9 d* F. Z# C* ^: _+ v7 a
    uint32_t chId   = 0;3 _( y, t0 }6 y( \) _
    uint32_t tcc    = 0;
% W0 j- u" C  L: z  s' v' S' o; `
0 w9 P  z2 Z- \' l5 Z1 I    print2arm("edma3 driver init...",0);
, c3 H" H0 z; ~  u6 A; c/ t1 K! k: K, b+ c  d
        hEdma = edma3init(0,&result);! M8 N7 `" Z) }" Y. p/ q8 {. E
        if(hEdma)# `3 ]& I: \! b. r) D
        {' }6 C  w+ d' {( o0 J% o
                print2arm("edma3init() Passed.",0);
; s& ]5 z$ O( a+ r1 C% i* r" U4 ]        }$ ?. I+ u# B4 U) w
        else- G+ E+ e; H: f8 z
        {
& ^; ~0 m- v. g$ o% t9 E! |                print2arm("edma3init() Failed.",0);" [/ t/ Z) P+ G* `3 g  Z) l5 x
        }
; \( }2 X  ?+ q$ p9 ]0 c        0 N- L9 ~) s- ?) E; @$ S2 b% d, K* t
        if (result == EDMA3_DRV_SOK)
. Q1 q0 }1 K6 j: z- t5 V    {) Y# h4 t0 y8 Q8 ^% r
                result = EDMA3_DRV_requestChannel (hEdma, &chId, &tcc,7 E: K1 M( W+ b% M4 z
                                                       (EDMA3_RM_EventQueue)0,
8 [( g% ?9 _+ ]$ W, D8 ?: U- m                                                            &edma3_isr, NULL);9 U! d! e) C- T0 C5 `9 v5 y/ D
    }4 r# [; g: T4 O& H4 [3 r; q4 x8 @
        " B7 Q3 E" N5 q1 C# Y- D
        if(result == EDMA3_DRV_SOK)
4 [1 o9 L; G) X2 n8 p9 ]4 K        {2 X8 ^' T% [& F7 j
                paramSet.srcBIdx    = 0;
5 Z( I4 j% i" m( h" S+ P6 S; R                paramSet.destBIdx   = 1;
4 U! n3 i. K" t  h0 B! A                paramSet.srcCIdx    = 0;
) z. _* g; [" F4 f# H% J) i# l                paramSet.destCIdx   = 0;
8 K. k' b8 X8 m! y                paramSet.aCnt       = PING_PONG_ACNT;
, P* ~! Z) s1 l7 {, g                paramSet.bCnt       = PING_PONG_BCNT;
" M0 S% u0 p$ x$ j) E                paramSet.cCnt       = PING_PONG_CCNT;3 Z4 d4 h4 f; j& @5 S# y  @. V
               
- i* Q$ Y) U$ S. x                /* For AB-synchronized transfers, BCNTRLD is not used. */; [* d1 S8 P0 u5 L/ |
                paramSet.bCntReload = PING_PONG_BCNT;
; C( I2 \) U0 o- O1 A0 `6 m) ~1 R. w
                /* Src in constant mode Dest in INCR modes */" C$ c* v( E" f5 p: F% k6 v8 }+ t3 ]/ n
                paramSet.opt &= 0xFFFFFFFDu;
% D) w3 I9 a; c. b( u                //paramSet.opt &= 0xFFFFFFFCu;5 F* i# M" C. a( G/ z7 v7 N
               
9 o+ V' x$ A, p                /* Program the TCC *// A5 E7 w% }# a0 D6 P
                paramSet.opt |= ((tcc << OPT_TCC_SHIFT) & OPT_TCC_MASK);) i, @7 C$ G4 O' g+ t3 E& h

8 w0 H8 }/ |+ a- T& s) c4 L" O                /* Enable Intermediate & Final transfer completion interrupt */) Y2 _# i% W2 T$ X4 ?/ h
                paramSet.opt |= (1 << OPT_ITCINTEN_SHIFT);
0 E( a- }: h- \+ r                paramSet.opt |= (1 << OPT_TCINTEN_SHIFT);
8 E! M( q) c6 Z7 i6 x0 S4 Q9 \
# O' o, h& ~* H" k9 x( E* ]                /* AB Sync Transfer Mode */9 A6 H1 E/ G& ]5 o
                paramSet.opt |= (1 << OPT_SYNCDIM_SHIFT);* W( ^- n' X) m
                0 x% A' P1 S1 @
                /* Program the source and dest addresses for master DMA channel */
/ b) a' ^; ~+ l                paramSet.srcAddr    = (uint32_t)(MCASP_BASEADDR+0X029C);
- ?9 F" f; @/ I: {% j0 J3 b6 Z! B                paramSet.destAddr   = (uint32_t)(ping_buffer);* L9 T* r  n0 B; K$ b) w6 x

( v9 w7 C9 h! t: n                /* Write to the master DMA channel first. */
0 T  Q* p! m) C                result = EDMA3_DRV_setPaRAM(hEdma, chId, &paramSet);
# S5 P, Q4 _5 d/ f/ H    }      
' A& `! ^4 p1 @, @( G* O- E& @5 ~
# J* y6 ]1 \, y; R        result = EDMA3_DRV_enableTransfer(hEdma,chId,EDMA3_DRV_TRIG_MODE_EVENT);
- k  j8 Y: y2 l2 V0 `' l1 @        2 H7 z/ o2 K' X2 }" c  X& T$ b
    if(result == EDMA3_DRV_SOK) 8 X5 h, c  S$ D/ V0 t1 }" E: g
    {+ p" N% D" G+ ?4 W$ h* D) W4 Q; R4 S
            print2arm("edma3 driver init success.",0);
" j; E  ]4 X* C9 R: ]    } 9 O; |0 m2 H6 o" Q4 ]
}
4 _# K7 x- `0 |3 N; O
& B" h. j# @2 \9 ^" c0 U$ l* M
1 `" |3 j5 F( y$ n4 qEDMA3的配置就这个函数,是由MCASP接收事件触发EDMA3传输的,中断函数edma3_isr只能进去一次,请大家帮忙看看哪里有问题。。。
& b" P3 E' T; k2 l
4 \7 @( Q& i5 r8 T/ j: q1 e/ N
% R4 O* u) l' t9 I( R: i
作者: Lewis    时间: 2015-4-24 10:47
每次DMA传输完成后都要再次使能传输
作者: silent123    时间: 2015-4-29 23:25
Lewis 发表于 2015-4-24 10:47
# v  T/ q) E) O; |每次DMA传输完成后都要再次使能传输

' p$ [4 P' x' M7 B, B8 V4 m( j4 w原来是这样,我明天去试试,谢谢了!




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