嵌入式开发者社区

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

作者: silent123    时间: 2015-4-22 22:01
标题: edma3中断只能进去一次
使用mcsdk中的edma3lld库写的edma3驱动,在omapl138的dsp核运行,但是中断函数只能进去一次,路过的朋友帮忙看看,感谢万分。代码如下:. s( s' K) O. U5 P$ O5 U2 V. T
#define  PING_PONG_ACNT          14 s1 Z2 e3 X: n7 w& m
#define  PING_PONG_BCNT          8*32*40
; }1 w9 L) R, S* e//#define  PING_PONG_BCNT       1
' E: b! ]: I+ ]) O# k#define  PING_PONG_CCNT          1! \0 N6 v8 j2 F9 G* O* ?
#define  MCASP_BASEADDR          0x01D000006 D# C3 Q5 e2 _$ ]5 z
#define  Mcasp_RXEVENTQUE        (0u)  Z" w5 c9 O, D

! m0 [8 x6 ]' m+ d- q: E) ^/* OPT Field specific defines */
" m" a# B  c5 |9 T: P7 w* g#define OPT_SYNCDIM_SHIFT                   (0x00000002u). X3 M! i& N- L. C6 h. j  `
#define OPT_TCC_MASK                        (0x0003F000u)
5 H/ T; @) ~* {% o) U( L" ~8 u9 e#define OPT_TCC_SHIFT                       (0x0000000Cu)
3 A( V0 \! l, ~& y0 A, x#define OPT_ITCINTEN_SHIFT                  (0x00000015u)) q5 e5 R& H" t" H
#define OPT_TCINTEN_SHIFT                   (0x00000014u)
5 }7 n( h$ t% q6 H& _6 b6 J4 S
* w. V6 p% v. q# C/ G& I* {# ^char ping_buffer[PING_PONG_BCNT];& ~0 V% V% }- Y- u2 [) l9 {; i
char pong_buffer[PING_PONG_BCNT];2 @* u  q) T  n" C
$ Y* v0 g/ x/ r+ o$ ?+ ^8 m

. r% M% V/ w" c
2 b% @5 Y6 X- h( F
# R" ^2 f5 _3 y, h! N! X  Sstatic void ys_edma3_init()4 Q3 x) ^7 M2 b. p
{
6 E/ u" o( I0 j6 O* E% \, a# w! |        EDMA3_DRV_PaRAMRegs paramSet = {0,0,0,0,0,0,0,0,0,0,0,0};
8 i, F* ]* J8 N* P: I- `) k8 l        EDMA3_DRV_Result result = EDMA3_DRV_SOK;  P# L, W( G9 n/ H2 Z0 d! S" O
        EDMA3_DRV_Handle hEdma;+ b- S+ t+ H) f5 z# Y
    uint32_t chId   = 0;
8 u$ V1 q! f+ A2 _" r7 s) D9 J    uint32_t tcc    = 0;5 L$ n' I2 ?% [: j& E8 h; T& ]- r
% g! |4 S. W. D- U( x
    print2arm("edma3 driver init...",0);
- A7 [* K# R' Z( c1 p1 U  e
' l$ X, W' k1 ]- _# M0 M        hEdma = edma3init(0,&result);: Z+ s( n7 t  u& c! G
        if(hEdma)
' s# K; G9 L9 O  W0 b        {
* ~5 j: l; t' w5 T% x                print2arm("edma3init() Passed.",0);
% s/ g& K- N  T) l        }, Y2 s, @6 M! t
        else
1 }; `, W; ?& P        {
+ f2 V1 s2 M& p' M# d2 E                print2arm("edma3init() Failed.",0);' Y: Y" E: k, P8 H. {; w+ f$ v
        }
/ S4 y" h  b8 `4 M+ D4 m+ l0 q% J        $ R7 _. K  s/ n' h6 w' m
        if (result == EDMA3_DRV_SOK)
, @+ p( F8 E' o    {5 Z; N" J! d! j
                result = EDMA3_DRV_requestChannel (hEdma, &chId, &tcc,. a1 @. Z( |6 ]$ S
                                                       (EDMA3_RM_EventQueue)0,' m' }& B: h3 g3 B) j" M
                                                            &edma3_isr, NULL);! [: `! c4 v% p
    }- t# R) {, f3 F+ G7 B. U
        9 g5 n9 r+ `  `$ _
        if(result == EDMA3_DRV_SOK); ]0 O2 _0 N  O, V" \$ t) t- L
        {
* w$ [3 x# s; x5 X+ b- o8 i1 \4 q                paramSet.srcBIdx    = 0;
$ L" h' H+ t0 w; y% K0 H                paramSet.destBIdx   = 1;
0 u% H7 z; Z4 W6 r% m! {                paramSet.srcCIdx    = 0;
5 U5 s) u0 o0 k' o" V: H; G: R( `# d                paramSet.destCIdx   = 0;0 h1 h6 P' l6 Y+ ~
                paramSet.aCnt       = PING_PONG_ACNT;
- @( G" H3 K# o9 q                paramSet.bCnt       = PING_PONG_BCNT;5 `$ g8 |4 C* b8 ^9 ]5 F
                paramSet.cCnt       = PING_PONG_CCNT;& ]6 O9 b2 L) L6 L0 v1 X% A9 ^& D
               
. X6 l' j$ j/ M                /* For AB-synchronized transfers, BCNTRLD is not used. */1 a& H0 i1 }6 D5 u; c! H
                paramSet.bCntReload = PING_PONG_BCNT;5 x8 r6 O" M- Y9 E* H5 k
! r! ~, d2 v$ j" K% o/ j
                /* Src in constant mode Dest in INCR modes */
; U& M3 m) b& g! s% q                paramSet.opt &= 0xFFFFFFFDu;
$ h4 V2 l& R2 r/ t: w6 z# ?                //paramSet.opt &= 0xFFFFFFFCu;0 c1 A  I( }3 i  P! j
               
