|
|
使用mcsdk中的edma3lld库写的edma3驱动,在omapl138的dsp核运行,但是中断函数只能进去一次,路过的朋友帮忙看看,感谢万分。代码如下:
/ F- S p6 V9 K5 m3 ~2 k#define PING_PONG_ACNT 1
/ {! K. ^1 B) s#define PING_PONG_BCNT 8*32*40
J. M2 t+ P1 J% v7 y z, G3 B' |//#define PING_PONG_BCNT 1
3 e: I5 `" K% G6 i' c. k#define PING_PONG_CCNT 1/ Q$ ~5 K1 \- E3 d5 ^, G4 k
#define MCASP_BASEADDR 0x01D00000$ V1 e$ p; _$ a: l& f9 b
#define Mcasp_RXEVENTQUE (0u)' |2 p# a- O' m p. _
3 o9 B, f! H6 [4 B* t/ G; i x: O& u/* OPT Field specific defines */
8 f/ f+ }! S" R3 j$ ~6 k# N3 o% u#define OPT_SYNCDIM_SHIFT (0x00000002u)& t" U! e2 T3 ?3 b. Z& w
#define OPT_TCC_MASK (0x0003F000u)
% G$ m/ D, j/ N$ e, [+ d: _% l#define OPT_TCC_SHIFT (0x0000000Cu)
4 V+ T. N% W7 b: f" ~#define OPT_ITCINTEN_SHIFT (0x00000015u)
4 q9 e4 Y# { y ~#define OPT_TCINTEN_SHIFT (0x00000014u)3 M& X0 M( ?) |; `3 V
; B# Y8 {" n2 \5 G) I
char ping_buffer[PING_PONG_BCNT];
0 p" |6 L! K* s. T# U% Z6 s! H2 s" qchar pong_buffer[PING_PONG_BCNT];
% i, S$ D9 q' J9 n6 l& J6 m. D
0 H7 n. F M$ Q0 C, p1 {" l5 p, f- {
5 s& P4 X, _4 d' _1 k& ?0 e+ r: R! L9 c9 s. ~3 ~" k0 h: _
6 G& z* @7 \, d; `
static void ys_edma3_init()
" o$ J, ^; r) j: B1 Y: P; a{
C" e6 ^4 x3 t+ _) F+ m8 h3 x EDMA3_DRV_PaRAMRegs paramSet = {0,0,0,0,0,0,0,0,0,0,0,0};( C3 ~3 A3 e+ _# O7 t
EDMA3_DRV_Result result = EDMA3_DRV_SOK;
! o0 d2 E8 Z9 H* G; V v7 o EDMA3_DRV_Handle hEdma;/ n5 |$ s( T* R) R( a- ?
uint32_t chId = 0;2 G, j; n: B: q% G! G; _7 _' d
uint32_t tcc = 0;+ y2 a/ e6 ^" G% }( r9 p( x% ], Z- z
3 b" k. {, b" i1 ^ print2arm("edma3 driver init...",0);9 o! U5 ?! O! @% L+ |* c. `* C
. [. Z4 n, q3 n2 G
hEdma = edma3init(0,&result);
/ ?; p( `( S' A2 R+ K if(hEdma)* J9 {7 `* l* J4 _& Y
{( o: Q4 R) R" L
print2arm("edma3init() Passed.",0);9 i& h- f, E+ x$ h% e- R$ |
} B% V# @$ |* h1 x% g
else6 b+ j) N# v. r# k7 g
{
! y! c$ g* Q1 ?# g print2arm("edma3init() Failed.",0);. P b& C3 {; g- l
}
4 R0 T7 P" d1 J! j h9 x ! A6 W2 ~ O' o( w: k6 E
if (result == EDMA3_DRV_SOK)7 s+ c0 u6 M; a a4 ]
{
+ _$ I; s, `3 F. w6 T4 n: t/ k( O result = EDMA3_DRV_requestChannel (hEdma, &chId, &tcc," `& ~! ~' O: r: b2 }$ j) e3 L8 K
(EDMA3_RM_EventQueue)0,1 C6 H5 f! K; ~- n$ p4 }/ t
&edma3_isr, NULL);
$ p+ L, M# l/ f/ o$ u& e }& g' a4 b4 y# n# F9 Y& w/ |$ ?
: T5 ?" }7 T& u5 R* I% i$ P# v; m
if(result == EDMA3_DRV_SOK)
! u2 `% G& B" m {( e/ U( n3 d; [5 P' `0 V
paramSet.srcBIdx = 0;
/ G2 B) g0 K! Z0 s6 g paramSet.destBIdx = 1;
9 |5 n% G: @8 A8 `+ P {# M9 T paramSet.srcCIdx = 0;
- Z/ J5 Z" f5 p paramSet.destCIdx = 0;; E$ n5 A- p; T
paramSet.aCnt = PING_PONG_ACNT;) H2 D. Z: C* j5 s4 d L7 y; a5 @
paramSet.bCnt = PING_PONG_BCNT;) W4 i4 _: }" T* ~
paramSet.cCnt = PING_PONG_CCNT;- t7 e7 {. b: Y" ?1 F4 G
d4 y0 O, {/ F# b# R! }
/* For AB-synchronized transfers, BCNTRLD is not used. */( o& @7 {# i" `0 V% Z' ~
paramSet.bCntReload = PING_PONG_BCNT;
7 p# u8 }5 }% k$ L. Y- J; |
" W w- ^1 j& e /* Src in constant mode Dest in INCR modes */! Z f5 w, m" T2 R
paramSet.opt &= 0xFFFFFFFDu;
, e! S) j$ f& v \$ F6 Q //paramSet.opt &= 0xFFFFFFFCu;9 c1 z4 g; o7 Q$ V; h! o
) I$ E0 x v0 k' o
/* Program the TCC */
/ ~, w4 n# o' |# |$ W# E5 q1 R paramSet.opt |= ((tcc << OPT_TCC_SHIFT) & OPT_TCC_MASK);
2 ?6 n: C# T% a: `# t5 @1 C6 ]. U% b; I \8 n4 Q* t* E
/* Enable Intermediate & Final transfer completion interrupt */
" }, z8 j# M( f ? paramSet.opt |= (1 << OPT_ITCINTEN_SHIFT);
+ I8 Y% q9 K5 A) G! F+ x paramSet.opt |= (1 << OPT_TCINTEN_SHIFT);, X0 H" ?- f2 S) n- X
9 K7 y' ?. M% a1 H+ g; o /* AB Sync Transfer Mode */# X& V0 ]/ F+ Q5 q
paramSet.opt |= (1 << OPT_SYNCDIM_SHIFT);3 W* o" c8 v5 u( \+ R; q
% k! A. e0 l& z
/* Program the source and dest addresses for master DMA channel */
" U% o* Y* `; g5 _" c. p$ B( K; L" f paramSet.srcAddr = (uint32_t)(MCASP_BASEADDR+0X029C);
8 n8 ~3 Y4 w- m+ ` paramSet.destAddr = (uint32_t)(ping_buffer);
* ~/ S0 S& c$ M, @
- l! @" U$ T8 h# D! E /* Write to the master DMA channel first. */
5 Y) `: i' } E/ W result = EDMA3_DRV_setPaRAM(hEdma, chId, ¶mSet);
: C- F2 ?& _! y4 l- Z+ I }
5 {9 o W4 c& n/ h) I. V4 _* T3 E8 c# @) z1 {
result = EDMA3_DRV_enableTransfer(hEdma,chId,EDMA3_DRV_TRIG_MODE_EVENT);/ z7 y8 z4 A5 P; r2 I& G7 o
$ |5 u& u* J9 y' c+ D/ G( S
if(result == EDMA3_DRV_SOK) 7 y$ x: H" P# t$ c2 Z T
{4 T4 B. D/ h& t4 F) l
print2arm("edma3 driver init success.",0);, r7 _$ r, t% E
}
7 R% r! R$ }' t5 y; k, |}
# @6 l" \& O6 P( B4 Z" p
$ d0 w) C9 l1 K. n& J& B4 S
( N9 f9 A( D! i. r/ f" j! H yEDMA3的配置就这个函数,是由MCASP接收事件触发EDMA3传输的,中断函数edma3_isr只能进去一次,请大家帮忙看看哪里有问题。。。
9 O; v- [* X8 P) K# p* E k) W7 `$ D6 p! D8 d3 E' o
8 n1 \, O9 ]2 B3 y6 @& ? |
|