|
|
使用mcsdk中的edma3lld库写的edma3驱动,在omapl138的dsp核运行,但是中断函数只能进去一次,路过的朋友帮忙看看,感谢万分。代码如下:9 m+ w) C9 N) g) d( c6 s
#define PING_PONG_ACNT 1' M* @5 q2 F- q5 \( h! {/ Q! j- @
#define PING_PONG_BCNT 8*32*40
8 f9 E, |* H9 d* W( L6 } w//#define PING_PONG_BCNT 1 5 |9 `2 P* r" j, Y
#define PING_PONG_CCNT 1( F, X( D! R& G; N
#define MCASP_BASEADDR 0x01D00000
/ B. _/ f( Z* ~. m& m5 t* m#define Mcasp_RXEVENTQUE (0u)
4 E- G: B2 a! l, @! z" F' l) u) I4 A" P3 Z) W- Z z6 j
/* OPT Field specific defines */' M+ f. I/ H p( p; Y- S
#define OPT_SYNCDIM_SHIFT (0x00000002u)0 r$ e6 V- g8 S: ]0 A
#define OPT_TCC_MASK (0x0003F000u)3 C1 X4 m. H: n" M) H& ^
#define OPT_TCC_SHIFT (0x0000000Cu)
5 K7 [1 E/ m. @6 R# r* s$ Z#define OPT_ITCINTEN_SHIFT (0x00000015u)
% a4 u! |0 a2 H ?" X9 A% z#define OPT_TCINTEN_SHIFT (0x00000014u)
' t3 S# \8 P2 ]) n$ `! Y1 A
f. {/ u* W; {0 Y4 {, `6 u# `char ping_buffer[PING_PONG_BCNT];! \0 u: r6 n2 s$ F# U
char pong_buffer[PING_PONG_BCNT];7 i2 I6 E- c. n+ Y! {
7 X$ c; \( L" A7 \- C8 m& A: ?- b/ D7 A* V9 U6 H# E/ j" s
/ i, M6 p' K$ H- z
( y/ c9 g. l5 c! N0 s6 |6 ^5 C2 D
static void ys_edma3_init()- U) p8 Z5 Q. V# E) P+ N( k
{( e" S6 ?- u% u5 p8 v3 |4 b
EDMA3_DRV_PaRAMRegs paramSet = {0,0,0,0,0,0,0,0,0,0,0,0};
2 ?* G& L8 H# K3 w9 m EDMA3_DRV_Result result = EDMA3_DRV_SOK;8 f: ^+ z5 s% m3 K
EDMA3_DRV_Handle hEdma;; M6 B+ Y$ X' p0 p# B4 s! e+ B
uint32_t chId = 0;3 j x, |# ] c" Z% e5 j1 W
uint32_t tcc = 0;
9 b' ^4 e( I1 z$ i0 `3 C# ?! O6 t0 Z5 j+ T& N
print2arm("edma3 driver init...",0);* D3 l( v0 }9 W1 S: S
' B8 Z8 Q1 [7 \( U0 s& A: C6 ? hEdma = edma3init(0,&result);
& d8 `$ |) z, L) [; m if(hEdma)9 z* \2 P' ?; Q' c8 }4 y: `0 }9 [
{
5 {1 a5 r' o% k/ Y+ Z' P print2arm("edma3init() Passed.",0);) I$ L; L( M8 _( C
} B/ a3 E o3 v0 f7 F2 O
else
4 r3 {3 I# \4 J8 ] {
" Z @3 m: P- o8 J print2arm("edma3init() Failed.",0);
4 z" f9 t. i2 k8 q7 \8 R, L }- I6 M3 d `' w, s) U8 d; h5 N" g
) x/ T/ P4 e/ T6 o. |2 x- x3 q
if (result == EDMA3_DRV_SOK)' _1 h9 F: d' D4 s1 m, ~
{- I( M2 O) j9 }. ?
result = EDMA3_DRV_requestChannel (hEdma, &chId, &tcc,8 I& ^. R5 G; @
(EDMA3_RM_EventQueue)0,9 T. D# z$ w6 F% P
&edma3_isr, NULL);. ]$ T* ^" Y# U4 k1 I( R, a; c, i
} c! r6 E$ m! c4 s9 g
0 D2 ^+ M& W! @: a3 X" ^1 _ if(result == EDMA3_DRV_SOK)7 x$ E# z4 p# N5 H+ w8 _1 i
{
+ E8 t) u9 N0 c" `/ h& D9 b paramSet.srcBIdx = 0;! Q: Z+ t6 U. v1 I( M6 `
paramSet.destBIdx = 1;/ V$ m9 W0 ]& i
paramSet.srcCIdx = 0;1 i7 ?' g1 k4 m# H
paramSet.destCIdx = 0;( L: }- i1 z6 x% o
paramSet.aCnt = PING_PONG_ACNT;
: V" f3 G2 c! v% d3 w paramSet.bCnt = PING_PONG_BCNT; Q% x! k, m1 T# T
paramSet.cCnt = PING_PONG_CCNT;
! H2 g" l5 K; \" S& l6 ^6 Z3 n & }/ n& n2 t: L
/* For AB-synchronized transfers, BCNTRLD is not used. */" e" q0 Z, n( @
paramSet.bCntReload = PING_PONG_BCNT;8 ]6 `( j' o- t" @
, v; M! j: u; e; e- A: [: n
/* Src in constant mode Dest in INCR modes */+ [+ `9 J* D' H
paramSet.opt &= 0xFFFFFFFDu;6 p) ~4 m. e3 M: \- _- q T: H- x
//paramSet.opt &= 0xFFFFFFFCu;6 a2 C3 B5 m! d* \
l$ ~6 r9 K0 [- [, I
/* Program the TCC */
) f1 S( f- t e- ^; Y: p paramSet.opt |= ((tcc << OPT_TCC_SHIFT) & OPT_TCC_MASK);" w/ V8 z( j5 l* u) B& g. \) w
& y K( a+ u# J8 A/ g7 Y9 J( w
/* Enable Intermediate & Final transfer completion interrupt */
0 n6 U; U, [( j- m paramSet.opt |= (1 << OPT_ITCINTEN_SHIFT);0 B: p4 }+ d" T+ C) F
paramSet.opt |= (1 << OPT_TCINTEN_SHIFT);+ o+ @( @6 n+ J8 n& s
$ [+ r7 S( Y! F& B# H
/* AB Sync Transfer Mode */) h4 P4 P+ s5 h4 H6 h+ O
paramSet.opt |= (1 << OPT_SYNCDIM_SHIFT); _' r: o7 P! B; c! E# b& B
1 x7 h) k9 D" G9 a. s _: b
/* Program the source and dest addresses for master DMA channel */
; Y$ s- l' c0 v, H4 j/ a5 W* o paramSet.srcAddr = (uint32_t)(MCASP_BASEADDR+0X029C);
0 o% @; U3 x8 k paramSet.destAddr = (uint32_t)(ping_buffer);0 Q: n7 [5 A$ u( K& [8 [. B1 f
9 y1 w+ S/ p8 a7 L
/* Write to the master DMA channel first. */" p. B- F9 Y# U% D
result = EDMA3_DRV_setPaRAM(hEdma, chId, ¶mSet);
9 ^# k, R& D' b& @$ z4 E }
" {2 _4 c+ U, g1 v5 i. Q t3 h1 l2 [, \( H/ d% s1 a E
result = EDMA3_DRV_enableTransfer(hEdma,chId,EDMA3_DRV_TRIG_MODE_EVENT); a V/ f! `% |* ?; Y% f% W
3 r0 T0 U* e% H if(result == EDMA3_DRV_SOK) - [) L; F! C8 w I `% f u% F
{$ k' m! k. P n8 P; L
print2arm("edma3 driver init success.",0);
1 G. ]) L0 F# g1 i! W/ }7 q% ~5 M } " T+ v) Q6 O/ [9 z3 G- a
}% m4 } U6 |9 m2 ?
9 E G. p( t$ Q; R+ l9 e6 U: @
1 R* p7 d4 ~( T/ _* X8 L7 `: IEDMA3的配置就这个函数,是由MCASP接收事件触发EDMA3传输的,中断函数edma3_isr只能进去一次,请大家帮忙看看哪里有问题。。。2 @. S' X x" h( H
5 z3 t; h' v0 b* s6 v8 G
3 t3 f; z f$ e( p! I: Z$ Y' e |
|