|
|
使用mcsdk中的edma3lld库写的edma3驱动,在omapl138的dsp核运行,但是中断函数只能进去一次,路过的朋友帮忙看看,感谢万分。代码如下:0 c8 {0 l& I6 k7 K2 `
#define PING_PONG_ACNT 1
' v1 N4 I$ _- ]#define PING_PONG_BCNT 8*32*40
* z9 _. D' K# d7 ] p+ S7 N//#define PING_PONG_BCNT 1
2 @6 R4 ~% T* R R- c#define PING_PONG_CCNT 1" `" c+ t" Q' d* A# c4 A& P
#define MCASP_BASEADDR 0x01D00000+ I9 ?) e) M: c
#define Mcasp_RXEVENTQUE (0u)
* c( T: N: L2 Z0 ?( O1 i; ^% I1 r0 w' Q. \, x( N: L
/* OPT Field specific defines */* s. v- n; X/ z) K/ `" a6 q
#define OPT_SYNCDIM_SHIFT (0x00000002u)
1 |, M! V; [2 ~' h3 I- |% `#define OPT_TCC_MASK (0x0003F000u)5 C. ^. n4 N# p
#define OPT_TCC_SHIFT (0x0000000Cu)
- H h1 m1 A8 v% V#define OPT_ITCINTEN_SHIFT (0x00000015u)
W1 S: x* t" `% i/ m! b6 I! o- M#define OPT_TCINTEN_SHIFT (0x00000014u)
7 E* p+ j( L; s# @
$ ?' Q- | I' y% Uchar ping_buffer[PING_PONG_BCNT];( u7 K ^" T# {0 h
char pong_buffer[PING_PONG_BCNT];
$ A1 h- Z% R [* W1 p0 w$ U
1 J0 R! P& y" F7 r1 ]) e( \0 C, G: g r3 D9 {; C
, M! d; c' O" Y) z6 T8 s9 X
* ~$ F \5 A) Z; Ustatic void ys_edma3_init()
! V5 A# V7 l: ^: Q( M, O& k{
, k; y& k& h. V6 s& s: D1 x' [6 B EDMA3_DRV_PaRAMRegs paramSet = {0,0,0,0,0,0,0,0,0,0,0,0};
4 Y) @3 ~! H7 H EDMA3_DRV_Result result = EDMA3_DRV_SOK;: u" o4 g8 N4 a9 o3 ]: Q9 b
EDMA3_DRV_Handle hEdma;
1 P: f* a2 ?. B" @+ P uint32_t chId = 0;) M5 C: P" t! y% }, f: ^
uint32_t tcc = 0;
2 U. |( S3 a Y$ T9 t$ ^# p+ }$ M% }- ~# J/ H# N, x: _- A, l& c
print2arm("edma3 driver init...",0);# _/ d( m( v* n& A1 u
p6 J( y1 |& E3 L4 O' c7 \
hEdma = edma3init(0,&result);3 O7 l) w6 ?' L
if(hEdma)
/ f) r. [/ V4 D* O {9 Z' t, a- S; e* V5 k$ Y
print2arm("edma3init() Passed.",0);
' ~, z, W: p# @% @2 W# ^7 _ }! N4 V- `1 f* T5 h
else: n4 i$ J' f' B8 ?$ T! P5 }" x
{; r* w! ~% F+ |- S5 L
print2arm("edma3init() Failed.",0);
& Q; S) [2 P* N) s# ?* ? }, h4 D9 U: w& ~6 n" E
/ }- s+ k& n7 s. ~$ U6 O' r7 P9 e Y if (result == EDMA3_DRV_SOK)+ k4 @/ f! g; A) B- o- S D1 C6 N0 l
{
1 O9 h3 q1 B" W1 _ result = EDMA3_DRV_requestChannel (hEdma, &chId, &tcc,
9 s% F, ^( e$ P+ J (EDMA3_RM_EventQueue)0,) a& A1 }! W* o4 u. M' h! f2 \
&edma3_isr, NULL);7 g( B; [9 G1 C' D6 `! ^5 ^
}5 N/ s6 m+ l2 Z% ]
6 V8 f$ A# r! J0 R if(result == EDMA3_DRV_SOK): _# P, ]* Y; O- P
{
" d: F# ~9 ~6 J _ paramSet.srcBIdx = 0;
$ U, w+ `- e! H: g& c6 y1 M paramSet.destBIdx = 1;
% ]) s! |$ Q- I paramSet.srcCIdx = 0;
9 `7 P" }! k' r( { paramSet.destCIdx = 0;
1 p' V- o4 e( V3 w) k. _% [) a5 K paramSet.aCnt = PING_PONG_ACNT;& O- M" e1 {% y) U. P0 L; s# Y
paramSet.bCnt = PING_PONG_BCNT;
5 u( c+ u2 J% y4 \+ S' r paramSet.cCnt = PING_PONG_CCNT;% n: O2 g& a0 P- d7 q
% D+ Q. c* S" \" l _ /* For AB-synchronized transfers, BCNTRLD is not used. */
. o! h' r4 k# ]/ U# e6 S# ^4 F paramSet.bCntReload = PING_PONG_BCNT;- c4 {0 M4 C( B* a S7 n
% W9 l8 X. n! P( s) Q
/* Src in constant mode Dest in INCR modes */
7 }! h5 [ K% ~- ]8 U paramSet.opt &= 0xFFFFFFFDu;
" m$ D, R, U2 Y) t //paramSet.opt &= 0xFFFFFFFCu;3 n7 x! K" c, }7 v" j, D* K4 _5 ?
8 m' ~: N- x" j7 L7 w ~ /* Program the TCC */
0 i( ]/ ] n1 I8 J paramSet.opt |= ((tcc << OPT_TCC_SHIFT) & OPT_TCC_MASK);9 r, }6 u8 _6 n3 B, N% r, g N
2 ^ m, E% O1 X, U1 u9 n
/* Enable Intermediate & Final transfer completion interrupt */
' a2 E. N$ \3 _1 N& u. p paramSet.opt |= (1 << OPT_ITCINTEN_SHIFT);( h) F: |" M' j
paramSet.opt |= (1 << OPT_TCINTEN_SHIFT);
# t/ [% x/ m- E+ u; q
0 O! U$ d0 g2 s /* AB Sync Transfer Mode */
+ @* | `9 R' m2 d) ^3 P paramSet.opt |= (1 << OPT_SYNCDIM_SHIFT);
) }/ b& u: `+ E6 l: [! q1 e$ n
7 Y+ U) Q& p& \+ R0 _; p- J. D2 p& A /* Program the source and dest addresses for master DMA channel */
7 D! a4 r* c& _/ c paramSet.srcAddr = (uint32_t)(MCASP_BASEADDR+0X029C);7 T, h: r/ P' M
paramSet.destAddr = (uint32_t)(ping_buffer);' _7 f8 M1 W6 s' I0 i$ R3 l
9 g; T% M) q3 e. q* {
/* Write to the master DMA channel first. */$ d7 l+ M1 S) |
result = EDMA3_DRV_setPaRAM(hEdma, chId, ¶mSet);
& I& w; O* {/ Z5 [7 [4 N. f* B3 p; k } ; y7 N" F/ Q3 L" _8 L/ K( m
3 D7 P3 s' j5 I result = EDMA3_DRV_enableTransfer(hEdma,chId,EDMA3_DRV_TRIG_MODE_EVENT); ?1 m- C, _; O* U v
4 \2 F2 Y* `4 q; h( V if(result == EDMA3_DRV_SOK)
0 \( g. L% O$ {4 }6 J {
: u, ~( t* @4 g. y( R7 y; a8 X7 q' s print2arm("edma3 driver init success.",0);9 O- l) ]8 v5 [5 a
}
/ W. x3 K t# x7 s3 q}
. w" d5 F8 R/ [6 Q
: S! ]& y% S( ~' t9 g, b- { r8 T, N! y1 E& g
EDMA3的配置就这个函数,是由MCASP接收事件触发EDMA3传输的,中断函数edma3_isr只能进去一次,请大家帮忙看看哪里有问题。。。
- y7 S8 Q4 H' X$ |. R4 h' Y1 v% _
e+ \, E/ M/ N |
|