嵌入式开发者社区
标题:
edma3中断只能进去一次
[打印本页]
作者:
silent123
时间:
2015-4-22 22:01
标题:
edma3中断只能进去一次
使用mcsdk中的edma3lld库写的edma3驱动,在omapl138的dsp核运行,但是中断函数只能进去一次,路过的朋友帮忙看看,感谢万分。代码如下:
) t& P4 P* b' j/ P( u* @) u
#define PING_PONG_ACNT 1
+ R8 e' d; E9 P6 }4 g
#define PING_PONG_BCNT 8*32*40
7 k# A5 f6 J- E/ S: Q, Y( }2 h2 o
//#define PING_PONG_BCNT 1
% T1 z0 a- I6 N3 [! V; M5 S! {
#define PING_PONG_CCNT 1
1 b; F6 b, ^+ k% A% Q4 A! l
#define MCASP_BASEADDR 0x01D00000
2 K5 Y' z* ?0 t! m8 u
#define Mcasp_RXEVENTQUE (0u)
3 D! U+ J- r6 W0 Y. y
' J, o; n2 i* ] H% U3 t
/* OPT Field specific defines */
- l0 l, ^* w/ K
#define OPT_SYNCDIM_SHIFT (0x00000002u)
1 I' X. b! K( B; e. z4 }
#define OPT_TCC_MASK (0x0003F000u)
+ v# S; M f j2 H& K- R
#define OPT_TCC_SHIFT (0x0000000Cu)
6 C( Y- ?, h) a3 v! n4 V1 e
#define OPT_ITCINTEN_SHIFT (0x00000015u)
; C+ ~1 e8 }3 j% K3 a) r N* [2 G Y
#define OPT_TCINTEN_SHIFT (0x00000014u)
. U- n& y! @& A! r4 q& X7 e; d
0 \1 H0 Y6 A2 [% R* \
char ping_buffer[PING_PONG_BCNT];
2 j, H. O- l1 e) q8 C$ U$ R
char pong_buffer[PING_PONG_BCNT];
; H* g w; W3 `
* |& M7 s+ k- U, w4 `* y
7 k( L0 u' w" ? b0 _
5 k& x0 ^8 c+ i/ W+ O' A; j' I& y( y
6 `; z+ l" n6 l1 S
static void ys_edma3_init()
& G! h$ t# f9 B
{
8 p0 I; `. ]* s* n
EDMA3_DRV_PaRAMRegs paramSet = {0,0,0,0,0,0,0,0,0,0,0,0};
# c+ _ ?; [8 a) ~$ s
EDMA3_DRV_Result result = EDMA3_DRV_SOK;
6 K* G( x9 w: r# N- }9 b" f# B7 o
EDMA3_DRV_Handle hEdma;
: e, }) J( y& J& a+ ~' Q
uint32_t chId = 0;
3 O& U5 l' D0 z6 D% Z- n
uint32_t tcc = 0;
9 ?4 [4 k5 C+ _( D- [
$ X# T$ b) U, J, b( ]
print2arm("edma3 driver init...",0);
M% y+ g, u# Y; f9 c/ i! ~1 Z3 [- c" }
6 K. [/ M3 F, e; r- Z
hEdma = edma3init(0,&result);
8 T9 Y9 C4 y0 `8 E
if(hEdma)
4 W$ w. k, w j1 z+ [' _& {: i8 Y8 h9 y
{
3 N$ `5 j3 Y) _- o
print2arm("edma3init() Passed.",0);
; o t X( t9 j7 P! @ K; `/ L
}
O/ F% E& n2 C: L5 A6 f
else
* e/ \/ l5 s3 o( j2 J9 D2 f
{
# ^ Y5 o6 T0 ]; N. I
print2arm("edma3init() Failed.",0);
8 J/ T* I0 w9 P4 a8 L6 c' q6 h
}
( q- W" ?/ q/ W2 A6 z5 F
9 _7 Y9 r5 r% y8 H( H& `; {0 R; W
if (result == EDMA3_DRV_SOK)
1 {' Q1 }, w2 U3 A
{
$ c" w5 q R* k Z" E; o7 }
result = EDMA3_DRV_requestChannel (hEdma, &chId, &tcc,
1 \) P! Z( O1 a6 x! U
(EDMA3_RM_EventQueue)0,
) b5 w# g* H/ {4 ?4 J* M
&edma3_isr, NULL);
- U3 Y6 A0 I* m0 ]! }" z
}
( Y( x; V/ F' p! n' B
- b- Y9 [; H( V: m2 {1 Q
if(result == EDMA3_DRV_SOK)
+ [* y0 E! m- W( K+ J
{
% R5 @2 l/ e# T% p( U( i x
paramSet.srcBIdx = 0;
& U3 f. k4 s7 J2 q/ e
paramSet.destBIdx = 1;
8 G2 j l. O J
paramSet.srcCIdx = 0;
9 }- @) g9 g0 M! W
paramSet.destCIdx = 0;
! |# `% ^! m" H& D6 a3 e
paramSet.aCnt = PING_PONG_ACNT;
- e; \7 H& l: ? M4 A9 K
paramSet.bCnt = PING_PONG_BCNT;
6 ~0 ~- |1 d. [
paramSet.cCnt = PING_PONG_CCNT;
[* o* P& _7 _) _% Q! R0 M
, d5 y( l+ x) @4 \
/* For AB-synchronized transfers, BCNTRLD is not used. */
9 E( ~, I+ }* q
paramSet.bCntReload = PING_PONG_BCNT;
5 O0 Y9 e0 J. t. e s! Q5 C9 ]* B" [2 _
$ M5 \9 B. e- s; W
/* Src in constant mode Dest in INCR modes */
8 a. ^1 x* W! P7 m% F, h1 I% F1 l
paramSet.opt &= 0xFFFFFFFDu;
9 a1 [9 l* ]7 x/ |( w! q# N
//paramSet.opt &= 0xFFFFFFFCu;
/ X1 u# G% W. D; _
( F/ }$ i0 e1 n1 c6 {
/* Program the TCC */
! D* d3 Z) }1 K, l" y+ `. m
paramSet.opt |= ((tcc << OPT_TCC_SHIFT) & OPT_TCC_MASK);
1 B+ u7 K3 A/ Q3 D& g0 [2 M6 ?
: K; t( c: R ^# l8 s) E
/* Enable Intermediate & Final transfer completion interrupt */
0 [$ K7 M) }8 u5 {; `2 d
paramSet.opt |= (1 << OPT_ITCINTEN_SHIFT);
9 W, t& d8 r6 c; ]
paramSet.opt |= (1 << OPT_TCINTEN_SHIFT);
! O7 \! Y1 [5 d: y
% ?- n) z' W( C& N* T
/* AB Sync Transfer Mode */
# ^- N! _& s4 P* r- \* q w8 X
paramSet.opt |= (1 << OPT_SYNCDIM_SHIFT);
# z* r, t6 s& d/ W
* H1 E5 Z7 R t7 z, X$ y5 [
/* Program the source and dest addresses for master DMA channel */
, e% X/ G* _/ X+ m+ B+ \
paramSet.srcAddr = (uint32_t)(MCASP_BASEADDR+0X029C);
- m& t% K g" j2 O+ `
paramSet.destAddr = (uint32_t)(ping_buffer);
F' e# F# ~7 k9 x5 b3 Y( g
# p! B0 X6 }% v6 S0 Z' W" L$ Q
/* Write to the master DMA channel first. */
! t+ M+ i% Q6 X% D
result = EDMA3_DRV_setPaRAM(hEdma, chId, ¶mSet);
2 ?; e ?$ r' s
}
) Z% r7 v C; t, i) K0 n# N; Z
9 b2 p1 n- G# Y. r
result = EDMA3_DRV_enableTransfer(hEdma,chId,EDMA3_DRV_TRIG_MODE_EVENT);
7 d5 @3 K3 H6 Z
1 Z+ I7 A) G0 {* f
if(result == EDMA3_DRV_SOK)
" B3 v% V; ~/ N3 P6 G
{
' D# p! P: T* ]0 s! n. r
print2arm("edma3 driver init success.",0);
& R, R ^, t; u0 h" S
}
& g$ ?/ o. s0 o
}
5 G' Z3 F* a2 C0 R) ^
+ r! W3 \# _( E* |4 Z5 d7 P
" V( s( K/ J. L( I+ d2 x7 ]5 u
EDMA3的配置就这个函数,是由MCASP接收事件触发EDMA3传输的,中断函数edma3_isr只能进去一次,请大家帮忙看看哪里有问题。。。
; y5 W$ Y8 E- i7 F
3 v; e# H: S% _4 H; Y9 j/ C! c
, [1 u' |4 c- l# `$ i* F* d& ~# w
作者:
Lewis
时间:
2015-4-24 10:47
每次DMA传输完成后都要再次使能传输
作者:
silent123
时间:
2015-4-29 23:25
Lewis 发表于 2015-4-24 10:47
q7 w8 i1 R4 A" F/ \
每次DMA传输完成后都要再次使能传输
" F" v$ D2 p5 x R
原来是这样,我明天去试试,谢谢了!
欢迎光临 嵌入式开发者社区 (https://www.51ele.net/)
Powered by Discuz! X3.4