嵌入式开发者社区
标题:
edma3中断只能进去一次
[打印本页]
作者:
silent123
时间:
2015-4-22 22:01
标题:
edma3中断只能进去一次
使用mcsdk中的edma3lld库写的edma3驱动,在omapl138的dsp核运行,但是中断函数只能进去一次,路过的朋友帮忙看看,感谢万分。代码如下:
3 t6 ~1 `% E4 D7 { s. n
#define PING_PONG_ACNT 1
& l9 J3 V. _6 r- W" X6 U. y4 W
#define PING_PONG_BCNT 8*32*40
' J' C" L6 g& y* W, ^
//#define PING_PONG_BCNT 1
7 \' W3 a$ M; B5 F
#define PING_PONG_CCNT 1
7 u8 Z$ c, T# H6 K( L- W$ _1 M
#define MCASP_BASEADDR 0x01D00000
. z1 ^7 q( c+ e8 N
#define Mcasp_RXEVENTQUE (0u)
! x4 B. R1 n$ d0 _: n
8 s+ }/ p! b% d& j5 Q+ p
/* OPT Field specific defines */
~. z0 v2 I: |
#define OPT_SYNCDIM_SHIFT (0x00000002u)
( ^3 X% [, A* Z$ E2 c, W
#define OPT_TCC_MASK (0x0003F000u)
1 w t1 `* Z) ?2 l# D/ U
#define OPT_TCC_SHIFT (0x0000000Cu)
2 ?3 |+ \; | O9 h# ~
#define OPT_ITCINTEN_SHIFT (0x00000015u)
' F1 N# m( Q; L+ q& o) |! G' n
#define OPT_TCINTEN_SHIFT (0x00000014u)
- s* k" v9 m9 @: Z3 F6 B$ a, m6 U
9 S6 E D3 b) Q5 C- a" ~# K/ W
char ping_buffer[PING_PONG_BCNT];
; |6 D6 t' o0 s% r6 @; s
char pong_buffer[PING_PONG_BCNT];
1 n' N/ B% U* q p: J
; Q6 T; ~ B! `0 I1 N) f
% b/ \7 t8 d, v9 F( o. A3 x) {% N' G
7 W6 G( Z* {3 ~5 C0 n% e: C3 I( f
' V! L6 o. W) Z
static void ys_edma3_init()
* i( {! f) F/ C8 a% Q+ l
{
. W% h' N/ H7 Z" L/ C
EDMA3_DRV_PaRAMRegs paramSet = {0,0,0,0,0,0,0,0,0,0,0,0};
" W1 P4 x' A, e2 ~
EDMA3_DRV_Result result = EDMA3_DRV_SOK;
8 Y' M" m9 H% P8 w, q; m5 G
EDMA3_DRV_Handle hEdma;
$ y" m! e. X1 w* r; J
uint32_t chId = 0;
R' K. v0 m/ m" }! {
uint32_t tcc = 0;
" \1 Z4 t1 L5 d" }
# s+ m- x; W" z8 f9 O$ h) ]* n' ~
print2arm("edma3 driver init...",0);
2 `' N3 Z! F: Y- E' b* H
+ H; `5 H$ ~# k: Z' J. b3 d
hEdma = edma3init(0,&result);
& i7 v' P1 E' n" x2 j! d
if(hEdma)
j* `9 @* C I7 w+ U
{
6 A$ ^ ~- \1 f5 f0 N4 O2 p
print2arm("edma3init() Passed.",0);
1 N: O2 g4 f* D$ e; z2 X
}
$ N# b6 E. x/ T3 H$ W$ V
else
+ \/ S# G" v0 R: K4 a) n0 v, y% u. z) Y
{
- |+ D& h; i) r0 Z" L
print2arm("edma3init() Failed.",0);
+ L) t, F5 v& q2 a Q+ v/ Z
}
' Y0 ~7 p0 D! Q+ s8 Q
F1 { R: i. x, f
if (result == EDMA3_DRV_SOK)
* k' ^( F) B- X E- P2 P' H
{
8 `7 i7 ^/ W+ Q( k5 B2 J+ E9 b7 U+ v
result = EDMA3_DRV_requestChannel (hEdma, &chId, &tcc,
& ~3 e- s: ]0 p, l8 j. g5 W
(EDMA3_RM_EventQueue)0,
, h9 x5 m/ D' z2 |# @, O
&edma3_isr, NULL);
& e4 h. Z4 p, c. x Z/ h
}
: b1 Q' t: o9 y5 n1 G. r0 A
5 c1 ~( J" i, [. y" O! L4 Q' y
if(result == EDMA3_DRV_SOK)
. j/ O8 L, G/ W, y4 ^
{
9 W. R0 F8 G0 W' e5 K/ H
paramSet.srcBIdx = 0;
$ K! n% p( r6 U
paramSet.destBIdx = 1;
) |& W& \+ ]* p1 M
paramSet.srcCIdx = 0;
6 S& ]. U% h1 o/ r' ~0 L
paramSet.destCIdx = 0;
, L% ^) d1 n, K9 u+ u; I+ Z
paramSet.aCnt = PING_PONG_ACNT;
6 E' L. u5 _& z/ h4 ?$ V, Z+ f- e0 e
paramSet.bCnt = PING_PONG_BCNT;
- f6 P3 p2 C: s+ v. z3 W
paramSet.cCnt = PING_PONG_CCNT;
. T3 O$ z3 [) Q. p# U5 b
0 g9 |- h9 V& ~7 I% W5 C
/* For AB-synchronized transfers, BCNTRLD is not used. */
J3 |/ C- r, X, h
paramSet.bCntReload = PING_PONG_BCNT;
; i: H' {4 V, N! S9 U2 G2 J
* x/ z5 j" t% O0 ?' W9 a
/* Src in constant mode Dest in INCR modes */
/ e8 E. E0 u, j0 P4 y: m
paramSet.opt &= 0xFFFFFFFDu;
' U f: R" B& Z' T5 \
//paramSet.opt &= 0xFFFFFFFCu;
6 v, v5 s* Z+ I4 Y
3 W a4 {/ e5 Z. d8 W( }
/* Program the TCC */
6 n3 X$ R) X7 E) v8 C0 o% F
paramSet.opt |= ((tcc << OPT_TCC_SHIFT) & OPT_TCC_MASK);
4 f) U- f+ ~ Z' r1 T/ j
! R5 q0 \6 M% ?: \
/* Enable Intermediate & Final transfer completion interrupt */
& N9 n' p* c9 z1 j/ C2 b) q
paramSet.opt |= (1 << OPT_ITCINTEN_SHIFT);
0 A! C! M8 d) a/ `
paramSet.opt |= (1 << OPT_TCINTEN_SHIFT);
U$ a0 m9 M6 |& J6 S* l: L
6 N) Q2 {8 b! k9 F% _3 A
/* AB Sync Transfer Mode */
: V/ E5 M' l! B" n& `5 ~
paramSet.opt |= (1 << OPT_SYNCDIM_SHIFT);
* f6 x8 R4 t1 }- ^$ @. o
% P4 w: K2 {2 ?8 w: c
/* Program the source and dest addresses for master DMA channel */
6 D( ?7 e% k; W; B* H) w& n
paramSet.srcAddr = (uint32_t)(MCASP_BASEADDR+0X029C);
K6 P) d! D6 e$ X
paramSet.destAddr = (uint32_t)(ping_buffer);
6 u1 O' K$ t& S8 V
' \0 V% [ B0 |+ {$ V& u8 x8 J. u1 f
/* Write to the master DMA channel first. */
/ k( x& a+ F9 k% N
result = EDMA3_DRV_setPaRAM(hEdma, chId, ¶mSet);
$ j( N' R- d: c! D
}
& B+ B8 L- H2 V2 ~: C7 H' i
- r% e" V5 Y% r; i" r% f
result = EDMA3_DRV_enableTransfer(hEdma,chId,EDMA3_DRV_TRIG_MODE_EVENT);
3 }; B. `5 `& |4 |3 k6 y
- ~! `' \% F2 p3 b, e0 ^
if(result == EDMA3_DRV_SOK)
: g2 n7 l1 F4 n( T9 e' ]
{
- k1 _0 ?- q% Y. N! H
print2arm("edma3 driver init success.",0);
+ `# F: _% Z& i( I, _- N
}
1 I" N6 c' T5 h$ [0 Q4 N3 W8 F! u2 S
}
4 x8 I. t( X% j8 w* a* Y
# V: B9 f/ G" v" B: f
. E- P# h( B7 v' `" W" @ Y
EDMA3的配置就这个函数,是由MCASP接收事件触发EDMA3传输的,中断函数edma3_isr只能进去一次,请大家帮忙看看哪里有问题。。。
% x! H& Q4 V7 i. s! V1 s* ]& W% K
' V" c$ ^6 V$ C& P }. m9 c- i* P4 G
+ q8 d" N% |1 P
作者:
Lewis
时间:
2015-4-24 10:47
每次DMA传输完成后都要再次使能传输
作者:
silent123
时间:
2015-4-29 23:25
Lewis 发表于 2015-4-24 10:47
( r; J' Q+ U m
每次DMA传输完成后都要再次使能传输
, ]( G; j W- @ n
原来是这样,我明天去试试,谢谢了!
欢迎光临 嵌入式开发者社区 (https://www.51ele.net/)
Powered by Discuz! X3.4