嵌入式开发者社区

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

作者: silent123    时间: 2015-4-22 22:01
标题: edma3中断只能进去一次
使用mcsdk中的edma3lld库写的edma3驱动,在omapl138的dsp核运行,但是中断函数只能进去一次,路过的朋友帮忙看看,感谢万分。代码如下:  j- v* O$ W5 p$ B7 p/ {3 a, m
#define  PING_PONG_ACNT          17 f' o8 l$ \* q# t) w2 Q
#define  PING_PONG_BCNT          8*32*40 ( x7 W- l3 ]; I- @  W/ W
//#define  PING_PONG_BCNT       1
/ J3 j4 k+ u8 u9 g#define  PING_PONG_CCNT          1( }: l* D* o# e% k$ n5 f
#define  MCASP_BASEADDR          0x01D000000 q# C1 w4 a0 t. V
#define  Mcasp_RXEVENTQUE        (0u)! i4 U# n1 s% R
2 m6 Y. `3 j( m# U. t* `
/* OPT Field specific defines */& @! V- f& [  d9 g9 t" e
#define OPT_SYNCDIM_SHIFT                   (0x00000002u)
/ `& f: u/ A( J7 \. r5 G7 \#define OPT_TCC_MASK                        (0x0003F000u)& \! c0 w8 ]) r! G2 E
#define OPT_TCC_SHIFT                       (0x0000000Cu)- v  t0 O4 R3 U6 J' [, ~
#define OPT_ITCINTEN_SHIFT                  (0x00000015u)( O% ^6 h( q7 ^6 ^- z
#define OPT_TCINTEN_SHIFT                   (0x00000014u)+ O% f0 ~" Z& w' S" j9 T# P

' y; L! K/ S0 o) v: Z# R6 U( Ichar ping_buffer[PING_PONG_BCNT];
/ F1 q4 ~5 b5 D6 Q! t3 k2 s8 z9 Nchar pong_buffer[PING_PONG_BCNT];5 Y" J. e" j" E) t
' P+ n' O$ l! Z) d2 @# w8 i3 |4 r
( f7 C+ c" d# u+ R
* d  k- J- u  [5 ]1 L
% M, P# X6 N( d/ L
static void ys_edma3_init()6 b9 }3 d2 D2 \+ S: E& z
{; m) x% [. t& R* S9 S9 |
        EDMA3_DRV_PaRAMRegs paramSet = {0,0,0,0,0,0,0,0,0,0,0,0};
$ n% m8 N# b2 }        EDMA3_DRV_Result result = EDMA3_DRV_SOK;' z6 g% \. _0 W- Z2 Q0 a
        EDMA3_DRV_Handle hEdma;
, e" I4 E4 u3 |6 m2 L7 E+ e. ^    uint32_t chId   = 0;) J0 s. ~+ P- M- Q  Q# i: _0 S
    uint32_t tcc    = 0;
* h6 r( ~: w7 q- I' `8 `( ]3 U3 l' J; r) \
    print2arm("edma3 driver init...",0);
" ~, M; p" x  Q- \5 [5 F  ^
5 z0 P' v7 ~& s3 r& ^9 o0 p        hEdma = edma3init(0,&result);  S+ p$ A3 Z& |% o
        if(hEdma)
$ l; o* M+ g! F9 Z, \3 ^! ~+ u        {* ?0 _! m0 ~; N) E. g( m4 `
                print2arm("edma3init() Passed.",0);
( {/ d* G+ e: Y6 z) [        }  A) ?1 Q' Q* p" O9 Z# w( d. a
        else/ Y! T& K1 V8 ^+ m4 Z
        {9 ~8 l6 n# E5 M& E2 F& n6 Y
                print2arm("edma3init() Failed.",0);, T" y4 H8 a& `! V
        }4 m+ `! \& T) e
        ( t) k0 J/ E! Y% ?, f# ~9 K  x) e- u
        if (result == EDMA3_DRV_SOK)
$ W6 `" R/ u1 k8 I3 w% n! E) [    {% a! Q8 {' B1 T# i5 R# W
                result = EDMA3_DRV_requestChannel (hEdma, &chId, &tcc,, ^7 Y' X1 O' {
                                                       (EDMA3_RM_EventQueue)0,
5 N) m* k3 a$ f; z: b6 _                                                            &edma3_isr, NULL);) o3 s! |8 P# J, i  @  _5 ~
    }
" r: A1 f2 O9 d" q5 N       
9 f9 N* a2 T, _+ x" p) B        if(result == EDMA3_DRV_SOK)
" |( _1 W& b5 P0 g3 H$ P2 F6 |        {- Q; S% ?# d; [: n
                paramSet.srcBIdx    = 0;/ Z! O3 ]% b4 ~) r5 ]0 E; Q
                paramSet.destBIdx   = 1;
