|
|
使用mcsdk中的edma3lld库写的edma3驱动,在omapl138的dsp核运行,但是中断函数只能进去一次,路过的朋友帮忙看看,感谢万分。代码如下:
( F# u8 t, B7 v: Q$ \5 e#define PING_PONG_ACNT 1! E5 d g1 F3 i
#define PING_PONG_BCNT 8*32*40 $ [4 g; S3 E1 d- _
//#define PING_PONG_BCNT 1
# b$ d! Q! y. C# q8 T#define PING_PONG_CCNT 10 Q" o5 s5 [) c- ?5 K3 ?
#define MCASP_BASEADDR 0x01D00000! b' _% f' t* u9 f
#define Mcasp_RXEVENTQUE (0u)
+ ]: U0 u! q, Q! z" J; m4 E! G1 @8 r4 U4 b" F
/* OPT Field specific defines */
7 @5 m O w; e9 ^2 b1 ^' B2 w#define OPT_SYNCDIM_SHIFT (0x00000002u)
9 O# d' ~( o( n" q3 j* \#define OPT_TCC_MASK (0x0003F000u)# x$ G: y: U- \; e& f- L( ]
#define OPT_TCC_SHIFT (0x0000000Cu)
. G2 X( z8 t2 d w#define OPT_ITCINTEN_SHIFT (0x00000015u)
- k+ \3 `1 L e( }% o#define OPT_TCINTEN_SHIFT (0x00000014u)5 C% i! ^% p( {* E! Y0 b
5 q& Z8 \+ X+ P* q9 s, h5 b
char ping_buffer[PING_PONG_BCNT];2 J2 {) z; |/ V3 s" [/ |
char pong_buffer[PING_PONG_BCNT]; X$ S9 M$ @* u/ ^
0 Y/ R( x6 D+ L4 l. s8 ^0 ~6 @
" F7 h+ H: }: z; t
1 j" v0 s+ s/ I0 J0 K! Q
( l$ x1 l1 @) A
static void ys_edma3_init()& Y% ?& m6 q3 \1 }# j9 x
{
( ]5 ^9 c5 v" {& L9 C EDMA3_DRV_PaRAMRegs paramSet = {0,0,0,0,0,0,0,0,0,0,0,0};% F; z; @+ t( e9 E, Z& K
EDMA3_DRV_Result result = EDMA3_DRV_SOK;
. o# i$ N: }6 x1 Q EDMA3_DRV_Handle hEdma;$ Y" J4 K/ t) ~- v* j& t
uint32_t chId = 0;
8 w- e+ L) M X# Z1 k& I7 W; m0 E uint32_t tcc = 0;
& O; z% {4 l$ t8 I& z
z- R: f2 U' ^6 v$ x6 t& M print2arm("edma3 driver init...",0);5 J4 V7 X$ R7 V
. l w2 {7 a1 e7 K
hEdma = edma3init(0,&result);
9 V7 g. c( C1 y4 N8 q8 t8 n9 s2 I+ T if(hEdma)
$ p' _! G, a# A5 F& z. h* o3 N) r {
( s+ ^% S- e, q0 U2 V' P2 t% a print2arm("edma3init() Passed.",0);
$ K5 W' B. z6 H }5 P% O8 g! E# u8 a& A0 F
else5 r+ f* d# z$ c9 N8 ]( r/ [* l
{' i; Z$ F7 _2 C [. F
print2arm("edma3init() Failed.",0);$ r) h4 P% F& l/ J3 b, B1 ]
}
; A) [! y. v2 I4 k' S
0 m' p/ S, ^* x0 X if (result == EDMA3_DRV_SOK)% F3 s+ R" F3 {) e
{" V# u+ X5 S2 W% _& `
result = EDMA3_DRV_requestChannel (hEdma, &chId, &tcc,; \1 R6 g' P; R7 }( s
(EDMA3_RM_EventQueue)0,/ y7 c2 t; o% D+ f% R7 u$ c
&edma3_isr, NULL);
! _! d0 M% v/ g p6 V% Q }4 b( z- j/ B8 N' E' z# X5 K; \
" g/ a! t1 E' s% o5 v4 l* S9 Q
if(result == EDMA3_DRV_SOK)
]2 h3 G* f$ I& m {' g3 h. |: o5 t8 L2 W9 | S
paramSet.srcBIdx = 0; z2 X" r3 K! \3 n9 y6 ^! W
paramSet.destBIdx = 1;
8 k! s' c# R1 ]& I% h/ q paramSet.srcCIdx = 0;5 d" c0 z' x9 B
paramSet.destCIdx = 0;
3 [6 t+ X1 P- @1 z( G! F6 g paramSet.aCnt = PING_PONG_ACNT;" g5 E& I* p: M
paramSet.bCnt = PING_PONG_BCNT;
0 D2 U( h& S1 ^+ g& d, M paramSet.cCnt = PING_PONG_CCNT;
$ C: T# Q6 A6 ~% ~$ g( B- _
: S \/ ?. y0 ~: e /* For AB-synchronized transfers, BCNTRLD is not used. */1 U# {; l7 G: H) o4 Z4 A
paramSet.bCntReload = PING_PONG_BCNT;
) w2 f2 ~' t, R2 w8 k0 D; Y2 w' z8 Y I
/* Src in constant mode Dest in INCR modes */. t1 b- g! n. H8 t
paramSet.opt &= 0xFFFFFFFDu;
4 @. T5 O! B# X' e* p0 v' } //paramSet.opt &= 0xFFFFFFFCu;
$ S, e, q% y! F6 J9 ^* [3 o5 m ; N) m1 i" r! M1 p( ]5 U% q
/* Program the TCC */
" o: s2 g# s5 X+ Q paramSet.opt |= ((tcc << OPT_TCC_SHIFT) & OPT_TCC_MASK);& Z( D; h. i' `7 C6 v1 A
/ V! q% C+ ?4 @+ S7 y0 s- U- m
/* Enable Intermediate & Final transfer completion interrupt */
( q& x8 c: U) R paramSet.opt |= (1 << OPT_ITCINTEN_SHIFT);. `% M( R; t4 i
paramSet.opt |= (1 << OPT_TCINTEN_SHIFT);
# e, G; |9 ~' e+ G& o. ]7 x5 [$ p8 @( V. R9 X5 w& M
/* AB Sync Transfer Mode */
% h3 }8 V& m' c6 [: F$ T4 ` paramSet.opt |= (1 << OPT_SYNCDIM_SHIFT);
( @0 N, P& \$ ~* C/ J& T3 q( D
( O: _7 K0 V5 a( Z5 d /* Program the source and dest addresses for master DMA channel */
7 S2 t, n* k, o! t" G) ` paramSet.srcAddr = (uint32_t)(MCASP_BASEADDR+0X029C);
# d$ j4 Z9 m3 `7 w; j% A3 r paramSet.destAddr = (uint32_t)(ping_buffer);
6 p! q$ A, L$ s8 c$ b) K
{) _: I9 O# y$ ^0 H! u, f6 Y /* Write to the master DMA channel first. */% N! H; @* ~; q' v0 N+ a4 w# o
result = EDMA3_DRV_setPaRAM(hEdma, chId, ¶mSet);2 F/ v0 s! c( |6 R; }- o
}
$ k% y4 d5 Z& g! Y4 p. Z- E( [, q6 X+ R+ ]
result = EDMA3_DRV_enableTransfer(hEdma,chId,EDMA3_DRV_TRIG_MODE_EVENT);1 Q* s5 B' a; P8 D8 h/ M0 x. X
5 s I" T* `' H& M+ A if(result == EDMA3_DRV_SOK)
( I) E% x( u) N; f {
# B. Z) k! w9 r- k7 Q print2arm("edma3 driver init success.",0);
" Z; y9 ?7 T6 E }
6 P) M& W% H! H; Z* w}
9 c9 t; c2 _ ^, [0 u) w4 @# ]: y" d5 E- C
, c# d$ ?" _- Q# U6 C" f
EDMA3的配置就这个函数,是由MCASP接收事件触发EDMA3传输的,中断函数edma3_isr只能进去一次,请大家帮忙看看哪里有问题。。。
0 p0 j( R& t3 ~1 f" z* B. o$ C8 s: I! ^+ v" v- X2 b2 S" w
* M3 A1 ?! x7 D- U( z1 R L- q& V
|
|