|
|
使用mcsdk中的edma3lld库写的edma3驱动,在omapl138的dsp核运行,但是中断函数只能进去一次,路过的朋友帮忙看看,感谢万分。代码如下:( \7 @; @$ T. Z$ S) v& {0 t
#define PING_PONG_ACNT 1
% e0 l# h: W1 o* b e& b4 p#define PING_PONG_BCNT 8*32*40 + O$ n" S% o1 p& ]
//#define PING_PONG_BCNT 1
4 l9 h+ u0 h5 S- \1 N#define PING_PONG_CCNT 1
0 x$ @$ M6 r1 W3 A8 g8 y& o3 _#define MCASP_BASEADDR 0x01D00000
: `5 N- Y$ Z4 O, V#define Mcasp_RXEVENTQUE (0u)* B" e- ~5 J3 J
9 V; M3 t0 E& {6 @/ v" N V
/* OPT Field specific defines */' A! Y1 T: x# O7 {1 b
#define OPT_SYNCDIM_SHIFT (0x00000002u)3 ^: m( j, x. O+ E0 i/ e) e) W/ y9 y
#define OPT_TCC_MASK (0x0003F000u)
% @+ B- R/ q9 Y c#define OPT_TCC_SHIFT (0x0000000Cu)
# R% M* R3 U7 P6 ?$ \& j#define OPT_ITCINTEN_SHIFT (0x00000015u)
. o( [5 ^3 B g9 K$ M#define OPT_TCINTEN_SHIFT (0x00000014u)
5 p o, z3 n% B5 c- ~
) x/ g7 f" J$ K* {char ping_buffer[PING_PONG_BCNT];7 i& k. Z8 {( ^' D$ e
char pong_buffer[PING_PONG_BCNT];- M: y4 m" i% {$ o+ E3 t$ |
4 ~" A, J7 y0 c/ ~5 [, t* }2 R
# X2 R3 F- U2 o; ]4 Y2 x: o( |- P+ `. r
7 N, p5 v7 P* `) d8 v/ o
static void ys_edma3_init()
& X& }! c" z) \' L1 X{
5 @0 q! c/ ~$ ~2 i EDMA3_DRV_PaRAMRegs paramSet = {0,0,0,0,0,0,0,0,0,0,0,0};2 ^# v z" c' T. j- L% a
EDMA3_DRV_Result result = EDMA3_DRV_SOK;
) W8 [8 g! ]! T# m, T EDMA3_DRV_Handle hEdma;& U l# X6 O8 |' D" r- \
uint32_t chId = 0;
3 i/ W% i1 J, w1 f uint32_t tcc = 0;
1 {) _4 n' ^6 G6 ?% N6 f9 S$ @' G
& E4 u9 c4 _) n( D6 F I( z print2arm("edma3 driver init...",0);% d. o' W8 e& U: @; c! U. v
3 x1 S8 C/ c9 l
hEdma = edma3init(0,&result);' K& {& t$ _; v, \( k% u6 D
if(hEdma)
7 E* `" @# V& B# O5 s5 t {
* Q8 \% h) e/ F } print2arm("edma3init() Passed.",0);* m; b' e$ L5 @9 c. f) P
}
& ?& u: G8 p- P; w$ `4 S8 m else
0 D; Z/ K, w1 i3 n2 k/ Q {
0 V( l' X# y# ?8 D' z+ e print2arm("edma3init() Failed.",0);7 Z' ^$ {& c, `: }4 I4 u, W, W
}
& B( F/ f- A& Q5 i ; k4 w, h' K' k
if (result == EDMA3_DRV_SOK)5 h. t% v8 T7 q- Z; S
{
6 D. b2 }+ x0 b result = EDMA3_DRV_requestChannel (hEdma, &chId, &tcc,
" y' {' y* x- G (EDMA3_RM_EventQueue)0,
; v7 E, R6 o% F% g( j &edma3_isr, NULL);0 `! K5 l. g; h( Q
}1 f( q" Z2 {; G7 z1 C+ f
8 e$ H# I9 H$ h1 p/ J6 M3 _ if(result == EDMA3_DRV_SOK)& I, S I& m: K7 ?7 I
{
+ F4 c( v( c5 u4 Q { paramSet.srcBIdx = 0;& G) _- i, v" T- q0 k; t
paramSet.destBIdx = 1;
: @6 D2 k9 D/ t* s, h% J, B& o4 {- Z paramSet.srcCIdx = 0;# }* H2 ?6 ~) |. N
paramSet.destCIdx = 0;
9 u$ [( g, j- A0 @% E paramSet.aCnt = PING_PONG_ACNT;4 c5 ]1 S) A+ Z2 j, |0 i6 J( g- ~
paramSet.bCnt = PING_PONG_BCNT;5 {7 O* d( l. h- H! ?5 q
paramSet.cCnt = PING_PONG_CCNT;" r7 c* W" P6 K
* J* f; p9 K9 t: u/ K8 ~ /* For AB-synchronized transfers, BCNTRLD is not used. */
* Z# g* ?% t3 e/ S, ?( Y paramSet.bCntReload = PING_PONG_BCNT;
0 ^ E& n- s; z7 E) e0 w C2 O9 t! P' {( n. h+ u
/* Src in constant mode Dest in INCR modes */
4 S7 H, ]( O% x8 V, a& G0 I, f paramSet.opt &= 0xFFFFFFFDu;" H3 _5 M, Z" l
//paramSet.opt &= 0xFFFFFFFCu;8 D! V; f8 k& v- o5 V
* k4 \9 Q( ?0 m c4 @9 R
/* Program the TCC */
- y/ T' c1 T+ T- _ paramSet.opt |= ((tcc << OPT_TCC_SHIFT) & OPT_TCC_MASK);
+ F" C b$ h1 O# P4 f
: @% m; {; p# }. ]; X/ U3 _. d8 u' _ /* Enable Intermediate & Final transfer completion interrupt */
. U' p. E0 K; ?. X3 P paramSet.opt |= (1 << OPT_ITCINTEN_SHIFT);
. P: ^5 Y3 R! L0 A o- f paramSet.opt |= (1 << OPT_TCINTEN_SHIFT);
. g# j6 h+ m7 k
0 O5 _7 w9 ~4 j& R) h! q /* AB Sync Transfer Mode */' Z; V+ B. y A, h5 T
paramSet.opt |= (1 << OPT_SYNCDIM_SHIFT);( \9 C1 N: P0 `5 l( W+ i( X8 ~" C
& S* P: |8 I% Q8 A, m
/* Program the source and dest addresses for master DMA channel */
. v% u! I, B6 m paramSet.srcAddr = (uint32_t)(MCASP_BASEADDR+0X029C);! [0 U: m' t" m. T7 o
paramSet.destAddr = (uint32_t)(ping_buffer);' z. D* j$ i& A* k& E: x1 P& I
) H) h7 K9 c) b
/* Write to the master DMA channel first. */: x' V; n7 q. J/ C7 V. ]8 d
result = EDMA3_DRV_setPaRAM(hEdma, chId, ¶mSet);
$ E D! m, S) q& r5 ~5 n% c! o. e } [) G: t. G! `$ Q) T& q, u
7 N7 j. ?! T, E9 K
result = EDMA3_DRV_enableTransfer(hEdma,chId,EDMA3_DRV_TRIG_MODE_EVENT);3 J6 u, L( m2 d- M X9 {
% D$ v. ~0 {; i6 O4 P
if(result == EDMA3_DRV_SOK)
1 W8 D; X6 y n- L/ M9 l* u { e! H5 Z; L: K9 b* @
print2arm("edma3 driver init success.",0);
6 e8 _ f- p8 @* w: O3 P" t }
9 N2 y0 T% Z, f5 [: k5 h}
9 W8 M" h/ t, h0 n- c+ J- q; \
- t, `+ P% S7 j) J
! @/ u2 q9 u& ^% dEDMA3的配置就这个函数,是由MCASP接收事件触发EDMA3传输的,中断函数edma3_isr只能进去一次,请大家帮忙看看哪里有问题。。。
, `' v2 O5 ~3 E9 p6 e6 x" T; F$ |1 |( c4 s) F
% R3 c0 |# L' R, g
|
|