嵌入式开发者社区

标题: upp问题,在SYSBIOS下的应用问题 [打印本页]

作者: tulipyyf    时间: 2014-12-22 14:35
标题: upp问题,在SYSBIOS下的应用问题
下面的任务,只能在第一次执行UPP时成功,后面的均不成功,请创龙工程师看看为什么?, e. Y' `6 A# @
Void UPP_TASK(Void)
  w4 p) x% C" E8 E# v4 u, `, }{
, {: H) y7 t0 C4 g4 S* O  u& c& m' a' E4 U# h# Y
    int i,j,k,target_int_count=2;& g) u( }( s- h$ e
    char ch[2];
3 a1 S) R* x7 Z, @) j7 S7 q0 {+ m9 w' W8 \6 J' D7 B. X

! d) H7 f& \- A/ o  w% T# I+ O3 s2 c' G3 N. ^- W- d
    upp_interrupt_count  = 0;
+ ^( w6 N3 ?+ T! S0 D" l; Z+ V    upp_error_count = 0;
8 J0 h! u. l4 A# j. R7 ~$ A
, y7 [( a" P1 n  k$ w    UARTPuts("\tResetting uPP buffers...\r\n",-2);, u( S6 S7 j( V, L/ W9 N
    // Initialize data buffers- Q0 W, h+ o5 K
    for (i = 0; i < upp_frame_size; i++)! @# b& E( \. U' j3 r
    {' g$ f: J& E1 ~$ o$ R
       upp_buffer_b =i;
' l3 ^4 `' x  [% `8 k9 E& }       upp_buffer_a = 0xDEAD;
0 V9 `8 w# N9 b) G    }9 B( ~1 D$ p' Q/ t: {  A; B3 B
3 f& E$ W! k: p- b0 W
    //for(i=0;i<1024;i++)
' k- _8 [1 j  T* f% B5 J& M    //    temp=0;
4 }1 e# r% c: R; X
% v6 K7 M7 f6 r  Y6 W2 T: v    //UPPReset();  O# r  |% h8 U: q/ ~8 M
    /*启动UPP DMA传输*/
, Y+ Z, Z" V! N    UARTPuts("upp_prog_dma_i\n",-2);
' G$ `# Q$ D/ _/ ]" q( B    upp_reg_hdl->UPID0 = (Uint32)upp_buffer_a;4 ?* ^& r0 c. a; b/ d0 H) h0 a! r
    upp_reg_hdl->UPID1 = ((Uint32)upp_line_count << 16) | (Uint32)upp_line_size*sizeof(Int16);! ?- m  j) A, U- ^5 T
    upp_reg_hdl->UPID2 = (Uint32)upp_line_offset*sizeof(Int16);6 X/ X: C3 I+ b. L3 O0 x

) k7 s7 z4 Z2 F' A$ A2 G    UARTPuts("upp_prog_dma_i\n",-2);+ e/ R: W4 j1 E
    upp_reg_hdl->UPQD0 = (Uint32)upp_buffer_b;; z1 H( x# L. q( P/ Z
    upp_reg_hdl->UPQD1 = ((Uint32)upp_line_count << 16) | (Uint32)upp_line_size*sizeof(Int16);
: Y; I. w' U2 n) C) j    upp_reg_hdl->UPQD2 = (Uint32)upp_line_offset*sizeof(Int16);4 a8 {" T" _- i$ Y' Q3 G5 g3 w
4 f$ \. j# K6 r$ a7 W; @
    /*等待UPP传输完毕*/
# u/ @# {" A6 b: |& p- O0 I    //i=0;- @8 M% ]3 q. i7 m3 V
    //j=0;; r' i/ |8 Y+ L- J- s& |9 [! J
    while (upp_interrupt_count < target_int_count && upp_error_count == 0)5 B; i9 Q8 G. L# O7 R1 N2 S
    {, ^4 q/ s$ ^" q- I
        /*  测试UPP传输的同时操作普通DDR数据
+ N  M# ^% }8 H        temp=i;8 b+ q% w7 q7 _
        i++;
# e5 y% Y) O7 P1 u        if(i==1024)
, N! o* x  C% @& h2 f* ?        {
' t) r0 m& T+ i4 R            i=0;; l( q9 V% q7 J' b9 q
            j++;' Y7 A+ x5 X& y5 n8 j2 L( a, U
        }- V' m2 H8 C  P$ w9 {7 m: s
        */
9 z9 g3 G9 q; P0 J
5 ]: |0 p; C# C. H, z# ]% u. C5 |       asm(" nop");
6 T3 _( d1 [1 b3 A" u. L  |. I
9 k5 ^: f. B# K* f       //UARTprintf( "upp_interrupt_count=%d\n",upp_interrupt_count);# C4 z0 t5 U/ [( M" y; T5 {
    }
9 t! ?+ z' M7 K& O5 R: X* X; F/ m. n# T  \8 n/ A( ]8 g, y
    /*检查UPP传输的数据是否正确 (loopback modes only)*/4 K3 o. C' }& e! t: E! H
    //UARTprintf( "i=%d\n",i);
& a3 X% }" o& K( I. P    //UARTprintf( "j=%d\n",j);# ?) {  V4 p; x) U" n* }
    UARTPuts("Data mismatch in buffers.\n",-2);
; f1 l1 a: x! }/ h    if (upp_interrupt_count == 2 && upp_error_count == 0)
$ Z4 R* f3 `/ o$ b* N+ H+ q    {0 F2 D4 `3 d. s8 e
        for (i = 0; i<upp_frame_size; i++)1 J. _# X# k' Z
        {
' F2 l4 H6 e$ w3 C3 `            if (upp_buffer_a != upp_buffer_b)
$ v* t0 z: p9 l) ]4 K            {
8 G4 k2 c. z* X. y( m3 @3 ~                upp_error_count++;
( T9 |9 H, k5 S# e3 o1 a4 L# _            }
2 f& l9 Y. z8 P, v        }  z2 i+ d6 U7 b" G& N0 J, B6 L
    }
  q' r. N6 L9 n+ B0 ^$ t4 J$ R" g" D& M5 _
    /* 报告通信结果*/9 n9 J% E1 R+ A7 X# a, v" V% b
    if(upp_error_count != 0)
( V3 c7 N2 r( Y( S9 s: u( L8 ]+ ^        UARTprintf( "upp_error_count=%d\n",upp_error_count);; J" g3 h( ]5 s# _: K# ~" X* i
    else
$ q4 ^* C) C7 H% R2 @! X        UARTPuts("uPP transfers complete!\n",-2);: K9 n1 f, u  z! u4 l1 w% f
3 D( q; T" n0 N$ x" H" I! U
    UARTPuts("Do you want to print all the data?(y/n)   ",-2);
7 ~* @8 o5 x0 l) `' n+ Y    UARTGets(ch,2);# d2 y0 r; t) Q3 \
    UARTPuts("\n", -2);* y; e3 K6 L9 `" d) `

; W+ E! c2 b- I5 i2 ]    if(ch[0] == 'y')
+ q: y- x: B- |, n7 J' j4 r    {; u9 A2 V7 ~- R) P
        /*打印全部读到的数据*/
7 P$ d$ D% }& Y9 B( z- f        for(i=0; i<upp_frame_size; )/ E7 O+ x) F( f7 ^
        {( i% I4 H. E7 T7 S  F+ |
            for(j=0; j<5; j++)
8 c; d" m0 E" g2 \' ?            {
1 Q' x  T3 u) c                UARTprintf("upp_buffer_a[%d]=%d   ",i,upp_buffer_a);
8 G$ V) G8 s$ c2 ]8 d# K0 |: d2 x1 i                i++;
: \5 @) j8 Q7 M1 i                //if(i >= 4096)
8 A( r+ f, [1 K. N0 M7 ^+ B9 M                //    break;9 b1 n8 s& [7 P4 S
$ ~% O3 y  @( h" j8 g: ]: |
            }
$ g3 a3 n- Y; E$ \9 V8 D" U            UARTPuts("\n",-2);% _, i0 ]5 _2 U7 C& p! D
        }+ t9 N- s. @5 Y* L; {7 D
    }
7 m7 \/ s/ J* R0 E3 H  g6 A$ B3 w. F  ]) n5 }; D' i
}

4 d& K  S) j% K" m8 L, \! Z
+ S* g& x" n7 I. C6 J

+ u* `* l) g8 K% ?# b
作者: tulipyyf    时间: 2014-12-22 16:08
追加说明:任务是空闲任务,因此没有做循环。
; t3 x2 w* f6 H" p0 G( _
作者: Lewis    时间: 2014-12-24 18:06
多次执行是没问题的,最好不要用空闲任务,优先级太低。
/ q9 m* w; b$ i




欢迎光临 嵌入式开发者社区 (https://www.51ele.net/) Powered by Discuz! X3.4