嵌入式开发者社区

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

作者: silent123    时间: 2015-4-22 22:01
标题: edma3中断只能进去一次
使用mcsdk中的edma3lld库写的edma3驱动,在omapl138的dsp核运行,但是中断函数只能进去一次,路过的朋友帮忙看看,感谢万分。代码如下:1 x( R8 B3 q8 T: [3 }
#define  PING_PONG_ACNT          1
! i( O6 \2 J% u4 N9 s6 f#define  PING_PONG_BCNT          8*32*40 4 S- d1 ]; `- @  {8 s) Q
//#define  PING_PONG_BCNT       1
, [1 r3 I8 B7 B4 r: C#define  PING_PONG_CCNT          1& u5 j$ R# W  }3 S' y
#define  MCASP_BASEADDR          0x01D00000
- c! H/ G+ P( S! I/ h0 U- q5 M#define  Mcasp_RXEVENTQUE        (0u)3 n& _$ \0 ]9 m# b; h

" x, o+ l: I0 `0 s( \8 ~/* OPT Field specific defines */. I. l5 `9 X! [3 j; K3 W4 @, _( V) c
#define OPT_SYNCDIM_SHIFT                   (0x00000002u)7 f2 z9 Q( n2 o2 b9 B& M, s' Z
#define OPT_TCC_MASK                        (0x0003F000u)
% P; k4 q' T* h" Q& M2 X9 P#define OPT_TCC_SHIFT                       (0x0000000Cu)
- d2 |* h- s! `! _( B. A6 O#define OPT_ITCINTEN_SHIFT                  (0x00000015u)3 u! C" M, M: ^( k8 v. i
#define OPT_TCINTEN_SHIFT                   (0x00000014u)
/ J& a  {9 ~8 ^6 u; @4 s8 }" h6 \5 v( n6 e
char ping_buffer[PING_PONG_BCNT];* b: N9 O3 v0 E! M: G
char pong_buffer[PING_PONG_BCNT];9 f: X' J9 O  ?& A$ ]

! j; Z4 [3 f& @8 {4 q! e
" w: Z) o2 b. t4 s4 [
4 F9 F+ [5 D+ R5 I0 h/ O# T6 [: q9 k* |- ?& m2 j5 y8 I# ^
static void ys_edma3_init()
& }' J+ ?: T3 x' |2 G/ l# P{
" R7 W0 W5 |6 i- F, S0 Q) ]/ E        EDMA3_DRV_PaRAMRegs paramSet = {0,0,0,0,0,0,0,0,0,0,0,0};2 L' r. Q% B4 q# g
        EDMA3_DRV_Result result = EDMA3_DRV_SOK;
( B* y  B- M1 W2 E' Y- {6 ^) A        EDMA3_DRV_Handle hEdma;9 B& w) ^4 l% S: c6 W3 T# k
    uint32_t chId   = 0;
9 C: r: }% {3 ]- k3 j/ n5 c/ ?    uint32_t tcc    = 0;
0 s- K5 x. n2 N# v9 K4 g5 u3 m% F7 T5 j& _! w) c
    print2arm("edma3 driver init...",0);
& d6 ^# z6 v! y1 Y' u6 H$ F, S$ s6 G
        hEdma = edma3init(0,&result);8 ]) H. k8 J; p: L4 f3 y9 _: v6 e% E' w
        if(hEdma)
! x& h# }% z# f, K+ X        {# g0 J* t5 W; n* P6 u* r4 W2 _# h
                print2arm("edma3init() Passed.",0);2 ?6 _& ^0 i4 B- I% K
        }
/ }, O0 M* q6 t4 R# a- d        else9 \0 o( N9 k* i+ Y5 }3 b% o
        {
  V! p6 u3 M: }5 X                print2arm("edma3init() Failed.",0);
+ ]) ?" C/ `+ U9 {! Q        }
4 B. j- }! x0 J8 k+ v, m' {5 {8 B- @5 i6 @        3 ~, P1 s, F0 p0 D$ p! Z, p
        if (result == EDMA3_DRV_SOK)
$ t3 T$ }5 O1 [3 g    {# L; D, R+ v+ Z* Z9 c+ n" T5 m
                result = EDMA3_DRV_requestChannel (hEdma, &chId, &tcc,1 _" r) D  ]. Z" A  N0 a* k8 ?( p
                                                       (EDMA3_RM_EventQueue)0,
% y4 f: W) F8 ~) Y                                                            &edma3_isr, NULL);! [& ?$ r( `1 p- I& k3 k6 D  C
    }
. \  y' r, Y" l4 b) t) D+ \        $ l3 m% H6 g' v$ y! Q( @( l
        if(result == EDMA3_DRV_SOK)6 ?$ ?( s9 {: Z! B4 E* G: y
        {
$ L5 {. U5 w- C                paramSet.srcBIdx    = 0;
; @/ ~3 k& O8 N  {0 L' `. I) S                paramSet.destBIdx   = 1;2 y. E% }' S3 x  r$ J
                paramSet.srcCIdx    = 0;: }2 B1 Z: |( Y0 ?) C& u2 Q5 @
                paramSet.destCIdx   = 0;: ~: s7 m4 R2 p
                paramSet.aCnt       = PING_PONG_ACNT;
- T) n9 P# R3 y# b8 \6 ?: U                paramSet.bCnt       = PING_PONG_BCNT;/ c% V" P* y: @$ A* _4 _
                paramSet.cCnt       = PING_PONG_CCNT;: j% {' h& B3 d8 X5 c
               
% \% O5 s; ~$ M) C/ S/ g5 N) Y                /* For AB-synchronized transfers, BCNTRLD is not used. */$ ~' n7 k; f4 M6 I
                paramSet.bCntReload = PING_PONG_BCNT;
