|
|
使用mcsdk中的edma3lld库写的edma3驱动,在omapl138的dsp核运行,但是中断函数只能进去一次,路过的朋友帮忙看看,感谢万分。代码如下:
/ K3 I" u8 i( |% Z( ~#define PING_PONG_ACNT 1
( |. m. H* X0 F1 T/ U- Z#define PING_PONG_BCNT 8*32*40 + X: V* ]$ x" R3 W$ F
//#define PING_PONG_BCNT 1 + U% ~) F1 v: n5 R8 O
#define PING_PONG_CCNT 1) \) @' G/ ]% V6 _
#define MCASP_BASEADDR 0x01D000008 e S: w/ ?2 D a1 E
#define Mcasp_RXEVENTQUE (0u)8 P* b# D" E9 z% g+ f2 E
, H% O3 G- {! }
/* OPT Field specific defines */3 T: U/ |/ ^: S+ k, Z+ E
#define OPT_SYNCDIM_SHIFT (0x00000002u)
6 ~! J b% {7 _5 X: }0 Q& k% i! H#define OPT_TCC_MASK (0x0003F000u)
^7 G3 J* F4 t4 m9 ?7 ?6 ]6 i+ ^# `#define OPT_TCC_SHIFT (0x0000000Cu)
8 U- p. ^- y- w) ]( v& N#define OPT_ITCINTEN_SHIFT (0x00000015u)
. c3 @3 L, ]) v% J% ?#define OPT_TCINTEN_SHIFT (0x00000014u)+ p' `0 Y2 F# j5 |* R$ ]+ h. Q
* n8 H. Q! A$ R/ P3 c# \4 X- k
char ping_buffer[PING_PONG_BCNT];: N/ s) t- f/ @/ p7 V1 b7 K
char pong_buffer[PING_PONG_BCNT];
. K' t0 K8 D3 J' |2 w
8 ~! @6 g) Q, ?: T
4 |% f5 z) \: A6 {
2 t: |& q e' g2 z
5 c+ U7 R# s0 V4 Y8 o1 f- Sstatic void ys_edma3_init()
, ^, p, e: @9 ]6 E- T{
( B3 A5 C/ r& [% R( T5 R EDMA3_DRV_PaRAMRegs paramSet = {0,0,0,0,0,0,0,0,0,0,0,0};
6 ~ Y/ A5 N+ x EDMA3_DRV_Result result = EDMA3_DRV_SOK;
) w$ h/ N. U5 \+ [. V | EDMA3_DRV_Handle hEdma;
. I1 w6 @4 |& I8 ]. s2 X uint32_t chId = 0;1 z& E) v& }, ~# G- ?
uint32_t tcc = 0;
7 G5 y1 @# z1 w2 U
8 _' O, h4 {+ z3 V print2arm("edma3 driver init...",0);
& |5 S4 H7 @$ o
* b7 u$ ^2 U0 ^7 H! w% Z! b3 L hEdma = edma3init(0,&result);
+ L/ [& I$ p: {4 E4 G% c if(hEdma)
( s0 l! k5 O% ?+ ? {
5 s& b' F- k1 e( [ print2arm("edma3init() Passed.",0);
: `$ W3 \$ B) x( c/ W: m1 z }% B/ ~3 S7 r Q# c- O6 M
else$ r+ n q/ p6 _, y$ {
{8 S7 v* W G4 {* @6 s
print2arm("edma3init() Failed.",0);; d% A w1 H- y1 s& c0 x1 m
}1 e1 A. c: u( y
5 U }0 j+ Z$ d0 r4 e9 B if (result == EDMA3_DRV_SOK)5 \* O/ U* z+ r q) \% Z% Y, d
{/ u/ {% J: t; O7 a& _
result = EDMA3_DRV_requestChannel (hEdma, &chId, &tcc,& l) I8 E- L% _8 O7 J$ E/ d) W
(EDMA3_RM_EventQueue)0,
! x& ]: q% w6 p- c! n) v9 ?0 K &edma3_isr, NULL);
; E# ]# `+ R* H }
0 V T! }$ O8 |" N' B n
; n3 T* q/ R1 j9 n4 [ if(result == EDMA3_DRV_SOK)
: R: l- o, b1 h5 k% v$ G {
8 h$ n: Q" X Y& n e paramSet.srcBIdx = 0;
, k, o2 \+ g2 Q6 f8 c paramSet.destBIdx = 1;3 g# g& ~" R" l; {- H/ D/ F
paramSet.srcCIdx = 0;9 g: f8 j( U" O
paramSet.destCIdx = 0;8 z1 j, Q7 ^( [% B2 B: o
paramSet.aCnt = PING_PONG_ACNT;+ a, Y9 m ]! x
paramSet.bCnt = PING_PONG_BCNT;. T7 k0 [3 F q% s4 h8 y f. r
paramSet.cCnt = PING_PONG_CCNT;
" c$ [) z! N2 _ * m$ Y5 O( o0 g0 N6 W9 ~9 b7 o
/* For AB-synchronized transfers, BCNTRLD is not used. */( t/ E, O; o3 T6 Q
paramSet.bCntReload = PING_PONG_BCNT;
4 W3 [: G6 j3 w' ?0 T" E/ v( c5 S
+ J1 W9 b/ B, x1 f5 A! n2 E+ \2 h /* Src in constant mode Dest in INCR modes */& S# o M7 B; {& a. ^" ]& S5 `; N
paramSet.opt &= 0xFFFFFFFDu;) }; p" L/ [; Z5 D- [: @ r
//paramSet.opt &= 0xFFFFFFFCu;; y" O6 R( w2 C j& |, S# L
1 H+ L7 K/ Z, A4 ^ /* Program the TCC */
0 W6 q- l* m$ k' S/ g* M paramSet.opt |= ((tcc << OPT_TCC_SHIFT) & OPT_TCC_MASK);
% L8 E, k" Y/ W0 e6 V8 F, N; d' W) G9 h
/* Enable Intermediate & Final transfer completion interrupt */
" H9 r8 I9 \7 o/ F: b; `/ A) y paramSet.opt |= (1 << OPT_ITCINTEN_SHIFT);
- i, W. k- @6 U4 E- D9 \ paramSet.opt |= (1 << OPT_TCINTEN_SHIFT);& @$ d: }3 K8 D
: r' u. ]) {2 l" i( R% s /* AB Sync Transfer Mode */% n, Y4 T( M2 h6 B( ?" k; }
paramSet.opt |= (1 << OPT_SYNCDIM_SHIFT);7 r' S" i' Q* U3 I* I
- e# ~' x; n# N' [' } _
/* Program the source and dest addresses for master DMA channel */; P9 Q; q8 ?8 z2 S0 O [* _
paramSet.srcAddr = (uint32_t)(MCASP_BASEADDR+0X029C);* j$ v% [. h4 U U8 u+ J
paramSet.destAddr = (uint32_t)(ping_buffer);
/ D6 s5 B; I2 n" S6 d3 C
5 L% q' n! F \8 E+ d% i7 h /* Write to the master DMA channel first. */
0 u: M+ B& d0 n' s result = EDMA3_DRV_setPaRAM(hEdma, chId, ¶mSet);1 ]* Z g/ o, \
}
+ V& C. B. @- _1 i @6 I0 l" C. F0 d* Z$ y
result = EDMA3_DRV_enableTransfer(hEdma,chId,EDMA3_DRV_TRIG_MODE_EVENT);- r7 A1 ~( I: G# c4 w* w7 P# R
7 w$ d+ x" d1 z5 E1 h& W if(result == EDMA3_DRV_SOK)
2 l, v. E1 D i# r4 ]) W- c {
3 f* A$ L C6 w r3 Q/ I print2arm("edma3 driver init success.",0); O3 ?% L1 l- Y5 \3 v" n- ?1 Z
} " Z8 [% Y0 g% H* U
}
! W7 g# v9 B" h0 H# Y* N6 W; s% l4 K3 `& M9 W2 m e% Q
6 J6 e" Z9 @9 Q* v% OEDMA3的配置就这个函数,是由MCASP接收事件触发EDMA3传输的,中断函数edma3_isr只能进去一次,请大家帮忙看看哪里有问题。。。. p" V, d1 L$ y, V9 k9 s0 o
) E M) ]& x* }6 U- P
: f3 y) V. `1 Q0 e/ d; }5 l
|
|