⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mem_transfer.c

📁 瑞芯微RK2608固件源代码
💻 C
📖 第 1 页 / 共 2 页
字号:
/*****************************************************************************
 *
 *  XVID MPEG-4@QVGA VIDEO DECODER ON ROCKCHIP RK2606
 *	
 *	Author:
 *		Jian Huan	<jh@rock-chips.com>
 *
 *	Date:
 *		2005-11-26 10:22
 ****************************************************************************/
#include "Macro.h"
#include "Memap.h"
#include "Global.h"
#include "Resource.h"

#include "AviMacro.h"
#include "AviGlobal.h"

#include "Dma.h"

#include "mem_transfer.h"
#include "../static_data.h"
#include "../xvid_decoder.h"
#include "../xvid_macro.h"

/*********************************************************************
 *  Func:
 *      DMA_YUV_I2E
 *  Description:
 *      Internal SRAM to External SDRAM
 *  Author:
 *      Fang ZF
 *  Date:
 *      2006-1-3 21:30
 *  Modify:
 *      Jian Huan
 *  Date:
 *      2006-2-15 9:21
 *********************************************************************/

//__attribute__((section(".avi_v_text, \"ax\"")))
//void DMA_YUV_I2E(DECODER *xvid_dec,short y, short size)
//{
//    unsigned int     temp2;
//    DMA_CHANNEL_REG *DmaChl;
//    
//    unsigned long dstY=0, dstUV=0;
//
//    while(DMA_CHANNEL_FULL == ( DmaChl = GetDmaChannelState(0))); 
//    
//    dstY = (unsigned long )((unsigned long )(xvid_dec->cur->y_page)<<16) + (unsigned long)(y)*(unsigned long)(size);          //????SDRAM????????Y????????????
//    
//    temp2 = 0x8c00-320*4*y;
//    //---------------------------------------------------------------------
//    DmaChl->pDmaFnct    = DMA_FNCT_NULL;
//    DmaChl->pDmaFnctArg = DMA_FNCT_NULL;
//    //---------------------------------------------------------------------    
//
//    DmaChl->DmaSar = (unsigned long)(((unsigned long)(IntMem.mb_y_row)<<1)+(unsigned long)0x40000);
//    DmaChl->DmaDar = ((unsigned long)(dstY)<<1)+(unsigned long)0x4000000;
//    
//    DmaChl->DmaCtl.Lsb = 0x00040025;
//    DmaChl->DmaCtl.Msb = 0x00000F00;
//    
//    DmaChl->DmaCfg.Lsb = 0x00000020;
//    DmaChl->DmaCfg.Msb = 0x00001004;
//    
//    DmaChl->DmaDsr = 0xA0000000|temp2;
//    
//    Dma_I2EBlock   = 1;
//    
//    DmaChl->Priority   = 0;
//    
//    DmaChl->pResFlag   = &Dma_I2EBlock;
//    
//    CALL_DmaChannelSetup(0);
//}
//
///***************************************************************************
// *  Func:
// *     DMA_YUV_E2I_A
// *  Description:
// *      index: 0-->y;  2-->uv
// *      dst_offset_pos: offset position of refer-image
// *  NB:
// *      The Size of Match_Block is 18X17 or 18X9
// *  Author:
// *      fang zf
// *      jian huan   (modify) 
// *  Date:
// *      2006-1-3 14:47
// *      2006-1-9 10:49  (modify)
// **************************************************************************/  
//__attribute__((section(".avi_v_text, \"ax\"")))
//void DMA_YUV_E2I_A(short index,   short   dst_offset_pos)       //32BIT--32BIT
//{
//    short   vert_in, hor_in, hor_out;
//    unsigned long   src;
//    unsigned short  dst;
//    IMAGE *refimg = Xvidec.ref;
//    DMA_CHANNEL_REG *DmaChl;
//    unsigned int  resflag;
//        
//    while(DMA_CHANNEL_FULL == ( DmaChl = GetDmaChannelState(0))); 
// 
//    
//   if(index == 0){ 
//        Global_Offset = (unsigned short)(src_offset_pos & 0x1);
//        src = (((unsigned long)(refimg->y_page))<<16) + (src_offset_pos - (unsigned long)Global_Offset);
//        dst = &match_y_block[0];  
//        resflag   = &Dma_E2IBlock_Y;
//        Dma_E2IBlock_Y = 1;
//        //hor_in  = 18;
//        vert_in = 17;
//    }else if(index == 2){
//        src = (((unsigned long)(refimg->uv_page))<<16) + 0x2c00 + src_offset_pos;
//        dst = &match_uv_block[0];       
//        resflag   = &Dma_E2IBlock_UV;
//        Dma_E2IBlock_UV = 1;
//        //hor_in  = 18;
//        vert_in = 9;
//    }
////---------------------------------------------------------------------
//    DmaChl->pDmaFnct    = DMA_FNCT_NULL;
//    DmaChl->pDmaFnctArg = DMA_FNCT_NULL;
////---------------------------------------------------------------------    
//    DmaChl->DmaSar = ((unsigned long)(src)<<1)+(unsigned long)(0x4000000);
//    DmaChl->DmaDar = ((unsigned long)(dst)<<1)+(unsigned long)0x40000;
//    
//    DmaChl->DmaCtl.Lsb = 0x00020025;         //32-bit transfer
//    DmaChl->DmaCtl.Msb = (unsigned long)(9*(unsigned long)vert_in);
//    
//    DmaChl->DmaCfg.Lsb = 0x00000020;
//    DmaChl->DmaCfg.Msb = 0x00001004;
//    
//    //DmaChl.DmaSgr.Lsb = (unsigned long)(160-9)|((unsigned long)(9)<<20);
//    DmaChl->DmaSgr = 0x00900097;
//    
//    DmaChl->Priority   = 1;
//    
//    DmaChl->pResFlag   = resflag;
//    
//    CALL_DmaChannelSetup(0);
//    
//}
//
///***************************************************************************
// *  Func:
// *     DMA_YUV_E2I_B
// *  Description:
// *      index: 0-->y;  2-->uv
// *      dst_offset_pos: offset position of refer-image
// *
// *  Author:
// *      fang zf
// *  Date:
// *      2006-1-3 14:47
// **************************************************************************/  
//__attribute__((section(".avi_v_text, \"ax\"")))
//void DMA_YUV_E2I_B(short index,   short   dst_offset_pos)           //16BIT--16BIT
//{
//    short   vert_in, hor_in, hor_out;
//    unsigned long   src;
//    unsigned short  dst;
//    PIXEL_COMP_STRUCT   *pcs = &PCS, *pcs_uv = &PCS_UV;
//    IMAGE *refimg = Xvidec.ref;
//    unsigned int  resflag;
//    DMA_CHANNEL_REG *DmaChl;
//    
//    while(DMA_CHANNEL_FULL == ( DmaChl = GetDmaChannelState(0))); 
//    
//   if(index == 0){              
//        src = (((unsigned long)(refimg->y_page))<<16) + src_offset_pos;
//        dst = &match_y_block[0] + dst_offset_pos;
//        resflag   = &Dma_E2IBlock_Y;
//        Dma_E2IBlock_Y = 1;
//        vert_in = pcs->vert_in;
//        hor_in  = pcs->hor_in; 
//        hor_out = pcs->hor_out;
//    }else if(index == 2){
//        src = (((unsigned long)(refimg->uv_page))<<16) + 0x2c00 + src_offset_pos;
//        dst = &match_uv_block[0] + dst_offset_pos;
//        resflag   = &Dma_E2IBlock_UV;
//        Dma_E2IBlock_UV = 1;
//        vert_in = pcs_uv->vert_in;
//        hor_in  = pcs_uv->hor_in; 
//        hor_out = pcs_uv->hor_out;
//    }
////---------------------------------------------------------------------
//    DmaChl->pDmaFnct    = DMA_FNCT_NULL;
//    DmaChl->pDmaFnctArg = DMA_FNCT_NULL;
////---------------------------------------------------------------------    
//
//    DmaChl->DmaSar = ((unsigned long)(src)<<1)+(unsigned long)(0x4000000);
//    DmaChl->DmaDar = ((unsigned long)(dst)<<1)+(unsigned long)0x40000;
//    
//    DmaChl->DmaCtl.Lsb = 0x00060013;
//    DmaChl->DmaCtl.Msb = (unsigned long)(hor_in*vert_in);
//    
//    DmaChl->DmaCfg.Lsb = 0x00000020;
//    DmaChl->DmaCfg.Msb = 0x00001004;
//    
//    DmaChl->DmaSgr = (unsigned long)(320-hor_in)|((unsigned long)(hor_in)<<20);
//    
//    DmaChl->DmaDsr = ((unsigned long)(hor_in)<<20)|((unsigned long)(hor_out));
//    
//    DmaChl->Priority   = 1;
//
//    DmaChl->pResFlag   = resflag;
//    
//    CALL_DmaChannelSetup(0);
//}
//
//
///***************************************************************************
// *  Func:
// *     DMA_YUV_E2I_C
// *  Description:
// *      index: 0-->y;  2-->uv
// *      dst_offset_pos: offset position of refer-image
// *  NB:
// *      The Size of Match_Block is 10x9
// *  Author:
// *      fang zf
// *      jian huan   (modify) 
// *  Date:
// *      2006-1-3 14:47
// *      2005-1-11 11:53  (modify)
// **************************************************************************/  
//__attribute__((section(".avi_v_text, \"ax\"")))
//void DMA_YUV_E2I_C(short index, short dst_offset_pos)       //32BIT--32BIT
//{
//    short   vert_in, hor_in, hor_out;
//    unsigned long   src;
//    unsigned short  dst;
//    IMAGE *refimg = Xvidec.ref;
//    DMA_CHANNEL_REG *DmaChl;
//    
//    while(DMA_CHANNEL_FULL == ( DmaChl = GetDmaChannelState(0))); 
// 
//    Global_Offset = (unsigned short)(src_offset_pos & 0x1);
//    src = (((unsigned long)(refimg->y_page))<<16) + (src_offset_pos - (unsigned long)Global_Offset);
//    dst = &match_y_block[0];  
//    hor_in  = 10;
//    vert_in = 9;
////---------------------------------------------------------------------
//    DmaChl->pDmaFnct    = DMA_FNCT_NULL;
//    DmaChl->pDmaFnctArg = DMA_FNCT_NULL;
////---------------------------------------------------------------------    
//    
//    DmaChl->DmaSar = ((unsigned long)(src)<<1)+(unsigned long)(0x4000000);
//    DmaChl->DmaDar = ((unsigned long)(dst)<<1)+(unsigned long)0x40000;
//    
//    DmaChl->DmaCtl.Lsb = 0x00020025;         //32-bit transfer
//    DmaChl->DmaCtl.Msb = (unsigned long)(45);
//    
//    DmaChl->DmaCfg.Lsb = 0x00000020;
//    DmaChl->DmaCfg.Msb = 0x00001004;
//    
//    DmaChl->DmaSgr = (unsigned long)(160-5)|((unsigned long)(5)<<20);
//    
//    Dma_E2IBlock_Y   = 1;
//    
//    DmaChl->Priority   = 1;
//    
//    DmaChl->pResFlag   = &Dma_E2IBlock_Y;
//    
//    CALL_DmaChannelSetup(0);
//}
//
//
///***************************************************************************
// *  Func:
// *      copy_y_from_external_to_internal
// *  Dsecripton:
// *      External SDRAM to Internal SRAM
// *  NB:
// *      32bit-32bit
// *  Author:
// *      Fang ZF
// *      Jian Huan (Modify)
// *  Date:
// *      2006-1-3 21:35
// *      2006-1-10 9:00
// **************************************************************************/
//__attribute__((section(".avi_v_text, \"ax\"")))
//void    copy_y_from_external_to_internal(DECODER *xvid_dec, short x, short y)
//{
//    unsigned long xy_cord;
//    unsigned long src, dst;
//    DMA_CHANNEL_REG *DmaChl;
//    
//    while(DMA_CHANNEL_FULL == ( DmaChl = GetDmaChannelState(0))); 
//    
//    xy_cord = (unsigned long)(xvid_dec->width) * ((unsigned long)(y)<<4) + ((unsigned long)(x)<<4);
//   
//    src = (unsigned long)(((unsigned long)(xvid_dec->ref->y_page)<<16)) + (unsigned long)xy_cord;       //128K/2 = 131072/2
//    dst = (unsigned long)IntMem.mb_y_row + ((unsigned long)(x)<<4);
////---------------------------------------------------------------------
//    DmaChl->pDmaFnct    = DMA_FNCT_NULL;
//    DmaChl->pDmaFnctArg = DMA_FNCT_NULL;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -