|
使用mcsdk中的edma3lld库写的edma3驱动,在omapl138的dsp核运行,但是中断函数只能进去一次,路过的朋友帮忙看看,感谢万分。代码如下:! ^2 N7 E* Y% {9 |) s
#define PING_PONG_ACNT 1
- H h9 G* b( J7 G# N#define PING_PONG_BCNT 8*32*40 # `0 v2 I# c8 `/ [% a# f
//#define PING_PONG_BCNT 1 - W. d/ K( I7 X' j1 N1 s- r
#define PING_PONG_CCNT 18 n9 \( y( T3 u9 [; M; a2 p8 C
#define MCASP_BASEADDR 0x01D00000. {5 u6 V1 T7 a: ^+ _
#define Mcasp_RXEVENTQUE (0u)$ |0 G* x R6 A: O4 e4 ^7 h
, g4 p' k1 G l
/* OPT Field specific defines */
, ?. |" @0 Y) G. q: s/ N- g#define OPT_SYNCDIM_SHIFT (0x00000002u)7 |1 ~- ]: E1 b+ o' Q) t$ T: k
#define OPT_TCC_MASK (0x0003F000u)
: g; W; P* m$ ?+ s/ D#define OPT_TCC_SHIFT (0x0000000Cu)
+ y, M" \2 p7 p8 Z. s% Z! X5 _#define OPT_ITCINTEN_SHIFT (0x00000015u): r+ I* ~) Y4 {$ h' i- x
#define OPT_TCINTEN_SHIFT (0x00000014u)& a/ D8 u7 H$ |9 k/ R/ D
3 d# s; S8 U J# ^2 F8 Kchar ping_buffer[PING_PONG_BCNT];
- Y c4 ]3 d+ ?char pong_buffer[PING_PONG_BCNT];% G M: Z5 h0 |: _* f
0 g7 j" E( v$ G0 z% d
8 s7 q7 d8 p7 C: T& T H- Y- Q& {5 L/ V0 F( k2 _3 S
4 h* U( Q8 L; d: g# E
static void ys_edma3_init()" d) V% ?3 N/ D" U. N
{, _' `, `% j5 t4 Y @8 u3 P& q3 ]
EDMA3_DRV_PaRAMRegs paramSet = {0,0,0,0,0,0,0,0,0,0,0,0};1 K! `2 z4 Y/ W1 w9 {
EDMA3_DRV_Result result = EDMA3_DRV_SOK;
; T% x; E0 R! u9 e* d( S EDMA3_DRV_Handle hEdma;
$ s- c: q: _7 k; T7 j% W& t8 ? uint32_t chId = 0;
/ H* C. t$ K! p7 I9 h uint32_t tcc = 0;
! P- d8 s c/ W
- C* n6 @% f: o/ g" b5 Y print2arm("edma3 driver init...",0);3 ^, M" D' k0 U9 ^* l
" V$ R+ |( f9 d9 I$ | hEdma = edma3init(0,&result);! u0 ~% ^! D) [
if(hEdma)' R, C$ H4 H$ d' W
{
% r& K9 d1 r' d% E4 N. }, M$ x; d print2arm("edma3init() Passed.",0);
& w. r1 _$ G) k. r }
. h6 ?* K+ `( v; Y$ Y3 b else
" C: i2 d' T7 b" o. T y& p' g {
; { r+ w* S2 N0 ~- O" G6 @ print2arm("edma3init() Failed.",0);
+ G8 S! D5 }8 Z( ] }% J6 U9 E7 q8 m2 a
: l. C9 E! e/ F( T
if (result == EDMA3_DRV_SOK)- x" x8 g2 v% Z* b- r" E. N
{, K! F' |! X9 U: L" `1 t" m
result = EDMA3_DRV_requestChannel (hEdma, &chId, &tcc,
# y: d; S }+ J% J) {6 u2 X$ N (EDMA3_RM_EventQueue)0,- B1 r- D$ l$ g
&edma3_isr, NULL);
& W. ?+ k) s1 m$ X } R% d6 C0 J3 ?; _0 u: S: `- n
! g# O: U+ }9 z, Q: t% t
if(result == EDMA3_DRV_SOK)
! E; d* }7 ?7 m" } {
6 M a" z4 H# a/ q# c4 Q8 Y$ h paramSet.srcBIdx = 0;
" I- M% h* [% g1 @ paramSet.destBIdx = 1;! ?' r# Q$ g3 ^. a5 ^* v4 Q% T: m
paramSet.srcCIdx = 0;9 T: n4 r+ \# z
paramSet.destCIdx = 0;
) U* H, S& y$ y& O* Z- a1 Z. t paramSet.aCnt = PING_PONG_ACNT;
0 \" R# x& t$ {8 }' _- [" S paramSet.bCnt = PING_PONG_BCNT;7 r# ~# t- B5 R# D
paramSet.cCnt = PING_PONG_CCNT;
0 J- b" s" d$ |$ Z% C6 R3 t- g 3 B1 J A! z4 G4 U- s2 H
/* For AB-synchronized transfers, BCNTRLD is not used. */7 W. A3 a! ]! y. [ n
paramSet.bCntReload = PING_PONG_BCNT;
3 G$ g3 ?/ y' C0 M9 W8 U
$ `9 X: J/ l: s# B4 F /* Src in constant mode Dest in INCR modes */
' E1 i- _7 j3 o0 l' s paramSet.opt &= 0xFFFFFFFDu;7 C3 I) }% s: _# U( ]
//paramSet.opt &= 0xFFFFFFFCu;
( B* \) K+ \, F4 n+ f 1 `: k5 u" C, `3 F' \& r; b- X
/* Program the TCC */
, A8 s. Q3 T5 W) b# G/ p" w paramSet.opt |= ((tcc << OPT_TCC_SHIFT) & OPT_TCC_MASK);$ P e) D; z- f# J# D q* K2 ]2 W
5 h! B) U5 |, e/ W1 { /* Enable Intermediate & Final transfer completion interrupt */6 Q8 n9 j' V! P: @9 {2 v
paramSet.opt |= (1 << OPT_ITCINTEN_SHIFT);8 k8 _0 E* I" q+ }% d2 f
paramSet.opt |= (1 << OPT_TCINTEN_SHIFT);1 R2 g% b( U5 P( \! i5 _
: S# h% r0 a& Z
/* AB Sync Transfer Mode */7 \: E8 i, E1 L
paramSet.opt |= (1 << OPT_SYNCDIM_SHIFT);* H1 |. h4 \6 u7 f& v
1 `" D9 n7 j. Q/ t' W /* Program the source and dest addresses for master DMA channel */9 T- V I3 a- _
paramSet.srcAddr = (uint32_t)(MCASP_BASEADDR+0X029C);
! D. j1 A* L- ?. h1 S paramSet.destAddr = (uint32_t)(ping_buffer);8 `; w/ d/ }* h: h. j1 c' ^
/ y W: r9 u: c /* Write to the master DMA channel first. */3 u0 U' L; L& Q4 I) I% P- t
result = EDMA3_DRV_setPaRAM(hEdma, chId, ¶mSet);
6 S8 {* X" G# Z' m! _ } ) X! W2 Z; A, J$ c
" F* q% L) a0 z5 g- G
result = EDMA3_DRV_enableTransfer(hEdma,chId,EDMA3_DRV_TRIG_MODE_EVENT);
- D. _: ^" n& E! r
0 }' V! y% m, `+ A! k7 a1 N- i if(result == EDMA3_DRV_SOK) 5 d2 E" a6 C9 M9 U1 y, F
{! Q! p" U. P, D: h* M
print2arm("edma3 driver init success.",0);) e) ~: a5 p+ W
} * z9 o7 B/ g6 T- ^$ x6 F
}
3 s# H+ d) t, L/ I" C E. Q
" d( C1 K5 N3 B
b6 h M# k- _; I4 \EDMA3的配置就这个函数,是由MCASP接收事件触发EDMA3传输的,中断函数edma3_isr只能进去一次,请大家帮忙看看哪里有问题。。。
! ?' L. X# Z% _" g( C$ t1 d2 E8 {6 d; `) G5 U; P) h
2 A) u; K7 A/ }) T$ Z; v$ P9 h
|
|