嵌入式开发者社区
标题:
upp问题,在SYSBIOS下的应用问题
[打印本页]
作者:
tulipyyf
时间:
2014-12-22 14:35
标题:
upp问题,在SYSBIOS下的应用问题
下面的任务,只能在第一次执行UPP时成功,后面的均不成功,请创龙工程师看看为什么?
" t a# r7 i0 F% l
Void UPP_TASK(Void)
5 C' A; f) e% ]1 M' @3 T; {
{
+ G9 p! z$ _6 n1 U+ G8 Q0 A) ^
' [ _+ o4 ?6 Z5 I
int i,j,k,target_int_count=2;
3 s: s* W i% [. q+ b
char ch[2];
3 J: l! n7 ~% J1 X" @: j* r
9 K) ~: A4 k! X% T+ ?' g
3 O& l' E/ s$ i3 Y; }# ~
& C7 F+ \1 a& S; w" _
upp_interrupt_count = 0;
9 P" ^4 N1 [* n$ z" z
upp_error_count = 0;
( t% a: l$ ^' ~# Z6 d
+ e/ r4 i, r8 t( |( X5 Y
UARTPuts("\tResetting uPP buffers...\r\n",-2);
6 g. R9 e0 u0 I7 x8 L& N1 p: u
// Initialize data buffers
/ i; G U5 J9 Q+ m1 p
for (i = 0; i < upp_frame_size; i++)
$ Q {# E/ w+ |& U1 S
{
) R2 l# U; J9 @+ f. g" u
upp_buffer_b
=i;
( }' J, W! s( }5 r5 t/ s o3 v
upp_buffer_a
= 0xDEAD;
/ b) Y) K/ y% ?8 a4 q+ [
}
3 G) O. X+ q+ h! j+ m
1 L. q0 }8 J0 D: Z8 M' @, z
//for(i=0;i<1024;i++)
% [( W; [: u, n
// temp
=0;
1 m9 ~ f# X4 H$ p
$ x4 A( X( \1 ]7 J/ S2 D
//UPPReset();
# @' u. i! h' t9 u: c- f3 m* g: Z4 ]
/*启动UPP DMA传输*/
, n# T& c! ]7 E
UARTPuts("upp_prog_dma_i\n",-2);
" `/ \$ V$ _5 N
upp_reg_hdl->UPID0 = (Uint32)upp_buffer_a;
?9 R: L9 o! \3 w+ J
upp_reg_hdl->UPID1 = ((Uint32)upp_line_count << 16) | (Uint32)upp_line_size*sizeof(Int16);
1 @% |- E( Y: Z: P! x' E5 A
upp_reg_hdl->UPID2 = (Uint32)upp_line_offset*sizeof(Int16);
z6 Q: q3 t' d+ ?
) n3 F8 @: |5 u$ b- c5 r
UARTPuts("upp_prog_dma_i\n",-2);
1 A7 \* `0 n# j; F' j8 i8 m- L a
upp_reg_hdl->UPQD0 = (Uint32)upp_buffer_b;
+ L& I6 [' z# |5 g4 D2 D8 A" o
upp_reg_hdl->UPQD1 = ((Uint32)upp_line_count << 16) | (Uint32)upp_line_size*sizeof(Int16);
' F( p3 l& [8 f. n! E
upp_reg_hdl->UPQD2 = (Uint32)upp_line_offset*sizeof(Int16);
9 `5 M4 S. b) A6 c9 t8 a* A' p
2 h0 {6 x& N% p( U$ M4 S5 ^
/*等待UPP传输完毕*/
% V/ i$ r" w- U& b
//i=0;
5 F- H. }- e# q; S
//j=0;
4 V( E7 H+ r* s9 o
while (upp_interrupt_count < target_int_count && upp_error_count == 0)
6 z4 ~ m3 F( c y4 I: a
{
6 Z: }2 d1 R6 y" J/ [/ ?
/* 测试UPP传输的同时操作普通DDR数据
" M# D! ]- C3 |, f9 C
temp
=i;
, M& B# o; o& N' T/ ^
i++;
3 D5 w" n: l8 o* `; t
if(i==1024)
3 G, g1 m9 U3 Y* ?4 G
{
. `9 ^) y, |6 W6 L9 x5 F+ K$ f0 _
i=0;
0 m; S; T0 |; t6 f' s- }' q
j++;
$ N( O$ g9 f9 U( h- u
}
5 i$ V g. Z8 \! I4 s" s
*/
7 I1 F0 l; T1 T3 c% q+ O g
0 A S, F9 |; W- ~$ L1 X
asm(" nop");
! o+ e2 |, u6 v/ k- W
) E2 X- D# d' M4 z$ r% X: D
//UARTprintf( "upp_interrupt_count=%d\n",upp_interrupt_count);
' z3 q7 I. P U
}
* y) Q) f( X/ e' i* I4 t
3 I+ x# l% j% A! w
/*检查UPP传输的数据是否正确 (loopback modes only)*/
$ s) ]$ E* c2 ~7 Z( C
//UARTprintf( "i=%d\n",i);
( X2 N W5 V8 F, M. ?
//UARTprintf( "j=%d\n",j);
s3 y% Q1 g8 X2 f! Z
UARTPuts("Data mismatch in buffers.\n",-2);
@* v6 |! T1 E7 G+ e
if (upp_interrupt_count == 2 && upp_error_count == 0)
' g; k$ ? w4 i& x
{
9 }8 E9 a3 s. }1 z% U& R) l" k; M
for (i = 0; i<upp_frame_size; i++)
6 n! c7 O( L' g/ I# n; L4 r
{
4 c! O9 V; U) q/ {7 g6 I9 k0 \0 g
if (upp_buffer_a
!= upp_buffer_b
)
@0 f6 ^) Z5 H
{
: x) }% n9 h* N9 F5 {% _! ^
upp_error_count++;
8 K% _2 i! y5 |% f+ Y* l$ C5 H
}
8 X) K/ L# P+ O4 W X# C
}
3 l3 M3 m8 h s
}
; l9 E2 }2 K6 T' F7 t# }; `
6 ^% h5 j; l% {) B$ b
/* 报告通信结果*/
) K$ {) P. T" R) D: ^+ I1 [
if(upp_error_count != 0)
! i# B r: f% @* T# `- s
UARTprintf( "upp_error_count=%d\n",upp_error_count);
* w9 R& i, ^7 g" `4 |
else
" [* G0 P* _$ _& U& \
UARTPuts("uPP transfers complete!\n",-2);
( ?+ Y8 H! n9 Q' k- F$ |0 L' ]
! T B9 L% h3 B
UARTPuts("Do you want to print all the data?(y/n) ",-2);
0 B) H& c* `& T8 r! Z2 V
UARTGets(ch,2);
* W* |0 y0 E9 T. _2 k2 R
UARTPuts("\n", -2);
1 Z$ z) G/ j0 n
$ I! y2 o: K* l2 }
if(ch[0] == 'y')
* X/ t) q2 t, B
{
; T2 B# m1 [& q& U# L% E# D
/*打印全部读到的数据*/
" X J* o) F; d2 {* ] o! w/ _
for(i=0; i<upp_frame_size; )
& ~' g: |: j& m# M0 V( `, {
{
4 K' h0 E% N% [
for(j=0; j<5; j++)
8 w: t1 g4 S& G( {5 ], n" {8 q- {0 e
{
+ D3 R/ A- s F' N3 I1 L9 [
UARTprintf("upp_buffer_a[%d]=%d ",i,upp_buffer_a
);
- n; j4 B) U/ N
i++;
! y! E; Z7 f7 U* N1 y# E& s9 m$ T
//if(i >= 4096)
# a3 K$ l8 J6 u) ^
// break;
: a% _# m2 ?/ N2 H$ _
+ f2 F+ w/ A- [! k
}
7 q5 v9 e n7 Y! K) h
UARTPuts("\n",-2);
% b' m# w( E a5 [& `! P
}
* j: O) ]) H2 R H/ j$ Z# c2 N& I
}
, X# n" f7 g1 h4 ?* g6 t4 v- h
1 l1 K& q1 p" q1 x: x7 K3 J
}
% q _( J5 Z' ~) O
/ d- k$ m8 g( i' N* x
: k" M r7 o% w9 @; A5 L, \
作者:
tulipyyf
时间:
2014-12-22 16:08
追加说明:任务是空闲任务,因此没有做循环。
* I" K" a+ m0 V- F' q, G
作者:
Lewis
时间:
2014-12-24 18:06
多次执行是没问题的,最好不要用空闲任务,优先级太低。
5 `6 V: w, Y8 \6 K/ b
欢迎光临 嵌入式开发者社区 (https://51ele.net/)
Powered by Discuz! X3.4