9 ?! q# s" q5 r# f6 q/ l
: Q/ F; i* P! @2 z, U) X                /* Src in constant mode Dest in INCR modes */
. m( P  W2 j( s                paramSet.opt &= 0xFFFFFFFDu;& p+ i1 L$ ^7 {( a
                //paramSet.opt &= 0xFFFFFFFCu;
2 h* p) d0 ^! T8 U: M6 N* ^: K                1 o" ^2 i1 t! f3 c& p3 m" x
                /* Program the TCC */
0 V7 F7 Z3 B4 }                paramSet.opt |= ((tcc << OPT_TCC_SHIFT) & OPT_TCC_MASK);* v6 ^% g  \" k: S; C  v, ]: M
, i7 g4 b/ [- T" k- O2 Q) |
                /* Enable Intermediate & Final transfer completion interrupt */, w) |* Z! R- [! Y" W% u! s: k
                paramSet.opt |= (1 << OPT_ITCINTEN_SHIFT);
3 Q7 {! Q& X! K3 s4 J4 B* l8 J                paramSet.opt |= (1 << OPT_TCINTEN_SHIFT);
& U5 K  a# d+ _  I/ P8 W+ m( U5 L$ K
                /* AB Sync Transfer Mode */
7 M, V' a. D8 M9 T# k, g4 C8 d                paramSet.opt |= (1 << OPT_SYNCDIM_SHIFT);
& c  A$ Q/ D9 x% R                ; F5 H; B( M& d4 q
                /* Program the source and dest addresses for master DMA channel */- b* N0 r0 ]# U
                paramSet.srcAddr    = (uint32_t)(MCASP_BASEADDR+0X029C);" F* w  F# d1 W% f8 F
                paramSet.destAddr   = (uint32_t)(ping_buffer);
6 l& n7 u' ?& ^9 I& ^3 j9 d# E+ s+ F3 T8 G1 O" A
                /* Write to the master DMA channel first. *// A. T) n" [  m/ D2 |
                result = EDMA3_DRV_setPaRAM(hEdma, chId, &paramSet);
8 k% |2 B5 F; h( K5 C& G    }      
. n# \: x+ ?* y0 ^! V- L* H% Z& k8 J: h
        result = EDMA3_DRV_enableTransfer(hEdma,chId,EDMA3_DRV_TRIG_MODE_EVENT);: F4 H) d% J$ k/ R8 O8 ]+ o
       
4 K1 m2 j* ?0 x$ w8 c    if(result == EDMA3_DRV_SOK) 3 H8 X" Z" y7 B* A+ C
    {, V$ Y1 r  a% B; G1 v
            print2arm("edma3 driver init success.",0);
! q5 F7 {4 \5 I% h* A2 S# o    } 7 \* @- ?9 d. F% G0 }
}- {' m0 l5 l8 R! f" @- ]
. Q( c0 f& a! P# ~4 c
2 H( l2 e5 P1 c- T8 h; L8 S
EDMA3的配置就这个函数,是由MCASP接收事件触发EDMA3传输的,中断函数edma3_isr只能进去一次,请大家帮忙看看哪里有问题。。。0 q; K6 G$ U2 h8 ^6 T+ j1 v
+ |' X' a9 V( q- Y

: J' R( H. }) k: @* e! e
作者: Lewis    时间: 2015-4-24 10:47
每次DMA传输完成后都要再次使能传输
作者: silent123    时间: 2015-4-29 23:25
Lewis 发表于 2015-4-24 10:479 p& T1 b! s1 y/ q2 S& q4 O
每次DMA传输完成后都要再次使能传输
4 {. S& h+ E7 D
原来是这样,我明天去试试,谢谢了!




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