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

📄 l2_dramimg.c

📁 dz3000_51.0.0.4.rar
💻 C
📖 第 1 页 / 共 3 页
字号:
UCHAR L2_StampOneFont(ULONG OSDAddr, ULONG FontID, USHORT Xoff, USHORT Yoff, ULONG TempAddr) USING_0
{
        UCHAR scale;
        UCHAR dstaddrH,dstaddrM,dstaddrL;
        UCHAR dstHsizeH,dstHsizeL,dstVsizeH,dstVsizeL;

        //PRINT_L2("        L2_StampOneFont: Enter\n");
        //PRINT_L2("            L2_StampOneFont: OsdAddr=0x%lx, FontID=%ld, Xoff=%d, Yoff=%d, TempAddr=%lx\n",OSDAddr,FontID,Xoff,Yoff,TempAddr);

        scale = (XBYTE[0x2785]+1);

        XBYTE[0x2771] = (UCHAR)(OSDAddr+FontID*64);
        XBYTE[0x2772] = (UCHAR)((OSDAddr+FontID*64) >> 8);
        XBYTE[0x2773] = (UCHAR)((OSDAddr+FontID*64) >> 16);

        if(scale>1)
        {
                dstaddrL = XBYTE[0x2774];
                dstaddrM = XBYTE[0x2775];
                dstaddrH = XBYTE[0x2776];

                dstHsizeL = XBYTE[0x277B];
                dstHsizeH = XBYTE[0x277C];
                dstVsizeL = XBYTE[0x277D];
                dstVsizeH = XBYTE[0x277E];

                XBYTE[0x2770] = 0x40;                                   // Set font scaling mode

                XBYTE[0x2774] = (UCHAR)(TempAddr);
                XBYTE[0x2775] = (UCHAR)(TempAddr >> 8);
        	XBYTE[0x2776] = (UCHAR)(TempAddr >> 16);

                XBYTE[0x2777] = 2;
                XBYTE[0x2778] = 0;
                XBYTE[0x2779] = 32;
                XBYTE[0x277A] = 0;

                XBYTE[0x277B] = 2*scale;
                XBYTE[0x277C] = 0;
                XBYTE[0x277D] = 32*scale;
                XBYTE[0x277E] = 0;

                XBYTE[0x27A1] = 0x80;                                   // start operation

                while(!(XBYTE[0x27B0] & 0x80));                 // wait operation done

                XBYTE[0x2771] = (UCHAR)(TempAddr);
                XBYTE[0x2772] = (UCHAR)(TempAddr >> 8);
        	XBYTE[0x2773] = (UCHAR)(TempAddr >> 16);

                XBYTE[0x2774] = dstaddrL;
                XBYTE[0x2775] = dstaddrM;
                XBYTE[0x2776] = dstaddrH;

                XBYTE[0x277B] = dstHsizeL;
                XBYTE[0x277C] = dstHsizeH;
                XBYTE[0x277D] = dstVsizeL;
                XBYTE[0x277E] = dstVsizeH;
        }

        XBYTE[0x2770] = 0x50;                                           // Set font stamping mode

        XBYTE[0x2777] = 2*scale ;                                       // set the font size
        XBYTE[0x2778] = 0;
        XBYTE[0x2779] = 32*scale;                                       // set the font size
        XBYTE[0x277A] = 0;

        XBYTE[0x2794] = (UCHAR)(Xoff);
        XBYTE[0x2795] = (UCHAR)(Xoff >> 8);
        XBYTE[0x2796] = (UCHAR)(Yoff);
        XBYTE[0x2797] = (UCHAR)(Yoff >> 8);

        XBYTE[0x27A1] = 0x80;                                           // start operation

        while(!(XBYTE[0x27B0] & 0x80));                         // wait operation done

        //PRINT_L2("        L2_StampOneFont: Exit\n");

        return L2K_SUCCESS;
}

