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

📄 drvge2.h

📁 mstar 776 开发的车载dvd
💻 H
📖 第 1 页 / 共 3 页
字号:
////////////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2006-2007 MStar Semiconductor, Inc.
// All rights reserved.
//
// Unless otherwise stipulated in writing, any and all information contained
// herein regardless in any format shall remain the sole proprietary of
// MStar Semiconductor Inc. and be kept in strict confidence
// (¨MStar Confidential Information〃) by the recipient.
// Any unauthorized act including without limitation unauthorized disclosure,
// copying, use, reproduction, sale, distribution, modification, disassembling,
// reverse engineering and compiling of the contents of MStar Confidential
// Information is unlawful and strictly prohibited. MStar hereby reserves the
// rights to any and all damages, losses, costs and expenses resulting therefrom.
//
/// @file drvGE2.h
/// @version Rev.14 #58042
/// @brief Graphics Engine Module
/// @author MStar Semiconductor Inc.
///
/// GE is used to paint OSD
///
/// Features:
/// - BLT engine : fast and simply blt function
/// - Pixel engine(PE) : complex blt function
////////////////////////////////////////////////////////////////////////////////

#ifndef _DRVGE2_H_
#define _DRVGE2_H_

#include "datatype.h"
#include "board.h"
#include "Memtype.h"

#define GE_TEST                                0
#define GE_DEBUG_CODE                   0

#define GE_ALIGNED_VALUE(value, align)  ( ((value) + ((align)-1)) & ~((align)-1) )
#define GE_ADDR_ALIGNMENT(addr)         GE_ALIGNED_VALUE(addr, 8)    // 8-byte alignment

#define MAX_FONT                        32  //5
#define MAX_BITMAP                      500
#define ERR_NULL_INDEX                  0xFFFF

#define CC_USE_123433 0
#define ERR_HANDLE                      -1

#ifdef  MDRV_GE_C
#define INTERFACE
#else
#define INTERFACE extern
#endif

//GE return code
/// GE DDI return value
#define GESTATUS                        U32
/// @name GESTATUS
/// GESTATUS return value
/// @{
#define GESTATUS_SUCCESS                    0x00000000  //0
#define GESTATUS_FAIL                       0x00000001  //Bit(0)
#define GESTATUS_NON_ALIGN_ADDRESS          0x00000002  //Bit(1)
#define GESTATUS_NON_ALIGN_PITCH            0x00000004  //Bit(2)
#define GESTATUS_INVALID_INTENSITY_ID       0x00000008  //Bit(3)
#define GESTATUS_INVALID_BUFF_INFO          0x00000010  //Bit(4)
#define GESTATUS_INVALID_FONT_HANDLE        0x00000020  //Bit(5)
#define GESTATUS_INVALID_BMP_HANDLE         0x00000040  //Bit(6)
#define GESTATUS_INVALID_PARAMETERS         0x00000080  //Bit(7)
//#define GESTATUS_OUTOF_MEMORY               0x00000040  //Bit(6)
//#define GESTATUS_INVALID_COMMAND            0x00000080  //Bit(7)

/// @}

///Define Blending Coefficient
typedef enum
{
    /// 1
    COEF_ONE     =  0,
    /// constant
    COEF_CONST   =  1,
    /// source alpha
    COEF_ASRC    =  2,
    /// destination alpha
    COEF_ADST    =  3,
    /// 0
    COEF_ZERO    =  4,
    /// 1 - constant
    COEF_1_CONST =  5,
    /// 1 - source alpha
    COEF_1_ASRC  =  6,
    /// 1 - destination alpha
    COEF_1_ADST  =  7,
}GE_BLEND_COEF;

///Define Blending Source from
typedef enum
{
    /// constant
    ABL_FROM_CONST = 0,
    /// source alpha
    ABL_FROM_ASRC  = 1,
    /// destination alpha
    ABL_FROM_ADST  = 2,
}GE_ALPHA_SRC_FROM;


/// Color Key Operation Mode
typedef enum
{
    /// Equal
    CK_OP_EQUQL = 0,
    /// Not equal
    CK_OP_NOT_EQUQL = 1,

}GE_COLOR_KEY_MODE;



