这些小活动你都参加了吗?快来围观一下吧!>>
电子产品世界 » 论坛首页 » 综合技术 » 基础知识 » blackfin,MDMA 请教:blackfin 同时开启两个MDMA ,产生

共2条 1/1 1 跳转至

blackfin,MDMA 请教:blackfin 同时开启两个MDMA ,产生冲突,为什么?

院士
2006-09-17 18:14:16     打赏
blackfin,MDMA 请教:blackfin 同时开启两个MDMA ,产生冲突,为什么?



关键词: blackfin     请教     同时     开启     两个     产生         

院士
2006-12-22 22:43:00     打赏
2楼
问 我在算法中同时开启两个片外SDRAM到L1SRAM的内存DMA,算法就出错;单独开启就正常,请问哪位大侠能帮助解决这个问题? 1: 补充对不起,我用的是blackfin561,DMA工作模式为FLOW = 7 (Descriptor List Large):谢谢! 2: 代码如下:#include "mpeg4_new_algorithm.h"
////DMAx_CONFIG, MDMA_yy_CONFIG Masks
/*#define DMAEN         0x00000001  // Channel Enable
#define WNR     0x00000002  // Channel Direction (W/R*)
#define WDSIZE_8 0x00000000  // Word Size 8 bits
#define WDSIZE_16 0x00000004  // Word Size 16 bits
#define WDSIZE_32 0x00000008  // Word Size 32 bits
#define DMA2D         0x00000010  // 2D/1D* Mode
#define RESTART         0x00000020  // Restart
#define DI_SEL         0x00000040  // Data Interrupt Select
#define DI_EN         0x00000080  // Data Interrupt Enable
#define NDSIZE         0x00000900  // Next Descriptor Size
#define FLOW         0x00007000  // Flow Control*/

//DMA1_S_CONFIG = FLOW|NDSIZE|DMA2D|DMAEN|WDSIZE_8    即0x7911
//DMA2_D_CONFIG = FLOW|NDSIZE|DMA2D|DMAEN|WDSIZE_8|WNR即0x7913
//y:16*16; u:8*8; v:8*8 单位byte
section("L1_data_ds") tDMA_descriptor tDescSrcy= {&tDescSrcu,0,0x7911,16,1,16,1,0};
section("L1_data_ds") tDMA_descriptor tDescSrcu= {&tDescSrcv,0,0x7911,8,1,8,1,0};
section("L1_data_ds") tDMA_descriptor tDescSrcv= {&tDescSrcdummy,0,0x7911,8,1,8,1,0};
section("L1_data_ds") tDMA_descriptor tDescSrcdummy= {&tDescSrcy,0,0x0911,8,1,8,1,0};

section("L1_data_ds") tDMA_descriptor tDescDsty= {&tDescDstu,0,0x7913,16,1,16,1,0};
section("L1_data_ds") tDMA_descriptor tDescDstu= {&tDescDstv,0,0x7913,8 ,1,8 ,1,0};
section("L1_data_ds") tDMA_descriptor tDescDstv= {&tDescDstdummy,0,0x7913,8 ,1,8 ,1,0};
section("L1_data_ds") tDMA_descriptor tDescDstdummy= {&tDescDsty,0,0x0913,8 ,1,8 ,1,0};
//y:48*48; u:24*24; v:24*24 单位byte
section("L1_data_ds") tDMA_descriptor tDescRefSrcy=   {&tDescRefSrcu,0,0x7911,48,1,48,1,0};
section("L1_data_ds") tDMA_descriptor tDescRefSrcu=   {&tDescRefSrcv,0,0x7911,24,1,24,1,0};
section("L1_data_ds") tDMA_descriptor tDescRefSrcv=   {&tDescRefSrcdummy,0,0x7911,24,1,24,1,0};
section("L1_data_ds") tDMA_descriptor tDescRefSrcdummy= {&tDescRefSrcy,0,0x0910,8,1,8,1,0};
section("L1_data_ds") tDMA_descriptor tDescRefDsty=   {&tDescRefDstu,0,0x7913,48,1,48,1,0};
section("L1_data_ds") tDMA_descriptor tDescRefDstu=   {&tDescRefDstv,0,0x7913,24 ,1,24 ,1,0};
section("L1_data_ds") tDMA_descriptor tDescRefDstv=   {&tDescRefDstdummy,0,0x7913,24 ,1,24 ,1,0};
section("L1_data_ds") tDMA_descriptor tDescRefDstdummy= {&tDescRefDsty,0,0x0912,8 ,1,8 ,1,0};



