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

📄 halgxm.h

📁 WinCE 3.0 BSP, 包含Inter SA1110, Intel_815E, Advantech_PCM9574 等
💻 H
字号:
/*
 * $Workfile: halgxm.h $
 * $Revision: 4 $
 * $Date: 4/07/00 9:12a $
 * $Modtime: 4/07/00 8:59a $
 * $Author: Sarma $
 *
 * Copyright (c) 1998 National Semiconductor Corporation.
 * All Rights Reserved.
 *
 * This software is the confidential and proprietary information of National 
 * Semiconductor Corporation. ("Confidential Information").
 * You shall not disclose such Confidential Information and shall use it only
 * in accordance with the terms of the license agreement you entered into
 * with National Semiconductor Corporation.
 * This code is supplied as is.
 *
 */

/*
 *$Log: /CE/Platform/Nsc/Drivers/Video/gxvideo/ddraw/halgxm.h $
 * 
 * 4     4/07/00 9:12a Sarma
 * Removed Cyrix Corporation from the legal/confidentail information. Also
 * added for files not containing this info.
 * 
 *$History: halgxm.h $
 * 
 * *****************  Version 4  *****************
 * User: Sarma        Date: 4/07/00    Time: 9:12a
 * Updated in $/CE/Platform/Nsc/Drivers/Video/gxvideo/ddraw
 * Removed Cyrix Corporation from the legal/confidentail information. Also
 * added for files not containing this info.
 *
*/

#ifdef DD_SUPPORT
//#include "vpe.h"

/*--------------------*/
/*  IO DEVICE ACCESS  */
/*--------------------*/

#define IO_READ_8(_port, _valueptr) \
{ \
    WORD ___port = (_port); \
    DWORD * ___valueptr = (DWORD *)(_valueptr); \
    __asm {mov  dx, ___port} \
    __asm {in   al, dx} \
    __asm {mov  edx, ___valueptr} \
    __asm {mov  BYTE PTR [edx], al} \
}

#define IO_READ_16(_port, _valueptr) \
{ \
    WORD ___port = (_port); \
    DWORD * ___valueptr = (DWORD *)(_valueptr); \
    __asm {mov  dx, ___port} \
    __asm {in   ax, dx} \
    __asm {mov  edx, ___valueptr} \
    __asm {mov  WORD PTR [edx], ax} \
}

#define IO_READ_32(_port, _valueptr) \
{ \
    WORD ___port = (_port); \
    DWORD * ___valueptr = (DWORD *)(_valueptr); \
    __asm {mov  dx, ___port} \
    __asm {in   eax, dx} \
    __asm {mov  edx, ___valueptr} \
    __asm {mov  DWORD PTR [edx], eax} \
}

#define IO_WRITE_8(_port, _value) \
{ \
    WORD ___port = (_port); \
    DWORD ___valueptr = (_value); \
    __asm {movzx  eax, BYTE PTR [___valueptr]} \
    __asm {mov  dx, ___port} \
    __asm {out  dx, al} \
}

#define IO_WRITE_16(_port, _value) \
{ \
    WORD ___port = (_port); \
    DWORD ___valueptr = (_value); \
    __asm {movzx  eax, WORD PTR [___valueptr]} \
    __asm {mov  dx, ___port} \
    __asm {out  dx, ax} \
}

#define IO_WRITE_32(_port, _value) \
{ \
    WORD ___port = (_port); \
    DWORD ___valueptr = (_value); \
    __asm {mov  eax, DWORD PTR [___valueptr]} \
    __asm {mov  dx, ___port} \
    __asm {out  dx, eax} \
}


//Added stuff from Windows95 Directdraw driver here - ullas

#define YVYU    0
#define YUYV    1
#define UYVY    2
#define RGB8    3
#define EMMA    4

/*
 * IN_VBLANK should be replaced by a test to see if the hardware is currently
 * in the vertical blank
 */
//#define IN_VBLANK               InVBlank()
//#define IN_DISPLAY              !InVBlank()

/*
 * DRAW_ENGINE_BUSY should be replaced by a test to see the bltter is still
 * busy drawing
 */
#define DRAW_ENGINE_BUSY        DrawEngineBusy()

/*
 * ENOUGH_FIFO_FOR_BLT should be replaced with a test to see if there is enough
 * room in the hardware fifo for a blt
 */
