diff --git a/glide_internal/fxhal.h b/glide_internal/fxhal.h new file mode 100644 index 0000000..692c6ff --- /dev/null +++ b/glide_internal/fxhal.h @@ -0,0 +1,165 @@ +/*-*-c++-*-*/ +#ifndef __FXHAL_H__ +#define __FXHAL_H__ + +/* +** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY +** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT +** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX +** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE +** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). +** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER +** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A +** FULL TEXT OF THE NON-WARRANTY PROVISIONS. +** +** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO +** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN +** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013, +** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR +** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF +** THE UNITED STATES. +** +** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED +** +** $Revision: 1.1.1.1 $ +** $Date: 1999/12/07 21:49:24 $ +*/ + +#if defined(BUILD_HAL) +#define FX_DLL_DEFINITION +#endif +#include + +#include + +// Allow SourceSafe to track Revision values +#define HAL_H_REV "$Revision: 1.1.1.1 $" + +// Just to unconfuse myself: +// +// CHIP FBI-REV TMU-REV DEV-ID +// SST1-0.6u 1 0 1 +// SST1-0.5u 2 1 1 +// SST-96 2 (1) 2 +// H3 3 4 4 +// H4 ? ? 4? +#define SST_DEVICE_ID_SST1 1 +#define SST_DEVICE_ID_SST96 2 +#define SST_DEVICE_ID_H3 3 + +#define MBYTE(n) (((FxU32)(n))<<20) +#define DEAD 0xDEAD + +// Maximum number of boards and TMUs supported +#define HAL_MAX_BOARDS 16 + +//---------------------------------------------------------------------- +// the root of all Hal information +//---------------------------------------------------------------------- +typedef struct { + int csim; + int hsim; + int hw; + FxU32 boardsFound; // number of boards found + FxDeviceInfo boardInfo[HAL_MAX_BOARDS]; + + int pollLimit; // number of pixels to poll msg Q after + int pollCount; // current pixel counter + int video; // video output enabled + FxU32 csimLastRead; +} HalInfo; + +//---------------------------------------------------------------------- +/* +** SST Hardware Initialization routine protypes +** +** If all initialization routines are called, it is assumed they are called +** in the following order: +** 0. fxHalInit(); +** 1. fxHalMapBoard(); +** 2. fxHalInitRegisters(); +** 3. fxHalInitGamma(); +** 4. fxHalInitVideo(); +** 5. fxHalShutdown(); +** +** fxHalShutdown() is called at the end of an application to turn off +** the graphics subsystem +** +*/ + +FX_ENTRY void FX_CALL fxHalPutenv(char *buf); +FX_ENTRY HalInfo * FX_CALL fxHalInit(FxU32 flags); +FX_ENTRY FxU32 FX_CALL fxHalNumBoardsInSystem(void); +FX_ENTRY SstRegs * FX_CALL fxHalMapBoard(FxU32 boardNum); +FX_ENTRY FxBool FX_CALL fxHalInitCmdFifo( SstRegs *sst, int which, + FxU32 fifoStart, FxU32 size, + FxBool directExec, FxBool disableHoles, + FxSet32Proc set32); +FX_ENTRY FxBool FX_CALL fxHalInitRegisters(SstRegs *sst); +FX_ENTRY FxBool FX_CALL fxHalInitRenderingRegisters(SstRegs *sst); +FX_ENTRY FxBool FX_CALL fxHalInitGamma(SstRegs *sst, FxFloat gamma); +FX_ENTRY FxBool FX_CALL fxHalInitGammaRGB(SstRegs *sst, FxFloat r, FxFloat g, FxFloat b); +FX_ENTRY FxBool FX_CALL fxHalInitVideo(SstRegs *sst, FxU32 resolution, + FxU32 refresh, sst1VideoTimingStruct *); +FX_ENTRY FxBool FX_CALL fxHalIdle(SstRegs *sst); +FX_ENTRY FxBool FX_CALL fxHalIdleNoNOP(SstRegs *sst); +FX_ENTRY FxBool FX_CALL fxHalIdleFBINoNOP( SstRegs *sst ); +FX_ENTRY FxBool FX_CALL fxHalShutdown(SstRegs *sst); +FX_ENTRY FxBool FX_CALL fxHalInitUSWC(SstRegs *sst); +FX_ENTRY void FX_CALL fxHalShutdownAll(void); +FX_ENTRY FxBool FX_CALL fxHalGetDeviceInfo(SstRegs *sst, FxDeviceInfo *); +FX_ENTRY FxBool FX_CALL fxHalInitSLI(SstRegs *sst, SstRegs *sst1); + +FX_ENTRY FxBool FX_CALL fxHalVsync(SstRegs *sst); +FX_ENTRY FxBool FX_CALL fxHalVsyncNot(SstRegs *sst); + + + #define GET8(s) s + #define GET16(s) s + #define GET(s) s + #define SET8(d,s) d = s + #define SET16(d,s) d = s + #define SET(d,s) d = s + #define SETF(d,s) (*(float *)&(d)) = s + +//--------------------------------------------------------------------------- +// internal HAL stuff not meant for external use +//--------------------------------------------------------------------------- +#if defined(BUILD_HAL) || defined(BUILD_DIAGS) + +// GMT: Init code SET/GET always go thru subroutines (allows for P6 fencing) +#define IGET(A) fxHalRead32((FxU32 *) &(A)) +#define ISET(A,D) fxHalWrite32((FxU32 *) &(A), D) + +// this is the FAKE address where the hardware lives +// we use a large address so attempts to write to it get an access violation +// and it has 28 zero bits so that we can easily figure out the board number +// and the offset into the board +#define SST_FAKE_ADDRESS_MAKE(i) (SstRegs *)((i+1)<<28) +#define SST_FAKE_ADDRESS_GET_BOARD(a) ((((FxU32)a>>28)&0xF)-1) +#define SST_FAKE_ADDRESS_GET_OFFSET(a) ((FxU32)a&0x0FFFFFFF) +#define SST_FAKE_ADDRESS_GET_BASE(a) ((FxI32)a&~0x0FFFFFFF) + +extern HalInfo halInfo; + +// internal HAL routines +FxU32 fxHalRead32(FxU32 *addr); +void fxHalWrite32(FxU32 *addr, FxU32 data); + +FxBool fxHalIdleFBI( SstRegs *sst ); + +void fxHalResetBoardInfo( FxDeviceInfo *info ); +FxBool fxHalFillDeviceInfo( SstRegs *sst ); +// FxBool fxHalGetFbiInfo( SstRegs *sst, FxDeviceInfo *info ); +// FxBool fxHalGetTmuInfo( SstRegs *sst, FxDeviceInfo *info ); +FxBool fxHalVaddrToBoardNumber( SstRegs *sst, FxU32 *boardNumber ); + +// GUI interface +FX_ENTRY void FX_CALL guiNewViewWindow(FxU32 boardNumber, const char *name); +void guiReadMessageQueue(void); +FxBool guiOpen( FxU32 boardNumber ); +void guiShutdown( SstRegs *sst ); + +#endif /* BUILD_HAL */ + +#endif /* !__FXHAL_H__ */ diff --git a/glide_internal/gdebug.h b/glide_internal/gdebug.h new file mode 100644 index 0000000..c8bb6a9 --- /dev/null +++ b/glide_internal/gdebug.h @@ -0,0 +1,138 @@ +/*-*-c++-*-*/ +#ifndef __GDEBUG_H__ +#define __GDEBUG_H__ + +/* +** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY +** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT +** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX +** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE +** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). +** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER +** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A +** FULL TEXT OF THE NON-WARRANTY PROVISIONS. +** +** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO +** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN +** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013, +** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR +** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF +** THE UNITED STATES. +** +** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED +** +** $Revision: 1.2 $ +** $Date: 2000/10/03 18:28:36 $ +*/ + +#include + +#if defined(FX_DLL_ENABLE) +#define FX_DLL_DEFINITION + +#endif +#include + +#define GDBG_MAX_LEVELS 512 + +#ifndef GETENV +#define GETENV(a) getenv(a) +#endif + +// if debug info turned on then GDBG_INFO does something +#ifdef GDBG_INFO_ON + +// Standard C provides no clean way to do this, but the GNU C tools do.. +#ifdef __GNUC__ + +#define GDBG_INFO(level, format, args...) \ + gdbg_info(level, format , ## args) +#define GDBG_INFO_MORE(level, format, args...) \ + gdbg_info_more(level, format , ## args) +#define GDBG_PRINTF(format, args...) \ + gdbg_printf(format , ## args) + +#else + +#define GDBG_INFO gdbg_info +#define GDBG_INFO_MORE gdbg_info_more +#define GDBG_PRINTF gdbg_printf + +#endif + +#define GDBG_ERROR_SET_CALLBACK gdbg_error_set_callback +#define GDBG_ERROR_CLEAR_CALLBACK gdbg_error_clear_callback + +#define GDBG_GET_DEBUGLEVEL gdbg_get_debuglevel +#define GDBG_SET_DEBUGLEVEL gdbg_set_debuglevel + +// otherwise GDBG_INFO does nothing +#else + +#if defined(__WATCOMC__) || defined(__WATCOM_CPLUSPLUS__) +/* Turn off the dead code warnings. Also changed the macro definitions + * to use an 'if' rather than the ternary operator because the + * type of the result sub-expressions must match. + * + * w111: Meaningless use of an expression + * w201: Unreachable code + */ +#pragma disable_message (111, 201) +#endif /* defined(__WATCOMC__) || defined(__WATCOM_CPLUSPLUS__) */ + +// Standard C provides no clean way to do this, but the GNU C tools do.. +#ifdef __GNUC__ + +#define GDBG_INFO(level, format, args...) +#define GDBG_INFO_MORE(level, format, args...) +#define GDBG_PRINTF(format, args...) + +#else + +#define GDBG_INFO 0 && (unsigned long) +#define GDBG_INFO_MORE 0 && (unsigned long) +#define GDBG_PRINTF 0 && (unsigned long) + +#define GDBG_ERROR_SET_CALLBACK 0 && (unsigned long) +#define GDBG_ERROR_CLEAR_CALLBACK 0 && (unsigned long) + +#endif + +#define GDBG_GET_DEBUGLEVEL(x) 0 +#define GDBG_SET_DEBUGLEVEL(a,b) + + +#endif + +#define GDBG_INIT gdbg_init +#define GDBG_SHUTDOWN gdbg_shutdown +#define GDBG_ERROR gdbg_error +#define GDBG_GET_ERRORS gdbg_get_errors +#define GDBG_SET_FILE gdbg_set_file + +FX_ENTRY void FX_CALL gdbg_init(void); +FX_ENTRY void FX_CALL gdbg_parse(const char *env); +FX_ENTRY void FX_CALL gdbg_shutdown(void); +FX_ENTRY void FX_CALL gdbg_vprintf(const char *format, va_list); +FX_ENTRY void FX_CALL gdbg_printf(const char *format, ...); +FX_ENTRY int FX_CALL gdbg_info(const int level, const char *format, ...); +FX_ENTRY int FX_CALL gdbg_info_more(const int level, const char *format, ...); +FX_ENTRY void FX_CALL gdbg_error(const char *name, const char *format, ...); +FX_ENTRY int FX_CALL gdbg_get_errors(void); +FX_ENTRY int FX_CALL gdbg_set_file(const char *name); +FX_ENTRY int FX_CALL gdbg_get_debuglevel(const int level); +FX_ENTRY void FX_CALL gdbg_set_debuglevel(const int level, const int value); + +// these routines allow for a library (like Glide) to get called back +typedef void (*GDBGErrorProc)(const char* const procName, + const char* const format, + va_list args); +FX_ENTRY int FX_CALL gdbg_error_set_callback(GDBGErrorProc p); +FX_ENTRY void FX_CALL gdbg_error_clear_callback(GDBGErrorProc p); + +// these routines allow for some GUI code to get called once in a while +// so that it can keep the UI alive by reading the message queue +typedef void (*GDBGKeepAliveProc)(int adjust); +FX_ENTRY void FX_CALL gdbg_set_keepalive(GDBGKeepAliveProc p); + +#endif /* !__GDEBUG_H__ */ diff --git a/glide_internal/sst1vid.h b/glide_internal/sst1vid.h new file mode 100644 index 0000000..035522e --- /dev/null +++ b/glide_internal/sst1vid.h @@ -0,0 +1,115 @@ +/* +** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY +** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT +** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX +** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE +** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). +** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER +** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A +** FULL TEXT OF THE NON-WARRANTY PROVISIONS. +** +** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO +** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN +** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013, +** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR +** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF +** THE UNITED STATES. +** +** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED +** +** $Header: /cvsroot/glide/glide2x/cvg/incsrc/sst1vid.h,v 1.1.1.1 1999/12/07 21:49:24 joseph Exp $ +** $Log: sst1vid.h,v $ +** Revision 1.1.1.1 1999/12/07 21:49:24 joseph +** Initial checkin into SourceForge. +** +** +** 5 3/10/98 2:33p Psmith +** separating cvg tree from h3/h4 trees + * + * 4 9/09/97 7:35p Sellers + * Added 400x300 resolution + * + * 3 8/24/97 9:31a Sellers + * moved new video timing to sst1vid.h + * redefined 1600x1280 to be 1600x1200 + * + * 2 6/05/97 11:14p Pgj + * + * 5 7/24/96 3:43p Sellers + * added 512x384 @ 60 Hz for arcade monitors + * added 512x256 @ 60 Hz for arcade monitors + * + * 4 7/18/96 10:58a Sellers + * fixed FT and TF clock delay values for lower frequencies with + * .5/.5 combos + * + * 3 6/18/96 6:54p Sellers + * added sst1InitShutdownSli() to fix Glide Splash screen problems with + * SLI + * + * 2 6/13/96 7:45p Sellers + * added "voodoo.ini" support + * added DirectX support + * misc cleanup + * + * 2 6/11/96 1:43p Sellers + * added support for 60, 75, 85, and 120 Hz refresh rates for "most" + * resolutions + * + * 1 5/08/96 5:43p Paik + * Video definitions +*/ +#ifndef __SST1VID_H__ +#define __SST1VID_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/* Video defines */ + +typedef FxI32 GrScreenRefresh_t; +#define GR_REFRESH_60Hz 0x0 +#define GR_REFRESH_70Hz 0x1 +#define GR_REFRESH_72Hz 0x2 +#define GR_REFRESH_75Hz 0x3 +#define GR_REFRESH_80Hz 0x4 +#define GR_REFRESH_90Hz 0x5 +#define GR_REFRESH_100Hz 0x6 +#define GR_REFRESH_85Hz 0x7 +#define GR_REFRESH_120Hz 0x8 +#define GR_REFRESH_NONE 0xff + +typedef FxI32 GrScreenResolution_t; +#define GR_RESOLUTION_320x200 0x0 +#define GR_RESOLUTION_320x240 0x1 +#define GR_RESOLUTION_400x256 0x2 +#define GR_RESOLUTION_512x384 0x3 +#define GR_RESOLUTION_640x200 0x4 +#define GR_RESOLUTION_640x350 0x5 +#define GR_RESOLUTION_640x400 0x6 +#define GR_RESOLUTION_640x480 0x7 +#define GR_RESOLUTION_800x600 0x8 +#define GR_RESOLUTION_960x720 0x9 +#define GR_RESOLUTION_856x480 0xa +#define GR_RESOLUTION_512x256 0xb +#define GR_RESOLUTION_1024x768 0xC +#define GR_RESOLUTION_1280x1024 0xD +#define GR_RESOLUTION_1600x1200 0xE +#define GR_RESOLUTION_400x300 0xF +#define GR_RESOLUTION_NONE 0xff + +#ifdef GR_RESOLUTION_MAX +#undef GR_RESOLUTION_MAX +#endif +#ifdef GR_RESOLUTION_MIN +#undef GR_RESOLUTION_MIN +#endif +#define GR_RESOLUTION_MIN GR_RESOLUTION_320x200 +#define GR_RESOLUTION_MAX GR_RESOLUTION_1600x1200 + +#ifdef __cplusplus +} +#endif + +#endif /* __SST1VID_H__ */