#define REFDMA
#define INDMA
//enable to global value , to convinient the function
section("L1_data_b")unsigned char *pSearchWin; //search window pointer
section("L1_data_b") MACROBLOCK *pCurrMB, *pTEMPMB;
section("L1_data_b") int iSearchRange, bIntra, flag_mbbuf = 0, is_full_ref;
section("L1_data_b") unsigned char *mbbuf_in;
section("L1_data_b") int  OffsetY  ;
section("L1_data_b") int  OffsetUV ;
section("L1_data_b") int  sc, scuv, sr, sruv;

section("L1_data_b") unsigned char *pppdy1 ;
section("L1_data_b") unsigned char *pppdy2 ;
section("L1_data_b") unsigned char *pppdy3 ;
section("L1_data_b") unsigned char *pppdy4 ;

section("L1_data_b") unsigned char *pppdu1 ;
section("L1_data_b") unsigned char *pppdu2 ;
section("L1_data_b") unsigned char *pppdu3 ;
section("L1_data_b") unsigned char *pppdu4 ;

section("L1_data_b") unsigned char *pppdv1 ;
section("L1_data_b") unsigned char *pppdv2 ;
section("L1_data_b") unsigned char *pppdv3 ;
section("L1_data_b") unsigned char *pppdv4 ;

section("L1_data_b") unsigned char* ppsry1;
section("L1_data_b") unsigned char* ppsry2;
section("L1_data_b") unsigned char* ppsry3;
section("L1_data_b") unsigned char* ppsry4;

section("L1_data_b") unsigned char* ppsru1;
section("L1_data_b") unsigned char* ppsru2;
section("L1_data_b") unsigned char* ppsru3;
section("L1_data_b") unsigned char* ppsru4;

section("L1_data_b") unsigned char* ppsrv1;
section("L1_data_b") unsigned char* ppsrv2;
section("L1_data_b") unsigned char* ppsrv3;
section("L1_data_b") unsigned char* ppsrv4;
section("L1_data_b")     unsigned char* pppdy4last;
section("L1_data_b")    unsigned char* pppdu4last;
section("L1_data_b")     unsigned char* pppdv4last;  
section("L1_data_b")     unsigned char* psrynext;    
section("L1_data_b")     unsigned char* psrunext;
section("L1_data_b")     unsigned char* psrvnext;


/// DMA descriptor lists
extern tDMA_descriptor tDescSrcy;
extern tDMA_descriptor tDescSrcu;
extern tDMA_descriptor tDescSrcv;
extern tDMA_descriptor tDescDsty;
extern tDMA_descriptor tDescDstu;
extern tDMA_descriptor tDescDstv;
         
/////////////////////////////////////////////////////////

