嵌入式开发者社区
标题:
edma3中断只能进去一次
[打印本页]
作者:
silent123
时间:
2015-4-22 22:01
标题:
edma3中断只能进去一次
使用mcsdk中的edma3lld库写的edma3驱动,在omapl138的dsp核运行,但是中断函数只能进去一次,路过的朋友帮忙看看,感谢万分。代码如下:
$ ~* S! P, h+ s7 ~; G
#define PING_PONG_ACNT 1
3 K6 k6 O2 ]" Y' R
#define PING_PONG_BCNT 8*32*40
" M s' `- \: U2 v2 L( V" q
//#define PING_PONG_BCNT 1
4 x1 c5 ], f+ D f; _% z3 K
#define PING_PONG_CCNT 1
: d$ j7 a" K* I5 e, p2 e/ F9 D K
#define MCASP_BASEADDR 0x01D00000
+ K) G- [0 ^ |) t f& U1 m' A
#define Mcasp_RXEVENTQUE (0u)
9 Z; }$ u3 A9 q7 X9 U8 }
, |3 _$ h, \' y
/* OPT Field specific defines */
# A! f" E: {1 ?8 I, o! P8 S
#define OPT_SYNCDIM_SHIFT (0x00000002u)
! {7 q4 Z6 K7 Y: k3 |$ I
#define OPT_TCC_MASK (0x0003F000u)
9 b4 |/ A% O% M; O( |) c* Y
#define OPT_TCC_SHIFT (0x0000000Cu)
0 `$ U [: r7 }. N/ \
#define OPT_ITCINTEN_SHIFT (0x00000015u)
3 L6 U9 v/ t, f4 U& S
#define OPT_TCINTEN_SHIFT (0x00000014u)
& V' o4 v" S. }! ]* T, L; T
4 G, e9 @$ k c0 V1 e8 `* I
char ping_buffer[PING_PONG_BCNT];
+ Y( q- t# {% M' Y T) O
char pong_buffer[PING_PONG_BCNT];
8 W7 x# T; o& ?0 Q
) J2 @2 e. |. Z# |3 d6 ?( i
) v' T$ r$ b( A( a% e4 y
; M# L6 B& v& N3 L. {0 _6 j- o
' L4 R% m- U# I9 O7 M) }! w8 _$ w
static void ys_edma3_init()
5 x0 t) c# n% z/ e" ^; M' h% f
{
/ ^( }2 O, u$ s" a& b
EDMA3_DRV_PaRAMRegs paramSet = {0,0,0,0,0,0,0,0,0,0,0,0};
$ G" o2 ?1 M% R3 ]1 k+ Z% N
EDMA3_DRV_Result result = EDMA3_DRV_SOK;
* e4 [% q9 w/ e8 [+ N
EDMA3_DRV_Handle hEdma;
1 c \4 n2 [8 m' v A; r9 `
uint32_t chId = 0;
: I: @- I9 ^5 Q$ W
uint32_t tcc = 0;
1 B$ j: b O& n* K$ s* i! n0 ?' j
4 q6 p# C$ q T) y
print2arm("edma3 driver init...",0);
6 Z, Z# z4 [0 P; ^
# Y& g1 W: R2 F- L" s5 p$ Y
hEdma = edma3init(0,&result);
3 e6 k. s0 i( Z9 x1 @$ y7 W
if(hEdma)
& \- s; b) `" I- j! P
{
2 `3 R) Q# g! K0 z
print2arm("edma3init() Passed.",0);
6 Q* W; n0 U/ e0 b1 T- W
}
* A+ X! r I6 q
else
+ \0 N& `: ~2 L- ^" v/ w
{
' D: W+ V, D& o- ?$ Q+ @
print2arm("edma3init() Failed.",0);
! G+ ] l/ u; k1 {
}
+ w9 ]4 F& `+ X) ]" N) b
. V! k; Y7 ?2 B& e
if (result == EDMA3_DRV_SOK)
7 f( w: ]3 [" M$ n8 @# I6 W
{
8 L5 q/ R: v9 S0 U
result = EDMA3_DRV_requestChannel (hEdma, &chId, &tcc,
; Q# X6 @2 G0 Z& s' ]5 c$ F/ y. G/ z
(EDMA3_RM_EventQueue)0,
6 t5 {" I( ?( ]- K$ \1 K1 k$ x
&edma3_isr, NULL);
3 p0 c8 o3 W; O- |8 x7 A
}
3 |3 m# ?: X. |: v% c% ?
3 Q- T9 I# {* X* w- m
if(result == EDMA3_DRV_SOK)
8 Q9 F/ x3 Z8 @5 b3 w
{
* O' l8 f( E* u1 A5 q5 |
paramSet.srcBIdx = 0;
/ E, N0 V1 E0 a
paramSet.destBIdx = 1;
! Y; S1 D2 B5 O
paramSet.srcCIdx = 0;
+ V W& u+ H/ H- ?# g" |
paramSet.destCIdx = 0;
( [) C7 N% u" c% T. h1 _- F2 N' r
paramSet.aCnt = PING_PONG_ACNT;
0 m, d( B/ g1 T9 c" h. D% a' t
paramSet.bCnt = PING_PONG_BCNT;
2 Z# C" t7 D2 \" j9 ]
paramSet.cCnt = PING_PONG_CCNT;
* H* z9 x5 P# I# T' H, Q% C; W
0 L5 g' k, a& w7 b6 t0 v
/* For AB-synchronized transfers, BCNTRLD is not used. */
0 j3 b: I/ l, |4 l0 R
paramSet.bCntReload = PING_PONG_BCNT;
/ x$ |+ s( O: k/ c- {. J4 V
* u! p! W+ ]8 e' h% ?% w' w
/* Src in constant mode Dest in INCR modes */
+ K' ?& [% h4 z% B
paramSet.opt &= 0xFFFFFFFDu;
" S6 V% Z3 a7 N# z' j
//paramSet.opt &= 0xFFFFFFFCu;
# B m% s7 g \3 Y3 T- \
/ C$ j4 A; s6 O A r( _7 k
/* Program the TCC */
( P0 ~: F2 @% M, O V- B
paramSet.opt |= ((tcc << OPT_TCC_SHIFT) & OPT_TCC_MASK);
$ c/ _$ W8 t6 X I. w- _
& b; [( O7 x7 W F2 T2 l% {# ^
/* Enable Intermediate & Final transfer completion interrupt */
{6 J& z' s/ }5 z4 Z* E
paramSet.opt |= (1 << OPT_ITCINTEN_SHIFT);
4 w+ ^$ @$ R) C% O9 R# F6 Y
paramSet.opt |= (1 << OPT_TCINTEN_SHIFT);
4 H/ r/ E1 |" O) _% f9 l2 C
8 _: y. Y, i) l3 k+ @
/* AB Sync Transfer Mode */
; u1 N1 M+ @4 f: y% Y" L5 a
paramSet.opt |= (1 << OPT_SYNCDIM_SHIFT);
5 [9 {. ^( ]! ~" {$ v$ r! ~
) e4 A7 e& e) R# W; S
/* Program the source and dest addresses for master DMA channel */
: d8 |% U( d* F% y9 v
paramSet.srcAddr = (uint32_t)(MCASP_BASEADDR+0X029C);
% Q" j5 n: L# L
paramSet.destAddr = (uint32_t)(ping_buffer);
0 B# v+ s- I* D/ H
) ]5 i7 ^6 {5 r$ r
/* Write to the master DMA channel first. */
: H" {% W2 o9 m
result = EDMA3_DRV_setPaRAM(hEdma, chId, ¶mSet);
, y; l7 ?5 Y* L; e9 k* c8 [
}
5 a1 W8 _3 c' t- N1 v4 F
2 x7 _3 l$ A, J
result = EDMA3_DRV_enableTransfer(hEdma,chId,EDMA3_DRV_TRIG_MODE_EVENT);
; g7 P/ b7 H% i$ J; Q' l
1 s% S0 D, x6 ^) R; _
if(result == EDMA3_DRV_SOK)
' x9 x1 X8 K( J: }; K! L1 b
{
; e U$ |9 H) j L+ ^' y/ t
print2arm("edma3 driver init success.",0);
5 j y" L+ Q! b1 P( d6 _
}
+ G. R1 U) u" G2 a& F. ~
}
- M) `' a5 V0 V7 m4 {5 o
6 M9 k8 z1 A0 u7 d
y4 x- G- t: Q- w& S" B/ `4 t
EDMA3的配置就这个函数,是由MCASP接收事件触发EDMA3传输的,中断函数edma3_isr只能进去一次,请大家帮忙看看哪里有问题。。。
5 s" u) r2 B0 H2 G1 X# p
# P! G4 I, }. G* c. W& ]0 L
* s7 Z2 E; b9 s: \
作者:
Lewis
时间:
2015-4-24 10:47
每次DMA传输完成后都要再次使能传输
作者:
silent123
时间:
2015-4-29 23:25
Lewis 发表于 2015-4-24 10:47
8 ]8 J% } M3 W- c1 v9 i: a& J
每次DMA传输完成后都要再次使能传输
* S1 K: t' x' Q/ N9 M' w
原来是这样,我明天去试试,谢谢了!
欢迎光临 嵌入式开发者社区 (https://www.51ele.net/)
Powered by Discuz! X3.4