|
|
使用mcsdk中的edma3lld库写的edma3驱动,在omapl138的dsp核运行,但是中断函数只能进去一次,路过的朋友帮忙看看,感谢万分。代码如下:
; q7 L, y. \+ R8 A) M4 l#define PING_PONG_ACNT 1
6 D9 F5 a ?: a- @#define PING_PONG_BCNT 8*32*40
Y" J! B( n' k6 ^/ d4 r% m3 Z//#define PING_PONG_BCNT 1
) S; G6 R+ x% V2 u5 P#define PING_PONG_CCNT 1
7 ]' ^4 C# W0 w2 s9 W( Y! m#define MCASP_BASEADDR 0x01D00000
; ` `& k6 z0 v t* h9 ?! x#define Mcasp_RXEVENTQUE (0u)
/ j& w8 r. T# T) P! K; d6 x2 e( |
/* OPT Field specific defines */
; }/ F* ~4 l( K( F#define OPT_SYNCDIM_SHIFT (0x00000002u)$ B: y6 _0 U* d1 I- x: e. T
#define OPT_TCC_MASK (0x0003F000u)
& i0 S7 a2 l: e) l: `+ g- y#define OPT_TCC_SHIFT (0x0000000Cu)" Y" s% H) ?# J
#define OPT_ITCINTEN_SHIFT (0x00000015u): J0 E' q q6 W6 H6 v$ b. Y
#define OPT_TCINTEN_SHIFT (0x00000014u)
3 o2 Q: O, w6 d7 E1 `
6 h1 D$ K# |1 \9 ^/ r; ]8 ~+ G) pchar ping_buffer[PING_PONG_BCNT]; U: \6 j/ W5 n& ?1 M- G' `
char pong_buffer[PING_PONG_BCNT];
! P4 e/ A' n% K# b! ]$ @0 g* S' r% [6 U4 y
6 _: q& \3 t% |* e4 _; F6 w! K' J3 Z: l; [# D
7 w0 g! d9 R! ~( R/ T* B* y
static void ys_edma3_init()
) O! }% L2 u/ Z& F{; a5 ^" U D3 P+ P
EDMA3_DRV_PaRAMRegs paramSet = {0,0,0,0,0,0,0,0,0,0,0,0};( d$ l( W* k1 v
EDMA3_DRV_Result result = EDMA3_DRV_SOK;% E. ~1 `) O+ e: g7 i. s
EDMA3_DRV_Handle hEdma;" D5 R& y* X; g, ~9 {
uint32_t chId = 0;
5 Q8 J+ R4 D5 H. ~$ L uint32_t tcc = 0;0 K5 J+ `/ c) }: M! r3 ]7 n9 G/ @* B5 o
4 w4 M) E: b* O/ r, g8 u2 n print2arm("edma3 driver init...",0);. O7 E9 \' {9 ~9 Y9 a
! s# ?& o( R$ z0 u7 I+ J) R- I; a
hEdma = edma3init(0,&result);
1 C+ k7 R4 t1 e- u3 m5 ^ if(hEdma)3 a, j' X! A( M8 U! z% Z
{6 z1 A: y2 Q* q4 f
print2arm("edma3init() Passed.",0);
8 {3 b( l( k3 V1 Y/ y) ?7 L0 R' W |( l4 l }
# L+ b* q0 D8 w0 X% [% } else
; B b e# V f" r6 Z+ a {6 Z5 L3 H% [' D- m! t8 S$ n
print2arm("edma3init() Failed.",0);3 t4 Q! g0 W2 t% x3 F
}6 ?* a; [/ }9 A$ W& v* b- W4 y5 t
# F% Y, P4 }" Q" S6 y) [$ k. M if (result == EDMA3_DRV_SOK)
2 m- L- z5 ]! L) J0 Z* `, @0 K5 S* m {5 W+ {1 ?8 g: u3 |% P# E4 I
result = EDMA3_DRV_requestChannel (hEdma, &chId, &tcc,
6 i- F9 @. H j* v (EDMA3_RM_EventQueue)0,
0 G/ ` ~$ v# O* z1 x2 `/ _1 T &edma3_isr, NULL);
+ R5 Z& \: e# t9 c0 t( q6 m$ o8 S }9 N2 S" x/ I8 V0 E
( c6 `" y/ V* q; N+ n! @/ J" h% }% d
if(result == EDMA3_DRV_SOK)
f" Z7 _" S) ?7 u {0 x5 ]+ k) b" \" {5 R* t
paramSet.srcBIdx = 0;
* s9 p% R- U5 \4 p# t; _ paramSet.destBIdx = 1;
9 n6 C' ~! ~. w0 \ paramSet.srcCIdx = 0;
6 F0 {5 P* W) R+ ^ paramSet.destCIdx = 0;5 w( v+ K% L$ ?4 `4 |- V+ g' ]# S
paramSet.aCnt = PING_PONG_ACNT;/ Y8 Y9 i* S0 o
paramSet.bCnt = PING_PONG_BCNT;9 Q7 P H; v [1 O: u1 m
paramSet.cCnt = PING_PONG_CCNT;
; I) A, G& r' y7 l# l4 l; H: I 8 O7 P, y! u: V m& m, r
/* For AB-synchronized transfers, BCNTRLD is not used. */
# A1 ~* A; z3 h9 O6 _8 A d; ^# t( B$ \ paramSet.bCntReload = PING_PONG_BCNT;# r! o- x* N5 n. |! R4 k$ k7 I
0 k# r$ x$ |% A6 z1 }& S
/* Src in constant mode Dest in INCR modes */0 y4 _. R/ [, \% O# ^
paramSet.opt &= 0xFFFFFFFDu;
( t$ [' r; ~1 x% u. v //paramSet.opt &= 0xFFFFFFFCu;; C/ s# z, H0 w# I
# g, Y' d" L8 S1 X
/* Program the TCC */
9 }* j6 E, {6 L0 J \ paramSet.opt |= ((tcc << OPT_TCC_SHIFT) & OPT_TCC_MASK);% A) Q- v5 {5 i+ B) y
, h: K; |: P: _* H6 E
/* Enable Intermediate & Final transfer completion interrupt */" r0 \- b: X( F1 p3 @7 c. F
paramSet.opt |= (1 << OPT_ITCINTEN_SHIFT);
7 u, c8 }5 z3 _) m; O; E paramSet.opt |= (1 << OPT_TCINTEN_SHIFT);0 ~. \% M" ?% U& P K! c3 ?
3 n# T: j+ k$ [6 T! m. z D
/* AB Sync Transfer Mode */- J: M. l% ?% E# \3 x
paramSet.opt |= (1 << OPT_SYNCDIM_SHIFT);! p k. X* R/ X7 B
1 w8 b2 P8 B9 M9 h' ~/ f
/* Program the source and dest addresses for master DMA channel */
) }3 ^ R, m6 P6 O% ^ paramSet.srcAddr = (uint32_t)(MCASP_BASEADDR+0X029C);5 @7 Q0 c$ [: E4 p0 S
paramSet.destAddr = (uint32_t)(ping_buffer);
" t8 \8 c. B0 l7 ?. b/ s
' k' a L9 l+ h0 K: |2 R( S /* Write to the master DMA channel first. */
r2 P. w4 b3 H1 w' L3 U! P) M/ P' | result = EDMA3_DRV_setPaRAM(hEdma, chId, ¶mSet);% r+ d3 M# p0 R$ }$ P1 r
} " O$ t* A) K) ~8 g) l8 |- b' m P
" ?& J! G* i' K6 f! C3 d; B) f result = EDMA3_DRV_enableTransfer(hEdma,chId,EDMA3_DRV_TRIG_MODE_EVENT);
" a! X6 C2 a$ ] X: Q0 ^8 Z4 \ * J! N1 c5 K, h6 ]
if(result == EDMA3_DRV_SOK)
8 n1 e( ?. G% d8 F {- H1 E/ @$ C4 g. t
print2arm("edma3 driver init success.",0);
) r A, J' q& w4 J6 i } 2 b; a2 }$ R8 J
}: l: s& |4 p) z1 N
6 E0 M$ m' y( v. E U+ _# }
; l+ X& d& }, BEDMA3的配置就这个函数,是由MCASP接收事件触发EDMA3传输的,中断函数edma3_isr只能进去一次,请大家帮忙看看哪里有问题。。。
; C+ p2 X, |! ~ o
+ ?( G5 |- Z" ~: J1 `& {" f/ n$ y* l5 Y- O0 `
|
|