嵌入式开发者社区
标题:
edma3中断只能进去一次
[打印本页]
作者:
silent123
时间:
2015-4-22 22:01
标题:
edma3中断只能进去一次
使用mcsdk中的edma3lld库写的edma3驱动,在omapl138的dsp核运行,但是中断函数只能进去一次,路过的朋友帮忙看看,感谢万分。代码如下:
1 f F; @6 G, D( o" R8 h4 @* s
#define PING_PONG_ACNT 1
$ i6 h! |3 n; P) @
#define PING_PONG_BCNT 8*32*40
& ^4 }! k; d/ ?! t2 y) i K& l- s
//#define PING_PONG_BCNT 1
( X( a v, U6 y9 r% P- s! i
#define PING_PONG_CCNT 1
4 `4 k$ E7 j: Q3 L
#define MCASP_BASEADDR 0x01D00000
% O7 u0 M! V0 F5 o9 h; P% l( {
#define Mcasp_RXEVENTQUE (0u)
+ A* }1 L) D! L% p4 \ @! F
* v4 V2 G( Y: c3 ]' t }3 v0 l. S
/* OPT Field specific defines */
0 u3 D" A( A1 S8 ~$ R
#define OPT_SYNCDIM_SHIFT (0x00000002u)
. _4 e; u, T$ j' `( F8 E9 U( F
#define OPT_TCC_MASK (0x0003F000u)
" \- y3 `8 w. _5 f
#define OPT_TCC_SHIFT (0x0000000Cu)
. b6 w; `/ H+ m% h
#define OPT_ITCINTEN_SHIFT (0x00000015u)
3 J. Q8 ^& a4 g7 x
#define OPT_TCINTEN_SHIFT (0x00000014u)
- `4 L# R+ V8 k5 Y3 M8 Z
4 l7 J; t$ M& `1 J9 R5 Q
char ping_buffer[PING_PONG_BCNT];
) i( A4 _% b" m- j7 |# g
char pong_buffer[PING_PONG_BCNT];
) X; R; H7 w$ p/ g8 F3 s
8 D( w+ H( B. E& i" ?4 @: v" N
% ^! B2 w+ D+ w+ s: h
- i& e r; a! a3 B9 }
0 x+ ~& c0 I( S
static void ys_edma3_init()
, E1 n I! Z9 A8 ]' D* C, H2 ^
{
. g* Y7 [! ^+ j! \
EDMA3_DRV_PaRAMRegs paramSet = {0,0,0,0,0,0,0,0,0,0,0,0};
- P9 S: H$ ?5 e0 S" e
EDMA3_DRV_Result result = EDMA3_DRV_SOK;
% P9 \ d+ m3 [, A( p
EDMA3_DRV_Handle hEdma;
: ?. r7 P) m' I3 ` ?+ ` b1 m
uint32_t chId = 0;
5 |& k. o8 ~* S, B: b' d9 w, E
uint32_t tcc = 0;
/ u" Q3 p( j% O! o
2 O% h- l! Y3 b* o2 A* L6 u
print2arm("edma3 driver init...",0);
1 Z& K3 N" n& m8 L4 A0 ^
2 x' m' }" F8 E) U
hEdma = edma3init(0,&result);
" Z! F- Q6 E& |5 ?
if(hEdma)
$ M% X( H) F! _
{
1 s) A! p2 v9 W/ t. U0 S
print2arm("edma3init() Passed.",0);
. G# v D* p+ H& Y5 Z
}
3 j6 N1 C$ A, _
else
8 j! `' R& A2 g8 a* p
{
/ W$ c. p) [8 D. s' H9 Y m
print2arm("edma3init() Failed.",0);
8 c9 y) b& n/ s! o7 J% [
}
* _+ H! t; Y! R+ T( q
( g+ |' l% f$ d, ]7 b
if (result == EDMA3_DRV_SOK)
$ g4 X, @. i" j. O
{
! g$ h7 |; K2 f( I+ N
result = EDMA3_DRV_requestChannel (hEdma, &chId, &tcc,
2 n* h7 f- _3 w* S
(EDMA3_RM_EventQueue)0,
/ |' d% k8 P$ Q0 T
&edma3_isr, NULL);
0 Z4 I5 P, S; r' }# E' c
}
% I4 z$ u6 Y' r% z/ K, M' Z
) V( ^0 x6 X, A( V. E* l* I( ]& i8 U7 n
if(result == EDMA3_DRV_SOK)
& C! P- o' A7 y) ?4 S( `
{
8 O; _- i9 ?0 R
paramSet.srcBIdx = 0;
; q, [3 K( U$ _- X9 [
paramSet.destBIdx = 1;
9 b* }4 H7 ? ]* V# S. m6 I) q
paramSet.srcCIdx = 0;
' O, M9 T* f1 t+ m) _
paramSet.destCIdx = 0;
! |0 C# |" `. Y9 f% l
paramSet.aCnt = PING_PONG_ACNT;
) ^; j8 D6 U4 f
paramSet.bCnt = PING_PONG_BCNT;
3 E1 A$ O; u/ u3 k3 e$ V
paramSet.cCnt = PING_PONG_CCNT;
: X- W( a' [1 O. t" O# J( m0 A
* o- ?( P$ J8 A* c# S
/* For AB-synchronized transfers, BCNTRLD is not used. */
! z% E" D8 A$ w! f3 y
paramSet.bCntReload = PING_PONG_BCNT;
3 p; _0 P) \' W( i( Y/ [
% m% l: E2 W+ ~( g1 O
/* Src in constant mode Dest in INCR modes */
& d) y* {( n; C' z
paramSet.opt &= 0xFFFFFFFDu;
! M# M$ u+ H& Y! ?3 x! o
//paramSet.opt &= 0xFFFFFFFCu;
. n6 z2 K5 z5 L
! u7 y* H$ H) H0 s# M; |. S f
/* Program the TCC */
8 f* T( ~8 _/ ^5 W! a ~
paramSet.opt |= ((tcc << OPT_TCC_SHIFT) & OPT_TCC_MASK);
) U) `- S: G9 w* u- k3 Z
+ [6 ^2 b" A5 o) D( }$ ?6 T
/* Enable Intermediate & Final transfer completion interrupt */
# `9 n5 x. o2 P: Y" q' I2 R
paramSet.opt |= (1 << OPT_ITCINTEN_SHIFT);
- Y2 n9 L# y5 ~# ]
paramSet.opt |= (1 << OPT_TCINTEN_SHIFT);
+ x: u9 l+ r9 ~# {3 m
! K) l+ ]0 Q* j/ x. Y$ b
/* AB Sync Transfer Mode */
! d* d& p! a$ ~! i5 O
paramSet.opt |= (1 << OPT_SYNCDIM_SHIFT);
; u, [# u5 h: n# \* W6 {8 L
+ r5 E- Y% r6 @1 k
/* Program the source and dest addresses for master DMA channel */
, U' u$ o# m; K, @7 Y6 Y. V
paramSet.srcAddr = (uint32_t)(MCASP_BASEADDR+0X029C);
; _: i" ], `+ n' n* n
paramSet.destAddr = (uint32_t)(ping_buffer);
# Q9 h# H, J% D, ? a+ h1 L0 K
2 c: e8 X4 X C9 P( O3 [2 O: }- E
/* Write to the master DMA channel first. */
) C( [2 C7 v ^7 l- K% t
result = EDMA3_DRV_setPaRAM(hEdma, chId, ¶mSet);
: P; G: O1 P! G7 F n6 y& \! S+ W
}
) r6 }: ], U; P9 E/ P' x! r# y! y: I
) T: M- a# j! g1 i) t0 ?1 V
result = EDMA3_DRV_enableTransfer(hEdma,chId,EDMA3_DRV_TRIG_MODE_EVENT);
* M1 B& r: P+ g) Z: {: C
+ y' I; Y- O. m3 g
if(result == EDMA3_DRV_SOK)
9 B. `5 p; \/ z% f/ e
{
8 F) j2 m4 K) Y, a ]& j
print2arm("edma3 driver init success.",0);
9 o- e# X# t- L6 @/ f' j9 [
}
+ n; o9 d5 f/ G
}
1 r9 U% Y# m4 g' [
: I1 A( y2 d! d% C* }
7 k1 g* H( E, C6 b8 E3 Z
EDMA3的配置就这个函数,是由MCASP接收事件触发EDMA3传输的,中断函数edma3_isr只能进去一次,请大家帮忙看看哪里有问题。。。
0 I& d0 j' X) V" A+ V1 G! b% P6 S
; Z/ W7 G$ b# ^' P; \& G% D
1 ], F* c6 i2 v3 e, f
作者:
Lewis
时间:
2015-4-24 10:47
每次DMA传输完成后都要再次使能传输
作者:
silent123
时间:
2015-4-29 23:25
Lewis 发表于 2015-4-24 10:47
! y! F' q+ `0 O2 [- X& q, {2 v
每次DMA传输完成后都要再次使能传输
9 J4 h3 s3 F, u
原来是这样,我明天去试试,谢谢了!
欢迎光临 嵌入式开发者社区 (https://www.51ele.net/)
Powered by Discuz! X3.4