//-----------------------------------------------------------------------------
//L2_RotateImage
//-----------------------------------------------------------------------------
/*
routine description:
        Rotate the image in the DRAM. The rotated image in stored in the
        destination area.
arguments:
        SrcAddr - Source image address (in the DRAM)
        SrcHsize- Source image width (in pixels)
        SrcVsize- Source image height
        DstAddr - Destination image address
        dir             - 0: rotate clockwise
                          1: rotate counter-clockwise
return value:
        0x00    - success
        others  - error
*/
UCHAR L2_RotateImage(ULONG SrcAddr, USHORT SrcHsize, USHORT SrcVsize, ULONG DstAddr, BIT Dir) USING_0
{
        //PRINT_L2("        L2_RotateImage: Enter\n");
        //PRINT_L2("            L2_RotateImage: SrcAddr=0x%lx, SrcHsize=%d, SrcVsize=%d, DstAddr=0x%lx, Dir=%x\n",SrcAddr,SrcHsize,SrcVsize,DstAddr,(USHORT)Dir);

        XBYTE[0x2770] = 0x20;                                           // Set rotation mode

        XBYTE[0x2771] = (UCHAR)(SrcAddr);
        XBYTE[0x2772] = (UCHAR)(SrcAddr >> 8);
        XBYTE[0x2773] = (UCHAR)(SrcAddr >> 16);

        XBYTE[0x2774] = (UCHAR)(DstAddr);
        XBYTE[0x2775] = (UCHAR)(DstAddr >> 8);
        XBYTE[0x2776] = (UCHAR)(DstAddr >> 16);

        XBYTE[0x2777] = (UCHAR)(SrcHsize);
        XBYTE[0x2778] = (UCHAR)(SrcHsize >> 8);
        XBYTE[0x2779] = (UCHAR)(SrcVsize);
        XBYTE[0x277A] = (UCHAR)(SrcVsize >> 8);

        XBYTE[0x277B] = (UCHAR)(SrcVsize);
        XBYTE[0x277C] = (UCHAR)(SrcVsize >> 8);
        XBYTE[0x277D] = (UCHAR)(SrcHsize);
        XBYTE[0x277E] = (UCHAR)(SrcHsize >> 8);

        if(Dir==1) XBYTE[0x2786] |= 0x01;
        else       XBYTE[0x2786] &= 0xFE;

        XBYTE[0x27A1] = 0x80;                                           // start operation
        while(!(XBYTE[0x27B0] & 0x80));                         // wait operation done

        //PRINT_L2("        L2_RotateImage: Exit\n");

        return L2K_SUCCESS;
}

//-----------------------------------------------------------------------------
//L2_TransYUV420toYUV422
//-----------------------------------------------------------------------------
/*
routine description:
        Convert the image from YUV420 format to YUV422 format.
arguments:
        SrcAddr - Image address
        SrcHsize- Image width (in pixels)
        SrcVsize- Image height (in pixels)
return value:
        0x00    - success
        others  - error
*/
UCHAR L2_TransYUV420toYUV422(ULONG SrcAddr, USHORT SrcHsize, USHORT SrcVsize) USING_0
{
        //PRINT_L2("        L2_TransYUV420toYUV422: Enter\n");
        //PRINT_L2("            L2_TransYUV420toYUV422: SrcAddr=0x%lx, SrcHsize=%d, SrcVsize=%d\n",SrcAddr,SrcHsize,SrcVsize);

        XBYTE[0x2770] = 0x90;                                           // Set YUV420-YUV422 mode

        XBYTE[0x2771] = (UCHAR)(SrcAddr);
        XBYTE[0x2772] = (UCHAR)(SrcAddr >> 8);
        XBYTE[0x2773] = (UCHAR)(SrcAddr >> 16);

        XBYTE[0x2777] = (UCHAR)(SrcHsize);
        XBYTE[0x2778] = (UCHAR)(SrcHsize >> 8);
        XBYTE[0x2779] = (UCHAR)(SrcVsize);
        XBYTE[0x277A] = (UCHAR)(SrcVsize >> 8);

        XBYTE[0x27A1] = 0x80;                                           // start operation
        while(!(XBYTE[0x27B0] & 0x80));                         // wait operation done

        //PRINT_L2("        L2_TransYUV420toYUV422: Exit\n");

        return L2K_SUCCESS;
}

