|
|
使用mcsdk中的edma3lld库写的edma3驱动,在omapl138的dsp核运行,但是中断函数只能进去一次,路过的朋友帮忙看看,感谢万分。代码如下:2 \& W" s# c( Z/ f" A; P
#define PING_PONG_ACNT 12 q: E; V3 L. ^: O8 ]4 `) B$ o
#define PING_PONG_BCNT 8*32*40
: ]' g$ A" Q/ J4 x. g6 b, |//#define PING_PONG_BCNT 1
. X) K6 M* ~. m2 ^0 Y) B9 |% U#define PING_PONG_CCNT 1
4 G! K: h3 B2 l3 K& Z#define MCASP_BASEADDR 0x01D00000
9 S7 X5 p4 X1 o4 Y#define Mcasp_RXEVENTQUE (0u)
/ |( G! u. g0 C, L' V
6 Q9 `- D1 V$ G& k! K v/* OPT Field specific defines */
0 `/ B6 |# e# u) `) l! U' X#define OPT_SYNCDIM_SHIFT (0x00000002u)
* y" t' Z$ X' ]( _0 ^7 M8 Z#define OPT_TCC_MASK (0x0003F000u)
1 V3 d' i) x3 J- U5 d. C# A#define OPT_TCC_SHIFT (0x0000000Cu)
3 M& B& @8 A, X% j; `4 H2 D#define OPT_ITCINTEN_SHIFT (0x00000015u)
0 n% C3 o) G! @$ s# f1 h#define OPT_TCINTEN_SHIFT (0x00000014u). v. J! e) @& r4 f3 y3 O, g
0 d' {1 N8 A" h
char ping_buffer[PING_PONG_BCNT];* H T& ~6 P6 \, T, X
char pong_buffer[PING_PONG_BCNT];
6 z# O/ M. n5 J/ G1 G _, T5 F
9 Z6 W$ C( l9 S; l, s$ R* W; P9 W
: L0 e' L, v& o Q0 I9 Y, m4 P* _6 g; @- A! Y3 }: d3 r9 C. S
static void ys_edma3_init(). u! p. t2 _" d3 W
{
; K4 q1 Y& q3 B/ N) P3 p( T% p EDMA3_DRV_PaRAMRegs paramSet = {0,0,0,0,0,0,0,0,0,0,0,0};* L0 L4 \' i( e0 }. w$ Y4 S
EDMA3_DRV_Result result = EDMA3_DRV_SOK;
. a, L% G' x2 d6 ]2 O# @ EDMA3_DRV_Handle hEdma;
1 j$ I! w! _5 R uint32_t chId = 0;
7 L6 Y# k( ^; b- r- K( ?! {* z; b+ j uint32_t tcc = 0;' @) ?# J$ L2 O
; \, }% W. [' G) o. g
print2arm("edma3 driver init...",0);) d* W: C5 q6 g. {$ z, ?
3 G5 }1 G9 V* _' T hEdma = edma3init(0,&result);
( q6 o+ F! }* C1 G* Q/ d4 h3 e if(hEdma): Y t" @$ W6 w5 Z7 T+ C
{& M! e ?/ w- W$ W" c# l, y
print2arm("edma3init() Passed.",0);2 F$ }% x+ @7 U" B0 Z. F" c
}- h9 B5 N. @/ Y8 Y8 X
else
( |5 B, P9 f0 {. e2 b) p7 _- l; v6 J {
; R! d# G% N3 G2 k print2arm("edma3init() Failed.",0);: y' O; I) C: Y* u
}
4 r# _; \+ m+ S% p" Z$ J 3 x5 _* X% |8 s( H0 X( Z/ E6 n
if (result == EDMA3_DRV_SOK)/ ~- W# O8 M7 |1 X9 ?3 ?
{) A4 M- t5 ]5 [# _8 P9 d
result = EDMA3_DRV_requestChannel (hEdma, &chId, &tcc,
6 ?; @( f: D+ @3 [( K (EDMA3_RM_EventQueue)0,
# T) N9 K' |7 q8 H: ?* U1 ^, L$ D &edma3_isr, NULL);% `2 c; U" ]; k4 M
}
8 m. S( h( a3 k7 w9 j. V & U6 H% ^% j( s1 _" E3 P6 [, M
if(result == EDMA3_DRV_SOK)
- `5 D: L. [7 u: w {
4 V1 @6 K9 ~5 Q$ h6 l paramSet.srcBIdx = 0;) t3 H% w# g" X; ?. b5 d; K+ ?
paramSet.destBIdx = 1;1 r- c$ ]0 c2 W. K
paramSet.srcCIdx = 0;
, [. H4 Q, y/ n2 i3 B paramSet.destCIdx = 0;
. y j. V Q0 v paramSet.aCnt = PING_PONG_ACNT;* ~- g7 M# j p! c: ?
paramSet.bCnt = PING_PONG_BCNT;
! Y& Q, ^% e6 m4 k% A7 O; F paramSet.cCnt = PING_PONG_CCNT;
/ E- X; _: S( o4 g 3 D: ~' C' o4 |/ r+ i
/* For AB-synchronized transfers, BCNTRLD is not used. */, m+ p4 y% S$ q9 [/ h7 q
paramSet.bCntReload = PING_PONG_BCNT;+ g* j1 q6 a. t/ P4 w
- @/ R2 {, \. a7 c1 z* T6 o0 d /* Src in constant mode Dest in INCR modes */. H' M/ m$ T3 H- G
paramSet.opt &= 0xFFFFFFFDu;
W s; H6 m; C9 R" s5 B //paramSet.opt &= 0xFFFFFFFCu;
5 f5 j3 |% w6 I
+ C( K4 ~- h. Q9 R /* Program the TCC */
2 p2 C/ h# ~/ l0 H; B6 h8 u: g paramSet.opt |= ((tcc << OPT_TCC_SHIFT) & OPT_TCC_MASK);
) h6 n5 A9 o& ?
9 d! \; A2 I0 I* h7 P% ]. z: h /* Enable Intermediate & Final transfer completion interrupt */ ]' l% t5 Q0 A
paramSet.opt |= (1 << OPT_ITCINTEN_SHIFT);
" \* Y5 d+ k1 q1 { A1 Q paramSet.opt |= (1 << OPT_TCINTEN_SHIFT);7 |% e8 W! I0 W q+ ~* n4 \
0 D* V* z4 s( @: N) d3 w
/* AB Sync Transfer Mode */
5 i6 g& v7 ^. \ e- ` paramSet.opt |= (1 << OPT_SYNCDIM_SHIFT);
; @5 ~: q) f- j4 J
4 j) G; [& h9 p- q8 x /* Program the source and dest addresses for master DMA channel */
. a) c$ I3 P9 _, [ I paramSet.srcAddr = (uint32_t)(MCASP_BASEADDR+0X029C);
6 Q+ `; K! H9 d2 D paramSet.destAddr = (uint32_t)(ping_buffer);9 o& p/ [. C) r# k7 x/ {/ R. f! U
+ w' c8 s" j- b* G7 \ /* Write to the master DMA channel first. */
( c/ g7 u. T0 _" {. o result = EDMA3_DRV_setPaRAM(hEdma, chId, ¶mSet);
6 k0 g/ r( x; @- T, g0 \ }
8 }; ~' l. j. G" a1 |: ?0 B9 h, I3 X
result = EDMA3_DRV_enableTransfer(hEdma,chId,EDMA3_DRV_TRIG_MODE_EVENT);" b% [/ ?8 h7 C" N) l( q$ s
0 c0 p# O, c8 {# L4 r if(result == EDMA3_DRV_SOK) % j: Y" @" f: T) V6 j
{+ T- V" i9 h% o% L0 |4 W3 F. W
print2arm("edma3 driver init success.",0);
" K4 d4 A& U, d" x$ b }
1 A, h9 O/ a- I}
9 Q' i/ k* R1 n s/ f% Q/ }/ p8 L8 d+ m
, P% _( s( q$ ?1 lEDMA3的配置就这个函数,是由MCASP接收事件触发EDMA3传输的,中断函数edma3_isr只能进去一次,请大家帮忙看看哪里有问题。。。( v* S; C8 ?/ m ], R0 g" ]
- j1 ^: Y9 }2 I6 x2 u O- _8 Y7 } W- t, `9 e7 \$ r; P0 h: J
|
|