嵌入式开发者社区
标题:
edma3中断只能进去一次
[打印本页]
作者:
silent123
时间:
2015-4-22 22:01
标题:
edma3中断只能进去一次
使用mcsdk中的edma3lld库写的edma3驱动,在omapl138的dsp核运行,但是中断函数只能进去一次,路过的朋友帮忙看看,感谢万分。代码如下:
# h P& p, l3 Q
#define PING_PONG_ACNT 1
9 _# E' L2 j' e
#define PING_PONG_BCNT 8*32*40
# t5 X8 P; s% L4 v: @: G D
//#define PING_PONG_BCNT 1
]9 U3 e2 ?* c7 _! x# E: I: Q
#define PING_PONG_CCNT 1
. }2 d% m2 Y' a0 {9 Q( @7 S0 {
#define MCASP_BASEADDR 0x01D00000
7 A) \4 U+ U$ ]! Q/ R
#define Mcasp_RXEVENTQUE (0u)
7 ?3 v- h( h( \$ N, c* M" l
' z& c4 N+ }" j' Y
/* OPT Field specific defines */
v% _' @( R4 x2 g
#define OPT_SYNCDIM_SHIFT (0x00000002u)
: L4 K# P. @0 D2 t) ~: u# p; \
#define OPT_TCC_MASK (0x0003F000u)
7 K G/ n! S( }& h3 Q
#define OPT_TCC_SHIFT (0x0000000Cu)
5 j& \ t0 a( @0 c# Y/ Y9 g: U
#define OPT_ITCINTEN_SHIFT (0x00000015u)
, Q7 T9 K' s c" L; C' V1 d4 d o: Y/ c
#define OPT_TCINTEN_SHIFT (0x00000014u)
% z$ U. G* U' Q
8 h! l& V/ c/ U; E& x
char ping_buffer[PING_PONG_BCNT];
2 ~6 r; [: w. x! ?' n
char pong_buffer[PING_PONG_BCNT];
" k$ p6 ]" o6 d; k( L
; H8 u$ S8 I2 B2 m8 x
3 A; [, D/ V* d, |; L' b! K% O& E
! S. `- Y8 C# V, N
! d) P2 v0 X* {0 k
static void ys_edma3_init()
% `. w' f- h2 k+ y/ k
{
/ @& q+ L. f+ ~1 f# `3 k* k) M3 c
EDMA3_DRV_PaRAMRegs paramSet = {0,0,0,0,0,0,0,0,0,0,0,0};
5 N: H) |; r; ^) t& g" a. y/ X' c. B
EDMA3_DRV_Result result = EDMA3_DRV_SOK;
, z% {( ]/ y+ F& k8 E
EDMA3_DRV_Handle hEdma;
( t z" G9 `& g' f* E4 l
uint32_t chId = 0;
* [8 A/ T+ B$ S/ ?+ U. V
uint32_t tcc = 0;
/ W( X' v; B# G2 f0 P
; B+ r9 B) B1 R( Z
print2arm("edma3 driver init...",0);
7 H; _& M( }" f9 y. \
' v2 s" y+ f L5 T% Y! a2 M
hEdma = edma3init(0,&result);
% \% M- }5 k# u) j! ^
if(hEdma)
% D' ], Q0 v7 V' m: n4 \/ Q: E
{
4 X8 T0 ~% @) z) {
print2arm("edma3init() Passed.",0);
% W% s- J4 i$ O2 i- R5 n
}
% j$ w' Q3 u$ o4 P2 K, H4 F& A8 U
else
2 |4 S/ N0 D. I
{
/ J& ~1 O/ j3 T( e# j& o
print2arm("edma3init() Failed.",0);
8 l' c( ~4 T/ u+ Y) d* Y% Z
}
2 @* e, P2 Z Q2 |) K) Y
+ m3 {5 [( E( ]8 ^) R5 K
if (result == EDMA3_DRV_SOK)
5 y x0 H& ^3 f
{
0 ^6 W' X v" I( R- K
result = EDMA3_DRV_requestChannel (hEdma, &chId, &tcc,
3 S% n. o! d# i+ t" k
(EDMA3_RM_EventQueue)0,
& q% N! f4 ^2 q+ a {
&edma3_isr, NULL);
* {$ c6 X& b( Q, H6 a; y
}
5 l5 z3 B* \9 H
! A o3 U* V; K
if(result == EDMA3_DRV_SOK)
# t7 {- |9 _$ e% g! {4 E8 a" d+ P9 K
{
0 Q5 L/ p2 O/ g# s8 A
paramSet.srcBIdx = 0;
# n) w0 K) b, ~/ Q( _
paramSet.destBIdx = 1;
: S. ^5 }- x8 P, r# d# ^! L
paramSet.srcCIdx = 0;
9 ^2 P8 d5 h% {
paramSet.destCIdx = 0;
2 l# P1 Z. e, }$ l* J
paramSet.aCnt = PING_PONG_ACNT;
# _- W+ f5 r! Q+ }1 r# c
paramSet.bCnt = PING_PONG_BCNT;
! s! j: \9 U! o6 B$ ?
paramSet.cCnt = PING_PONG_CCNT;
! w; E9 \, j+ a; j' h) N
4 ` v7 O7 K8 n7 k
/* For AB-synchronized transfers, BCNTRLD is not used. */
( Z( t8 j" Y# V7 F" i
paramSet.bCntReload = PING_PONG_BCNT;
3 w- {7 Q9 `/ j- {3 Q7 m2 Q
. z* M4 ` o: Z3 }3 R$ n3 M
/* Src in constant mode Dest in INCR modes */
1 W0 G7 n3 @+ p) [0 P2 ~; H) j2 _
paramSet.opt &= 0xFFFFFFFDu;
. E* u- j0 P7 Q
//paramSet.opt &= 0xFFFFFFFCu;
# t1 ~6 j7 D. A& g! Q+ j1 j7 Z& x) O
( K2 e1 q" Q; `8 u a* y# }' X6 ^! x/ h
/* Program the TCC */
% t. R! t7 ~! ]+ }: O- ]5 r9 N
paramSet.opt |= ((tcc << OPT_TCC_SHIFT) & OPT_TCC_MASK);
& v: O: `; u; B
5 a3 B8 V) y& v2 ]: D& f V* h7 r
/* Enable Intermediate & Final transfer completion interrupt */
3 O1 b0 {2 j- Y& u
paramSet.opt |= (1 << OPT_ITCINTEN_SHIFT);
5 }5 b+ `, P A' E% q+ C
paramSet.opt |= (1 << OPT_TCINTEN_SHIFT);
1 B/ |' R% _* H* P* i
+ a9 \/ l+ n V$ T1 O. p9 p% K: l% ^
/* AB Sync Transfer Mode */
( g2 w [1 t9 {6 A" b7 z& c: p
paramSet.opt |= (1 << OPT_SYNCDIM_SHIFT);
/ P2 \4 ?% Z, ^* `4 r
. Y2 b5 ~( S. h8 X' I0 J. N
/* Program the source and dest addresses for master DMA channel */
& v- g2 f5 i, E! L1 X, L' m: t6 B# z
paramSet.srcAddr = (uint32_t)(MCASP_BASEADDR+0X029C);
$ C. k8 X# T1 ~" d7 c
paramSet.destAddr = (uint32_t)(ping_buffer);
6 o! _0 T/ `3 S2 G
|3 K/ z) s8 v5 s4 g' p+ X: p
/* Write to the master DMA channel first. */
6 [* z# N4 Z l' o
result = EDMA3_DRV_setPaRAM(hEdma, chId, ¶mSet);
b$ j/ T8 p: H' N) ?
}
. i1 B& p, \% I% W
$ [. Y8 X" j) Z0 A- y6 E! l
result = EDMA3_DRV_enableTransfer(hEdma,chId,EDMA3_DRV_TRIG_MODE_EVENT);
. g) S5 i2 L7 t: K/ a
6 m' E2 J! u( J" v
if(result == EDMA3_DRV_SOK)
8 Z$ C3 ?8 c" [* T; @7 L
{
, a( M- [% i$ m# J& d' _7 H- f) W
print2arm("edma3 driver init success.",0);
: b9 V) y/ [+ y5 I0 t& x2 {& L
}
4 D& M8 d, k+ G
}
0 _, x& `! s. {+ W6 @) L
R% C" x9 B* V4 M; ]9 J* \: E
: d- F% f4 ~; a' _! S1 f; `5 E
EDMA3的配置就这个函数,是由MCASP接收事件触发EDMA3传输的,中断函数edma3_isr只能进去一次,请大家帮忙看看哪里有问题。。。
e0 m% X+ V* c- S; m2 ^
; D1 i: G6 B5 Y
( x$ f* _& k" E5 X2 a
作者:
Lewis
时间:
2015-4-24 10:47
每次DMA传输完成后都要再次使能传输
作者:
silent123
时间:
2015-4-29 23:25
Lewis 发表于 2015-4-24 10:47
& G) l3 t! h1 y' X' }
每次DMA传输完成后都要再次使能传输
& D1 w! m. ?) ^* `, ?+ G
原来是这样,我明天去试试,谢谢了!
欢迎光临 嵌入式开发者社区 (https://www.51ele.net/)
Powered by Discuz! X3.4