#pragma optimize_for_speed
section("L1_code") int FrameCodeP_tss(Encoder * pEnc,
       Bitstream * bs,
       uint32_t * pBits,      
       bool vol_header,
       uint8_t** pMbCurAndRefWinPara,      //接口控制

       MACROBLOCK_CUR* pMbCurParamter ) // *pMbCur[2] peter add interface
{
     

    unsigned char* pWinY;
    unsigned char* pWinU;
    unsigned char* pWinV;
       
    tDescSrcy.YModify = (pEnc->mbParam.edged_width - 16) +1;
tDescSrcu.YModify = ((pEnc->mbParam.edged_width>>1) - 8) +1;
tDescSrcv.YModify = ((pEnc->mbParam.edged_width>>1) - 8) +1;
#ifdef REFDMA
tDescRefSrcy.YModify = (pEnc->mbParam.edged_width - 48) +1;
tDescRefSrcu.YModify = ((pEnc->mbParam.edged_width>>1) - 24) +1;
tDescRefSrcv.YModify = ((pEnc->mbParam.edged_width>>1) - 24) +1;  
#endif //REFDMA
    
     
psry = pEnc->reference->image.y - (pEnc->mbParam.edged_width*16+16);
psru = pEnc->reference->image.u - ((pEnc->mbParam.edged_width>>1)*8+8);
psrv = pEnc->reference->image.v - ((pEnc->mbParam.edged_width>>1)*8+8);
  


pdy = pEnc->current->image.y;
pdu = pEnc->current->image.u;
pdv = pEnc->current->image.v;


        
pEnc->mbParam.m_rounding_type = 1 - pEnc->mbParam.m_rounding_type;

pEnc->current->rounding_type = pEnc->mbParam.m_rounding_type;

pEnc->current->fcode = pEnc->mbParam.m_fcode;
pEnc->current->coding_type = P_VOP;

BitstreamPutBits(bs, 0, 32);
    
BitstreamWriteVopHeader(bs, &pEnc->mbParam, pEnc->current, 1);

*pBits = BitstreamPos(bs);  


OffsetY = 16*pEnc->mbParam.edged_width -  pEnc->mbParam.width + 16 ;

    
OffsetUV = (pEnc->mbParam.edged_width<<2) -   (pEnc->mbParam.width>>1) + 8 ;
  
int x_index;// x index
    
int nLoop = pEnc->mbParam.mb_width>>2; // 22
int nLoopRemaining = (pEnc->mbParam.mb_width)%4; // 22

int x, y ;
int x1, x2, x3, x4;

int curr = 0;
int next = 0;
//填满缓冲队列
#ifdef REFDMA//refdma
Lib_CoreWaittingForMem_0();
*pMDMA2_S0_CONFIG = 0;
*pMDMA2_D0_CONFIG = 0;

tDescRefSrcy.start_address = psry;
tDescRefSrcu.start_address = psru;
tDescRefSrcv.start_address =  psrv;

tDescRefDsty.start_address = &refwin1[0];
tDescRefDstu.start_address = (&refwin1[0] + 48*48);
tDescRefDstv.start_address = (&refwin1[0] +48*48+24*24);
   
*pMDMA2_S0_NEXT_DESC_PTR = &tDescRefSrcy;
//Dst  
*pMDMA2_D0_NEXT_DESC_PTR = &tDescRefDsty;
ssync();
//config  
*pMDMA2_S0_CONFIG = 0x7911;
*pMDMA2_D0_CONFIG = 0x7913;
#endif  
#ifdef INDMA
Lib_CoreWaittingForMem_1();
*pMDMA1_S1_CONFIG = 0;
*pMDMA1_D1_CONFIG = 0;

tDescSrcy.start_address = pdy;
tDescSrcu.start_address = pdu;
tDescSrcv.start_address =  pdv;

tDescDsty.start_address = &MB_curr1[0];
tDescDstu.start_address = (&MB_curr1[0] + 16*16);
tDescDstv.start_address = (&MB_curr1[0] +16*16+8*8);  

*pMDMA1_S1_NEXT_DESC_PTR = &tDescSrcy;
//Dst
  
*pMDMA1_D1_NEXT_DESC_PTR = &tDescDsty;
//////////////////////////////////////////////////////
ssync();
//config
*pMDMA1_S1_CONFIG = 0x7911;
*pMDMA1_D1_CONFIG = 0x7913;
#endif
#ifdef REFDMA

Lib_CoreWaittingForMem_0();  
//
*pMDMA2_S0_CONFIG = 0;
*pMDMA2_D0_CONFIG = 0;

tDescRefSrcy.start_address = psry +48;
tDescRefSrcu.start_address = psru +24;
tDescRefSrcv.start_address =  psrv +24;

tDescRefDsty.start_address = &refwin2[0];
tDescRefDstu.start_address = (&refwin2[0] + 48*48);
tDescRefDstv.start_address = (&refwin2[0] +48*48+24*24);

ssync();
//config  
*pMDMA2_S0_CONFIG = 0x7911;
*pMDMA2_D0_CONFIG = 0x7913;
#endif //REFDMA


psrynext  = psry ;
psrunext   = psru ;
psrvnext   = psrv ;
//编码循环
for (y = 0; y < pEnc->mbParam.mb_height; y++)
{

  x = 0;  

     for( x_index = 0; x_index < nLoop; x_index++)
     {
      

      
      ///////////////////////////1111111111111111///////////////    
    ppsry1   = psry ;
    ppsru1   = psru ;
    ppsrv1   = psrv ;
    
    
    pWinY = psry + 3*16;
         pWinU = psru + 3*8;
         pWinV = psrv + 3*8;
    
         ////////////////

         pppdy1   = pdy ;
    pppdu1   = pdu ;
    pppdv1   = pdv ;
    
    pppdy2   = pdy + 16;
    pppdu2   = pdu + 8;
    pppdv2   = pdv + 8;
    
    pppdy3   = pdy + 16*2;
    pppdu3   = pdu + 8*2;
    pppdv3   = pdv + 8*2;
    
    pppdy4   = pdy + 16*3;
    pppdu4   = pdu + 8*3;
    pppdv4   = pdv + 8*3;
     curr = curr%2;
   next = (curr +1)%2;
#ifdef REFDMA

    if((x + 4)>= pEnc->mbParam.mb_width)
    {
           psrynext += 16*3+OffsetY;
     psrunext += 8*3+OffsetUV;
     psrvnext += 8*3+OffsetUV;       
    }
    else
    {

           psrunext += 8<<2;         
           psrynext += 16<<2;
     psrvnext += 8<<2;
    }


       
   Lib_CoreWaittingForMem_0();
   *pMDMA2_S0_CONFIG = 0;
   *pMDMA2_D0_CONFIG = 0;
   tDescRefSrcy.start_address = psrynext;
   tDescRefSrcu.start_address = psrunext;
   tDescRefSrcv.start_address =  psrvnext;
   
   tDescRefDsty.start_address = &refwin1[0+ next*3456];
   tDescRefDstu.start_address = (&refwin1[0+ next*3456] + 48*48);
   tDescRefDstv.start_address = (&refwin1[0+ next*3456] +48*48+24*24);  


   //config
   *pMDMA2_S0_CONFIG = 0x7911;
   *pMDMA2_D0_CONFIG = 0x7913;  


#else
         copyRefWindows(ppsry1, ppsru1, ppsrv1, &refwin1[0+curr*3456], 1);  //将从图像上取48×48的搜索窗数据

         copyRefWindows(pWinY, pWinU, pWinV, &refwin2[0+curr*3456], 1);//将从图像上取48×48的搜索窗数据
#endif //REFDMA
#ifdef INDMA
   Lib_CoreWaittingForMem_1();
   *pMDMA1_S1_CONFIG = 0;
   *pMDMA1_D1_CONFIG = 0;

   tDescSrcy.start_address = pppdy2;
   tDescSrcu.start_address = pppdu2;
   tDescSrcv.start_address =  pppdv2;
   
   tDescDsty.start_address = &MB_curr2[0];
   tDescDstu.start_address = (&MB_curr2[0] + 16*16);
   tDescDstv.start_address = (&MB_curr2[0] +16*16+8*8);  

   ssync();
   //config
   
   *pMDMA1_S1_CONFIG = 0x7911;
   *pMDMA1_D1_CONFIG = 0x7913;

         /////////////////////////////////////////////////////////
#else  
    copyMB(pppdy1 , pppdu1 , pppdv1 , &MB_curr1[0] );//从当前图像上取一个16×16的数据
    copyMB(pppdy2 , pppdu2 , pppdv2 , &MB_curr2[0] );
   
#endif

   x1 = x;  
         
         ///////////////////////////////
         pEnc->target_MB = &MB_curr1[0];
    refwin_curr = &refwin1[0 +curr*3456];
    mbbuf_in = &MB_curr1[0];
    ///////////////////////////////
   //更新
   coreP_frame_coding(pEnc,bs ,x  ,y  ,pMbCurParamter)  ;
   //coding to the outer
   pFrameCoding_called(pEnc,bs,  x1,  y,pMbCurParamter);  

   
         x++;
///////////////////////////2222222222222222///////////////

         x2 = x;   
#ifdef INDMA         
   Lib_CoreWaittingForMem_1();
   *pMDMA1_S1_CONFIG = 0;
   *pMDMA1_D1_CONFIG = 0;

   tDescSrcy.start_address = pppdy3;
   tDescSrcu.start_address = pppdu3;
   tDescSrcv.start_address =  pppdv3;
   
   tDescDsty.start_address = &MB_curr3[0];
   tDescDstu.start_address = (&MB_curr3[0] + 16*16);
   tDescDstv.start_address = (&MB_curr3[0] +16*16+8*8);  

   ssync();
   //config
   *pMDMA1_S1_CONFIG = 0x7911;
   *pMDMA1_D1_CONFIG = 0x7913;
#else
         copyMB(pppdy3 , pppdu3 , pppdv3 , &MB_curr3[0] );

#endif
///////////////////////////////

         pEnc->target_MB = &MB_curr2[0];
    refwin_curr = &refwin1[0+curr*3456];
    mbbuf_in = &MB_curr2[0];
         copy_ref23win(refwin_curr);      
    copy_win2win(refwin_curr, &refwin2[0+curr*3456], 0);
    

   copyMBToImage(&MB_curr1[0], pppdy1, pppdu1, pppdv1);
     
    ///////////////////////////////       
         coreP_frame_coding(pEnc,
      bs ,
      x  ,
      y  ,
      pMbCurParamter)  ;
   //coding to the outer
   pFrameCoding_called(pEnc,bs,  x2,  y, pMbCurParamter);  

   
         x++;
///////////////////////////3333333333333333//////////////  
  

         x3 = x;               
#ifdef INDMA
   Lib_CoreWaittingForMem_1();
   *pMDMA1_S1_CONFIG = 0;
   *pMDMA1_D1_CONFIG = 0;

   tDescSrcy.start_address = pppdy4;
   tDescSrcu.start_address = pppdu4;
   tDescSrcv.start_address =  pppdv4;
   
   tDescDsty.start_address = &MB_curr4[0];
   tDescDstu.start_address = (&MB_curr4[0] + 16*16);
   tDescDstv.start_address = (&MB_curr4[0] +16*16+8*8);  

   ssync();
   //config
   *pMDMA1_S1_CONFIG = 0x7911;
   *pMDMA1_D1_CONFIG = 0x7913;
#else
         copyMB(pppdy4 , pppdu4 , pppdv4 , &MB_curr4[0] );
#endif

///////////////////////////////

         pEnc->target_MB = &MB_curr3[0];
    refwin_curr = &refwin1[0+curr*3456];
    mbbuf_in = &MB_curr3[0];
         copy_ref23win(refwin_curr);     
    copy_win2win(refwin_curr, &refwin2[0+curr*3456], 1);
#ifdef REFDMA
   Lib_CoreWaittingForMem_0();  //
   *pMDMA2_S0_CONFIG = 0;
   *pMDMA2_D0_CONFIG = 0;

   tDescRefSrcy.start_address = psrynext +48;
   tDescRefSrcu.start_address = psrunext +24;
   tDescRefSrcv.start_address =  psrvnext +24;
   
   tDescRefDsty.start_address = &refwin2[0+next*3456];
   tDescRefDstu.start_address = (&refwin2[0+next*3456] + 48*48);
   tDescRefDstv.start_address = (&refwin2[0+next*3456] +48*48+24*24);

   //config  
   *pMDMA2_S0_CONFIG = 0x7911;
   *pMDMA2_D0_CONFIG = 0x7913;

#endif     
    ///////////////////////////////

   copyMBToImage(&MB_curr2[0], pppdy2, pppdu2, pppdv2);    
     
         coreP_frame_coding(pEnc,
      bs ,
      x  ,
      y  ,
      pMbCurParamter)  ;
   //coding to the outer
   pFrameCoding_called(pEnc,bs,  x3,  y,pMbCurParamter);    

      
         x++;
///////////////////////////44444444444444444///////////////

         
         x4 = x;   
       
         ///////////////////////////////

         pEnc->target_MB = &MB_curr4[0];
    refwin_curr = &refwin2[0+curr*3456];
    mbbuf_in = &MB_curr4[0];
    
   
               
         coreP_frame_coding(pEnc,
      bs ,
      x  ,
      y  ,
      pMbCurParamter)  ;
#ifdef INDMA      
   Lib_CoreWaittingForMem_1();      
   *pMDMA1_S1_CONFIG = 0;
   *pMDMA1_D1_CONFIG = 0;
   tDescSrcy.start_address = pdy;
   tDescSrcu.start_address = pdu;
   tDescSrcv.start_address =  pdv;
   
   tDescDsty.start_address = &MB_curr1[0];
   tDescDstu.start_address = (&MB_curr1[0] + 16*16);
   tDescDstv.start_address = (&MB_curr1[0] +16*16+8*8);  

   ssync();
   //config
   *pMDMA1_S1_CONFIG = 0x7911;
   *pMDMA1_D1_CONFIG = 0x7913;
#endif
  
   copyMBToImage(&MB_curr3[0], pppdy3, pppdu3, pppdv3);       

       
   //coding to the outer
   pFrameCoding_called(pEnc,bs,  x4,  y,pMbCurParamter);    
   //copy to outer  
   /////////////////////////////////////////////////////////////

  
   copyMBToImage(&MB_curr4[0], pppdy4, pppdu4, pppdv4);
   /////////////////////////////////////////////////////////////   
         x++;
   pppdy4last = pppdy4;
   pppdu4last = pppdu4;  
   pppdv4last = pppdv4;
   curr ++;
  ///////////////////////////////
    
     }  
     

         
        ////////////outer operation////////////////////////////////////
           ///////////////////////////1111111111111111///////////////
     if(nLoopRemaining>0)   
     {
    
   pppdy1   = pdy ;       
    pppdu1   = pdu ;
    pppdv1   = pdv ;
    
    ppsry1   = psry ;
    ppsru1   = psru ;
    ppsrv1   = psrv ;
    
    /////////////////add new///////////////////
    pppdy2   = pdy + 16;
    pppdu2   = pdu + 8;
    pppdv2   = pdv + 8;
    
    ppsry2   = psry + 16*3;
    ppsru2   = psru + 8*3;
    ppsrv2   = psrv + 8*3;
     curr = curr%2;
   next = (curr +1)%2;
     
#ifdef REFDMA
    if((x + 2)>= pEnc->mbParam.mb_width)
    {
           psrynext += 16+OffsetY;
     psrunext += 8+OffsetUV;
     psrvnext += 8+OffsetUV;       
    }
    else
    {

           psrunext += 8<<1;         
           psrynext += 16<<1;
     psrvnext += 8<<1;
    }

    Lib_CoreWaittingForMem_0();
   *pMDMA2_S0_CONFIG = 0;
   *pMDMA2_D0_CONFIG = 0;

   tDescRefSrcy.start_address = psrynext;
   tDescRefSrcu.start_address = psrunext;
   tDescRefSrcv.start_address =  psrvnext;
   
   tDescRefDsty.start_address = &refwin1[next*3456];
   tDescRefDstu.start_address = (&refwin1[next*3456] + 48*48);
   tDescRefDstv.start_address = (&refwin1[next*3456] +48*48+24*24);
     
   *pMDMA2_S0_NEXT_DESC_PTR = &tDescRefSrcy;
   //Dst  
   *pMDMA2_D0_NEXT_DESC_PTR = &tDescRefDsty;
   ssync();
   //config  
   *pMDMA2_S0_CONFIG = 0x7911;
   *pMDMA2_D0_CONFIG = 0x7913;
    
#else    
    copyRefWindows(ppsry1, ppsru1, ppsrv1, &refwin1[+curr*3456], 1);
#endif            
            copyRefWindowsLeft13(ppsry2, ppsru2, ppsrv2, &refwin2[+curr*3456]);
#ifdef INDMA
   Lib_CoreWaittingForMem_1();
   *pMDMA1_S1_CONFIG = 0;
   *pMDMA1_D1_CONFIG = 0;

   tDescSrcy.start_address = pppdy2;
   tDescSrcu.start_address = pppdu2;
   tDescSrcv.start_address =  pppdv2;
   
   tDescDsty.start_address = &MB_curr2[0];
   tDescDstu.start_address = (&MB_curr2[0] + 16*16);
   tDescDstv.start_address = (&MB_curr2[0] +16*16+8*8);  

   ssync();
   //config
   
   *pMDMA1_S1_CONFIG = 0x7911;
   *pMDMA1_D1_CONFIG = 0x7913;
#else             
    copyMB(pppdy1 , pppdu1 , pppdv1 , &MB_curr1[0] );             
    copyMB(pppdy2 , pppdu2 , pppdv2 , &MB_curr2[0] );
            
#endif    //////////////////////////////////////////
    x1 = x;  
    
            pEnc->target_MB = &MB_curr1[0];
    refwin_curr = &refwin1[+curr*3456];
    mbbuf_in = &MB_curr1[0];
    

   coreP_frame_coding(pEnc,
      bs ,
      x  ,
      y  ,
      pMbCurParamter)  ;
   //coding to the outer
   pFrameCoding_called(pEnc,bs,  x1,  y, pMbCurParamter);     

   copyMBToImage(pEnc->target_MB, pppdy1, pppdu1, pppdv1);    
      
            x++;
///////////////////////////2222222222222222///////////////
#ifdef REFDMA

   Lib_CoreWaittingForMem_0();  
   //
   *pMDMA2_S0_CONFIG = 0;
   *pMDMA2_D0_CONFIG = 0;

   tDescRefSrcy.start_address = psrynext +48;
   tDescRefSrcu.start_address = psrunext +24;
   tDescRefSrcv.start_address =  psrvnext +24;
   
   tDescRefDsty.start_address = &refwin2[next*3456];
   tDescRefDstu.start_address = (&refwin2[next*3456] + 48*48);
   tDescRefDstv.start_address = (&refwin2[next*3456] +48*48+24*24);

   ssync();
   //config  
   *pMDMA2_S0_CONFIG = 0x7911;
   *pMDMA2_D0_CONFIG = 0x7913;
#endif //REFDMA             
             
            ///////////////////////////////
      
            x2 = x;   
            
            pEnc->target_MB = &MB_curr2[0];
            
    refwin_curr = &refwin1[+curr*3456];
    
    mbbuf_in = &MB_curr2[0];
    
//    copy_23refHor(refwin_curr);
   copy_ref23win(refwin_curr);
       
//    copyWinToWin(refwin_curr, &refwin2[+curr*3456], 0);
    copy_win2win(refwin_curr, &refwin2[+curr*3456], 0);
    
            pEnc->target_MB = &MB_curr2[0];
    refwin_curr = &refwin1[+curr*3456];
    mbbuf_in = &MB_curr2[0];
    

            coreP_frame_coding(pEnc,
      bs ,
      x  ,
      y  ,
      pMbCurParamter)  ;
#ifdef INDMA      
   Lib_CoreWaittingForMem_1();      
   *pMDMA1_S1_CONFIG = 0;
   *pMDMA1_D1_CONFIG = 0;
   tDescSrcy.start_address = pdy;
   tDescSrcu.start_address = pdu;
   tDescSrcv.start_address =  pdv;
   
   tDescDsty.start_address = &MB_curr1[0];
   tDescDstu.start_address = (&MB_curr1[0] + 16*16);
   tDescDstv.start_address = (&MB_curr1[0] +16*16+8*8);  

   ssync();
   //config
   *pMDMA1_S1_CONFIG = 0x7911;
   *pMDMA1_D1_CONFIG = 0x7913;
#endif        
      //coding to the outer
   pFrameCoding_called(pEnc,bs,  x2,  y,pMbCurParamter);
   copyMBToImage(&MB_curr2[0], pppdy2, pppdu2, pppdv2);    
      
      
            x++;
        
        ///////////////////////////////////////////////////////////////
    curr ++;
     }


}// for y

}

