嵌入式开发者社区
标题:
upp问题,在SYSBIOS下的应用问题
[打印本页]
作者:
tulipyyf
时间:
2014-12-22 14:35
标题:
upp问题,在SYSBIOS下的应用问题
下面的任务,只能在第一次执行UPP时成功,后面的均不成功,请创龙工程师看看为什么?
f8 A4 z h2 g( D3 P
Void UPP_TASK(Void)
V1 v. h* L7 ~4 B8 M
{
6 f" I- @/ u' z" @5 E
& G) O& ~" }- [% w9 J& U% a
int i,j,k,target_int_count=2;
" f9 j8 y% y0 v$ Y3 y' {
char ch[2];
8 N7 P# {' @; E; t% X
& J3 D j0 P# k6 k: R8 B
7 B* G5 }0 [& N1 c0 p
4 h+ Q* a1 L- E) C
upp_interrupt_count = 0;
$ h! h U* x) M. f% M
upp_error_count = 0;
4 n) Q/ H7 X: ^3 J
0 Z) c5 {' Y M0 W2 q2 Z
UARTPuts("\tResetting uPP buffers...\r\n",-2);
$ P+ b1 _: K' ^8 `4 c% K
// Initialize data buffers
9 A8 V* x8 T$ T4 U- m _) Q
for (i = 0; i < upp_frame_size; i++)
# `; d- a9 R+ q! Y8 d6 p1 ^
{
7 O5 W8 t. R6 B& a
upp_buffer_b
=i;
: G5 [2 u! q: C! o/ ?
upp_buffer_a
= 0xDEAD;
0 W" W% z% t; {' U) j. z
}
: F+ F& I! I p9 C3 v# [
% k9 m/ l, O; X9 _
//for(i=0;i<1024;i++)
) | r3 D( F' j
// temp
=0;
/ T" N/ U. C P1 n) ?
3 O- G; [# O! J, v! N
//UPPReset();
" h$ R8 `, ~6 O4 S1 D3 \
/*启动UPP DMA传输*/
# { ~8 r9 [$ n0 |
UARTPuts("upp_prog_dma_i\n",-2);
: ]' S5 r `6 k7 [& N2 a( p# x3 z, q
upp_reg_hdl->UPID0 = (Uint32)upp_buffer_a;
- a! w& k) u; T7 c5 L) c- V) k
upp_reg_hdl->UPID1 = ((Uint32)upp_line_count << 16) | (Uint32)upp_line_size*sizeof(Int16);
6 s" ^# V- ?9 D2 T
upp_reg_hdl->UPID2 = (Uint32)upp_line_offset*sizeof(Int16);
# g' \ T1 o5 O5 e
9 q J7 Y' h3 V/ }6 w1 J l; N
UARTPuts("upp_prog_dma_i\n",-2);
, ~! R7 ?# Z& n
upp_reg_hdl->UPQD0 = (Uint32)upp_buffer_b;
9 T0 g* e& W$ `$ F7 c- T
upp_reg_hdl->UPQD1 = ((Uint32)upp_line_count << 16) | (Uint32)upp_line_size*sizeof(Int16);
' }$ m) d1 N, i0 i, d7 @
upp_reg_hdl->UPQD2 = (Uint32)upp_line_offset*sizeof(Int16);
5 A+ j' c& h% ^# g
" S& D& g0 i# [ h9 y0 E; u
/*等待UPP传输完毕*/
+ x, L. i) \' ~" w
//i=0;
/ z, _0 T6 c( s/ q# U& O- n
//j=0;
& k; S/ d% ? ]( I2 U# f" V# b" l) j, X
while (upp_interrupt_count < target_int_count && upp_error_count == 0)
! ]- B5 O, w2 t- x
{
$ R5 @2 L3 l0 x; @% B! c
/* 测试UPP传输的同时操作普通DDR数据
3 ~0 _/ w/ \; ]) H" ^/ a
temp
=i;
# E' |5 t; ^8 h; u& I5 n
i++;
$ K* f! o7 q* I: }
if(i==1024)
. g3 F l) p4 P0 d
{
5 K' v6 z' i3 g- ^& k
i=0;
2 K" ~; U$ Z+ K0 j8 e/ P
j++;
" K! y# G1 N- B6 |( |
}
: a& v" y) J( q
*/
4 C( `3 K) J8 R7 p
$ P( [9 x! x) Z0 Y- B2 S: K2 J( t
asm(" nop");
4 _% \- U3 q/ j) E% _
2 m% y, j% ^2 O G+ l) }
//UARTprintf( "upp_interrupt_count=%d\n",upp_interrupt_count);
$ \/ W7 w h, W [ K
}
5 _# X A6 V" ]0 K9 a6 n
5 ?. y5 s8 U% O' O: B5 x
/*检查UPP传输的数据是否正确 (loopback modes only)*/
: E+ w$ a1 E5 H! b2 z
//UARTprintf( "i=%d\n",i);
: h; R5 @4 _: T
//UARTprintf( "j=%d\n",j);
+ B, G" }; g# G& l( C9 H4 B4 n
UARTPuts("Data mismatch in buffers.\n",-2);
% g. |, y, {4 r2 `' k9 B. i
if (upp_interrupt_count == 2 && upp_error_count == 0)
, k/ J6 p6 L' k1 N, U8 i
{
' s$ j8 R' V* P# C( a- o$ j9 X
for (i = 0; i<upp_frame_size; i++)
5 f; m& h. W ]
{
4 c% {, {" m; r v5 C0 {
if (upp_buffer_a
!= upp_buffer_b
)
* {9 @7 V* I. c8 h9 I9 g
{
8 g* S' Y; A) A) A J- ]! I
upp_error_count++;
/ w& Q% K% l' O1 {$ v
}
# S' j- b0 v" \5 Q
}
* B5 O. ?* s2 v( t
}
- }, I# G' k6 V7 ?: L4 Z; \
/ }$ {3 {# [: E: B$ A
/* 报告通信结果*/
& ?: W3 E3 B% `4 f: o. i. Z, N
if(upp_error_count != 0)
$ a8 ^. S3 `( Z8 g! `3 C& i
UARTprintf( "upp_error_count=%d\n",upp_error_count);
) t6 c7 k9 W/ o7 }5 a4 b# w. w; u: y
else
/ O: K" Z" {; G& R+ P- U+ f1 ]
UARTPuts("uPP transfers complete!\n",-2);
4 s6 G- g8 K8 F& D
0 j# V1 v1 X8 J f5 U L9 m
UARTPuts("Do you want to print all the data?(y/n) ",-2);
) L8 B7 O& W' B1 B
UARTGets(ch,2);
, ]# V! u: w) v- n% s! |
UARTPuts("\n", -2);
" ^1 I6 N0 l h
" ]( R; B' s; o) j) M
if(ch[0] == 'y')
; w" g# l( N+ Q( _" F4 @4 H/ T
{
4 C( e6 B5 x1 b' Y' h0 ^, q
/*打印全部读到的数据*/
8 h: z; Q R; s. S) Q
for(i=0; i<upp_frame_size; )
& n5 h. V f4 j; t `- T* U
{
; v3 d0 W& t4 X7 P3 I
for(j=0; j<5; j++)
( x/ ?5 a$ ?) S+ P0 L9 G' i
{
" c7 x. H4 u8 u* v
UARTprintf("upp_buffer_a[%d]=%d ",i,upp_buffer_a
);
$ ^. Y+ f; `( h9 E8 r
i++;
( j3 o8 k. g$ |
//if(i >= 4096)
1 z* S! D1 J, N1 c( w1 Y6 J7 o9 N
// break;
0 ^& |8 g# S7 V: A! A- \+ s9 y
, P) z! C( }( N. b. {
}
- U% ]0 q9 O. [& J$ y7 U, p
UARTPuts("\n",-2);
0 e4 l7 U9 D& f8 |1 [6 [
}
) z5 Q6 Y8 K+ J0 I7 \2 K) v. B/ w* Q4 J
}
' U. D, X& y V: C, G$ O( z
* J/ Z E! x1 n7 r
}
' [4 z# W% C- u" s
( y; u D2 Q6 K. H
& v8 [7 K$ Q9 O1 Y7 z1 j
作者:
tulipyyf
时间:
2014-12-22 16:08
追加说明:任务是空闲任务,因此没有做循环。
! {' C. V/ _0 `& B5 _5 N
作者:
Lewis
时间:
2014-12-24 18:06
多次执行是没问题的,最好不要用空闲任务,优先级太低。
, l, a4 H. K' Q& J4 U
欢迎光临 嵌入式开发者社区 (https://www.51ele.net/)
Powered by Discuz! X3.4