" S" P" ~7 ?4 ]2 @$ n" R                paramSet.srcCIdx    = 0;
! m( K$ I& G2 j  S& a7 l0 k                paramSet.destCIdx   = 0;
+ @4 Q$ N0 @5 k7 f9 I$ ^: s9 s                paramSet.aCnt       = PING_PONG_ACNT;
- |  ^9 E  z- i6 E( Q$ y# R; v, b1 k                paramSet.bCnt       = PING_PONG_BCNT;
/ y3 s& _/ n) @" O                paramSet.cCnt       = PING_PONG_CCNT;
7 S% P7 k% ]; L; ?) X$ c8 V6 _/ b                5 U- N$ c* q. L. d& Y# ^( Y, o
                /* For AB-synchronized transfers, BCNTRLD is not used. */7 ^4 Z1 ?7 k5 p$ \! t+ q
                paramSet.bCntReload = PING_PONG_BCNT;
! ?# ^, _3 h2 |
* w  t/ {6 G! A$ m                /* Src in constant mode Dest in INCR modes */% r! V9 m) g( g; a
                paramSet.opt &= 0xFFFFFFFDu;  T6 i6 v* M. b9 q; z& Z$ M0 }$ p
                //paramSet.opt &= 0xFFFFFFFCu;8 R: L7 c4 z* P7 C# {
                * R, n5 p& u9 c1 w  e4 S# w
                /* Program the TCC */
- j0 C" v: O9 c                paramSet.opt |= ((tcc << OPT_TCC_SHIFT) & OPT_TCC_MASK);9 M4 d0 I" v% J; E2 Z* a

3 u+ m+ `+ a- ?+ |$ V                /* Enable Intermediate & Final transfer completion interrupt */
0 m6 L5 V1 D& Q4 K5 N5 w" H                paramSet.opt |= (1 << OPT_ITCINTEN_SHIFT);
4 U% b# ]( B; i. U                paramSet.opt |= (1 << OPT_TCINTEN_SHIFT);0 J4 d: E; m/ V; A3 O; l2 g

) x- Y. X4 d8 v                /* AB Sync Transfer Mode */
4 R$ h* w; k( k3 Q1 L                paramSet.opt |= (1 << OPT_SYNCDIM_SHIFT);' \# [7 G3 Y2 n( K% K7 q
               
' |9 W. d: Z4 z- j& b" Y4 r) h                /* Program the source and dest addresses for master DMA channel */
4 J  c, H8 o5 l) l* B+ m9 T# v                paramSet.srcAddr    = (uint32_t)(MCASP_BASEADDR+0X029C);
- n3 W% y, v" z7 S; `! g* K1 U$ m" t                paramSet.destAddr   = (uint32_t)(ping_buffer);, f3 q( b2 `( D) A% Z  y5 N
( |" e6 H( O+ X3 D) W9 V% P
                /* Write to the master DMA channel first. */
: E5 k4 h! A5 [0 x% \$ ]: E                result = EDMA3_DRV_setPaRAM(hEdma, chId, &paramSet);) ~/ l6 N/ x& F
    }      
1 n4 q# [( k$ S0 o9 ?& @; x( ?9 k! W. l% H/ I0 E
        result = EDMA3_DRV_enableTransfer(hEdma,chId,EDMA3_DRV_TRIG_MODE_EVENT);
+ N5 o; U3 [; l4 R5 q" c8 V        - a! {/ b( q8 y* _  E8 ^
    if(result == EDMA3_DRV_SOK)
2 y) l6 Z  \: o% W: M2 J9 H6 e& Z    {* ^- y; E5 G8 k3 S9 {
            print2arm("edma3 driver init success.",0);
6 g7 m; d( T+ }7 _    }
% a1 m# O4 J4 h7 p  ~' @5 P}. E, w  S2 M* D4 i1 R/ M5 e

$ F' F- K7 U( Z% ^$ ]6 t
% E" M/ O, y6 N) ~EDMA3的配置就这个函数,是由MCASP接收事件触发EDMA3传输的,中断函数edma3_isr只能进去一次,请大家帮忙看看哪里有问题。。。' H. N8 E+ D% j6 U7 o  a" k
% N  @6 _$ H! i# [

9 J; q& @" ^5 @) G1 h* Q
作者: Lewis    时间: 2015-4-24 10:47
每次DMA传输完成后都要再次使能传输
作者: silent123    时间: 2015-4-29 23:25
Lewis 发表于 2015-4-24 10:47: t/ L( r' ^% T% r7 d
每次DMA传输完成后都要再次使能传输
! s9 w8 j' l  o9 x6 }* N8 b
原来是这样,我明天去试试,谢谢了!




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