.section L1_code;
.align 4;

_Lib_CoreWaittingForMem_0 :
[--sp] = r0;
[--sp] = r1;
[--sp] = r2;
[--sp] = p0;

p0.l = lo(MDMA2_D0_IRQ_STATUS ); // MDMA1_D1_IRQ_STATUS // MDMA_D1_IRQ_STATUS 532
p0.h = hi(MDMA2_D0_IRQ_STATUS);

r1 = 0;
r2.l = 0xB000;
r2.h = 0x0;

DMARUNNING2:
r1 += 1;
cc = r2 < r1;
if cc jump ERROR2;

r0.l = w[p0];
cc = bittst(r0, 3);
if cc jump DMARUNNING2;

END2:
p0 = [sp++];
r2 = [sp++];
r1 = [sp++];
r0 = [sp++];
rts;

ERROR2:
p0.l = lo(MDMA2_S0_IRQ_STATUS);
p0.h = hi(MDMA2_S0_IRQ_STATUS);
r0.l = 0x3;
w[p0] = r0.l;

    p0.l = lo(MDMA2_D0_IRQ_STATUS ); // MDMA1_D1_IRQ_STATUS // MDMA_D1_IRQ_STATUS 532
p0.h = hi(MDMA2_D0_IRQ_STATUS);
r0.l = 0x3;
w[p0] = r0.l;

