|
|
下面的任务,只能在第一次执行UPP时成功,后面的均不成功,请创龙工程师看看为什么?) I- o$ e) R8 B4 R+ D: N, a5 S% N% _0 P
Void UPP_TASK(Void)( r. h. u. H# t- Z3 l
{
! a& Q( T3 o3 q. n0 y& G" t# h7 {, i- }$ V7 x4 ^4 g
int i,j,k,target_int_count=2;
% j/ v H* D$ L: ?0 @- v" [* ]$ j char ch[2];3 [$ D8 W. L; L a) l# \) A3 {' Z' w
8 I9 K: Q0 y7 n% g& F5 c9 l6 y' F, f6 A# c- U3 a3 ~# K
" p4 _' |% x& p0 O! }
upp_interrupt_count = 0;8 s& W/ ~8 o" u. G
upp_error_count = 0;
3 o- B( a; _& L* V5 C/ }
% t$ t% O7 S0 H; {1 x9 s UARTPuts("\tResetting uPP buffers...\r\n",-2);2 L* q6 z8 R$ R3 g) X
// Initialize data buffers
1 l! f3 ]% _0 t) G% v- f, a% q; k) z for (i = 0; i < upp_frame_size; i++)5 C3 O) E5 @; e0 Q& F i. r* Z
{
" `# M6 V s6 h& _$ w upp_buffer_b =i;- E+ D( o. P1 b( @8 W# P# x" U
upp_buffer_a = 0xDEAD;! v# `2 B' R. L' f7 k! K7 K$ U4 F
}
; g* E4 B; e/ |, n' K
1 `3 F, O1 t: g# [9 Q) P8 z8 L //for(i=0;i<1024;i++)
l' L+ i" e! J, o // temp=0;8 `/ E8 S7 g! J* H( Z/ ~; e
; t0 q' ~/ G2 x/ Z) G
//UPPReset();
% f- w3 ^+ y: |' s. @ /*启动UPP DMA传输*/$ O( o; ^, o$ w( B2 s) o2 G
UARTPuts("upp_prog_dma_i\n",-2);0 ^% _% Q ]7 V& m5 o& h0 F' z
upp_reg_hdl->UPID0 = (Uint32)upp_buffer_a;* F; X% p; D4 T3 f4 m/ Z/ Q
upp_reg_hdl->UPID1 = ((Uint32)upp_line_count << 16) | (Uint32)upp_line_size*sizeof(Int16);
0 t0 e7 x- `4 U% b" F upp_reg_hdl->UPID2 = (Uint32)upp_line_offset*sizeof(Int16);& G5 R! [" y8 n$ v: V m9 n7 A* M' O
( R0 V$ Z# L! c" R UARTPuts("upp_prog_dma_i\n",-2);+ w2 p; ]/ O1 k o! d5 X3 s
upp_reg_hdl->UPQD0 = (Uint32)upp_buffer_b;& R) ~8 _( k7 Z, {& o
upp_reg_hdl->UPQD1 = ((Uint32)upp_line_count << 16) | (Uint32)upp_line_size*sizeof(Int16);
w2 n D a& \: ~) a' s9 A upp_reg_hdl->UPQD2 = (Uint32)upp_line_offset*sizeof(Int16);4 N) n6 b g* y" h0 j
0 h& a: F1 [: Y( u. C8 N4 z
/*等待UPP传输完毕*/
" `: [2 P; p, K5 o. [7 P! ] m //i=0;+ P" b* ^1 I5 B2 G4 `
//j=0;
9 l! F: K% q( Y3 m while (upp_interrupt_count < target_int_count && upp_error_count == 0)0 \# Y5 ]4 g5 `( [
{
! Z/ Q: I; E, @; @ /* 测试UPP传输的同时操作普通DDR数据
- V5 P6 D8 _- j$ B temp=i;
# C+ e6 x$ G3 c1 C" K c i++;; g; Y6 W9 N' ~, [% H
if(i==1024) S9 m6 [5 O- K2 F
{* T0 h' r- W+ F5 ~
i=0;
& x( F! ~: l) O- M9 {/ L j++;( h: T! h$ T/ A: j3 R
}
8 ?7 @6 s4 [: J3 C3 A */
7 S, l3 [+ q/ j% p l
9 n% ^7 b& g4 X$ f3 r: e asm(" nop");
( |+ f: q, E {+ w, c: u0 n; V/ L* p2 y9 ]* O. |
//UARTprintf( "upp_interrupt_count=%d\n",upp_interrupt_count);9 o# A0 C, A$ A( M% @
}1 ^- l6 R# N: _! @
3 A% O+ d" G- ^6 H$ f /*检查UPP传输的数据是否正确 (loopback modes only)*/: i; D4 p9 A9 [/ u
//UARTprintf( "i=%d\n",i);# W1 o0 C' R3 C
//UARTprintf( "j=%d\n",j);
u' s5 z% J+ @9 H UARTPuts("Data mismatch in buffers.\n",-2);
( Z; v' n' G+ M+ R if (upp_interrupt_count == 2 && upp_error_count == 0)
" q/ \* T6 C/ t7 L- e {
0 }9 a' Z3 A ?% o$ g for (i = 0; i<upp_frame_size; i++)
3 O" w! h8 |0 C {
- x/ ]2 A9 q0 {* z if (upp_buffer_a != upp_buffer_b)" L0 n; _. V8 o3 M) Q! ]: h7 _
{5 U& _' S6 G2 g# ^5 t
upp_error_count++;# P& N; S" [# ?5 v. m
}3 t/ F1 W2 w" e/ y# x7 }; f
}8 m# f$ g* \# |( S
}% o, W4 H" Y! G7 y
5 z& V6 n8 S3 x4 X, c /* 报告通信结果*/ b4 F: N' L) c- ?% S) k# Y
if(upp_error_count != 0)
+ A% t, {/ x U UARTprintf( "upp_error_count=%d\n",upp_error_count);
) i* W2 B/ @+ p @$ Z else" B- {. v4 }: z% W& m+ c& _
UARTPuts("uPP transfers complete!\n",-2);
e& Y& l7 R) w* V: F& a# i- [! Q3 H
UARTPuts("Do you want to print all the data?(y/n) ",-2);
# O2 J R e5 x, l- O( e6 N UARTGets(ch,2);
$ i! c; R% k0 v' v) ^& H/ x UARTPuts("\n", -2);
: G( l3 _5 ]1 c2 r0 @# ~ f8 B
- N, t8 L. t0 [0 Z if(ch[0] == 'y')
; K( f, o& t) q( [ V' ` {
' L9 f/ s$ k2 ^# ^; E- z /*打印全部读到的数据*/* k3 |$ K% r; E/ A
for(i=0; i<upp_frame_size; )
0 G9 W% h- j+ s! B0 E! y {
- S/ q% z' q/ v; P& @3 [4 o for(j=0; j<5; j++)
/ X6 v% @- o; w1 Y0 y1 y8 Q: i {- L- B3 V: I# Z: x- h
UARTprintf("upp_buffer_a[%d]=%d ",i,upp_buffer_a);, a0 m) u* R) y- \9 G/ i
i++;
- S5 Q5 E# f/ z( H //if(i >= 4096)
" o9 S: ~$ f( z, y // break;
: V& m2 s! S2 U& d
- C, \) q* d" F( y6 L }& y% e: t- P6 l5 u" @
UARTPuts("\n",-2);
7 s/ e o9 s6 ?4 p. s }
' I! z: }3 _, Q9 Y/ L4 ?: O( W }
/ V3 T3 t' K: L
- I0 X6 E/ k, W; k+ K' T}
/ d4 T2 _% n: u5 u% z
8 ~5 @" X5 ?: O: r
) S! U) P2 N. d0 r( O9 u |
|