|
|
使用mcsdk中的edma3lld库写的edma3驱动,在omapl138的dsp核运行,但是中断函数只能进去一次,路过的朋友帮忙看看,感谢万分。代码如下:
& [0 d- t7 q2 W' R' o6 R#define PING_PONG_ACNT 1
) P: w w" e I" `; Z) f#define PING_PONG_BCNT 8*32*40
+ O- M% q# R7 c* L//#define PING_PONG_BCNT 1
; {1 G6 M( P4 K, @3 C' [& R& C4 V#define PING_PONG_CCNT 16 H9 D6 y1 G% ?7 y
#define MCASP_BASEADDR 0x01D00000
# Y* q- ~: t- P#define Mcasp_RXEVENTQUE (0u)
4 {, `! G# x3 A' B. h( i% `) \( o9 J9 k3 d/ }1 Q# e
/* OPT Field specific defines */
; c# L3 U" O7 J- [ }0 V( ^#define OPT_SYNCDIM_SHIFT (0x00000002u)
9 p5 D. m9 |' I. T9 J! D8 Q#define OPT_TCC_MASK (0x0003F000u)7 U) T* v0 C# V/ J- M
#define OPT_TCC_SHIFT (0x0000000Cu)
2 L: {. R r) J6 n#define OPT_ITCINTEN_SHIFT (0x00000015u)9 U2 V4 E* G, ?
#define OPT_TCINTEN_SHIFT (0x00000014u)
: q& T! c# y3 W
# k0 [; q! F/ vchar ping_buffer[PING_PONG_BCNT];& a4 [ ?! \7 c } q
char pong_buffer[PING_PONG_BCNT];
+ f0 o1 E2 M/ d& A3 v$ p& V2 R0 g+ x6 `& p, T& q3 u) g
0 P; C8 M7 X2 ^9 m. [4 q3 X/ E, u4 C6 d( T* ^& d9 H y/ o {
% j7 H, }, j% x1 f' p5 n/ _. ~2 h
static void ys_edma3_init()7 J% t$ C) j5 [
{
% [8 J) c9 t+ _" c EDMA3_DRV_PaRAMRegs paramSet = {0,0,0,0,0,0,0,0,0,0,0,0};6 n; R) _$ C1 ~$ c0 p
EDMA3_DRV_Result result = EDMA3_DRV_SOK;% ~. L1 c0 M/ \- n+ X8 N+ Y* n
EDMA3_DRV_Handle hEdma;
, E9 W' f! R5 w uint32_t chId = 0;
) Q8 ~6 V3 d7 f& o1 J7 X! U# d! z uint32_t tcc = 0;# x, L. V% }4 q9 K4 u3 ?
+ c$ u) {7 {# t5 ` print2arm("edma3 driver init...",0);
3 z' q8 J! {8 f! V- l
j$ U7 Y7 y6 d$ P1 g hEdma = edma3init(0,&result);
1 K. I& Y# G! Y% n. H6 S- O if(hEdma)
, ^, K) g1 @1 S) I; }7 s& i( [ {
( ?$ _/ g' ]5 K% ^7 y1 h5 u' \ print2arm("edma3init() Passed.",0);1 ~+ t% b l: l& F
}
3 n0 a' y# Y1 q2 L else9 ~9 E% M1 v) h* P i& h# q
{6 H3 O! _( q- l
print2arm("edma3init() Failed.",0);
3 b$ s" m b; n" a }' W2 P5 x, G. B% M$ b1 i7 I
o) n( m. s8 V if (result == EDMA3_DRV_SOK)
+ K, i) R+ `* n5 j/ V7 B {% x; M" }1 u. b6 ^: E) R
result = EDMA3_DRV_requestChannel (hEdma, &chId, &tcc,
$ s9 ]+ G8 @) D0 _# u (EDMA3_RM_EventQueue)0,6 a' b3 ?# D$ x$ f
&edma3_isr, NULL);
6 Q: K' s7 B9 c6 z }# C5 c$ m1 |) l: T2 P: Q* f& N
% G+ E% c- Z6 s+ n
if(result == EDMA3_DRV_SOK)
3 R: _8 S. B( c. b2 h {
# y& M9 |7 r* b+ l7 U paramSet.srcBIdx = 0;2 C, k# R4 z. ~9 q; U
paramSet.destBIdx = 1;
4 y- P' k% ^6 V) c9 a5 U: P9 B1 S paramSet.srcCIdx = 0;
; a! f8 l' O- v! M3 l# N X paramSet.destCIdx = 0; k' w% l& {) k6 _, P
paramSet.aCnt = PING_PONG_ACNT;
* z- G) H l# H7 ~ paramSet.bCnt = PING_PONG_BCNT;! K- _6 Y! ?6 S; n
paramSet.cCnt = PING_PONG_CCNT;, I D" l2 S& H: X$ S# R
5 q U" m5 e- o" O! v* J! H /* For AB-synchronized transfers, BCNTRLD is not used. */' K) X, r; o @4 j- W7 \2 @0 b" h" P5 |
paramSet.bCntReload = PING_PONG_BCNT;, I5 ~3 Q6 R, s5 s, q
, ~! C3 V) P2 g /* Src in constant mode Dest in INCR modes */; l A( }2 S; ^7 E+ [: Q
paramSet.opt &= 0xFFFFFFFDu;0 {, E7 P& f7 N1 l7 Y
//paramSet.opt &= 0xFFFFFFFCu;- e# Q$ C/ M' p. @/ }* A- e" c
* B$ [5 E; |+ P4 U+ G4 d /* Program the TCC */' D6 H: H# d V. Z+ e
paramSet.opt |= ((tcc << OPT_TCC_SHIFT) & OPT_TCC_MASK);( {7 e- ]) F7 }5 U: U. E
S4 r4 S* P: ^2 f
/* Enable Intermediate & Final transfer completion interrupt */
$ K3 i8 d1 z4 R7 \( ~& i* @ paramSet.opt |= (1 << OPT_ITCINTEN_SHIFT);
' W+ E. M1 k3 s5 {6 K) @ paramSet.opt |= (1 << OPT_TCINTEN_SHIFT);
! V3 E% H5 ]) Y, h8 M4 @( u; K6 z# O1 l, n& f) U5 N' c4 s* K# X% e
/* AB Sync Transfer Mode */
d1 ?. K* p/ k* I* c5 ^0 K paramSet.opt |= (1 << OPT_SYNCDIM_SHIFT);0 S# S( V5 C( p# m# b$ \4 C3 J
_" e; X$ W/ i& h /* Program the source and dest addresses for master DMA channel */
- @. t8 @2 L" I% R) U3 _8 c9 W paramSet.srcAddr = (uint32_t)(MCASP_BASEADDR+0X029C);! `- }0 \* @! \$ Z
paramSet.destAddr = (uint32_t)(ping_buffer);, X2 {7 I' c W8 `1 ?# x
* w9 k' t8 M7 _8 x: Y4 N' y+ M" z/ x+ a /* Write to the master DMA channel first. */0 D6 Z1 O5 {- F( T9 r
result = EDMA3_DRV_setPaRAM(hEdma, chId, ¶mSet);# K2 i9 \- f- e4 y3 F! X" f
}
: s$ _/ B- V# m9 ~# \
. v6 Y$ L' p8 l0 E$ W* o: s result = EDMA3_DRV_enableTransfer(hEdma,chId,EDMA3_DRV_TRIG_MODE_EVENT);
2 H9 u# S7 A5 Y2 v. l1 ^) ]* N 6 n" m) w9 o3 a; |7 E
if(result == EDMA3_DRV_SOK) 6 N, i& F( Y5 r5 Y
{
$ L/ N) g2 J+ y" k print2arm("edma3 driver init success.",0);# g) N0 D$ ^. T. q8 ]
} ; S# W; @: L8 E
}
% t8 ]6 E* i& ]1 K* l" e
$ n' y, |/ K6 N6 B' Q) |% P4 h; Y
EDMA3的配置就这个函数,是由MCASP接收事件触发EDMA3传输的,中断函数edma3_isr只能进去一次,请大家帮忙看看哪里有问题。。。9 U1 S0 L: J: V/ }0 p9 W
4 ]3 [7 R0 I9 }( r* x8 U/ e
8 X( U3 N" m/ c |
|