/// GE buffer format
typedef enum
{
    /// font mode I1
    GE_FMT_I1          = 0x0,
    /// font mode I2
    GE_FMT_I2          = 0x1,
    /// font mode I4
    GE_FMT_I4          = 0x2,
    /// color format palette 256(I8)
    GE_FMT_I8          = 0x4,
    /// color format blinking display
    GE_FMT_1ABFgBg12355  = 0x7,
    /// color format RGB565
    GE_FMT_RGB565      = 0x8,
    /// color format ORGB1555
    GE_FMT_ARGB1555    = 0x9,
    /// color format ARGB4444
    GE_FMT_ARGB4444    = 0xa,
    /// color format for blinking display (will be obsoleted)
    GE_FMT_1BAAFGBG123433= 0xb,
    /// color format YUV422
    GE_FMT_YUV422    = 0xe,
    /// color format ARGB8888
    GE_FMT_ARGB8888    = 0xf
}GE_Buffer_Format;


///Define Raster Operation
typedef enum
{
    ///    rop_result = 0;
    ROP2_OP_ZORE          = 0,
    ///    rop_result = ~( rop_src | rop_dst );
    ROP2_OP_NOT_PS_OR_PD  = 1,
    ///    rop_result = ((~rop_src) & rop_dst);
    ROP2_OP_NS_AND_PD     = 2,
    ///    rop_result = ~(rop_src);
    ROP2_OP_NS            = 3,
    ///    rop_result = (rop_src & (~rop_dst));
    ROP2_OP_PS_AND_ND     = 4,
    ///    rop_result = ~(rop_dst);
    ROP2_OP_ND            = 5,
    ///    rop_result = ( rop_src ^ rop_dst);
    ROP2_OP_PS_XOR_PD     = 6,
    ///    rop_result = ~(rop_src & rop_dst);
    ROP2_OP_NOT_PS_AND_PD = 7,
    ///    rop_result = (rop_src & rop_dst);
    ROP2_OP_PS_AND_PD     = 8,
    ///    rop_result = ~(rop_dst ^ rop_src);
    ROP2_OP_NOT_PS_XOR_PD = 9,
    ///    rop_result = rop_dst;
    ROP2_OP_PD            = 10,
    ///    rop_result = (rop_dst | (~rop_src));
    ROP2_OP_NS_OR_PD      = 11,
    ///    rop_result = rop_src;
    ROP2_OP_PS            = 12,
    ///    rop_result = (rop_src | (~rop_dst));
    ROP2_OP_PS_OR_ND      = 13,
    ///    rop_result = (rop_dst | rop_src);
    ROP2_OP_PD_OR_PS      = 14,
    ///    rop_result = 0xffffff;
    ROP2_OP_ONE           = 15,
}GE_ROP2_OP;


///Define STBB SCK mode
typedef enum
{
    /// Do nothing
    STBB_SCK_NONE    = 0,
    ///	Use nearest
    STBB_SCK_NEAREST = 1,
    ///	Use custom color
	STBB_SCK_CUSTOM  = 2,
} GE_STBB_SCK_OP;


///Define Alpha Compare mode
typedef enum
{
    /// Maximum alpha of Source and Destination
    PE_ALPHA_CMP_MAX = 0,
    ///	Minimum alpha of Source and Destination
    PE_ALPHA_CMP_MIN = 1,
} PE_ALPHA_CMP_TYPE;


///Define Color Space Convertion Format for Decode(RGB to YUV)
typedef enum
{
    ///	Computer mode
    PE_DC_CSC_COMP    = 0,
    ///	CSC to 0~255
	PE_DC_CSC_255  = 1,
}PE_DC_CSC_TYPE;


///Define YUV output range
typedef enum
{
    ///	0~255
    PE_YUV_RANGE_U  = 0,
    ///	-128~127
	PE_YUV_RANGE_S  = 1,
}PE_YUV_RANGE_TYPE;



///Define UV input range
typedef enum
{
    ///	Do nothing
    PE_UV_RANGE_U   = 0,
    ///	Use nearest
	PE_UV_RANGE_S  = 1,
}PE_UV_RANGE_TYPE;


///Define YUV 422 source/destination format
typedef enum
{
    /// CbY1CrY0
    PE_YUV_FMT_0  = 0,
    ///	CrY1CbY0
	PE_YUV_FMT_1  = 1,
    /// Y1CbY0Cr
    PE_YUV_FMT_2  = 2,
    ///	Y1CrY0Cb
	PE_YUV_FMT_3  = 3,
}PE_YUV_FMT_TYPE;



