|
下面的任务,只能在第一次执行UPP时成功,后面的均不成功,请创龙工程师看看为什么?
3 _" s R5 M! v, P3 ?& y* B \& gVoid UPP_TASK(Void). e* X( a$ W) \. Z
{
9 t! ]* h( H- e5 E; R+ \6 t1 `* w& K; h& K
int i,j,k,target_int_count=2;
; k D- |' f* h% u; L% h char ch[2];# X) Q q @; A& S. Q+ s
3 V- X2 O' f9 u, p" ]% o
2 @( G3 y6 K( n' |/ o! O' Q5 g
& r' R8 J% D) l$ j! ] upp_interrupt_count = 0;
* J- Z4 u6 O! G# {1 _ upp_error_count = 0;
; y c+ g0 C) M% o' H1 f9 d6 C& D* g0 h2 f# X
UARTPuts("\tResetting uPP buffers...\r\n",-2);
; {# E& q" C5 Q- J5 A // Initialize data buffers
/ }1 s, v5 ~" S1 }7 r5 z4 _6 N% c for (i = 0; i < upp_frame_size; i++)
9 {0 N2 B9 E. E' p# c5 E1 }* h {
( W5 a2 h: H8 V# Q upp_buffer_b =i;
. d, N# O e0 S5 h4 r* w/ K; ] upp_buffer_a = 0xDEAD;- `1 Z4 {: u; q0 C) V$ ]1 P7 K
}
3 \2 V7 H$ M! h% ]2 E+ C3 j1 w& Q- O( h8 ^+ r( [- t) w& t
//for(i=0;i<1024;i++)0 @1 v7 M* t, z% Z/ S
// temp=0; X) A5 V/ J+ h+ b
* c) O2 _% N. [
//UPPReset();
$ n) V. ^7 C% }6 J /*启动UPP DMA传输*/
' m: P3 n, c- d UARTPuts("upp_prog_dma_i\n",-2);. s1 M0 e5 |1 y+ }
upp_reg_hdl->UPID0 = (Uint32)upp_buffer_a;1 \% d" t3 r' O+ x% I" ]! y
upp_reg_hdl->UPID1 = ((Uint32)upp_line_count << 16) | (Uint32)upp_line_size*sizeof(Int16);
2 [2 o6 f4 \% }" C! a/ \ upp_reg_hdl->UPID2 = (Uint32)upp_line_offset*sizeof(Int16);$ v4 z" x5 w8 G
8 l0 L# B" q% l& Y, {! g# V
UARTPuts("upp_prog_dma_i\n",-2);
* U; C5 A/ a* m$ u1 ]( e upp_reg_hdl->UPQD0 = (Uint32)upp_buffer_b;
" F7 q& T4 j: s% T/ \ upp_reg_hdl->UPQD1 = ((Uint32)upp_line_count << 16) | (Uint32)upp_line_size*sizeof(Int16);/ P$ }+ U- t4 {3 W% u
upp_reg_hdl->UPQD2 = (Uint32)upp_line_offset*sizeof(Int16);
4 R/ Q7 z1 _& ^+ r. j+ w
6 l* ]2 _$ k7 \3 G. O /*等待UPP传输完毕*/
1 F- \0 F- `1 a- q- ?$ L" H //i=0;
( s! D( \3 h: B1 `8 q4 T //j=0;: r! O6 g0 L; l1 {3 e# |9 N
while (upp_interrupt_count < target_int_count && upp_error_count == 0)0 [6 w/ ^. X$ g9 D9 L9 E
{
9 r7 J, D0 J! n /* 测试UPP传输的同时操作普通DDR数据) @1 |( O, e3 |6 I
temp=i;( ?- _+ R) a% j5 R5 T
i++;7 H1 W# I& f9 e+ Y
if(i==1024)
4 Y% z7 G: T/ @- {! V, e3 P1 x% g) r {
3 |$ s; ~ y8 h i=0;
& z; }" D2 I: V. h" J1 f- u( a( G9 x j++;
8 S) t* j- |8 H. p9 X/ O8 P# Y }5 W7 ]9 I$ K( W
*/
Y2 I1 i$ u, E- v# ~- t& {! h% {+ a1 B: p4 ~
asm(" nop");3 x- h! P0 b, U) r% p2 x
4 i+ x' G+ C5 |( u9 _7 {* {
//UARTprintf( "upp_interrupt_count=%d\n",upp_interrupt_count);# a" I3 [ r/ Z9 L5 h$ A- \
}( |% Q1 P1 C/ K2 r* a
+ H9 d5 T; s- |# b( y' I& k
/*检查UPP传输的数据是否正确 (loopback modes only)*/! ]2 X' b& `9 k% x5 v
//UARTprintf( "i=%d\n",i);% O# f) W% ?1 U8 P
//UARTprintf( "j=%d\n",j);- w' v" C8 {, V4 ]4 j, Q7 r1 \$ o
UARTPuts("Data mismatch in buffers.\n",-2);
3 | a4 p9 N7 M' k if (upp_interrupt_count == 2 && upp_error_count == 0)4 W$ O% ] Y/ b
{6 S. R1 K$ R d5 \# g1 d4 r
for (i = 0; i<upp_frame_size; i++)
% D2 s9 j/ f. Q' C {& F$ s9 \" @6 O4 P0 g
if (upp_buffer_a != upp_buffer_b)) v3 G; B" M8 h `4 J' m7 y
{
; |8 Y2 ?; r. {) ]: ^# f/ F upp_error_count++;
# i, R0 f/ m: m# o }! t6 r3 Z# m) M- C
}
+ U9 t1 f6 r$ ~. L. t4 p' ? }8 F" G# s9 C5 K* e9 f3 H
* G2 m. L; y7 Z- I- k' E
/* 报告通信结果*/
. Z7 |+ h# M8 x$ f3 W( Z( C& E if(upp_error_count != 0)
7 K H- S, N! d% j# p2 W9 |. z UARTprintf( "upp_error_count=%d\n",upp_error_count);
8 l; i4 t( M* z' W. _+ E else
. m; I O3 }; a W3 v& z1 c UARTPuts("uPP transfers complete!\n",-2);# R6 F( b) u; \3 G$ T
9 @. Z8 C, a8 W
UARTPuts("Do you want to print all the data?(y/n) ",-2);
" ~- J, ^ B! G: {" u UARTGets(ch,2);
' a1 d) S0 H4 C* Y6 t6 Y5 k UARTPuts("\n", -2);
$ P3 d( D: U8 \* |% r. Z! a6 \
2 }0 l/ Y" b+ [. b& y$ ]. u5 d) z if(ch[0] == 'y')8 W$ q4 c# u5 Q
{7 J- [$ X f- `! y
/*打印全部读到的数据*/, ], b: q4 Y8 x9 K" i, t4 t+ a
for(i=0; i<upp_frame_size; )
( h& A* _; _. D* E* ~2 B7 S! Y0 u; P {
/ B) n I- i% {9 O" i for(j=0; j<5; j++)
8 j r% Y7 }+ U; P5 l! ` x {
* d- T! }! b" T( w UARTprintf("upp_buffer_a[%d]=%d ",i,upp_buffer_a);
: d7 c( k0 j( `8 j7 x" R i++;# t5 i0 H6 ?& Y
//if(i >= 4096)2 K- {6 o- e: z$ h# f p
// break;
& g/ ~/ G6 {- R" x7 J5 V0 E0 B- S4 S( [0 q; |
}
' M! r% C* T* N UARTPuts("\n",-2);" d- i4 { ~7 n' A
}; q, U4 Q+ H0 j
}
$ l7 _- ^0 s/ W% a$ j/ l/ a% V/ O. w: r; a0 c1 z* u$ m
}
% U& j" G9 h% C9 O% g1 t7 M+ C+ `8 ?7 n- H6 I
, T5 F: ^- w/ m' I& o/ S4 t
|
|