嵌入式开发者社区
标题:
edma3中断只能进去一次
[打印本页]
作者:
silent123
时间:
2015-4-22 22:01
标题:
edma3中断只能进去一次
使用mcsdk中的edma3lld库写的edma3驱动,在omapl138的dsp核运行,但是中断函数只能进去一次,路过的朋友帮忙看看,感谢万分。代码如下:
8 z& J1 X- w" D3 [0 d
#define PING_PONG_ACNT 1
* x5 |9 K# W1 k9 N" }$ A( V
#define PING_PONG_BCNT 8*32*40
! Y- W# Q+ C. A. c( @) H n& }" r$ Q
//#define PING_PONG_BCNT 1
( i3 |! j% R/ ~* m, p( e" N6 F" a2 u
#define PING_PONG_CCNT 1
1 K% R) Y X" B( d1 l7 Z
#define MCASP_BASEADDR 0x01D00000
( ~( e# V& l, k1 X
#define Mcasp_RXEVENTQUE (0u)
1 ]/ S: Z( t5 |4 M5 _ d) x
; D2 `: b3 f0 u( o
/* OPT Field specific defines */
8 P7 f7 M( Y2 X& V( s8 L& q) q+ K
#define OPT_SYNCDIM_SHIFT (0x00000002u)
; n5 I9 V, e2 E5 g+ J! _
#define OPT_TCC_MASK (0x0003F000u)
& N: N$ k0 C) T0 @
#define OPT_TCC_SHIFT (0x0000000Cu)
8 k' o0 ^5 k1 m, p9 _( r% L
#define OPT_ITCINTEN_SHIFT (0x00000015u)
$ w8 P. y( c4 l! Q' p
#define OPT_TCINTEN_SHIFT (0x00000014u)
" i0 k5 @- q& E% ?3 D9 T
0 B7 f' t6 L' \" f0 B S9 B- v
char ping_buffer[PING_PONG_BCNT];
, [4 K/ k" [) c; Z4 J0 w9 l
char pong_buffer[PING_PONG_BCNT];
0 p4 V! b6 U! B) {) z- r }. D
3 [* ~1 Y7 [* t" n
0 c0 G6 b# F+ r6 q! Q
5 S+ H& C' L1 P& T
+ v, q M$ P) W' l2 f1 ~, T- q
static void ys_edma3_init()
8 [& h& O; ?( j9 |
{
2 V( \, g- B9 O, s
EDMA3_DRV_PaRAMRegs paramSet = {0,0,0,0,0,0,0,0,0,0,0,0};
! F- c- @# F; r4 C8 A f- {/ t
EDMA3_DRV_Result result = EDMA3_DRV_SOK;
1 r3 S! @, A+ x) |
EDMA3_DRV_Handle hEdma;
$ ^+ {1 G' Z3 l( d2 B
uint32_t chId = 0;
- t! A8 ?9 h& o
uint32_t tcc = 0;
( }/ z+ d% S7 n5 c' o
% H* I9 X! n# Y. V, p0 t/ Q' a
print2arm("edma3 driver init...",0);
7 I4 O2 l: p& {) I9 m9 i' o' `; n' Q
# y" ?- F% x# q: ~" R
hEdma = edma3init(0,&result);
( ~& Z$ G6 n9 E7 {$ _
if(hEdma)
! f( j7 J7 \% B4 s
{
/ @: ?! ?. v' Z" l/ J3 P
print2arm("edma3init() Passed.",0);
; ~' c! _6 a H @* l2 F" A& u0 ~7 E
}
" s7 V3 K7 o/ N
else
3 ]6 n% ]. O/ j' D
{
* [& e8 a/ {. x9 E! S% x
print2arm("edma3init() Failed.",0);
0 q- V8 r6 M" C& N
}
3 i! M5 p m2 z; D. N$ P
5 v5 C1 o" Q ^5 r9 j" n3 _
if (result == EDMA3_DRV_SOK)
/ a" R. F' T5 ~. v
{
& |' o/ ]! |, C8 j4 j6 G4 M
result = EDMA3_DRV_requestChannel (hEdma, &chId, &tcc,
; ~6 N& S$ x2 Y
(EDMA3_RM_EventQueue)0,
- c, c7 H' ]) L1 V9 D2 y+ m8 a' P$ `
&edma3_isr, NULL);
9 B# m. _; B) M/ r, m+ `. ?
}
9 ^' u( e8 T: k) E! | {
0 X* r5 P: h0 t, Y: G7 A0 x7 `1 H
if(result == EDMA3_DRV_SOK)
) v) f8 H* {8 z4 f6 S
{
5 d/ |1 g( T- M( {& W
paramSet.srcBIdx = 0;
& U* e, T1 E3 y1 Z" V
paramSet.destBIdx = 1;
0 V4 k+ c0 h P7 Y6 e
paramSet.srcCIdx = 0;
) O6 J8 i' ^" L8 ]& N. p
paramSet.destCIdx = 0;
& A# V9 u$ t; o) ]8 [; v+ M" b
paramSet.aCnt = PING_PONG_ACNT;
! w: V7 V3 ?8 A6 C- R
paramSet.bCnt = PING_PONG_BCNT;
! P. ^) a$ E" ~4 U0 O+ l
paramSet.cCnt = PING_PONG_CCNT;
^* S {1 W# D$ T7 q
- Z7 R- E1 r0 H% |1 t4 h7 B/ |
/* For AB-synchronized transfers, BCNTRLD is not used. */
5 B/ _ ^ N7 V: e. I2 ^0 y( F" h
paramSet.bCntReload = PING_PONG_BCNT;
* x0 S; ?. r' Y( s! B% s Y7 t
3 b# J% I0 D! B y, q& s, P
/* Src in constant mode Dest in INCR modes */
/ o4 [: O, H: u9 k5 Q
paramSet.opt &= 0xFFFFFFFDu;
$ w% s7 P9 x }' s3 d& T8 y
//paramSet.opt &= 0xFFFFFFFCu;
; F& ^5 }) L" X' B* s! L
7 ?4 }- Q" A+ o. f
/* Program the TCC */
+ y6 [ O/ g9 _; N# A* P$ t
paramSet.opt |= ((tcc << OPT_TCC_SHIFT) & OPT_TCC_MASK);
; |& g# v' b! V) X/ f! j# l
3 T0 E7 p- p9 Z1 r: k, T! ^$ u
/* Enable Intermediate & Final transfer completion interrupt */
% P3 b' f- ]9 e1 P: Y+ C2 a
paramSet.opt |= (1 << OPT_ITCINTEN_SHIFT);
' u$ e0 i9 g2 D( _0 q- [7 i6 @
paramSet.opt |= (1 << OPT_TCINTEN_SHIFT);
3 q& K$ ^, ]7 }% C: ]% Q
, D. C/ W3 L, Q
/* AB Sync Transfer Mode */
+ P H8 k6 |2 b" L
paramSet.opt |= (1 << OPT_SYNCDIM_SHIFT);
* u5 v$ |8 o1 ~9 M+ p
) Z j/ K; L* D3 r% F
/* Program the source and dest addresses for master DMA channel */
# q7 X8 w) {: ]' X4 C
paramSet.srcAddr = (uint32_t)(MCASP_BASEADDR+0X029C);
! l7 A+ b( M0 x( z; }
paramSet.destAddr = (uint32_t)(ping_buffer);
# y/ `' f: w) A6 q0 I# |
+ o3 E3 N) U# ~: ]7 v! l
/* Write to the master DMA channel first. */
, T% K8 N2 d! r) F& R# k# I. W( y
result = EDMA3_DRV_setPaRAM(hEdma, chId, ¶mSet);
# {# r0 w! i. K6 Z- n/ }) K. U3 P
}
7 @+ Q" ~$ y( Z
% k# ?9 }7 @" R7 ?( z
result = EDMA3_DRV_enableTransfer(hEdma,chId,EDMA3_DRV_TRIG_MODE_EVENT);
) Y; N" E. @7 L2 F z9 W
5 H) h) l0 E0 [
if(result == EDMA3_DRV_SOK)
1 s" n3 A- ~# @' |( E5 b$ r5 Q
{
+ g. c; |6 W& C6 Y
print2arm("edma3 driver init success.",0);
$ `6 G' P4 b( J& Y! S+ y/ L
}
! ]7 L7 x% k8 W! V! R- S& c3 x
}
# {( k- ~( H1 F6 l4 X% U
6 n; n5 k9 ]7 V* n/ D
0 y) W' K2 W A' X) @. B% x% {
EDMA3的配置就这个函数,是由MCASP接收事件触发EDMA3传输的,中断函数edma3_isr只能进去一次,请大家帮忙看看哪里有问题。。。
; Z/ ]2 ?: v: v& \8 ]6 p$ r6 U
! M, ^, z+ w& C0 \# K
6 i! E- m) H+ w1 ^$ p8 m' w! G
作者:
Lewis
时间:
2015-4-24 10:47
每次DMA传输完成后都要再次使能传输
作者:
silent123
时间:
2015-4-29 23:25
Lewis 发表于 2015-4-24 10:47
' m, B* q+ [; ]0 p6 D
每次DMA传输完成后都要再次使能传输
# E& {- V+ @1 c7 ?! ]
原来是这样,我明天去试试,谢谢了!
欢迎光临 嵌入式开发者社区 (https://www.51ele.net/)
Powered by Discuz! X3.4