嵌入式开发者社区
标题:
edma3中断只能进去一次
[打印本页]
作者:
silent123
时间:
2015-4-22 22:01
标题:
edma3中断只能进去一次
使用mcsdk中的edma3lld库写的edma3驱动,在omapl138的dsp核运行,但是中断函数只能进去一次,路过的朋友帮忙看看,感谢万分。代码如下:
9 W K/ | M* @
#define PING_PONG_ACNT 1
' U p0 x: {! v( L3 Q
#define PING_PONG_BCNT 8*32*40
; z4 t4 s! r; R6 P5 ^ n
//#define PING_PONG_BCNT 1
" G/ O$ [" Y; X {/ D( ^1 J: e
#define PING_PONG_CCNT 1
( s# `' u" @! s& n& S* q
#define MCASP_BASEADDR 0x01D00000
L: M% _- S- n& a5 ^- Y' Z
#define Mcasp_RXEVENTQUE (0u)
* b. L8 r/ g4 `
* ^( i1 S8 A# a ?: b6 p! C# C" S
/* OPT Field specific defines */
$ S2 X/ q# b$ d& B3 u7 K
#define OPT_SYNCDIM_SHIFT (0x00000002u)
% L' \& {# b5 y6 Q4 t6 d
#define OPT_TCC_MASK (0x0003F000u)
' o3 I& d/ m+ |! w* e
#define OPT_TCC_SHIFT (0x0000000Cu)
" j: j L2 {5 j0 B6 K& \) A
#define OPT_ITCINTEN_SHIFT (0x00000015u)
) Q9 r5 Q+ Q0 }7 Z( @ w/ l! v+ D
#define OPT_TCINTEN_SHIFT (0x00000014u)
$ p1 t, [# }# R4 y" H9 y" o) R. [1 _( G
/ j& v2 B& J' N: \9 l, X1 b# [+ C
char ping_buffer[PING_PONG_BCNT];
) X D1 g. z% o% B8 E5 g2 e
char pong_buffer[PING_PONG_BCNT];
+ P$ n, R0 ?5 \3 ]0 ]
+ o: H$ { G! |: o& o0 {
7 P. t% ]8 j: [( A2 b
. ^9 g$ j7 A- ]; L0 F* p$ v4 V' p
6 L7 n* |) k- F
static void ys_edma3_init()
( _$ U' K+ f8 y' d
{
( B8 b7 L6 y0 u- C# ]% @! ~9 ^
EDMA3_DRV_PaRAMRegs paramSet = {0,0,0,0,0,0,0,0,0,0,0,0};
8 z0 m- q& Z9 Y: h- Y- x
EDMA3_DRV_Result result = EDMA3_DRV_SOK;
* w' y6 j9 Q$ c) k* {% C
EDMA3_DRV_Handle hEdma;
) N% z. u$ ` [7 `# s
uint32_t chId = 0;
8 B# F. V% E1 D1 \7 c; ?- r
uint32_t tcc = 0;
) L- m1 I$ W4 K5 t+ @3 l
4 ~4 F; h# @; v- N8 W2 ~
print2arm("edma3 driver init...",0);
7 j0 {2 V A8 ~
5 A8 N4 [- k d/ d
hEdma = edma3init(0,&result);
+ \0 w# n v& x3 V9 [- @; x
if(hEdma)
( O I0 `2 u3 b% r* q! R
{
) V, l# C: O' L7 N+ _) ]
print2arm("edma3init() Passed.",0);
) j3 y* u. [% Q; J. P( G
}
c6 j5 O" F% r' y5 E) ]
else
1 J) a1 q3 ?; U( U; M& s2 \
{
; p" t& P6 I0 @ z
print2arm("edma3init() Failed.",0);
- v7 x( d, g1 H# M! g
}
" T! T+ i+ h$ C3 Y T h
: o* q% H4 T& k$ J1 {1 e, {
if (result == EDMA3_DRV_SOK)
% P6 @. d* U3 O! l
{
7 M6 h, M/ N: w6 L5 J: ~% B
result = EDMA3_DRV_requestChannel (hEdma, &chId, &tcc,
2 L( g) P! t x$ ?5 [* k
(EDMA3_RM_EventQueue)0,
5 C$ ~: T$ v! r0 H
&edma3_isr, NULL);
! a& g3 J8 @5 d
}
2 \% n& u$ R& B/ `
; M: E2 C4 J5 i
if(result == EDMA3_DRV_SOK)
9 ^) O& e8 a( Y
{
& s* E T* E% E: R9 z" |
paramSet.srcBIdx = 0;
2 c5 Y4 {: E ?2 f
paramSet.destBIdx = 1;
! {3 N$ [8 g9 O* s
paramSet.srcCIdx = 0;
* }' N/ }+ _1 w% z7 u# T9 w$ s
paramSet.destCIdx = 0;
, Q1 S8 j$ A/ l; e" q7 i) S' O: n
paramSet.aCnt = PING_PONG_ACNT;
# y1 T! {1 K3 E8 m, S1 C% Y
paramSet.bCnt = PING_PONG_BCNT;
! y0 s3 D. y! [( n) G
paramSet.cCnt = PING_PONG_CCNT;
: Z- i! v: [8 ~6 d, h
M5 p9 S! Z% e+ W
/* For AB-synchronized transfers, BCNTRLD is not used. */
4 p* \* o5 x" z. V' c. P
paramSet.bCntReload = PING_PONG_BCNT;
! x% }, e* p1 c: \. K. B
( B: y8 J' S2 c! O9 z
/* Src in constant mode Dest in INCR modes */
2 U) f% A3 X3 W2 l
paramSet.opt &= 0xFFFFFFFDu;
e: z: u$ L1 m
//paramSet.opt &= 0xFFFFFFFCu;
( v: u: b2 @+ [5 d* r* b: b
" @% h5 q) z. _
/* Program the TCC */
$ N2 u& l u4 E9 Z; o* M
paramSet.opt |= ((tcc << OPT_TCC_SHIFT) & OPT_TCC_MASK);
7 f7 `& B, D: R1 a! T+ P
5 M9 Z2 T9 I6 n
/* Enable Intermediate & Final transfer completion interrupt */
6 P9 A3 D t; O& v
paramSet.opt |= (1 << OPT_ITCINTEN_SHIFT);
! t( U, J1 F- q
paramSet.opt |= (1 << OPT_TCINTEN_SHIFT);
; M* K; I* n8 u
, T7 [, c, G/ U: A
/* AB Sync Transfer Mode */
# |( _2 I8 a" h7 J! t# Z) \0 z3 j- y
paramSet.opt |= (1 << OPT_SYNCDIM_SHIFT);
( W4 T+ }0 s# l; x1 p j
6 g+ ~5 S# Z, n9 t9 u. ?
/* Program the source and dest addresses for master DMA channel */
) h" ~! {* {! p
paramSet.srcAddr = (uint32_t)(MCASP_BASEADDR+0X029C);
7 k# x0 g# n0 |, l; E& w) C4 v
paramSet.destAddr = (uint32_t)(ping_buffer);
; i: X% h" Z0 I4 Q( G1 ?
( m% i6 N; [5 O8 E4 ^" a) k9 `
/* Write to the master DMA channel first. */
+ |1 g% n* w8 r( n3 }
result = EDMA3_DRV_setPaRAM(hEdma, chId, ¶mSet);
$ S+ W7 a1 o8 _
}
0 u) f# P f4 @( F
- n$ l8 P* F. {2 q5 J
result = EDMA3_DRV_enableTransfer(hEdma,chId,EDMA3_DRV_TRIG_MODE_EVENT);
I/ G( D/ S+ T+ _. q2 `6 {
' C2 c7 ^7 O+ Z& i( E! C
if(result == EDMA3_DRV_SOK)
6 ]* v3 H; i+ Y6 j. L2 `1 v2 J
{
4 c. z3 e# ]3 P% r6 n3 G. ]2 z0 H% y
print2arm("edma3 driver init success.",0);
7 i2 a% Y* t( g6 V
}
! m' ~. H. F! y
}
; @3 p& {& M5 j, `
% {: ^3 L! C& ?" R* l' N9 y" z
3 S6 q9 C% T" J$ o% H, i
EDMA3的配置就这个函数,是由MCASP接收事件触发EDMA3传输的,中断函数edma3_isr只能进去一次,请大家帮忙看看哪里有问题。。。
( |) }0 K$ O/ s! N/ H5 \# s
' A. D. Y2 a+ @5 p* p9 x& N; O
% m- N% @! j0 O+ a3 s- f
作者:
Lewis
时间:
2015-4-24 10:47
每次DMA传输完成后都要再次使能传输
作者:
silent123
时间:
2015-4-29 23:25
Lewis 发表于 2015-4-24 10:47
) m" n, S, F9 n' g5 v
每次DMA传输完成后都要再次使能传输
2 z3 `0 z* _4 A" W$ r
原来是这样,我明天去试试,谢谢了!
欢迎光临 嵌入式开发者社区 (https://www.51ele.net/)
Powered by Discuz! X3.4