p0.l = lo(MDMA2_S0_CONFIG);
p0.h = hi(MDMA2_S0_CONFIG);
r0 = 0;
w[p0] = r0;

p0.l = lo(MDMA2_D0_CONFIG);
p0.h = hi(MDMA2_D0_CONFIG);
r0 = 0;
w[p0] = r0;

jump END2;

_Lib_CoreWaittingForMem_0.end:
nop;


.section L1_code;
.align 4;
_Lib_CoreWaittingForMem_1 :
[--sp] = r0;
[--sp] = r1;
[--sp] = r2;
[--sp] = p0;

p0.l = lo(MDMA1_D1_IRQ_STATUS ); // MDMA1_D1_IRQ_STATUS // MDMA_D1_IRQ_STATUS 532
p0.h = hi(MDMA1_D1_IRQ_STATUS);

r1 = 0;
r2.l = 0xB000;
r2.h = 0x0;

DMARUNNING:
r1 += 1;
cc = r2 < r1;
if cc jump ERROR;

r0.l = w[p0];
cc = bittst(r0, 3);
if cc jump DMARUNNING;

END:
p0 = [sp++];
r2 = [sp++];
r1 = [sp++];
r0 = [sp++];
rts;

ERROR:
p0.l = lo(MDMA1_S1_IRQ_STATUS);
p0.h = hi(MDMA1_S1_IRQ_STATUS);
r0.l = 0x3;
w[p0] = r0.l;

    p0.l = lo(MDMA1_D1_IRQ_STATUS ); // MDMA1_D1_IRQ_STATUS // MDMA_D1_IRQ_STATUS 532
p0.h = hi(MDMA1_D1_IRQ_STATUS);
r0.l = 0x3;
w[p0] = r0.l;

p0.l = lo(MDMA1_S1_CONFIG);
p0.h = hi(MDMA1_S1_CONFIG);
r0 = 0;
w[p0] = r0;

p0.l = lo(MDMA1_D1_CONFIG);
p0.h = hi(MDMA1_D1_CONFIG);
r0 = 0;
w[p0] = r0;

jump END;

_Lib_CoreWaittingForMem_1.end:  
nop;

共2条 1/1 1 跳转至

回复

匿名不能发帖!请先 [ 登陆 注册 ]