//-----------------------------------------------------------------------------
//L2_CopyImage
//-----------------------------------------------------------------------------
/*
routine description:
        Copy a part from the source image and pastes it to the destination image.
        It can use the L2_SetCopyColorKey function to turn on/off the color key
        attribute.
arguments:
        SrcAddr - Source image address (in the DRAM)
        SrcHsize- Source image width (in pixels)
        SrcVsize- Source image height
        SrcX    - define the region to be copied in the source image. Horizontal
                  offset.
        SrcY    - define the region in the source image. Vertical offset.
        Hsize   - define the size to be copied. Width of the copied region.
        Vsize   - define the height of the copied region.
        DstAddr - Destination image address in the DRAM.
        DstVsize- Destination image height
        DstHsize- Destination image width
        DstX    - The location (of the destination image) to paste the image.
                  This parameter defines the horizontal offset.
        DstY    - Pasting location vertical offset from the left-top corner of
                  the destination image.
return value:
        0x00    - success
        others  - error
*/
UCHAR L2_CopyImage(ULONG SrcAddr, USHORT SrcHsize, USHORT SrcVsize, USHORT SrcX, USHORT SrcY, USHORT Hsize, USHORT Vsize, ULONG DstAddr, USHORT DstHsize, USHORT DstVsize, USHORT DstX, USHORT DstY) USING_0
{
        //PRINT_L2("        L2_CopyImage: Enter\n");
        //PRINT_L2("            L2_CopyImage: SrcAddr=%lx, SrcHsize=%d, SrcVsize=%d, SrcX=%d, SrcY=%d, Hsize=%d, Vsize=%d, DstAddr=%lx, DstHsize=%d, DstVsize=%d, DstX=%d, DstY=%d\n",SrcAddr,SrcHsize,SrcVsize,SrcX,SrcY,Hsize,Vsize,DstAddr,DstHsize,DstVsize,DstX,DstY);

        XBYTE[0x2770] = 0x30;                                           // Set copy-paste mode

        XBYTE[0x2771] = (UCHAR)(SrcAddr);
        XBYTE[0x2772] = (UCHAR)(SrcAddr >> 8);
        XBYTE[0x2773] = (UCHAR)(SrcAddr >> 16);

        XBYTE[0x2774] = (UCHAR)(DstAddr);
        XBYTE[0x2775] = (UCHAR)(DstAddr >> 8);
        XBYTE[0x2776] = (UCHAR)(DstAddr >> 16);

        XBYTE[0x2777] = (UCHAR)(SrcHsize);
        XBYTE[0x2778] = (UCHAR)(SrcHsize >> 8);
        XBYTE[0x2779] = (UCHAR)(SrcVsize);
        XBYTE[0x277A] = (UCHAR)(SrcVsize >> 8);

        XBYTE[0x277B] = (UCHAR)(DstHsize);
        XBYTE[0x277C] = (UCHAR)(DstHsize >> 8);
        XBYTE[0x277D] = (UCHAR)(DstVsize);
        XBYTE[0x277E] = (UCHAR)(DstVsize >> 8);

        XBYTE[0x2781] = (UCHAR)(SrcX);
        XBYTE[0x2782] = (UCHAR)(SrcX >> 8);
        XBYTE[0x2783] = (UCHAR)(SrcY);
        XBYTE[0x2784] = (UCHAR)(SrcY >> 8);

        XBYTE[0x2794] = (UCHAR)(DstX);
        XBYTE[0x2795] = (UCHAR)(DstX >> 8);
        XBYTE[0x2796] = (UCHAR)(DstY);
        XBYTE[0x2797] = (UCHAR)(DstY >> 8);

        XBYTE[0x278C] = (UCHAR)(Hsize);
        XBYTE[0x278D] = (UCHAR)(Hsize >> 8);
        XBYTE[0x278E] = (UCHAR)(Vsize);
        XBYTE[0x278F] = (UCHAR)(Vsize >> 8);

        XBYTE[0x27A1] = 0x80;                                           // start operation

        while(!(XBYTE[0x27B0] & 0x80));                         // wait operation done

        //PRINT_L2("        L2_CopyImage: Exit\n");

        return L2K_SUCCESS;
}