//=============================================================================
// Data Buffer info
//=============================================================================
/// Data buffer info.
typedef struct
{
    /// start memory address
    U32 u32Addr;       // flat address of whole memory map
    /// width
    U32 u32Width;
    /// height
    U32 u32Height;
    /// pitch
    U32 u32Pitch;
    /// Color format\n
    /// - GE_FMT_I1\n
    /// - GE_FMT_I2\n
    /// - GE_FMT_I4\n
    /// - GE_FMT_I8\n
    /// - GE_FMT_RGB565\n
    /// - GE_FMT_ARGB1555\n
    /// - GE_FMT_ARGB4444\n
    /// - GE_FMT_1BAAFGBG123433\n
    /// - GE_FMT_ARGB8888\n
    GE_Buffer_Format u32ColorFmt;
} GE_BUFFER_INFO;

#define MAX_BUF_INFO 7

typedef GE_BUFFER_INFO* PGE_BUFFER_INFO;

/// Blink type (Obsoleted)
typedef enum
{
    GE_BLINK_OFF    = 0,
    GE_BLINK_BG     = 1,
    GE_BLINK_FG     = 2,
    GE_BLINK_ALL    = 3,
} GEBlinkMode;

/// GE Color information
typedef struct
{
#ifdef WORDS_BIGENDIAN
    U8 a;   ///< alpha
    U8 r;   ///< Red
    U8 g;   ///< Green
    U8 b;   ///< Blue
#else
    U8 b;   ///< Blue
    U8 g;   ///< Green
    U8 r;   ///< Red
    U8 a;   ///< alpha
#endif
} GERGBColor;

#define GE_COLOR(c)  (*(U32 *)&(c))

/// GE Color Range
typedef struct
{
    GERGBColor color_s;     ///< start color
    GERGBColor color_e;     ///< end color
} GEColorRange;

/// GE pointer information
typedef struct
{
    U16 x;  ///< x coordinate of point
    U16 y; ///< y coordinate of point 1
    GERGBColor clr; ///< color information
} GEClrPoint;

/// GE pointer coordinate
typedef struct
{
    U16 x; ///< x coordinate of point
    U16 y; ///< y coordinate of point
} GEPoint;

/// GE Line information
typedef struct
{
    U16 x1; ///< x coordinate of point 1
    U16 y1; ///< y coordinate of point 1
    U16 x2; ///< x coordinate of point 2
    U16 y2; ///< y coordinate of point 2
    GERGBColor clr; ///< color information for line
} GEClrLine;

/// GE Block (Rectangle) information
typedef struct
{
    U16 x;  ///< x coordinate
    U16 y; ///< y coordinate
    U16 width; ///< rectangle width
    U16 height; ///< rectangle height
} GEBlock;

/// GE BLOCK (Rectangle) information with color
typedef struct
{
    U16 x;  ///< start point x coordinate
    U16 y;  ///< start point y coordinate
    U16 width;  ///< rectangle width
    U16 height; ///< rectangle height
    GERGBColor clr; ///< color information
} GEClrBlock;

/// Types for GEFontFmt.flag: Default
#define GEFONT_FLAG_DEFAULT     0x0000
/// Types for GEFontFmt.flag: Italic
#define GEFONT_FLAG_ITALIC        0x0001
/// Types for GEFontFmt.flag: Scale
#define GEFONT_FLAG_SCALE        0x0002
/// Types for GEFontFmt.flag: Compact
#define GEFONT_FLAG_COMPACT     0x0004
/// Types for GEFontFmt.flag: Background
#define GEFONT_FLAG_BACKGROUND  0x0008
/// Types for GEFontFmt.flag: Blink
#define GEFONT_FLAG_BLINK        0x0010
/// Types for GEFontFmt.flag: Variable width
#define GEFONT_FLAG_VARWIDTH    0x0020  // variable width
/// Types for GEFontFmt.flag: Gap
#define GEFONT_FLAG_GAP         0x0040  // gap (specified by font_tab) between fonts
/// Types for GEFontFmt.flag: Bold
#define GEFONT_FLAG_BOLD        0x0080
/// Types for GEFontFmt.flag: Simple
#define GEFONT_FLAG_SIMPLE      0x0100
/// Types for GEFontFmt.flag: Blink foreground
#define GEFONT_FLAG_BLINK_FG    0x0200
/// Types for GEFontFmt.flag: Blink Background
#define GEFONT_FLAG_BLINK_BG    0x0400
/// Types for GEFontFmt.flag: TRANSL Foreground
#define GEFONT_FLAG_TRANSL_FG   0x0800
/// Types for GEFontFmt.flag: TRANSL Background
#define GEFONT_FLAG_TRANSL_BG   0x1000
/// Types for GEFontFmt.flag: Transparent Foreground
#define GEFONT_FLAG_TRANSP_FG   0x2000
/// Types for GEFontFmt.flag: Transparent Background
#define GEFONT_FLAG_TRANSP_BG   0x4000


