嵌入式开发者社区
标题:
edma3中断只能进去一次
[打印本页]
作者:
silent123
时间:
2015-4-22 22:01
标题:
edma3中断只能进去一次
使用mcsdk中的edma3lld库写的edma3驱动,在omapl138的dsp核运行,但是中断函数只能进去一次,路过的朋友帮忙看看,感谢万分。代码如下:
; `" T! D6 `/ d, U6 Y! a
#define PING_PONG_ACNT 1
* }* H4 z C6 E+ U* l; T
#define PING_PONG_BCNT 8*32*40
) Q; U; s; H: q6 q/ W
//#define PING_PONG_BCNT 1
- \( `$ v1 b/ o# H
#define PING_PONG_CCNT 1
& R2 N6 r" S2 s+ Z* W
#define MCASP_BASEADDR 0x01D00000
( P$ E; T j7 Q5 E( B3 V
#define Mcasp_RXEVENTQUE (0u)
; {# j2 M$ F5 p+ F
; V5 P/ ^( j0 D! X1 {
/* OPT Field specific defines */
) X6 P8 l! y( t* U6 n8 y3 g
#define OPT_SYNCDIM_SHIFT (0x00000002u)
) a) o$ v+ X! }5 ?
#define OPT_TCC_MASK (0x0003F000u)
7 I! r) z& U" a$ d Q
#define OPT_TCC_SHIFT (0x0000000Cu)
, }* i9 r8 S8 S& N! j
#define OPT_ITCINTEN_SHIFT (0x00000015u)
0 Z: D) K& l7 t( M
#define OPT_TCINTEN_SHIFT (0x00000014u)
2 n4 Z0 W5 ^. f$ t
' l @0 T; P' \# Z5 G4 R
char ping_buffer[PING_PONG_BCNT];
s! Y, d# |2 E: v j
char pong_buffer[PING_PONG_BCNT];
' A- B5 B- C& `2 Z
' g6 h% [* O( I1 t
# y4 ~2 X: D2 {# r6 g
' U8 Q$ V7 F& j5 s7 d& a% T3 x8 D7 q
( O7 h( [5 i" W7 r& }3 r' g- d# L
static void ys_edma3_init()
( u- l4 `3 k* D9 v
{
2 w& P: B. ]5 `6 h0 h: k. ?5 s
EDMA3_DRV_PaRAMRegs paramSet = {0,0,0,0,0,0,0,0,0,0,0,0};
, I: K- ]4 a6 f S5 Q
EDMA3_DRV_Result result = EDMA3_DRV_SOK;
6 ^ E0 F: L% ]. A: Q/ k8 W; C% a
EDMA3_DRV_Handle hEdma;
! f& p8 ]2 H/ ]
uint32_t chId = 0;
: G. [/ L' B! ?6 t t
uint32_t tcc = 0;
. C$ Y O8 Z |8 v) ^. q
3 [, i' ? A7 N
print2arm("edma3 driver init...",0);
5 }, a: Z9 q% C5 S, `
) v8 W! j% r( l2 p" {" R
hEdma = edma3init(0,&result);
3 O( A4 ]; g1 \$ G
if(hEdma)
1 X8 Q7 f. P0 O+ s/ P5 w% \- P! E* T
{
2 U+ b4 k! A& o
print2arm("edma3init() Passed.",0);
7 K: a) {3 J8 v
}
. r9 @# J+ T% ~" e% M; a; \6 Y
else
& l& `6 _; o& H1 V
{
. u- }9 R: ]: G* C ?# A
print2arm("edma3init() Failed.",0);
8 D3 t& |/ {/ s
}
2 _; }1 K9 f1 @) C
2 y7 h: w* J- g' p
if (result == EDMA3_DRV_SOK)
6 S- E0 ~# [6 Q# t! d: q& p1 y
{
! h$ t( ^& s. _' _8 f
result = EDMA3_DRV_requestChannel (hEdma, &chId, &tcc,
! g( r2 X; g; E3 w
(EDMA3_RM_EventQueue)0,
5 S9 J+ O& ^7 G) f1 l5 ^2 c5 y
&edma3_isr, NULL);
) S# O e9 Q( j
}
8 ~" O1 Q& L F) i y: Q$ q2 i
* [7 _# e# B7 X. l* j9 M
if(result == EDMA3_DRV_SOK)
, o! d; J1 T1 Y; @: X+ I0 m
{
) z9 p' I3 C) i- c4 [" c: c
paramSet.srcBIdx = 0;
+ V+ D. T4 V( W
paramSet.destBIdx = 1;
1 H+ Q& M- @( _
paramSet.srcCIdx = 0;
8 z* e1 q) ?0 q! [, T& g
paramSet.destCIdx = 0;
6 m! x" A7 H6 k0 Z& o
paramSet.aCnt = PING_PONG_ACNT;
- E- r8 U' F+ l- r$ Z: d3 F
paramSet.bCnt = PING_PONG_BCNT;
5 y8 u) h& x3 g7 d4 ^
paramSet.cCnt = PING_PONG_CCNT;
7 v4 T, W& k0 A$ N7 o
8 r; n" A8 E: E! C8 ]
/* For AB-synchronized transfers, BCNTRLD is not used. */
& f; c2 O, O) Q! y
paramSet.bCntReload = PING_PONG_BCNT;
$ ]6 r/ n) s, l. J3 h, o
* U. O* G3 N" K3 X
/* Src in constant mode Dest in INCR modes */
! F9 D3 u5 y j% ?
paramSet.opt &= 0xFFFFFFFDu;
, Z( g# z9 G' m2 [
//paramSet.opt &= 0xFFFFFFFCu;
) ]. ~6 x3 f' c' @4 o! D* J0 u
8 |" F& j' I! M9 d8 w
/* Program the TCC */
! h& b. z( W' Y" n6 E
paramSet.opt |= ((tcc << OPT_TCC_SHIFT) & OPT_TCC_MASK);
; I* O. |# [% h
& t) a5 P6 ]- W" ~9 A5 }
/* Enable Intermediate & Final transfer completion interrupt */
* ~) {0 ]& X0 U% @6 ]) v
paramSet.opt |= (1 << OPT_ITCINTEN_SHIFT);
+ Z1 V% |9 O& {
paramSet.opt |= (1 << OPT_TCINTEN_SHIFT);
4 x/ T% z6 v# L# V# D) s4 ^
8 R+ ^, f! l* p. d' y$ k
/* AB Sync Transfer Mode */
9 V" q" y( M3 B6 K: w
paramSet.opt |= (1 << OPT_SYNCDIM_SHIFT);
- T0 A4 s5 ~2 _' I( ^: k
( s/ @# T' c) Q& J3 ^
/* Program the source and dest addresses for master DMA channel */
$ m5 v8 {1 K! M- @" ~
paramSet.srcAddr = (uint32_t)(MCASP_BASEADDR+0X029C);
, H/ U! p) ?; @+ s' G$ r- C
paramSet.destAddr = (uint32_t)(ping_buffer);
A ?& R. F- B( ?) x; w- ?1 t, d
3 t+ O7 M; r: u* a
/* Write to the master DMA channel first. */
% ?0 n" f" m& J% j B' I& d$ B
result = EDMA3_DRV_setPaRAM(hEdma, chId, ¶mSet);
3 h" u! ~! d6 @: i
}
% ~' O6 e! h: p5 [
l+ \/ u6 L6 C( ~6 s8 l
result = EDMA3_DRV_enableTransfer(hEdma,chId,EDMA3_DRV_TRIG_MODE_EVENT);
; `6 G3 v. K0 \+ _- r5 I3 [
N [( {' V( b% r% L
if(result == EDMA3_DRV_SOK)
" P% a* Y1 Z6 M: Y0 w
{
) m1 p5 s; e* ^8 C
print2arm("edma3 driver init success.",0);
* p' c% E% ^: I- O. o; X! X
}
* }, M+ t2 C$ \; i* A3 S
}
0 d( V- p! ]3 E! l8 |& P0 F# L" [
: F5 b8 J; J" h& R2 K0 L. ^
* j, V3 e- K1 Q: W ~ t0 }
EDMA3的配置就这个函数,是由MCASP接收事件触发EDMA3传输的,中断函数edma3_isr只能进去一次,请大家帮忙看看哪里有问题。。。
: Q, \5 w6 ]$ D# S
0 {5 |9 T3 ^3 B a" w+ J- O V9 K
1 t% C2 n, O, h" B3 v/ R- `
作者:
Lewis
时间:
2015-4-24 10:47
每次DMA传输完成后都要再次使能传输
作者:
silent123
时间:
2015-4-29 23:25
Lewis 发表于 2015-4-24 10:47
5 w: Q9 u' }4 W2 n% ^) w) [
每次DMA传输完成后都要再次使能传输
& E8 {) y4 ]% `1 q3 }
原来是这样,我明天去试试,谢谢了!
欢迎光临 嵌入式开发者社区 (https://www.51ele.net/)
Powered by Discuz! X3.4