#define ENOUGH_FIFO_FOR_BLT     CommandBufferEmpty()

/*
 * CURRENT_VLINE should be replaced by a macro to retrieve the current
 * scanline
 */
#define CURRENT_VLINE           GetScanLine()

#define SPAD_BUSY_FLAG          0x0ED0      // Save to disk busy flag
#define BLIT_BUFFER_1_8BPP      0x0B30  
#define BLIT_BUFFER_1_16BPP     0x0930  

// Gamma control defines

#define GAMMASTATE_REGVALID         0x10    // Registry data is valid
#define GAMMA_SLIDEASONE            0x01    // Move RGB channels together 
#define BRIGHT_SLIDEASONE           0x02    // Move RGB channels together 
#define CONTRAST_SLIDEASONE         0x04    // Move RGB channels together 

#define COLOR_RANGE    255
#define COLOR_MID      128
#define COLOR_DEFAULT  128

#define MODE_GAMMA      0
#define MODE_BRIGHT     1
#define MODE_CONTRAST   2
#define MODE_HUE        3



typedef struct tagOVERLAYDATA
{
    BOOL        OverlayActive;
    DWORD       VidFormat;
    DWORD       VidBufSize;
} OVERLAYDATA;

typedef struct tagVIDEODATA
{
    DWORD       XPos;
    DWORD       YPos;
    DWORD       XSize;
    DWORD       YSize;
    DWORD       XScale;
    DWORD       YScale;
    DWORD       Offset;
    DWORD       Pitch;
    DWORD       XClip;
} VIDEODATA;

/*
** VPE specific data
*/
typedef struct tagVPEDATA {
    BYTE        bInputWidthPixelAlign;
    BYTE        bFlags;
    BYTE        GUIDIndex;
    DWORD       dwBaseOffset;
    DWORD       *HDecimationTable;
    DWORD       *VDecimationTable;
    WORD        HDecimationSteps;
    WORD        VDecimationSteps;
    DWORD       dwVDecimationPattern;   // the current VDecimation pattern
    DWORD       dwNumBuffers;           // number of attached, flippable buffers
    DWORD       dwBufferSize;           // size of buffers in KB
    FLATPTR     fpCurrentSurface;
    DDVIDEOPORTCAPS ddVideoPortCaps;    // the capabilities of this instance
} VPEDATA;

typedef struct tagDDRAWDATA
{
//#ifdef _WIN32
//    DWORD                       lpPDevice;
//#else
//    DIBENGINE FAR *             lpPDevice;
//#endif
    DWORD                       FbLinear;
    DWORD                       RegLinear;
//    DWORD                       VidLinear;
    DWORD                       DhruvaLinear;
    DWORD                       VIPLinear;
    WORD                        hTiming;
    WORD                        vTiming;
    WORD                        MaxBufferPixels;
    WORD                        BB1Base;
//    DWORD                       VideoBase;      // base of video memory.
//    DWORD                       VideoHeapBase;  // start of video heap.
//    DWORD                       VideoHeapEnd;   // end of video heap.
//    DWORD                       fReset;
    DWORD                       dwWidth;      
    DWORD                       dwHeight;     
    LONG                        lPitch;       
    DWORD                       dwBpp;
    DWORD                       dwRefreshRate; 
    DWORD                       DeviceID;
//    DWORD                       dwDirectDrawVersion;
//    WORD                        GXflags;
//    WORD                        CPUSpeed;
    WORD                        wPanX;
    WORD                        wPanY;
    VIDEODATA                   Video;
//    SYSINFO1                    SysInfo1;
//    DWORD                       CPUClockMult;
//    DWORD                       ProcessorID;
//    DDHALDDRAWFNS               HALCallbacks;
//    DDHALINFO                   HALInfo;
//    DDHAL_DDCALLBACKS           DDCallbacks;
//    DDHAL_DDSURFACECALLBACKS    DDSurfaceCallbacks;
//    DDHAL_DDPALETTECALLBACKS    DDPaletteCallbacks;
//    VIDMEM                      vidMem[1];
    VPEDATA                     VPE;
} DDRAWDATA;


typedef struct {
    FLATPTR             fpFlipFrom;
    BOOL                bFlipFlag;
    UINT                wFlipScanLine;
    BOOL                bFlipDuringVBlank;
    BOOL                bWasEverInDisplay;

} FLIPRECORD;


