嵌入式开发者社区
标题:
upp问题,在SYSBIOS下的应用问题
[打印本页]
作者:
tulipyyf
时间:
2014-12-22 14:35
标题:
upp问题,在SYSBIOS下的应用问题
下面的任务,只能在第一次执行UPP时成功,后面的均不成功,请创龙工程师看看为什么?
3 `- t L$ F1 d5 d
Void UPP_TASK(Void)
, E' Y) D' ?. D" O3 E; T
{
' ^1 s" z& p8 |$ `7 i+ s7 M) n
* [2 ^$ j4 F: h' b
int i,j,k,target_int_count=2;
M& i3 a9 \5 x
char ch[2];
6 R( f4 n! L" z Y/ Y" n
# V6 g7 \/ Z; e9 y# n' `3 ~0 V
, D3 z7 }- ?7 U# y, x
( R5 Q: K- V1 E% x+ O% g
upp_interrupt_count = 0;
4 o* c7 C2 n% l) i
upp_error_count = 0;
9 H0 w( A1 ~/ F$ s5 {0 c+ Y
. o# Z, p) x! Q9 C# g% a/ {
UARTPuts("\tResetting uPP buffers...\r\n",-2);
1 y6 Q* X$ s) f3 P. V
// Initialize data buffers
% ^' `4 D& a8 g6 q* m g
for (i = 0; i < upp_frame_size; i++)
( \) {3 K( f5 [& G" }+ c- W
{
) H0 Q+ @9 j& F/ O' z
upp_buffer_b
=i;
/ s+ G6 X) }3 ^! e% f
upp_buffer_a
= 0xDEAD;
C& K$ z7 ?* n6 Y; b, }0 b
}
$ u O9 m. S5 z' C% p
7 v R- e2 H/ S& b. s( a( C2 c
//for(i=0;i<1024;i++)
8 i4 d7 v7 Y3 f7 c+ t
// temp
=0;
% _2 h( A+ |1 S a. ?
' J0 {/ D* H- H* b
//UPPReset();
1 e/ l& v: n% w8 `' [
/*启动UPP DMA传输*/
, K* N4 H5 c4 [$ r$ ?/ s+ u3 p) `- A
UARTPuts("upp_prog_dma_i\n",-2);
2 h4 P% k; a0 p. E& t% Z* V
upp_reg_hdl->UPID0 = (Uint32)upp_buffer_a;
! g! R% p0 {6 o4 F8 ]
upp_reg_hdl->UPID1 = ((Uint32)upp_line_count << 16) | (Uint32)upp_line_size*sizeof(Int16);
, Y8 s) j9 g5 ~' |
upp_reg_hdl->UPID2 = (Uint32)upp_line_offset*sizeof(Int16);
/ z0 S; g3 f% x* h' i' I
; B" q( L. s/ e. a' s0 o1 s
UARTPuts("upp_prog_dma_i\n",-2);
9 i0 U& J" ?! Z$ q$ N( x0 u
upp_reg_hdl->UPQD0 = (Uint32)upp_buffer_b;
( Q! Z. t, R; T' L S4 h/ R
upp_reg_hdl->UPQD1 = ((Uint32)upp_line_count << 16) | (Uint32)upp_line_size*sizeof(Int16);
% E& ~$ H6 z5 p' v) g ^4 ~4 G5 y, X
upp_reg_hdl->UPQD2 = (Uint32)upp_line_offset*sizeof(Int16);
+ @: }/ g2 q6 }" @; |
6 }' D/ I) Z1 u, T d1 |3 `! Y# a/ f
/*等待UPP传输完毕*/
; d m _" X ?4 K
//i=0;
& p# m$ l7 P. H, G1 r
//j=0;
+ J d7 A5 B: H2 j5 z( B
while (upp_interrupt_count < target_int_count && upp_error_count == 0)
8 s7 V% F0 X) Q1 Z7 W% \9 y) q1 k
{
$ _4 h# B2 Q0 l4 c& C) d7 F
/* 测试UPP传输的同时操作普通DDR数据
9 m, J4 e! [ H5 I8 @
temp
=i;
0 f0 [, u% n5 G4 ^( e
i++;
r1 H3 j; } ~# g
if(i==1024)
o6 `5 s, F; ^% i! N( r) D' s
{
, H2 E% L0 v# U- P5 ]
i=0;
2 T: B9 K$ i/ r8 @+ b' e
j++;
& u6 {, \! u+ D! s* o9 l: [+ D
}
% |7 c& ?8 b- g. b
*/
+ m" H' ~- k2 b$ y, e$ |
- h' \- g K ?
asm(" nop");
/ P Y2 ^$ S; p5 D2 O* e
' j' C9 b6 p5 G% q0 W
//UARTprintf( "upp_interrupt_count=%d\n",upp_interrupt_count);
! X9 s9 I) W$ J1 Z5 c' h2 @
}
) z# l' u8 h& O. {: A4 D
- Q- Z# B% R6 U) J4 [% L) S; s
/*检查UPP传输的数据是否正确 (loopback modes only)*/
8 w% O p& S; ]" m; g4 {
//UARTprintf( "i=%d\n",i);
7 x/ g7 u$ ^! Q$ x5 `
//UARTprintf( "j=%d\n",j);
/ x4 f1 x6 r& u8 r9 z
UARTPuts("Data mismatch in buffers.\n",-2);
$ H+ h$ ?1 J( P- \
if (upp_interrupt_count == 2 && upp_error_count == 0)
& {5 G+ ~$ @8 b3 p" e9 K/ l
{
/ |* ~( P4 ?7 z' Z, c+ o+ W X, R) y5 ^
for (i = 0; i<upp_frame_size; i++)
3 @0 M/ L' a9 {) b3 v
{
* @+ m; ]% K) m* l, }4 K9 L
if (upp_buffer_a
!= upp_buffer_b
)
. M: b. o, \/ T: w
{
2 ?/ `) v: f2 m' Y, j
upp_error_count++;
U1 l8 Z* f9 w. R3 ?) @
}
7 |4 O" L/ S g
}
t* I. w9 ^6 m+ I
}
X- Q; {6 b% w1 _, M
0 @! i5 f9 [/ t5 }% F0 T8 v! v
/* 报告通信结果*/
) U0 e' y8 `4 m7 G& e# y+ L" X' _
if(upp_error_count != 0)
# U: G3 U1 M$ q! @1 F
UARTprintf( "upp_error_count=%d\n",upp_error_count);
) ]/ W8 C0 h8 {! G7 i6 M
else
. j8 k. B% C, C& W( |
UARTPuts("uPP transfers complete!\n",-2);
[& ]! u( @3 ~9 D& J
* F n4 L1 J2 O- ~
UARTPuts("Do you want to print all the data?(y/n) ",-2);
3 W9 d |2 a3 `$ m: m- W
UARTGets(ch,2);
" {* y' R9 u+ t# u/ U4 ^
UARTPuts("\n", -2);
5 v' ?5 o3 r( p
/ _5 ]2 g: J9 P) @4 a
if(ch[0] == 'y')
6 ~3 T4 t! g2 e' z7 t. h4 ?
{
) }/ J8 |) }. r0 o0 F
/*打印全部读到的数据*/
0 ?5 N1 u3 G7 L: d# h
for(i=0; i<upp_frame_size; )
) j3 a# r, C' \; p7 O
{
2 p/ l3 J, f2 H" Q
for(j=0; j<5; j++)
2 `5 s" [1 Z$ x% ^+ _/ P. O9 \' {
{
/ `( \% J, P; T& S
UARTprintf("upp_buffer_a[%d]=%d ",i,upp_buffer_a
);
s$ R( G& R( a( W6 H n( o
i++;
! z' i8 _: Q# Q, Q: T: f; j' I
//if(i >= 4096)
1 \9 f6 q" A+ f$ n' ^. m# V: @
// break;
9 q7 _( {$ e/ o4 x$ J
0 J1 M, M3 v) Z& L& V* ?
}
& W2 C3 ` m4 `# p s( J% c% }( E
UARTPuts("\n",-2);
0 b* W0 C! T! |# q; F! L2 z# f
}
# y ]8 z. n8 y
}
0 t+ \" ~7 \' K' b
$ b' q& `2 Q- c
}
- E2 N# n5 A7 @: G" p. B* O% N1 W- t
; S! @) D1 E1 V* ~% a
( O( m: V( V' L5 R1 I9 Z
作者:
tulipyyf
时间:
2014-12-22 16:08
追加说明:任务是空闲任务,因此没有做循环。
$ Y% E9 d) T( E+ O. b
作者:
Lewis
时间:
2014-12-24 18:06
多次执行是没问题的,最好不要用空闲任务,优先级太低。
# y4 d; M- ]4 p* h/ W' t
欢迎光临 嵌入式开发者社区 (https://51ele.net/)
Powered by Discuz! X3.4