嵌入式开发者社区
标题:
upp问题,在SYSBIOS下的应用问题
[打印本页]
作者:
tulipyyf
时间:
2014-12-22 14:35
标题:
upp问题,在SYSBIOS下的应用问题
下面的任务,只能在第一次执行UPP时成功,后面的均不成功,请创龙工程师看看为什么?
1 p) i9 c+ G% M' `& F
Void UPP_TASK(Void)
' g$ R: W: F1 A h" J F8 x- P( w
{
5 p& F3 L; L. |7 F Z. A7 m* q1 {( t
# D1 J3 U2 O; I* S$ @( \, N
int i,j,k,target_int_count=2;
6 e9 T0 ~/ Z A x0 H
char ch[2];
! M+ M" d9 t' {9 J" R- T. s0 q
5 d2 d ~0 I h- d* F: n
# u# W, E- X6 q# g. j5 W3 j
8 T& \) p5 M+ }. G0 J% x0 C0 U
upp_interrupt_count = 0;
; |! D$ A& |% n) E8 {9 ^
upp_error_count = 0;
6 \! K8 Z: g* k& |
+ E, P+ }4 w8 A5 T
UARTPuts("\tResetting uPP buffers...\r\n",-2);
1 Z% _% h3 N- F% I
// Initialize data buffers
9 o R0 { ]6 w3 L# d
for (i = 0; i < upp_frame_size; i++)
! l6 S/ ^6 _! L- t1 C& ?
{
& p* s( F9 T9 V9 n# @: [) a8 u
upp_buffer_b
=i;
0 S# V! @) p) g0 C/ A3 D
upp_buffer_a
= 0xDEAD;
0 S2 a: r6 _# d( Q/ O. u
}
: ~/ v" J! i5 f) r2 J. P0 a
; ]" [; I0 {9 i
//for(i=0;i<1024;i++)
' _/ }1 J, x- n8 n3 x f( W
// temp
=0;
4 P0 Q' L' Z2 P4 A0 b
?6 s' O7 |5 e( _
//UPPReset();
8 P- H; c+ U/ y2 C, _4 h& d2 l
/*启动UPP DMA传输*/
" g. s* f! P. c* @0 f8 O4 W( N9 l
UARTPuts("upp_prog_dma_i\n",-2);
. I4 w8 M5 i4 G# g$ U6 y
upp_reg_hdl->UPID0 = (Uint32)upp_buffer_a;
c1 T( [: k, e- j- N
upp_reg_hdl->UPID1 = ((Uint32)upp_line_count << 16) | (Uint32)upp_line_size*sizeof(Int16);
/ l- x; `+ h/ g8 m/ E
upp_reg_hdl->UPID2 = (Uint32)upp_line_offset*sizeof(Int16);
; k4 E/ q; J0 G; f
$ B+ c& X: S: L' }& i: H& v2 T
UARTPuts("upp_prog_dma_i\n",-2);
# ^/ f, s6 \, V0 ~
upp_reg_hdl->UPQD0 = (Uint32)upp_buffer_b;
5 F# F+ q6 ?& s& q1 Y) `$ W
upp_reg_hdl->UPQD1 = ((Uint32)upp_line_count << 16) | (Uint32)upp_line_size*sizeof(Int16);
* o( s2 h5 B& r4 K6 ^% w
upp_reg_hdl->UPQD2 = (Uint32)upp_line_offset*sizeof(Int16);
1 A, |! k, @% N& M9 d+ _
' |# h( o) }9 D F) q
/*等待UPP传输完毕*/
: \$ B1 y4 t: d ? a
//i=0;
* R5 ]9 j) T7 y2 {# ~) Y E+ l
//j=0;
; [6 y! t$ z* G+ _, l
while (upp_interrupt_count < target_int_count && upp_error_count == 0)
- u: b G3 V9 T2 k# Q3 G x
{
- Y: c' B! W, r- u I5 Q
/* 测试UPP传输的同时操作普通DDR数据
8 c* c! p9 A/ s; Z# ^
temp
=i;
2 P: W3 U! q' w8 P2 F% h" _
i++;
4 L$ j( x2 C7 z* W
if(i==1024)
1 m5 t8 O. ?# y4 `5 Y+ \5 N+ n0 [
{
% Z* F) U1 w/ r- w$ ^7 l
i=0;
7 s* c& k! y3 K( Y( V E
j++;
& F' Y% F! ~$ n* b
}
3 r3 a& g+ ?7 d. ~
*/
7 g2 v! }: @/ ]0 A4 ^. P
( Z6 K/ I$ G1 Y& X, h
asm(" nop");
. N3 L$ @+ y1 z* S: p: Y% g+ E
' J# W( U$ W3 I
//UARTprintf( "upp_interrupt_count=%d\n",upp_interrupt_count);
1 } Z6 L: w- ]
}
8 K" T/ \/ ^7 k6 b
E! K `2 S( E' Z
/*检查UPP传输的数据是否正确 (loopback modes only)*/
/ s/ ^# R- C3 O v7 F& H0 X4 j* s
//UARTprintf( "i=%d\n",i);
# m8 y/ f& y" X0 T; a( s$ u0 [
//UARTprintf( "j=%d\n",j);
4 B3 h: [+ g1 ^; f; m- \* J
UARTPuts("Data mismatch in buffers.\n",-2);
5 C& y, W; ~2 |5 c
if (upp_interrupt_count == 2 && upp_error_count == 0)
e- t8 Z6 s& i) ~ N! n
{
# I4 E; E F. I `4 ^* ?; q% `
for (i = 0; i<upp_frame_size; i++)
. X# q& h( _8 U; ], R
{
% S8 L' O* u( W0 R$ P
if (upp_buffer_a
!= upp_buffer_b
)
5 w+ c: d" A9 H {5 t
{
4 G# P* W; H% Q6 W
upp_error_count++;
0 K4 c$ l" t! V: k
}
9 C9 {) ?, K R1 H% q4 }
}
1 ?* L( D( f8 j% J& C2 R2 `5 c( f/ T
}
9 z& d* _* j* I9 a
( S( v% ^1 [5 T; A! W5 C
/* 报告通信结果*/
( \# |1 d ~' M# E- k* m; f
if(upp_error_count != 0)
b6 t$ x. J- W2 {7 q
UARTprintf( "upp_error_count=%d\n",upp_error_count);
1 f7 W8 d1 w1 r- u5 {" ^4 x% i
else
]! Y9 g- _) X2 Q. s: o/ Q
UARTPuts("uPP transfers complete!\n",-2);
* D* k6 t% ~' c7 d6 y. `
6 f( ] B5 |7 l* v- V1 G$ Q
UARTPuts("Do you want to print all the data?(y/n) ",-2);
& O+ P4 o5 Z! h8 J) v7 \! d3 _
UARTGets(ch,2);
% ^6 `! U2 H8 }
UARTPuts("\n", -2);
$ P6 G e' ?& Y$ R
" i% ]/ U1 g% R4 l1 q
if(ch[0] == 'y')
4 z- ~/ l; B& _3 I# a \: Q) D% F ^
{
" [2 C% m2 a& L- {& ^
/*打印全部读到的数据*/
! f7 a" P( J2 L! I7 @
for(i=0; i<upp_frame_size; )
1 W: D7 K6 B t4 E1 G( L0 m* H
{
% u( B; t0 O! Y, `( g
for(j=0; j<5; j++)
& H/ ], ^3 V) O7 X
{
3 T2 h2 r' z" {3 |+ F8 F
UARTprintf("upp_buffer_a[%d]=%d ",i,upp_buffer_a
);
: _- @! @3 N# }; B3 E+ ]# X
i++;
4 ~ G1 K! C" ?& m4 s9 h. ~ ~( ?5 Y: ^
//if(i >= 4096)
3 |: v" J2 m, d( j
// break;
& U) d: l) m P9 I2 x1 H
9 R w. T9 S' p$ @0 B0 D; `6 n
}
4 e6 m, Z0 g% s
UARTPuts("\n",-2);
7 `/ O0 n& ~ O
}
, ~- B5 m. a# }7 D
}
( W* I" s3 m# w4 ?4 @! x
/ W+ k7 S# k( T# Z; W
}
3 n& I( u7 w7 c' i( t
! a A2 h6 {) ^1 I1 O
" _% l. D/ J' f3 k& X
作者:
tulipyyf
时间:
2014-12-22 16:08
追加说明:任务是空闲任务,因此没有做循环。
- m! C$ A0 h; A8 i& [2 t
作者:
Lewis
时间:
2014-12-24 18:06
多次执行是没问题的,最好不要用空闲任务,优先级太低。
9 f$ _- I1 R9 M
欢迎光临 嵌入式开发者社区 (https://51ele.net/)
Powered by Discuz! X3.4