嵌入式开发者社区
标题:
upp问题,在SYSBIOS下的应用问题
[打印本页]
作者:
tulipyyf
时间:
2014-12-22 14:35
标题:
upp问题,在SYSBIOS下的应用问题
下面的任务,只能在第一次执行UPP时成功,后面的均不成功,请创龙工程师看看为什么?
/ _9 _" ?. p# J' u' F0 p4 Y
Void UPP_TASK(Void)
$ K. a0 O5 B6 R# L
{
7 G" L: m4 R" K! S5 F% q. A
7 K7 ? X- h$ N- G+ r
int i,j,k,target_int_count=2;
7 o/ H1 g! V: ^
char ch[2];
" t5 s' G; l* R- E, }
) H8 S) X# ? j; ?
7 H+ C! t9 J8 m! i/ C8 F* ?/ ~1 H
9 Z+ d* g% N6 X4 I1 p
upp_interrupt_count = 0;
6 A; O( C- e* N
upp_error_count = 0;
+ p+ p5 |; ? P M% Q) S" c
( ]' L0 f8 H) d C8 Q4 X
UARTPuts("\tResetting uPP buffers...\r\n",-2);
5 D/ {4 ]: _/ [' D3 U w2 ?
// Initialize data buffers
- e8 Q8 _7 Q" }1 K% ^
for (i = 0; i < upp_frame_size; i++)
# L: j' Q/ B4 E
{
6 n U4 B* M* U8 B% W& z8 v
upp_buffer_b
=i;
- J, G# V2 \; `& w! p( l/ x4 N
upp_buffer_a
= 0xDEAD;
5 i* h9 `$ q( ? U
}
* U% r% N( |; |) ~0 h: t
( s% w+ C6 Z& N. i* V6 Z# P+ ]1 F
//for(i=0;i<1024;i++)
: e! t7 c2 d$ y3 k6 |
// temp
=0;
- _+ ?. y% {" f# y: ~
6 D; O1 |; \- G S) ]
//UPPReset();
; ~5 H& t' q+ I! ]) b" @+ f. `
/*启动UPP DMA传输*/
! ~+ R* u! U h8 ^/ a, G
UARTPuts("upp_prog_dma_i\n",-2);
. V6 H! ^! W/ Z3 E G4 @9 p# y) e
upp_reg_hdl->UPID0 = (Uint32)upp_buffer_a;
8 U9 U* n/ \' n
upp_reg_hdl->UPID1 = ((Uint32)upp_line_count << 16) | (Uint32)upp_line_size*sizeof(Int16);
( K, b( Z1 F) |7 P
upp_reg_hdl->UPID2 = (Uint32)upp_line_offset*sizeof(Int16);
* f* X- ]7 D4 L7 {. V: y' h
: \# r4 Y1 l- ~( Z) _- k1 @
UARTPuts("upp_prog_dma_i\n",-2);
/ `/ R% i; n5 ?3 d
upp_reg_hdl->UPQD0 = (Uint32)upp_buffer_b;
4 Z. e1 b7 j$ X7 {4 Q( K5 q5 I. ~
upp_reg_hdl->UPQD1 = ((Uint32)upp_line_count << 16) | (Uint32)upp_line_size*sizeof(Int16);
! R" y2 j( E* [" h6 L
upp_reg_hdl->UPQD2 = (Uint32)upp_line_offset*sizeof(Int16);
8 S* ?5 A' I; k3 e
* y W" v7 g% L
/*等待UPP传输完毕*/
6 y3 Q) Z( s" T4 _# a
//i=0;
0 H* c5 Q' f% n1 f
//j=0;
]* n5 V0 ^" G; D( e* ~7 O' z
while (upp_interrupt_count < target_int_count && upp_error_count == 0)
* X& C T; j4 W1 G. X$ [, s* y3 \
{
; ?/ {) t c! c& M
/* 测试UPP传输的同时操作普通DDR数据
' A) @: Z8 u8 `4 U
temp
=i;
: d/ Q4 J- s( x: i' T
i++;
) q$ m) e1 J% k/ ^7 x0 @8 y
if(i==1024)
- [) Y7 }% H3 p! o
{
2 M! m, a! K1 p5 Z3 T
i=0;
7 C# E" X( z# ]' }3 W; I1 W- \8 G
j++;
, ]; v" A% X/ e( K: e2 E% A
}
4 C& B% ^. O6 h% y: K5 s
*/
* o" D5 H2 g1 A# V" H
7 P6 g9 M! v' z$ l7 X
asm(" nop");
0 i4 i+ T+ [9 s5 Z. b" Q8 y/ l, n
+ U8 I) Q \( @
//UARTprintf( "upp_interrupt_count=%d\n",upp_interrupt_count);
% [# ?! M U( |
}
% g; O# H: K/ N, ?; R' @* r1 u! o
( r7 ?4 {! K0 ]4 m; Q# y! E
/*检查UPP传输的数据是否正确 (loopback modes only)*/
' a& j) o8 d! ^# g
//UARTprintf( "i=%d\n",i);
! i9 D+ \: j) a# ~4 W1 }' I: `
//UARTprintf( "j=%d\n",j);
- Z8 m9 Z }" D- U# A8 `3 n2 V- a
UARTPuts("Data mismatch in buffers.\n",-2);
* p9 ?1 r0 c1 g' I; F8 w
if (upp_interrupt_count == 2 && upp_error_count == 0)
& Y, ~% m9 H8 J m) B
{
5 s' k0 f. U) U: O) ~/ K: [0 D
for (i = 0; i<upp_frame_size; i++)
! e* v0 f$ }5 [6 I; w/ l3 P
{
3 u r6 t$ ?% G& u X( U: @$ ]) N
if (upp_buffer_a
!= upp_buffer_b
)
/ |3 Z' P8 K' M
{
6 d: x6 N2 g7 J L! u
upp_error_count++;
1 V8 ]# l, k" R* y( \7 P
}
4 C6 k( S- S% P
}
, n4 @' P5 C- u5 ` Z6 S
}
$ t+ P% {6 B+ w6 N6 {0 c- ]2 ?
/ i: b6 M1 h" M+ r, Q
/* 报告通信结果*/
. v* A( Z2 c: k& } [; k1 C* K
if(upp_error_count != 0)
) C+ f a' q: B" U
UARTprintf( "upp_error_count=%d\n",upp_error_count);
3 k' P r, @) r0 |8 u
else
: u9 C- @- l4 H( V6 Z
UARTPuts("uPP transfers complete!\n",-2);
2 @# M) G! ?! z' m! E5 `
1 S8 X& X9 D e
UARTPuts("Do you want to print all the data?(y/n) ",-2);
1 U/ K0 X/ E/ k5 _5 d7 l
UARTGets(ch,2);
) T- S0 `4 {% i: }, A$ b& `2 E
UARTPuts("\n", -2);
8 F E" |- z w* { |$ b0 K) s
# ~) g; o5 I. ?1 d
if(ch[0] == 'y')
% z# a* w: ?2 h2 E3 k/ q
{
* P: m7 R$ `: a
/*打印全部读到的数据*/
7 ?( m2 w- E( ~" w ^) Z+ E
for(i=0; i<upp_frame_size; )
/ ?4 d5 b* O* l/ D6 ~
{
* S7 m" F* F m
for(j=0; j<5; j++)
! g2 h+ F0 ~8 q" i
{
) h- K! j6 n5 s/ G
UARTprintf("upp_buffer_a[%d]=%d ",i,upp_buffer_a
);
) J _2 T0 n; c# m \: S7 M
i++;
' ]7 C' O5 H5 ?' n2 k8 D/ v3 h
//if(i >= 4096)
1 f# U. j& Z/ E! T. R7 l+ _ g5 V
// break;
/ @+ k* Q& g; z+ H! u7 I0 v3 }
: j' T; T$ B* Q* F. o; m
}
. m; y# S" B2 ~- p4 y" N8 y" ?' T
UARTPuts("\n",-2);
; }2 w: z, [. w# A. x
}
/ ]! V. ^# o) p$ x, _
}
1 |# B' T( y( f% h- G+ E
4 H" r, Y* o$ i U
}
$ O4 h5 n" _' e' u' B
. ?+ n5 A; X: c+ [
9 g4 c- f& D M; `8 h
作者:
tulipyyf
时间:
2014-12-22 16:08
追加说明:任务是空闲任务,因此没有做循环。
. p" V" @& S; s4 ^2 n6 T& Y& ~
作者:
Lewis
时间:
2014-12-24 18:06
多次执行是没问题的,最好不要用空闲任务,优先级太低。
5 x$ ]' n- l" d" a9 [
欢迎光临 嵌入式开发者社区 (https://www.51ele.net/)
Powered by Discuz! X3.4