嵌入式开发者社区
标题:
edma3中断只能进去一次
[打印本页]
作者:
silent123
时间:
2015-4-22 22:01
标题:
edma3中断只能进去一次
使用mcsdk中的edma3lld库写的edma3驱动,在omapl138的dsp核运行,但是中断函数只能进去一次,路过的朋友帮忙看看,感谢万分。代码如下:
, _5 u+ M- {" _: {3 w6 d$ u
#define PING_PONG_ACNT 1
3 q. {; o: X4 ]
#define PING_PONG_BCNT 8*32*40
3 [4 \# c5 Q; x5 V. V
//#define PING_PONG_BCNT 1
: I n( ?1 z9 G3 A o
#define PING_PONG_CCNT 1
! i& c/ n/ D1 ]$ b$ U$ O9 D6 S
#define MCASP_BASEADDR 0x01D00000
4 @- I4 Z- \5 C
#define Mcasp_RXEVENTQUE (0u)
" z. g5 `- W1 Y! ~9 w
! M) {9 I! j1 v, u( F, ^
/* OPT Field specific defines */
! ]2 _/ }+ f0 M5 w% Q; E
#define OPT_SYNCDIM_SHIFT (0x00000002u)
! m& ^9 \& l& ]8 x
#define OPT_TCC_MASK (0x0003F000u)
- l' r' G" `- R0 u* J
#define OPT_TCC_SHIFT (0x0000000Cu)
) J. g7 x3 _% K- E1 V6 K6 t
#define OPT_ITCINTEN_SHIFT (0x00000015u)
! P- f% B0 V$ G+ W) L
#define OPT_TCINTEN_SHIFT (0x00000014u)
# X! g. i4 x8 Z- L, s6 j9 W
: U, E# F: k3 o& Q" ~
char ping_buffer[PING_PONG_BCNT];
3 `) {* X* S, J9 C' l
char pong_buffer[PING_PONG_BCNT];
% h" m& m7 k" M; J8 D, R
5 N& i" K- P2 {$ m
$ l O2 L+ J! x8 b1 b/ j. E
" g1 }* [& |) W. [/ o0 m
* P7 H( m/ l' E7 S$ z7 C
static void ys_edma3_init()
. P! C; J# K2 W& ]! x
{
, h, Z$ P" Y, p, g$ Q5 Z3 x
EDMA3_DRV_PaRAMRegs paramSet = {0,0,0,0,0,0,0,0,0,0,0,0};
2 P" N8 E5 X3 m8 O
EDMA3_DRV_Result result = EDMA3_DRV_SOK;
; h& n7 h' g! e) {3 M
EDMA3_DRV_Handle hEdma;
8 z) P8 Y9 e( ?
uint32_t chId = 0;
: w$ \; V+ o9 C9 c; p
uint32_t tcc = 0;
9 m' @" @7 m% ?/ _+ L% K8 v3 q
1 F: P6 v/ E8 K# `' e
print2arm("edma3 driver init...",0);
0 u; X) W: ^+ ~& F- ~9 p, t m( F
( f. ]5 V" G# J* }% x. p
hEdma = edma3init(0,&result);
+ G" J1 M9 A1 _# s" f) f& S
if(hEdma)
) h* }& h, b$ x& b( d! V
{
. J9 _4 j- H8 [* U- `/ @
print2arm("edma3init() Passed.",0);
. x1 I8 C) z% t+ y! \9 v
}
. I7 Y7 S4 Y; c# G. x Y
else
5 W% ^, @0 G B4 [& g& M t9 O- Y! P
{
2 _$ a0 o2 ?4 p: G9 m
print2arm("edma3init() Failed.",0);
/ K8 J; G- U, L: g
}
( @) Y& k/ x# w2 _; f
6 g' v: x. `# n8 u
if (result == EDMA3_DRV_SOK)
% i" B" Q! @. R* Y3 f4 [' {
{
: Y- f, h7 w q7 }0 h' Z- D- ?$ k
result = EDMA3_DRV_requestChannel (hEdma, &chId, &tcc,
D5 N) r$ t) _. K$ F/ }. R: f
(EDMA3_RM_EventQueue)0,
: |: V0 @+ x+ S8 p3 T
&edma3_isr, NULL);
: [. T: y, `1 {7 r
}
# }& _0 l; n" G4 L
1 n& o3 b8 M! d2 K- w
if(result == EDMA3_DRV_SOK)
$ V! B1 f) l/ ~4 H9 }
{
0 p" y$ M6 w" n: x8 D% Z* n
paramSet.srcBIdx = 0;
! m" }) w, C/ L( T
paramSet.destBIdx = 1;
" v: A% ?: h3 y" R8 m2 a
paramSet.srcCIdx = 0;
4 C) z/ g1 V4 @- l" P$ Z+ f, p0 g4 j
paramSet.destCIdx = 0;
! ^! b( j: [6 D) X: H0 S
paramSet.aCnt = PING_PONG_ACNT;
, c: y( |( t4 g0 R' U" P- u: Z2 v
paramSet.bCnt = PING_PONG_BCNT;
! l' s3 h( ?3 |; r' s4 A8 R
paramSet.cCnt = PING_PONG_CCNT;
+ {# w! d y9 L; x( T: k' T) X ~
- Z4 K) \. r% T+ k( C9 R7 W
/* For AB-synchronized transfers, BCNTRLD is not used. */
" G9 j$ I9 p8 w- c' K- K" K" J" {0 S; ?
paramSet.bCntReload = PING_PONG_BCNT;
9 r/ U2 X L! Z2 T1 w% T: l
0 E' p% V! x2 o2 L2 B5 y
/* Src in constant mode Dest in INCR modes */
6 |& Q6 O' ^# h( w! i+ t% x/ k- i
paramSet.opt &= 0xFFFFFFFDu;
! z9 r# x" ` T
//paramSet.opt &= 0xFFFFFFFCu;
: a, P( \0 W8 K5 h# F
9 r( `- U7 C. s) V
/* Program the TCC */
+ B" I; l/ @7 Q' p! [
paramSet.opt |= ((tcc << OPT_TCC_SHIFT) & OPT_TCC_MASK);
9 c2 e9 Q6 p4 I8 e3 S' z! O& h
5 N5 A+ ~1 R( b) ?7 ^
/* Enable Intermediate & Final transfer completion interrupt */
0 c3 R3 _! r' H" [
paramSet.opt |= (1 << OPT_ITCINTEN_SHIFT);
' K4 A6 _+ Q6 s+ g# V
paramSet.opt |= (1 << OPT_TCINTEN_SHIFT);
- ~, E4 b$ {: |: K4 `
" S' l2 Q) n( G/ o8 L
/* AB Sync Transfer Mode */
8 f8 r' a: F- C$ t" l' J
paramSet.opt |= (1 << OPT_SYNCDIM_SHIFT);
; y, V A& v* t7 f; w, T
* e( W7 w; x7 q# L; k7 P5 z F
/* Program the source and dest addresses for master DMA channel */
5 W7 ]" p1 @: `) T
paramSet.srcAddr = (uint32_t)(MCASP_BASEADDR+0X029C);
; _% }. \" G& v4 b# \: k
paramSet.destAddr = (uint32_t)(ping_buffer);
! m2 _& W3 v& ]: M8 i
/ \8 K$ w! @3 O! d: y
/* Write to the master DMA channel first. */
( X+ G+ |" H: Y) p6 r
result = EDMA3_DRV_setPaRAM(hEdma, chId, ¶mSet);
: ?0 @$ g: a* m: S4 Z5 d2 O+ x
}
8 ]6 o8 X% N3 `, \- y" i( ]
: Q5 P/ Y) W2 \! {
result = EDMA3_DRV_enableTransfer(hEdma,chId,EDMA3_DRV_TRIG_MODE_EVENT);
$ V$ p: ?4 L! M7 \; y- U& [( k
" u3 N% s Z/ J; h- C' R
if(result == EDMA3_DRV_SOK)
. D1 H6 G+ [* f5 t/ _- [* d
{
$ ?1 T) h. y; Q# ^
print2arm("edma3 driver init success.",0);
: V8 D; m& ~: ~; p2 }7 }0 H! E6 V- @
}
3 H9 ]6 v* O2 }* t, a) d
}
- ^' `9 h5 |" u/ I; V
U7 w* m! T! }# \ `9 k- X
4 l. `# {! {, ^5 b' x% @
EDMA3的配置就这个函数,是由MCASP接收事件触发EDMA3传输的,中断函数edma3_isr只能进去一次,请大家帮忙看看哪里有问题。。。
0 _: Q# \: E" X$ I! }
) p& b" X1 f" `( u: j0 P/ E
5 X* x% q* F: v" T) G& X
作者:
Lewis
时间:
2015-4-24 10:47
每次DMA传输完成后都要再次使能传输
作者:
silent123
时间:
2015-4-29 23:25
Lewis 发表于 2015-4-24 10:47
2 g) U8 k5 p( H0 x7 l
每次DMA传输完成后都要再次使能传输
! q) B) i/ A! e/ W1 v% y" y
原来是这样,我明天去试试,谢谢了!
欢迎光临 嵌入式开发者社区 (https://www.51ele.net/)
Powered by Discuz! X3.4