标题: edma3中断只能进去一次 [打印本页] 作者: silent123 时间: 2015-4-22 22:01 标题: edma3中断只能进去一次 使用mcsdk中的edma3lld库写的edma3驱动,在omapl138的dsp核运行,但是中断函数只能进去一次,路过的朋友帮忙看看,感谢万分。代码如下: . d6 `1 j3 X3 O$ P#define PING_PONG_ACNT 1 3 ?4 l4 K: @) u) r- Z* Z3 Z#define PING_PONG_BCNT 8*32*40 6 H0 a# U4 d' u7 Q+ K
//#define PING_PONG_BCNT 1 ! P. o! ?7 ~* v ]5 B& C' u) Z5 r/ E#define PING_PONG_CCNT 1 b+ f @3 p4 x0 l+ _
#define MCASP_BASEADDR 0x01D00000 : z. Q( l# N+ k4 G, b#define Mcasp_RXEVENTQUE (0u) 2 h% q, E m$ Z9 f' M) U/ i H4 Y& n1 G: A: T
/* OPT Field specific defines */& p$ o! A6 s; j
#define OPT_SYNCDIM_SHIFT (0x00000002u): @4 M0 f1 ~; a- P3 ?
#define OPT_TCC_MASK (0x0003F000u)$ z. i& t, J5 A3 Q" K$ U4 }
#define OPT_TCC_SHIFT (0x0000000Cu) 3 \8 K% D0 j7 W& r% [( [. S#define OPT_ITCINTEN_SHIFT (0x00000015u)& |8 c& c5 n" V! M8 }& p S
#define OPT_TCINTEN_SHIFT (0x00000014u) 8 ]0 D: i: D n" o- g0 y6 U/ d $ J2 I2 x7 L8 ]. n" @char ping_buffer[PING_PONG_BCNT]; 1 c* a/ \. @4 U8 s achar pong_buffer[PING_PONG_BCNT]; " e+ t. |7 [" w3 ^& V* `* `8 ^% ^, Z7 r: }
4 d0 b; l& D/ t% I
) b' O% X% {0 Q. _8 R$ q
4 D' M8 ^6 ]; K4 wstatic void ys_edma3_init(); W2 j- G! O/ A3 e% H
{; \/ P# h" l! j8 U* P+ u; o
EDMA3_DRV_PaRAMRegs paramSet = {0,0,0,0,0,0,0,0,0,0,0,0}; " y) ?4 P/ u7 h, y, _5 ~( H' i EDMA3_DRV_Result result = EDMA3_DRV_SOK;5 S& `! e5 C( Q3 M# q
EDMA3_DRV_Handle hEdma; ( ?/ r( L Q$ f3 u6 J& o" Z uint32_t chId = 0; - |6 q' ?. F* r/ l7 f' r. Z0 `" D uint32_t tcc = 0;$ T: _# h3 {0 Y) b, L7 P
. Y4 m# H* T2 x2 G2 S% x7 Q( @
print2arm("edma3 driver init...",0); & m. t2 j* ?: M! G: e! ~. z: C+ l7 g& M2 w7 P, W- ] a
hEdma = edma3init(0,&result);- F. Y0 w4 I5 c
if(hEdma)8 K) c' |( ]1 h% x
{ 3 K9 J+ D/ x+ T/ \7 @9 E print2arm("edma3init() Passed.",0); 3 t- X7 i( h5 j3 l9 P4 A3 K }0 Q$ W( ?# }. G; v0 z) u, l _
else* d) Y' `1 i* `) c# V. S
{0 h5 H' k( \6 ]. Z
print2arm("edma3init() Failed.",0); 4 x, q4 ]( y/ u# _: y4 ? } / J8 h( q' T9 Z( G0 z( [! c # W5 ?: O, F& }3 A; x% q
if (result == EDMA3_DRV_SOK) $ Z$ m1 i' @ @; [4 c" ]! v { g' T R& a* y4 i result = EDMA3_DRV_requestChannel (hEdma, &chId, &tcc, $ ]/ ~/ g4 }9 F, O( L* U2 i (EDMA3_RM_EventQueue)0, 1 K' h$ D# u* B9 N0 U &edma3_isr, NULL);- z) ]/ W/ V( }; e0 m
} 2 l2 n8 Z) B7 w0 | 6 ?+ j' j7 z' i1 O
if(result == EDMA3_DRV_SOK) & B3 d: B( z" ~9 A {! V9 R! ^/ [' L0 ^+ Z
paramSet.srcBIdx = 0;3 {; l% n7 E9 K- n* I
paramSet.destBIdx = 1; 8 _4 }; K3 l+ t8 o- E6 a paramSet.srcCIdx = 0;! b( `: O1 r3 t8 {% c. n& ]
paramSet.destCIdx = 0;' v5 d. L4 T( y: ?
paramSet.aCnt = PING_PONG_ACNT; 2 m6 a- y. Z q5 l paramSet.bCnt = PING_PONG_BCNT;; |: K% Z' F+ S& M4 J& A4 w1 G: d
paramSet.cCnt = PING_PONG_CCNT; 5 H3 J9 l3 b2 c! t/ v X & b1 ]0 o$ D2 E; X6 J7 c1 ]) z /* For AB-synchronized transfers, BCNTRLD is not used. */2 X5 a5 R+ h+ E5 v' K
paramSet.bCntReload = PING_PONG_BCNT;: `& C6 f! t; \7 M; G7 R% Y" R
. d; M( S4 n% C /* Src in constant mode Dest in INCR modes */ ! W7 G! O. P J8 V2 ]% Z3 R2 n paramSet.opt &= 0xFFFFFFFDu; % O, k9 b. Y2 R, w& ] //paramSet.opt &= 0xFFFFFFFCu;4 ~0 U5 s* P: f0 q' t, I
4 f! s1 U0 d7 j3 a& e' f" m /* Program the TCC */% `9 b K( x( z" a3 N
paramSet.opt |= ((tcc << OPT_TCC_SHIFT) & OPT_TCC_MASK); & G: ]4 Y/ p% f* v; U3 g+ J# P' n+ d8 {# B0 }
/* Enable Intermediate & Final transfer completion interrupt */ % h* h' D1 \' A9 d$ V( L) x paramSet.opt |= (1 << OPT_ITCINTEN_SHIFT);. r0 L0 V; j/ T5 }6 R" h
paramSet.opt |= (1 << OPT_TCINTEN_SHIFT); ' I/ d% b5 }8 ^& Q R& I9 a y; g* v. j( K0 h* ^1 M
/* AB Sync Transfer Mode */; I ?3 P, O* z8 P- m. }0 g9 ?$ g
paramSet.opt |= (1 << OPT_SYNCDIM_SHIFT);' F# e. o# d6 Z7 `& q# Z# l
0 X/ F h" ]6 o, t /* Program the source and dest addresses for master DMA channel */ 8 c; V6 h+ \1 ?) Z* O paramSet.srcAddr = (uint32_t)(MCASP_BASEADDR+0X029C); ; w* f! L; A/ G3 |0 e* C paramSet.destAddr = (uint32_t)(ping_buffer); 9 T n% p0 q. O: W, z' F% l: ~# ^# [% K. B) G' Q% `) V
/* Write to the master DMA channel first. *// y2 _! \( s% K* s- L) s
result = EDMA3_DRV_setPaRAM(hEdma, chId, ¶mSet); ' E' s! ~2 [5 \0 y6 K+ f } ; T+ X9 [8 _4 i; t' e, G
! m e* O9 K; \5 h/ [ result = EDMA3_DRV_enableTransfer(hEdma,chId,EDMA3_DRV_TRIG_MODE_EVENT); / ]% w8 A9 v2 A: O4 Q : M, _* W. ?; n0 O% N/ F
if(result == EDMA3_DRV_SOK) - S/ G; q: z3 w" B ^& q1 w
{ . w& o* c6 b9 Y6 S/ M' @- e print2arm("edma3 driver init success.",0); ; `0 w& r- t8 P0 }: w4 e& S } # f1 k4 h7 \. E; F6 h6 n}- v# G4 y3 X, j! L; ]
# {2 }$ R f4 i: U! \0 a3 Q& T, C3 t( B
% q( s/ i \+ H* |. L j9 J
EDMA3的配置就这个函数,是由MCASP接收事件触发EDMA3传输的,中断函数edma3_isr只能进去一次,请大家帮忙看看哪里有问题。。。% C5 o5 p8 X+ M" q5 Y+ w
2 S2 z9 p" h" v1 Q# B' Z* |* S; k: p4 P2 e5 C' m% x 作者: Lewis 时间: 2015-4-24 10:47
每次DMA传输完成后都要再次使能传输作者: silent123 时间: 2015-4-29 23:25