typedef struct {
    LPDDRAWI_DDRAWSURFACE_LCL pSrcSurf;
    DWORD               dwID   ;        //0 if available
    DWORD               dwDstX1;
    DWORD               dwDstY1;
    DWORD               dwDstW ;        //w and h in pixel
    DWORD               dwDstH ;
    DWORD               dwDstCKHi;
    DWORD               dwDstCKLo;
    DWORD               dwSrcW ;        //w and h in pixel
    DWORD               dwSrcH ;
    DWORD               dwSrcCKHi;
    DWORD               dwSrcCKLo;
    DWORD               pSrcStart;
    DWORD               dwSrcPitch;
    DWORD               dwSurfBpp;
    DWORD               dwFlags;
    DWORD               dwFlipOfs;
    //Hardware-Used stuffs
    DWORD               dwHWFlags;      // 1 if frontend conversion
    long                dwVidEngNo;     // -1,0/1/2 or
    WORD                wVideoFmt;
    WORD                wVideoCtrl;
    WORD                wVFIFO;
    WORD                wFetch;

} OVERLAYSURF,FAR *LPOVERLAYSURF;


/* graphic functions */
WORD GetScanline();
BOOL InVBlank(void);
HRESULT updateFlipStatus( FLATPTR );
BOOL DrawEngineBusy(void);
BOOL CommandBufferEmpty(void);
BOOL FlipStatus(DWORD);
BOOL FlipDisplay(DWORD);

/* video functions */
DWORD OverlayOK(DWORD VertScale);
BOOL SetVideoOffset(DWORD);
BOOL SetChromaKey(DWORD, DWORD);
void BytesToPixels(DWORD Bpp, LONG Pitch, DWORD Offset, DWORD *OffsetX, DWORD *OffsetY);
BOOL ScrToScrBlt(DWORD SrcX, DWORD SrcY, DWORD DstX, DWORD DstY, DWORD Width, DWORD Height);
BOOL ScrToScrXBlt(DWORD SrcX, DWORD SrcY, DWORD DstX, DWORD DstY, DWORD Width, DWORD Height, DWORD ColorKey); 
BOOL FillBlt(DWORD DstX, DWORD DstY, DWORD Width, DWORD Height, DWORD Color);
BOOL SetVideoPalette(BYTE *RedGamma, BYTE *GreenGamma, BYTE *BlueGamma);
BOOL SetVideoOutput(BOOL);
BOOL SetVideoBufferSize(DWORD SizeBytes);
BOOL SetVideoDisplay(DWORD * VidCfg, BOOL State);
BOOL SetVideoFormat(DWORD * VidCfg, DWORD Format);
BOOL SetVideoPosition(DWORD * VidCfg, DWORD XPos, DWORD YPos, DWORD Width, DWORD Height, BOOL SizeValid);
BOOL SetScaleFactor(DWORD * VidCfg, DWORD DstWidth, DWORD DstHeight, DWORD SrcWidth, DWORD SrcHeight);
BOOL DhruvaSetScale(DWORD * VidCfg, DWORD DstWidth, DWORD DstHeight, DWORD SrcWidth, DWORD SrcHeight);
BOOL SetVideoSource(DWORD * VidCfg, DWORD XPos, DWORD Pitch);
BOOL BeginLoad(DWORD * VidCfg);
BOOL EndLoad(DWORD VidCfg);


// videoport functions
void MPC2_EnablePort(BOOL);
void MPC2_Reset();
void MPC2_DisablePort();
//void MPC2_Freeze();       // Freeze is similar to DisablePort
//void MPC2_UnFreeze();     // Unfreeze is inc.d in EnablePort..
DWORD MPC2_Get(DWORD reg);
void  MPC2_Set(DWORD reg, DWORD value);
void  MPC2_RMW(DWORD reg, DWORD dwClear, DWORD dwSet);
DWORD Dhruva_Get(DWORD reg);
void  Dhruva_Set(DWORD reg, DWORD value);
void  Dhruva_RMW(DWORD reg, DWORD dwClear, DWORD dwSet);
DWORD CFG_Get(DWORD reg);
void  CFG_Set(DWORD reg, DWORD value);
void  CFG_RMW(DWORD reg, DWORD dwClear, DWORD dwSet);
int IndexFromGUID(GUID *pGUID);

#endif //DD_SUPPORT

⌨️ 快捷键说明

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