|
使用mcsdk中的edma3lld库写的edma3驱动,在omapl138的dsp核运行,但是中断函数只能进去一次,路过的朋友帮忙看看,感谢万分。代码如下:7 s6 |9 Q8 [, a' b. Z8 E0 d
#define PING_PONG_ACNT 16 o: m8 R0 Q; g: _
#define PING_PONG_BCNT 8*32*40 , o" g3 F1 [1 f2 \
//#define PING_PONG_BCNT 1 9 X! ^# a+ g7 l$ M; R
#define PING_PONG_CCNT 1, `2 ~. y b- ~
#define MCASP_BASEADDR 0x01D00000
* W. }: @- N& ?' d/ F& W#define Mcasp_RXEVENTQUE (0u) X% z' U0 j/ {5 |) \9 s
" V! t' L- T7 d( @' s6 \& l/* OPT Field specific defines */
' B% M, z/ u8 M; O#define OPT_SYNCDIM_SHIFT (0x00000002u)0 _. v5 C! M5 V5 P
#define OPT_TCC_MASK (0x0003F000u)
: {4 e4 p- d, I( S; q#define OPT_TCC_SHIFT (0x0000000Cu)
. K: L9 y# V* ?. F L% ?2 `#define OPT_ITCINTEN_SHIFT (0x00000015u)# T3 V, M9 g4 S8 J( B/ R
#define OPT_TCINTEN_SHIFT (0x00000014u)
3 Y. B& E7 p0 Z# k2 Q7 U+ W+ \2 B
r7 E; H% e) T6 }8 Uchar ping_buffer[PING_PONG_BCNT];( K! w# L/ R5 k* a4 g9 u/ T
char pong_buffer[PING_PONG_BCNT];: Z" X- H* k' F: i6 o
, }3 C5 z% g) Z" C9 I1 ^5 p) L
' |" W1 p' i p, ~9 [
9 U2 }: T- v: P: M8 g& L c& c" h3 {- Z/ t, ]
static void ys_edma3_init()
: Q! P& e) |: M{' H$ P6 L7 _# B9 K. D1 A* w
EDMA3_DRV_PaRAMRegs paramSet = {0,0,0,0,0,0,0,0,0,0,0,0};
4 q( E9 j! ]% D |( {; j* X& C3 | EDMA3_DRV_Result result = EDMA3_DRV_SOK;
4 i% w" z8 U) x) b2 H$ B. r. a EDMA3_DRV_Handle hEdma;0 d4 E/ W R% ? \
uint32_t chId = 0;
% c C8 g: u( K3 p; {; [ uint32_t tcc = 0;+ w8 B0 s9 y ]) `1 d! x& |) |! g. `
9 l; _ h1 ^/ W8 w5 _ print2arm("edma3 driver init...",0);
& F( u; z2 Z: h3 M" S/ o( S; m$ l2 ]3 z. v8 t N1 P' Z8 v
hEdma = edma3init(0,&result);
3 t9 e: Q3 m: U+ J if(hEdma)( A" \& }$ x, X1 k
{
, ]- t1 \/ f; K1 q' L& n print2arm("edma3init() Passed.",0);
7 g: }5 y( w. _ `+ m }! @: ? w2 e" }3 K( ]" z
else
- e7 S, Z$ z7 t% X. ~ ^" O% S, G {0 j: j2 J. C& G* ?* H
print2arm("edma3init() Failed.",0);
( E$ e0 Q4 M. E8 [9 f }, U% ~( |6 ^( {+ ]$ J, y4 b
3 q$ |& E( K0 i% A/ Q4 \ if (result == EDMA3_DRV_SOK)
6 {$ j) L4 N" n3 W6 |* _4 v: z {2 G9 _0 k3 ^ R# G. O
result = EDMA3_DRV_requestChannel (hEdma, &chId, &tcc,. I/ ?6 V- C+ l/ P( s
(EDMA3_RM_EventQueue)0,
/ d/ b) P( A/ m' L$ ]8 @7 e2 G9 Z &edma3_isr, NULL);" A; W5 L9 c k$ q
}
7 Y) W D+ U& s1 n4 c( E* w! E2 m
6 `! J/ k; ?0 t& L( x h if(result == EDMA3_DRV_SOK)
) r' r+ S9 D5 D& k) { {+ f$ c( |; n" \$ v
paramSet.srcBIdx = 0;9 E/ j/ K! Y1 Z/ S1 |) Y+ o
paramSet.destBIdx = 1;
$ P; g- v/ W- A0 q, M paramSet.srcCIdx = 0;
, s* t$ Y+ |* v+ X paramSet.destCIdx = 0;
/ R$ o1 f/ J1 j& Y9 s paramSet.aCnt = PING_PONG_ACNT;1 C, `) K) a6 w1 Z' f/ c# C0 i
paramSet.bCnt = PING_PONG_BCNT;" F' D2 I. f- H' n1 H
paramSet.cCnt = PING_PONG_CCNT;, }7 C8 d6 Y3 n3 I- J! F
- U$ w# \8 X5 A; @
/* For AB-synchronized transfers, BCNTRLD is not used. */
5 s$ V3 J# P) }& g paramSet.bCntReload = PING_PONG_BCNT;2 D' F5 ^6 P/ H# z
5 X1 P0 l' _$ E1 e) r5 Z) V
/* Src in constant mode Dest in INCR modes */# H1 I4 y7 J+ L6 \7 c0 C% v
paramSet.opt &= 0xFFFFFFFDu; ~9 X- \' Q7 z0 r+ l0 ?
//paramSet.opt &= 0xFFFFFFFCu;
+ p/ Y7 a& U5 D# L 5 V. d8 J f* t/ Y
/* Program the TCC */
7 X( G. D$ Q; w8 _7 b9 c, _& g paramSet.opt |= ((tcc << OPT_TCC_SHIFT) & OPT_TCC_MASK);6 c# o4 S' |. O! R
8 U1 Q7 y7 c* s
/* Enable Intermediate & Final transfer completion interrupt */
2 |' E5 y0 i) a6 E! P paramSet.opt |= (1 << OPT_ITCINTEN_SHIFT);
3 U! O+ z J+ x1 a) w* K paramSet.opt |= (1 << OPT_TCINTEN_SHIFT);0 I4 p+ p+ A$ W, A5 M! l
8 F5 i5 u) s4 p3 n& h3 g /* AB Sync Transfer Mode */5 `2 d$ J- O! ~
paramSet.opt |= (1 << OPT_SYNCDIM_SHIFT);
4 L+ `! [4 }7 A' \ / V+ v5 x: c, G# {) }7 B& m
/* Program the source and dest addresses for master DMA channel */' x- a0 B# X8 K9 r6 E) d' c
paramSet.srcAddr = (uint32_t)(MCASP_BASEADDR+0X029C);, N" z! e# ~, M2 {1 H4 j
paramSet.destAddr = (uint32_t)(ping_buffer);! D5 i5 D9 j# {' i' ~0 d# F+ b- @$ o
( i! L+ j9 d; d6 \. c- o /* Write to the master DMA channel first. */
1 Z1 ]! S2 U$ Q- I& N result = EDMA3_DRV_setPaRAM(hEdma, chId, ¶mSet);
: z0 Q. W' X. S7 \" _8 P } + ^8 z0 h! _0 o, r; _9 X
2 h$ Z* `6 v% ~5 w9 I9 G result = EDMA3_DRV_enableTransfer(hEdma,chId,EDMA3_DRV_TRIG_MODE_EVENT);/ i X& [; ]2 p$ f, ~
7 i V. t; ?) x if(result == EDMA3_DRV_SOK) ' ~0 V3 w. N4 R* ?7 K
{
1 V8 ?2 K# O3 f" n7 | print2arm("edma3 driver init success.",0);
- i9 N) S n3 E& f6 P }
) A6 ?! O2 q8 x8 y* e' S}% ~5 K2 g4 J% E& B4 K9 s% E7 ]
7 ^8 G0 v9 z" Q7 t4 C/ M& \3 x& E/ W. A S
EDMA3的配置就这个函数,是由MCASP接收事件触发EDMA3传输的,中断函数edma3_isr只能进去一次,请大家帮忙看看哪里有问题。。。/ X2 _2 H7 K3 D& u- ~
; ?- a- P t- ]6 J8 I# b
) S8 K4 H$ v9 C( A+ _ ^ |
|