嵌入式开发者社区

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

作者: tulipyyf    时间: 2014-12-22 14:35
标题: upp问题,在SYSBIOS下的应用问题
下面的任务,只能在第一次执行UPP时成功,后面的均不成功,请创龙工程师看看为什么?
1 W9 c& K. ?& H& v1 j* X1 }' S
Void UPP_TASK(Void)
; K7 y4 x6 O) z9 f. S# l{
7 A$ {; n& w, e% b
6 p2 @% _& Q$ h2 @3 N8 C    int i,j,k,target_int_count=2;
9 }4 U- h/ C6 C6 F, A  B' b7 ~. k    char ch[2];2 b* u- u4 S$ D+ g+ Q# ]

/ S) J) d2 W: I- N9 R! m
4 G& T4 f/ w/ `6 l# K9 q7 N3 t; Z
% |8 a1 e3 a9 p& P/ n" f    upp_interrupt_count  = 0;
2 H! r) c- M; E2 C7 x: s    upp_error_count = 0;
/ t' q- A0 f/ r- {) g9 I$ ~1 X- X; t) s& F9 k/ X3 a
    UARTPuts("\tResetting uPP buffers...\r\n",-2);1 p3 g! w7 O, Y  Z! L
    // Initialize data buffers% w0 a/ j. M) \4 f
    for (i = 0; i < upp_frame_size; i++)$ |8 B2 u, H. e! y) H( I; e
    {* U* B) |$ P& V/ s. T# E2 p! ?! z& g
       upp_buffer_b =i;
  S$ C1 X. _+ M7 g       upp_buffer_a = 0xDEAD;0 H$ \: W* \: e7 j& y4 p" w9 \6 `
    }
+ C% \+ x" z9 ?$ i- P% _9 x" v6 k$ R
0 z: ^& e, R3 G    //for(i=0;i<1024;i++)  F/ U% Q2 a6 W0 P; l" L" o/ M8 L* w
    //    temp=0;- Q. M1 N/ w6 e* B
4 W$ X2 w1 V& z5 n
    //UPPReset();
" z! Q5 X! s8 |& D+ I    /*启动UPP DMA传输*/. N5 J: t0 u4 x/ z. Q: ~: g
    UARTPuts("upp_prog_dma_i\n",-2);
6 h; g: `% k) I    upp_reg_hdl->UPID0 = (Uint32)upp_buffer_a;( t. T9 P, i7 |% ~0 X
    upp_reg_hdl->UPID1 = ((Uint32)upp_line_count << 16) | (Uint32)upp_line_size*sizeof(Int16);" D- d# ~, N; c! d. @) a
    upp_reg_hdl->UPID2 = (Uint32)upp_line_offset*sizeof(Int16);
* U4 a# e; l' b6 D3 L1 Y6 S2 ?. A- Q
' O# V. M+ ?. ?8 ^& x    UARTPuts("upp_prog_dma_i\n",-2);
: t% g. Z  d' }! f$ q- ^/ `    upp_reg_hdl->UPQD0 = (Uint32)upp_buffer_b;6 g5 D1 `' k" V3 |9 B
    upp_reg_hdl->UPQD1 = ((Uint32)upp_line_count << 16) | (Uint32)upp_line_size*sizeof(Int16);
" A8 w# P5 A4 Z1 r9 `    upp_reg_hdl->UPQD2 = (Uint32)upp_line_offset*sizeof(Int16);
7 h& i* X" `  ^' [9 ?1 ]8 A) g
    /*等待UPP传输完毕*/) x; t. v) u' M' Q( ]! d2 q
    //i=0;
+ D) t6 W+ G, ~+ A# e% H+ y7 o    //j=0;8 g: q$ e, D: J* S+ I5 K2 O4 b
    while (upp_interrupt_count < target_int_count && upp_error_count == 0)
$ G" b: K( L, u" D    {$ b+ ?& y1 e; Y) d# \* E4 ?
        /*  测试UPP传输的同时操作普通DDR数据
' U; i# e* ]; ]7 [8 i        temp=i;; R& h( `: V6 x0 P! ?
        i++;
2 m0 {+ m4 A: ~0 c) P        if(i==1024)
; \; t* d- A0 X$ ]. G        {
+ |: l' ?: @5 |  \; t4 d( X7 d            i=0;, Z+ F$ P4 e$ Y* ~
            j++;8 @( v% H  C$ H& A4 j! }7 D' h
        }9 T5 {9 }  p9 C" a' J& s
        */" N' O# ~3 ]' v- C7 J$ a