7 b$ J5 g# j0 E                /* Program the TCC */3 K# I& k2 W8 c8 J
                paramSet.opt |= ((tcc << OPT_TCC_SHIFT) & OPT_TCC_MASK);
1 s7 {9 b4 ~0 z* a$ h
/ T; o$ L9 r5 B: k4 A                /* Enable Intermediate & Final transfer completion interrupt */
: z% q/ r% y: m1 Y+ y                paramSet.opt |= (1 << OPT_ITCINTEN_SHIFT);% [+ e, }. d% n; V
                paramSet.opt |= (1 << OPT_TCINTEN_SHIFT);9 A1 u9 U, c: c/ H1 x; p$ h  _

7 o  K6 n& l& S1 p3 g; @; ^                /* AB Sync Transfer Mode */. E* L/ c! ~/ N# C! ?, v  N3 Q
                paramSet.opt |= (1 << OPT_SYNCDIM_SHIFT);! o. u4 k. {: @
                + v: y2 ^2 @% [2 G1 l
                /* Program the source and dest addresses for master DMA channel */6 A* `7 T" J; ^7 z
                paramSet.srcAddr    = (uint32_t)(MCASP_BASEADDR+0X029C);' S  f7 y- o7 Z" k2 U  w6 c
                paramSet.destAddr   = (uint32_t)(ping_buffer);$ V- b! Q* M7 I3 `& n; D

4 D" P/ T- k8 e5 h9 t7 T                /* Write to the master DMA channel first. */, _' W6 Q, x1 K$ o
                result = EDMA3_DRV_setPaRAM(hEdma, chId, &paramSet);& j% M5 x% r) i' y
    }       & H0 u: e. m& s2 W
9 [, \; c" b+ Y% Q2 n
        result = EDMA3_DRV_enableTransfer(hEdma,chId,EDMA3_DRV_TRIG_MODE_EVENT);
0 E' l2 R# D: _# K# a" n       
* g! {3 K9 N" r2 W3 \$ c2 B    if(result == EDMA3_DRV_SOK)
7 W* f$ B6 I  }5 B# c. N% q    {' f0 o. i& ?+ n7 N. P' p$ @
            print2arm("edma3 driver init success.",0);. \7 M* k/ n0 @6 |4 J, A; u7 _
    }
$ ^, g# M1 L7 ?* V6 N& k}+ R% [, ?9 {- K9 I

% }$ j  i% u9 h5 f" ?/ ~  L5 d3 q) k" j/ W/ ?2 I
EDMA3的配置就这个函数,是由MCASP接收事件触发EDMA3传输的,中断函数edma3_isr只能进去一次,请大家帮忙看看哪里有问题。。。& ^( N7 N$ X+ M$ p, W
; m# b/ f( \) F8 u7 J0 U8 s! P

! N- r, G" x0 H! M( g5 U
作者: Lewis    时间: 2015-4-24 10:47
每次DMA传输完成后都要再次使能传输
作者: silent123    时间: 2015-4-29 23:25
Lewis 发表于 2015-4-24 10:47
9 G' ]# A/ a; v& d3 k9 b7 a  r每次DMA传输完成后都要再次使能传输

- a! L+ e: Q: }- p4 b8 M原来是这样,我明天去试试,谢谢了!




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