嵌入式开发者社区
标题:
upp问题,在SYSBIOS下的应用问题
[打印本页]
作者:
tulipyyf
时间:
2014-12-22 14:35
标题:
upp问题,在SYSBIOS下的应用问题
下面的任务,只能在第一次执行UPP时成功,后面的均不成功,请创龙工程师看看为什么?
$ W; s+ {7 z2 H- H
Void UPP_TASK(Void)
, I) E1 m$ M' P p3 D
{
, z' S9 ^* `& y
' K( p/ K* Y- N$ p# w1 }
int i,j,k,target_int_count=2;
: C- i! N; N8 \, y! t
char ch[2];
- Y6 v5 d5 @# L: |' I D
" W4 q6 D( Z/ V/ q0 F6 T
( o$ X& P# ?, h% j
* x! X" N0 H# G- O1 Y
upp_interrupt_count = 0;
8 B# V1 Q: ~! S$ T8 o
upp_error_count = 0;
8 x% }) }0 @4 v7 w( R: b# x
. y$ L, ^# t; ^! P) k9 f/ X
UARTPuts("\tResetting uPP buffers...\r\n",-2);
4 [9 i/ w5 ]$ {9 p
// Initialize data buffers
9 o# k5 R5 c" w; T
for (i = 0; i < upp_frame_size; i++)
, h* \- b# |! R: J6 T9 w
{
% E. r# K7 ~ k8 u% y: y p: q
upp_buffer_b
=i;
8 [. m( Y8 c+ ~3 |% L% b0 m
upp_buffer_a
= 0xDEAD;
& {# U# z# i0 z, _. J
}
V3 A1 V$ ]: P$ j" F6 r3 m" b0 M
: g# V" \9 S- Z) Q8 X8 Z* ?
//for(i=0;i<1024;i++)
3 f1 ~9 l# l( |& w4 }& [" A$ c& @& B
// temp
=0;
' @( M. A$ _8 ?$ Z8 [8 n
4 e8 P7 f t! L: Z' ^
//UPPReset();
- I: Y5 w9 u+ S) \( I! W
/*启动UPP DMA传输*/
: f3 D$ H; f" ~5 G
UARTPuts("upp_prog_dma_i\n",-2);
B; M" L' ?% m
upp_reg_hdl->UPID0 = (Uint32)upp_buffer_a;
) t+ A2 X. f# ]8 w+ K2 k
upp_reg_hdl->UPID1 = ((Uint32)upp_line_count << 16) | (Uint32)upp_line_size*sizeof(Int16);
1 U0 k. C8 q$ b5 a/ ^; v1 F5 J% F
upp_reg_hdl->UPID2 = (Uint32)upp_line_offset*sizeof(Int16);
- ?: m, G5 m l7 N. ~ I/ m1 A
$ W- f4 L7 q# a
UARTPuts("upp_prog_dma_i\n",-2);
* s% ^& @$ p+ U1 t& z& b$ s3 K
upp_reg_hdl->UPQD0 = (Uint32)upp_buffer_b;
: P) z8 J. D' [, o/ r- r) p
upp_reg_hdl->UPQD1 = ((Uint32)upp_line_count << 16) | (Uint32)upp_line_size*sizeof(Int16);
# G t, Z* F+ M6 z
upp_reg_hdl->UPQD2 = (Uint32)upp_line_offset*sizeof(Int16);
5 s3 p7 {! G+ P; |
+ G$ B9 U2 X! I, [# i8 M
/*等待UPP传输完毕*/
2 K' G' k `& J+ s; j
//i=0;
8 c" {( X+ j3 O/ }! P7 W) b6 p/ V
//j=0;
# x( d/ o& C2 z' M5 a) }
while (upp_interrupt_count < target_int_count && upp_error_count == 0)
6 m- t6 G! V6 ?0 F& D
{
1 d" N i B0 Z! G5 I
/* 测试UPP传输的同时操作普通DDR数据
" R# {2 k6 s# m, }
temp
=i;
. t& M# w0 g- a% i- c7 t
i++;
) r/ U/ [/ j' W6 z( i
if(i==1024)
' k E( F r# J& a- w
{
' d- }+ w# C+ L
i=0;
; M+ o5 m3 P: u+ H4 P9 H
j++;
# Y. H1 }: h0 ]; @3 N7 l
}
1 t4 i3 j$ g |! r) U
*/
5 [6 B3 h/ A: A6 X
* J! N7 S* D7 S$ g% |6 H! V
asm(" nop");
& \) U- r1 E0 R/ [) A F# J
$ ^8 m# A L' s" t
//UARTprintf( "upp_interrupt_count=%d\n",upp_interrupt_count);
7 s% {0 u7 I: r2 h+ @, A5 D
}
1 \% ~, S. N9 h& M j
: Y+ r3 M0 a. R' f
/*检查UPP传输的数据是否正确 (loopback modes only)*/
. W1 e" ~# J$ N8 b
//UARTprintf( "i=%d\n",i);
) \3 u4 A( F2 p) {& ~7 W
//UARTprintf( "j=%d\n",j);
2 K6 ^" G7 d/ r% {$ ?$ |5 ^
UARTPuts("Data mismatch in buffers.\n",-2);
8 d3 @! ]( m4 E0 I# Z
if (upp_interrupt_count == 2 && upp_error_count == 0)
; ~3 V4 K9 ^- p% X3 `
{
3 I' c* N" U! A
for (i = 0; i<upp_frame_size; i++)
/ j6 V Q. |# }, z) r
{
8 W4 i Y& W. P0 S) y
if (upp_buffer_a
!= upp_buffer_b
)
1 w2 G3 `4 L1 ^) }
{
$ ~' W- P4 \6 k0 k1 j" b M
upp_error_count++;
$ j+ V3 G2 \1 D* y
}
' w: d- W( ~ o
}
- S3 f; ~/ v9 U3 p
}
. h; ^ T$ M5 C. j) l' x. k$ `
2 S7 H; F: n3 N6 V; |
/* 报告通信结果*/
/ k# j* O* F/ K, i7 \; a$ E8 u
if(upp_error_count != 0)
% Z7 Q/ f* g% y" Z( Z
UARTprintf( "upp_error_count=%d\n",upp_error_count);
$ ~! C& B; }& q" `) c
else
( L5 Q: G' p/ q1 c
UARTPuts("uPP transfers complete!\n",-2);
, X& |! q# F" G
+ Y" N1 `$ {3 t/ b4 J' A
UARTPuts("Do you want to print all the data?(y/n) ",-2);
3 b+ V5 L: _6 g8 B6 r! H/ h
UARTGets(ch,2);
1 U( X! x* a9 F9 W* Q8 O5 A. O
UARTPuts("\n", -2);
. V4 r, H5 o; D
+ }/ J9 g8 r; r# v
if(ch[0] == 'y')
' _; l0 k5 w0 W0 U0 b4 E$ ]1 h5 r
{
8 B1 ^/ P/ y0 o) ^0 B- ?' y# G
/*打印全部读到的数据*/
- [. R2 e- ]% E* B% ]
for(i=0; i<upp_frame_size; )
0 \! K) G: Q% o# i0 L0 R
{
- C' V- ?. h$ W9 @7 c
for(j=0; j<5; j++)
* s/ `7 u9 ^1 I
{
- W7 X3 Z" B% H% n
UARTprintf("upp_buffer_a[%d]=%d ",i,upp_buffer_a
);
/ C& [% u3 L# R$ S
i++;
# `1 O6 O/ g* k6 O8 [" C
//if(i >= 4096)
$ B9 a* Q [: _, t: g
// break;
1 D- [3 _ c( R" i
' ]9 |( M% M' m# H
}
) B; |9 f; W- A/ I" k. M
UARTPuts("\n",-2);
( ^, O, e4 n# k% `8 _
}
7 F( R3 R4 L/ x l4 K/ p# G
}
! l$ Q: C% j4 E5 ~, `) f
( D: H: w* q# B) V# b
}
5 B5 i( U6 O9 o7 I& E- b8 P* F
, @4 b1 F4 x7 R6 l9 e, p6 b
8 H7 k0 X4 O6 I' u( C7 U
作者:
tulipyyf
时间:
2014-12-22 16:08
追加说明:任务是空闲任务,因此没有做循环。
- R- A4 D$ M; x0 H" ?( g$ O
作者:
Lewis
时间:
2014-12-24 18:06
多次执行是没问题的,最好不要用空闲任务,优先级太低。
) z% H. [6 I" f7 d$ E" c0 r
欢迎光临 嵌入式开发者社区 (https://www.51ele.net/)
Powered by Discuz! X3.4