//-----------------------------------------------------------------------------
//L2_SetCopyColorKey
//-----------------------------------------------------------------------------
/*
routine description:
        Set the color key attribute when using the L2_CopyImage function
arguments:
        Enable  - 0: disable the color key function
                - 1: enable the color key function
        Thd             - the threshold value of color key attribute
return value:
        0x00    - success
        others  - error
*/
UCHAR L2_SetCopyColorKey(BIT Enable, UCHAR Thd) USING_0
{
        //PRINT_L2("        L2_SetCopyColorKey: Enter\n");
        //PRINT_L2("            L2_SetCopyColorKey: Enable=%bd, Thd=%bd\n",(UCHAR)Enable,Thd);

        XBYTE[0x2798] = ((UCHAR)Enable << 7) + Thd;

        //PRINT_L2("        L2_SetCopyColorKey: Exit\n");

        return L2K_SUCCESS;
}

//-----------------------------------------------------------------------------
//L2_SubDarkFrame
//-----------------------------------------------------------------------------
/*
routine description:
        Subtract the data in the source image from the destination image.
        The result will be written back to the destination area.
arguments:
        SrcAddr - Source image address in the DRAM
        DstAddr - Destination image address in the DRAM
        DstHsize- Destination image width
        DstVsize- Destination image height
return value:
        0x00    - success
        others  - error
*/
UCHAR L2_SubDarkFrame(ULONG SrcAddr, ULONG DstAddr, USHORT DstHsize, USHORT DstVsize) USING_0
{

        //PRINT_L2("        L2_SubDarkFrame: Enter\n");
        //PRINT_L2("            L2_SubDarkFrame: SrcAddr=%lx, DstAddr=%lx, DstHsize=%d, DstVsize=%d\n",SrcAddr,DstAddr,DstHsize,DstVsize);

        XBYTE[0x2770] = 0x80;                                           // Set inter-frame subtraction mode

        XBYTE[0x2771] = (UCHAR)(SrcAddr);
        XBYTE[0x2772] = (UCHAR)(SrcAddr >> 8);
        XBYTE[0x2773] = (UCHAR)(SrcAddr >> 16);

        XBYTE[0x2774] = (UCHAR)(DstAddr);
        XBYTE[0x2775] = (UCHAR)(DstAddr >> 8);
        XBYTE[0x2776] = (UCHAR)(DstAddr >> 16);

        XBYTE[0x2777] = (UCHAR)(DstHsize);
        XBYTE[0x2778] = (UCHAR)(DstHsize >> 8);
        XBYTE[0x2779] = (UCHAR)(DstVsize);
        XBYTE[0x277A] = (UCHAR)(DstVsize >> 8);

        XBYTE[0x277B] = (UCHAR)(DstHsize);
        XBYTE[0x277C] = (UCHAR)(DstHsize >> 8);
        XBYTE[0x277D] = (UCHAR)(DstVsize);
        XBYTE[0x277E] = (UCHAR)(DstVsize >> 8);

        XBYTE[0x27A1] = 0x80;                                           // start operation

        while(!(XBYTE[0x27B0] & 0x80));                         // wait operation done

        //PRINT_L2("        L2_SubDarkFrame: Exit\n");

        return L2K_SUCCESS;
}

//-----------------------------------------------------------------------------
//L2_ChkDRAMImgRdy
//-----------------------------------------------------------------------------
/*
routine description:
        Check if the DRAM image operation is done
arguments:
        none
return value:
        0x00 -  DRAM operation is busy
        0x01 -  DRAM operation is done

*/
UCHAR L2_ChkDRAMImgRdy(void) USING_0
{
        //PRINT_L2("        L2_ChkDRAMImgRdy: Enter\n");

        while(!(XBYTE[0x27B0] & 0x80));                         // wait operation done

        //PRINT_L2("        L2_ChkDRAMImgRdy: Exit\n");

        return L2K_SUCCESS;
}


⌨️ 快捷键说明

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