//Bitblt Type Flag
#define GEBitbltType_Normal                  0x01
#define GEBitbltType_Bitmap                  0x02
#define GEBitbltType_Font                    0x04

/// GE Font format
typedef struct
{
    U16 flag;    ///< scale, italic, blink ....
    U16 width;      ///< font width
    U16 height;     ///< font height
    U8 dis;         ///< distance
    GERGBColor clr; ///< color information
    U8 blinkfg; ///< foreground blinking
    U8 blinkbg; ///< background blinking
    U8 ifont_gap;  ///< inter-font gap, only valid for GEFONT_FLAG_GAP
} GEFontFmt;

/// GE Blink type for mono font (2 color font)
typedef enum
{
    GEBLINK_NONE = 0x0, ///< NO blink
    GEBLINK_BACKGROUND, ///< Background blink
    GEBLINK_FOREGROUND, ///< Foreground blink
    GEBLINK_BOTH,   ///< Both background & foreground blink
} GEBLINKTYPE;

/// Types for GELineFmt.flag : Constant
#define GELINE_FLAG_COLOR_CONSTANT  0x00
/// Types for GELineFmt.flag : Gradient color
#define GELINE_FLAG_COLOR_GRADIENT  0x80
/// GE Line format
typedef struct
{
    U8 width;   ///< line width (for bold line)
    U8 flag;     ///< color constant or gradient
    U8 pattern; ///< line pattern
} GELineFmt;

/// Types for GERectFmt.flag : CONSTANT
#define GERECT_FLAG_COLOR_CONSTANT      0x1
/// Types for GERectFmt.flag : Gradient color in x direction
#define GERECT_FLAG_COLOR_GRADIENT_X    0x2
/// Types for GERectFmt.flag : Gradient color in y direction
#define GERECT_FLAG_COLOR_GRADIENT_Y    0x4
/// Types for GERectFmt.flag : blending
#define GERECT_FLAG_BLENDING            0x8

/// GE Rectangle format
typedef struct
{
    U8 flag;    ///< color constant, gradient at x/y direction, blending
    GERGBColor e_clr;   ///< color information
} GERectFmt;

//-------------------------------------------------
#define GEROUND_PHASE0    0x2
#define GEROUND_PHASE1    0x4
#define GEROUND_PHASE2    0x8
#define GEROUND_PHASE3    0x10

#define GEROUND_FLAG_COLOR_CONSTANT      0x1
#define GEROUND_FLAG_COLOR_GRADIENT_X    0x2
#define GEROUND_FLAG_COLOR_GRADIENT_Y    0x4
typedef struct
{
    U8 degree;
    U8 flag;
    GERGBColor e_clr;
} GERoundFmt;

//-------------------------------------------------
typedef struct
{
    U8 degree;
    U8 width;
} GERoundFrameFmt;

//-------------------------------------------------
typedef struct
{
    U8 rop;
} GEBltFmt;

/// GE Bitmap format
typedef struct
{
    BOOLEAN bBmpColorKeyEnable; ///< colorkey enable
    GEColorRange clrrange;  ///< color range
    BOOLEAN bScale; ///< scaling enable
      U16 width; ///< bitmap width
    U16 height; ///< bitmap height
} GEBitmapFmt;

//-------------------------------------------------
typedef struct
{
    U8 fmt;
} GEClipFmt;

/// GE Direction types positive
#define GEDIR_POSITIVE        0
/// GE Direction types negative

⌨️ 快捷键说明

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