' B# K6 t$ G9 j
       asm(" nop");3 H9 O1 B2 i9 Q+ e* b

  X: [5 ]6 ?! f% S* l9 _       //UARTprintf( "upp_interrupt_count=%d\n",upp_interrupt_count);
+ s& V* H$ z, Y    }/ F9 c+ O& M9 B) _9 s# n0 h

7 W  F9 b$ q  g! ~    /*检查UPP传输的数据是否正确 (loopback modes only)*/2 ?1 q7 L" U7 j8 G' [
    //UARTprintf( "i=%d\n",i);
* x/ k! S3 o8 J    //UARTprintf( "j=%d\n",j);
+ b( f' w% N  ~" I5 \5 t    UARTPuts("Data mismatch in buffers.\n",-2);( S5 Q7 d7 E( r
    if (upp_interrupt_count == 2 && upp_error_count == 0). B$ B1 p* X/ g" v
    {
# y/ k: a/ n/ d0 e        for (i = 0; i<upp_frame_size; i++)
! }' i& D( `. C  x3 Z' G- r0 ~        {7 N& ?1 m7 O0 X0 y1 f; p
            if (upp_buffer_a != upp_buffer_b)
; G+ p! R, y+ c. }; G2 w& e# P            {4 J8 ?) j1 q& y  u, E
                upp_error_count++;) l: Z2 E8 Q1 U' w/ q* F
            }
" B3 {; D( B# W% b6 [1 k        }5 x' T: ~; y9 x/ i% U
    }
0 j9 o% c5 B, o( b4 \# g+ z6 Z6 c( W, i6 j/ E' N' Z
    /* 报告通信结果*/
% d' s' `# R3 B    if(upp_error_count != 0)3 z9 b  i- Q4 n# H+ z6 _* _% q
        UARTprintf( "upp_error_count=%d\n",upp_error_count);4 L) L. D: E* X1 _1 B7 b6 M6 E( T
    else6 z, [& F$ m3 P" o- k
        UARTPuts("uPP transfers complete!\n",-2);; \0 C  @, ?3 [5 \1 `5 H$ V1 L  G" x

% Y; [, {5 E* p: G# ]    UARTPuts("Do you want to print all the data?(y/n)   ",-2);: S$ X/ w2 \- |9 }3 n
    UARTGets(ch,2);2 z3 p0 N9 @' t- K$ T( _
    UARTPuts("\n", -2);
8 F3 l1 s1 B# |; B$ R# L, K( y9 i( `8 y- Z3 r# l2 D+ e
    if(ch[0] == 'y'), ?6 {1 f1 A7 ~% ]1 W3 E. H
    {1 S: D9 w/ E: ?9 f. u4 w0 \
        /*打印全部读到的数据*/0 E) p$ @# y1 Y
        for(i=0; i<upp_frame_size; )7 J; X" Q5 x9 U* {* p  `& Z
        {" T: `" n( I0 ^0 J/ X/ {. G7 R
            for(j=0; j<5; j++)1 j, w4 ~& \( M/ g
            {
- O& p) A, b$ n, _                UARTprintf("upp_buffer_a[%d]=%d   ",i,upp_buffer_a);
9 W/ I8 I! y( l9 d                i++;
) b& Y# z& p# J5 j  _6 Q                //if(i >= 4096)# o! y. [; L$ X1 r, `9 s8 h  @  h; _
                //    break;/ ?4 _, ~0 d% K; m2 i$ g/ \
: s. h, w" h! x0 D
            }
: ^. t6 c. `" z. e            UARTPuts("\n",-2);
2 l  g; S3 ~, }' G. W( r5 c8 r. k        }6 _% @/ d- r) n9 U9 ^0 i! ~
    }) D, [: ?4 P4 J7 T9 }7 X6 o7 e+ r9 S
% m0 I% s" @8 F/ z" c' _
}
" Y" s! B8 k% B$ r& I, r; ^
1 s" n  G. C" L, S4 |0 D+ m

" W( O% A. P! x3 ~9 j% I6 |
作者: tulipyyf    时间: 2014-12-22 16:08
追加说明:任务是空闲任务,因此没有做循环。% n* c2 k4 v/ L' v6 j! B

作者: Lewis    时间: 2014-12-24 18:06
多次执行是没问题的,最好不要用空闲任务,优先级太低。9 a9 e: x. s0 s* k+ i6 ?





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