嵌入式开发者社区
标题:
upp问题,在SYSBIOS下的应用问题
[打印本页]
作者:
tulipyyf
时间:
2014-12-22 14:35
标题:
upp问题,在SYSBIOS下的应用问题
下面的任务,只能在第一次执行UPP时成功,后面的均不成功,请创龙工程师看看为什么?
, e4 Z2 y3 _3 `& D. P! m
Void UPP_TASK(Void)
# e; w7 X. G: X
{
# A, _ U3 i2 ^0 e X. T2 j
$ p4 n p/ b: O1 Q t
int i,j,k,target_int_count=2;
$ O1 h" l# C5 T1 ~5 I2 D
char ch[2];
0 Q4 d, Y* ^5 l) c
7 @/ k( T( p; ^! T, i
3 V- I% k# ]: d! X) p; L. z, z; }
$ G$ v$ M+ i1 z/ \+ K6 N/ h( Y
upp_interrupt_count = 0;
; p( l5 u L+ y
upp_error_count = 0;
- _# M* t2 K' I7 b% s7 E( @3 z
; N( g0 B6 g2 E5 x/ K4 L7 g, r
UARTPuts("\tResetting uPP buffers...\r\n",-2);
! s. M; K- ] F1 [2 R# \. l
// Initialize data buffers
. @* `! m7 A& j8 p. D" {0 y
for (i = 0; i < upp_frame_size; i++)
8 X( T" u: u% Y$ \$ x
{
; x! b* S3 {2 t5 z7 k& G* Z/ G
upp_buffer_b
=i;
: N" _3 w# x v+ H
upp_buffer_a
= 0xDEAD;
! J. z) c+ x" s! i# O4 G7 S; x
}
5 R) p4 w2 `+ l, R8 F
) x4 |+ A6 }% {; O9 i- b5 \; W$ g
//for(i=0;i<1024;i++)
' M; `. r. h4 `( n
// temp
=0;
% a& M+ T! q4 _0 d% Z- [
2 l8 M4 \3 f* w" S. B" f: v& ]6 W) ]! E; B
//UPPReset();
8 B: l! _* f2 y$ g* r6 F" E0 Q
/*启动UPP DMA传输*/
c" y0 w# f5 D' p: T/ h$ g
UARTPuts("upp_prog_dma_i\n",-2);
: c" [& v# h/ X0 Y
upp_reg_hdl->UPID0 = (Uint32)upp_buffer_a;
, n3 p( Z. z. M2 N: }4 y9 M3 C
upp_reg_hdl->UPID1 = ((Uint32)upp_line_count << 16) | (Uint32)upp_line_size*sizeof(Int16);
( A: J) a2 Z( d3 q
upp_reg_hdl->UPID2 = (Uint32)upp_line_offset*sizeof(Int16);
* m. U1 P+ _9 a' }( d
9 @5 N s- `* ^: c, Z
UARTPuts("upp_prog_dma_i\n",-2);
8 S# w/ \+ D/ c. L& n/ t
upp_reg_hdl->UPQD0 = (Uint32)upp_buffer_b;
/ u7 S% {6 }) q8 M( L+ C( G* R
upp_reg_hdl->UPQD1 = ((Uint32)upp_line_count << 16) | (Uint32)upp_line_size*sizeof(Int16);
1 H; z- O0 |- `0 |* D
upp_reg_hdl->UPQD2 = (Uint32)upp_line_offset*sizeof(Int16);
9 `$ C" A2 O) D# M8 c" q
3 C1 q1 N. O7 A7 n: w! u
/*等待UPP传输完毕*/
6 n( `# g j) Z+ G8 [, ^: i% L
//i=0;
+ c2 ?0 n5 ^+ @& j: Y
//j=0;
, }1 w* b+ H& ~7 }. D p- Q/ D% P
while (upp_interrupt_count < target_int_count && upp_error_count == 0)
+ W4 X7 d5 b5 s. S
{
, [+ Q, ~+ ?( }! T, E
/* 测试UPP传输的同时操作普通DDR数据
& z+ p4 Q% E- K; P7 }! K
temp
=i;
; ]0 t2 W7 M+ `" j/ P; w
i++;
* n8 V- H. Q( q
if(i==1024)
# B! M" L$ z X5 b' Z/ [$ E
{
8 k+ H+ L2 N- k; ~8 f
i=0;
0 P" G @9 }2 |" V4 D8 F6 {1 S. E% Q" A! r; R
j++;
# }9 j+ k# ?8 Z
}
& Q; f$ Z8 ^1 j4 r& w
*/
' Z8 h' X$ ]6 e0 P/ m1 c& C5 o
5 y- M, D/ t. C, g7 d- o1 V! H& f
asm(" nop");
- T- n' D' m5 \ H4 k8 m3 o
3 d& u3 N8 i5 [1 Y* R9 P
//UARTprintf( "upp_interrupt_count=%d\n",upp_interrupt_count);
S# j1 x% }7 K
}
: h" o2 L/ X6 `' j' t$ W
- i* z) v; b; f! j! l3 F
/*检查UPP传输的数据是否正确 (loopback modes only)*/
6 d# I$ G+ [) f* Y/ ]/ X
//UARTprintf( "i=%d\n",i);
, K: @9 u+ \! r8 H; \
//UARTprintf( "j=%d\n",j);
$ p$ H' P+ b0 L5 V S: E
UARTPuts("Data mismatch in buffers.\n",-2);
* C9 K! Z% r" b% ?3 l
if (upp_interrupt_count == 2 && upp_error_count == 0)
, b. s' f7 {6 d
{
% t2 g. M6 p& W1 @4 l
for (i = 0; i<upp_frame_size; i++)
. n# B4 ~0 L; y
{
( u/ c5 P2 g+ k+ _9 P# W
if (upp_buffer_a
!= upp_buffer_b
)
6 j% ^8 y; s* p0 j) c4 p" Z5 T
{
2 }& W' }" n* P; Q! O
upp_error_count++;
# a" E" ? @% g( {
}
8 f. k% j; h D, M
}
1 r: x% r V. B/ }0 x
}
6 r% H& L/ P- G! B5 H/ k' i
0 D: W1 S( F+ O8 \ \2 Z
/* 报告通信结果*/
, e3 h% G Z* p6 m& u
if(upp_error_count != 0)
' p. P( }+ p& ~+ b: U
UARTprintf( "upp_error_count=%d\n",upp_error_count);
+ U, N% n7 u- m s- d6 C5 ~5 n( \/ ~$ ]
else
, _. D( ?( J+ m
UARTPuts("uPP transfers complete!\n",-2);
, ^- a8 `2 l; W8 t
; b. Z9 e8 Z; f$ O/ L/ Z O& a: @
UARTPuts("Do you want to print all the data?(y/n) ",-2);
: ?$ @# c* y. ?4 E
UARTGets(ch,2);
) e1 s3 O8 b9 U7 X/ K! U; `* v
UARTPuts("\n", -2);
4 C6 _1 ]6 z; [7 S& o, O! V' C
2 e- e- {; E$ Q& V" V& t
if(ch[0] == 'y')
# K$ l, @2 N' M6 x# Y/ K" Y3 h
{
3 r( Z( l- E0 H( n3 F
/*打印全部读到的数据*/
- ? d6 T# [1 B6 N1 I5 R4 s; i
for(i=0; i<upp_frame_size; )
; O4 k0 d& Q. d1 L6 o
{
& ^( Z6 m/ c7 t1 @) }
for(j=0; j<5; j++)
5 ^5 E S% H+ K- O7 ~" R
{
3 \9 ^2 y) u* a
UARTprintf("upp_buffer_a[%d]=%d ",i,upp_buffer_a
);
) U& |7 \5 @. _
i++;
; y5 C* R' ^) v. a+ e6 Y! M6 y
//if(i >= 4096)
/ J$ B! W; t6 H- g/ c
// break;
' r3 Y# H0 j6 s( Q6 E
' d2 ?+ l2 ^! X0 i$ n& ]' v* ?
}
, p2 P' s7 V/ D% I- ^# s2 z
UARTPuts("\n",-2);
+ n: o: P9 w4 w) \+ [# A( b, }; b
}
2 ~$ y2 c/ i% i# C' `' H5 q
}
% B$ I* y- w+ @- S \1 W0 L
. l3 h! X% ^ x' N/ z9 F
}
+ m6 G* n6 l" H' j
$ ~" B0 C. o+ Q) Z: B2 S
% W& \3 {+ w! g0 V
作者:
tulipyyf
时间:
2014-12-22 16:08
追加说明:任务是空闲任务,因此没有做循环。
+ w4 H* n+ u, V3 C1 B3 h
作者:
Lewis
时间:
2014-12-24 18:06
多次执行是没问题的,最好不要用空闲任务,优先级太低。
9 g6 z' u2 r% k+ Q5 V% A8 s D
欢迎光临 嵌入式开发者社区 (https://51ele.net/)
Powered by Discuz! X3.4