diff --git a/glide2x/cvg/glide/src/fxgasm.c b/glide2x/cvg/glide/src/fxgasm.c index 34aa228..880ed4a 100644 --- a/glide2x/cvg/glide/src/fxgasm.c +++ b/glide2x/cvg/glide/src/fxgasm.c @@ -50,8 +50,9 @@ else printf("%s\tequ %10d\n",pname,((int)&o)-(int)&p) #define SIZEOF(p,pname) if (hex) \ - printf("SIZEOF_%s\tequ %08lxh\n",pname,sizeof(p)); \ - else printf("SIZEOF_%s\tequ %10ld\n",pname,sizeof(p)) + printf("SIZEOF_%s\tequ %08lxh\n",pname,(unsigned long)sizeof(p)); \ + else printf("SIZEOF_%s\tequ %10lu\n",pname,(unsigned long)sizeof(p)) + int main (int argc, char **argv) @@ -67,7 +68,7 @@ main (int argc, char **argv) if (argc > 1) { if (strcmp("-inline", argv[1]) == 0) { - SstRegs dummyRegs = { 0x00UL }; + SstRegs dummyRegs = { 0x00UL }; /* silence VC6 */ printf("#ifndef __FX_INLINE_H__\n"); printf("#define __FX_INLINE_H__\n"); @@ -75,14 +76,14 @@ main (int argc, char **argv) #if GLIDE_DISPATCH_SETUP printf("#define kCurGCOffset 0x%lXUL\n", - offsetof(struct _GlideRoot_s, curGC)); + (unsigned long)offsetof(struct _GlideRoot_s, curGC)); printf("#define kTriProcOffset 0x%lXUL\n", - offsetof(struct GrGC_s, curArchProcs.triSetupProc)); + (unsigned long)offsetof(struct GrGC_s, curArchProcs.triSetupProc)); #endif /* GLIDE_DISPATCH_SETUP */ printf("/* The # of 2-byte entries in the hw fog table */\n"); - printf("#define kInternalFogTableEntryCount 0x%lXUL\n", - sizeof(dummyRegs.fogTable) >> 1); + printf("#define kInternalFogTableEntryCount 0x%X\n", + (unsigned int)sizeof(dummyRegs.fogTable) >> 1); printf("\n"); printf("#endif /* __FX_INLINE_H__ */\n"); @@ -153,8 +154,7 @@ main (int argc, char **argv) NEWLINE; HEADER ("GrVertex"); - { - GrVertex v; + { GrVertex v; OFFSET(v, x, "x"); OFFSET(v, y, "y"); diff --git a/glide2x/h3/glide/src/fxgasm.c b/glide2x/h3/glide/src/fxgasm.c index 1deda1c..fe58abd 100644 --- a/glide2x/h3/glide/src/fxgasm.c +++ b/glide2x/h3/glide/src/fxgasm.c @@ -50,8 +50,9 @@ else printf("%s\tequ %10d\n",pname,((int)&o)-(int)&p) #define SIZEOF(p,pname) if (hex) \ - printf("SIZEOF_%s\tequ %08xh\n",pname,sizeof(p)); \ - else printf("SIZEOF_%s\tequ %10d\n",pname,sizeof(p)) + printf("SIZEOF_%s\tequ %08lxh\n",pname,(unsigned long)sizeof(p)); \ + else printf("SIZEOF_%s\tequ %10lu\n",pname,(unsigned long)sizeof(p)) + int main (int argc, char **argv) @@ -67,23 +68,23 @@ main (int argc, char **argv) if (argc > 1) { if (strcmp("-inline", argv[1]) == 0) { - SstRegs dummyRegs = { 0x00UL }; + SstRegs dummyRegs = { 0x00UL }; /* silence VC6 */ printf("#ifndef __FX_INLINE_H__\n"); printf("#define __FX_INLINE_H__\n"); printf("\n"); #if GLIDE_DISPATCH_SETUP - printf("#define kCurGCOffset 0x%XUL\n", - offsetof(struct _GlideRoot_s, curGC)); + printf("#define kCurGCOffset 0x%lXUL\n", + (unsigned long)offsetof(struct _GlideRoot_s, curGC)); - printf("#define kTriProcOffset 0x%XUL\n", - offsetof(struct GrGC_s, archDispatchProcs.triSetupProc)); + printf("#define kTriProcOffset 0x%lXUL\n", + (unsigned long)offsetof(struct GrGC_s, archDispatchProcs.triSetupProc)); #endif /* GLIDE_DISPATCH_SETUP */ printf("/* The # of 2-byte entries in the hw fog table */\n"); - printf("#define kInternalFogTableEntryCount 0x%XUL\n", - sizeof(dummyRegs.fogTable) >> 1); + printf("#define kInternalFogTableEntryCount 0x%X\n", + (unsigned int)sizeof(dummyRegs.fogTable) >> 1); printf("\n"); printf("#endif /* __FX_INLINE_H__ */\n"); @@ -140,7 +141,7 @@ main (int argc, char **argv) OFFSET(gc, reg_ptr, "gc_reg_ptr"); OFFSET(gc, tex_ptr, "gc_tex_ptr"); OFFSET(gc, lfb_ptr, "gc_lfb_ptr"); - + #ifdef GLIDE_INIT_HWC OFFSET(gc, bInfo, "gc_bInfo"); #endif @@ -148,25 +149,25 @@ main (int argc, char **argv) #if GLIDE_MULTIPLATFORM OFFSET(gc, gcFuncs, "gc_gcFuncs"); #endif - + #if defined(GLIDE3) && defined(GLIDE3_ALPHA) OFFSET(gc, oemInit, "gc_oemInit"); #endif - + OFFSET(gc, cmdTransportInfo.fifoStart, "gc_cmdTransportInfo_fifoStart"); OFFSET(gc, cmdTransportInfo.fifoEnd, "gc_cmdTransportInfo_fifoEnd"); OFFSET(gc, cmdTransportInfo.fifoOffset, "gc_cmdTransportInfo_fifoOffset"); OFFSET(gc, cmdTransportInfo.fifoSize, "gc_cmdTransportInfo_fifoSize"); OFFSET(gc, cmdTransportInfo.fifoJmpHdr, "gc_cmdTransportInfo_fifoJmpHdr"); - + OFFSET(gc, cmdTransportInfo.fifoPtr, "gc_cmdTransportInfo_fifoPtr"); OFFSET(gc, cmdTransportInfo.fifoRead, "gc_cmdTransportInfo_fifoRead"); - + #if GLIDE_USE_DEBUG_FIFO OFFSET(gc, cmdTransportInfo.fifoShadowBase, "gc_cmdTransportInfo_fifoShadowBase"); OFFSET(gc, cmdTransportInfo.fifoShadowPtr, "gc_cmdTransportInfo_fifoShadowPtr"); #endif /* GLIDE_USE_DEBUG_FIFO */ - + /* Fifo checking information. In units of usuable bytes until * the appropriate condition. */ @@ -175,7 +176,7 @@ main (int argc, char **argv) OFFSET(gc, cmdTransportInfo.roomToEnd, "gc_cmdTransportInfo_roomToEnd"); OFFSET(gc, cmdTransportInfo.lfbLockCount, "gc_cmdTransportInfo_lfbLockCount"); - + OFFSET(gc, ioRegs, "gc_ioRegs"); OFFSET(gc, cRegs, "gc_cRegs"); OFFSET(gc, gRegs, "gc_gRegs"); @@ -187,7 +188,7 @@ main (int argc, char **argv) OFFSET(gc, frontBuffer, "gc_frontBuffer"); OFFSET(gc, backBuffer, "gc_backBuffer"); OFFSET(gc, buffers, "gc_buffers"); - + OFFSET(gc, counter, "gc_counter"); OFFSET(gc, expected_counter, "gc_expected_counter"); @@ -225,8 +226,7 @@ main (int argc, char **argv) NEWLINE; HEADER ("GrVertex"); - { - GrVertex v; + { GrVertex v; OFFSET(v, x, "x"); OFFSET(v, y, "y"); diff --git a/glide2x/sst1/glide/src/fxgasm.c b/glide2x/sst1/glide/src/fxgasm.c index 562de2a..87c8cd8 100644 --- a/glide2x/sst1/glide/src/fxgasm.c +++ b/glide2x/sst1/glide/src/fxgasm.c @@ -55,13 +55,14 @@ else printf("%s\tequ %10d\n",pname,((int)&o)-(int)&p) #define SIZEOF(p,pname) if (hex) \ - printf("SIZEOF_%s\tequ %08lxh\n",pname,sizeof(p)); \ - else printf("SIZEOF_%s\tequ %10ld\n",pname,sizeof(p)) + printf("SIZEOF_%s\tequ %08lxh\n",pname,(unsigned long)sizeof(p)); \ + else printf("SIZEOF_%s\tequ %10lu\n",pname,(unsigned long)sizeof(p)) #define CONST(name) if (hex) \ printf(#name " equ 0%xh\n", name); \ else printf(#name " equ %d\n", name) + int main (int argc, char **argv) { @@ -73,15 +74,15 @@ main (int argc, char **argv) if (argc > 1) { if (strcmp("-inline", argv[1]) == 0) { - Sstregs dummyRegs = { 0x00UL }; + Sstregs dummyRegs = { 0x00UL }; /* silence VC6 */ printf("#ifndef __FX_INLINE_H__\n"); printf("#define __FX_INLINE_H__\n"); printf("\n"); printf("/* The # of 2-byte entries in the hw fog table */\n"); - printf("#define kInternalFogTableEntryCount 0x%XUL\n", - sizeof(dummyRegs.fogTable) >> 1); + printf("#define kInternalFogTableEntryCount 0x%X\n", + (unsigned int)sizeof(dummyRegs.fogTable) >> 1); printf("\n"); printf("#endif /* __FX_INLINE_H__ */\n"); @@ -112,7 +113,7 @@ main (int argc, char **argv) HWOFFSET (sst,FvC.y,"FVCY\t\t"); HWOFFSET (sst,FtriangleCMD,"FTRIANGLECMD\t"); #else -#error "Update fxgasm.c for this chip" +#error "Update fxgasm.c for this chip" #endif NEWLINE; #ifdef GLIDE_USE_ALT_REGMAP diff --git a/glide2x/sst1/init/init.c b/glide2x/sst1/init/init.c index 13501ed..cd6eb72 100644 --- a/glide2x/sst1/init/init.c +++ b/glide2x/sst1/init/init.c @@ -26,16 +26,16 @@ #include #if defined(__WATCOMC__) +#include #define _inp inp #define _outp outp #define _outpw outpw #endif -#if defined(__linux__) +#if defined(__linux__) #define _inp(port) pioInByte(port) #define _outp(port, data) pioOutByte(port, data) #define _outpw(port, data) pioOutWord(port, data); - #endif #include @@ -66,7 +66,6 @@ static inline void _outp_asm (unsigned short _port, unsigned char _data) { Module Constants -------------------------------------------------------------------*/ - static InitContext contexts[NUM_3DFX_PRODUCTS]; /* pool of device contexts */ InitContext @@ -180,7 +179,7 @@ initEnumHardware( InitHWEnumCallback *cb ) FxU8 regVal; _outp(0x3d4, 0x3f); regVal = _inp(0x3d5); - + if (!(regVal & (1 << 2))) /* we're not there */ continue; } @@ -203,15 +202,14 @@ initEnumHardware( InitHWEnumCallback *cb ) (FxU32)hwInfo[numDevicesInSystem].regs.hwDep.VG96RegDesc.partnerRegPtr; hwInfo[numDevicesInSystem].hwDep.vg96Info.vg96BaseAddr = (FxU32)hwInfo[numDevicesInSystem].regs.hwDep.VG96RegDesc.baseAddress; - + numDevicesInSystem++; - } + } #else # error "Do hardware enumeration for this chip!" #endif } } - /* Sanity Check for SLI detection */ for( device = 0; device < numDevicesInSystem; device++ ) { @@ -356,7 +354,7 @@ initDeviceSelect( FxU32 devNumber ) context = &contexts[hwInfo[devNumber].hwClass]; context->info = hwInfo[devNumber]; rv = FXTRUE; - } + } return rv; @@ -672,7 +670,6 @@ void initIOCtl( FxU32 token, void *argument ) { -------------------------------------------------------------------*/ FxBool initControl( FxU32 code) { - FxBool rv; GDBG_INFO((80, "initControl: code = %d, context=%.08x\n", code, context)); diff --git a/glide2x/sst1/init/init96/dxdrvr.c b/glide2x/sst1/init/init96/dxdrvr.c index 0f2bf86..196bbed 100644 --- a/glide2x/sst1/init/init96/dxdrvr.c +++ b/glide2x/sst1/init/init96/dxdrvr.c @@ -727,11 +727,11 @@ dxControl(FxU32 code, InitBufDesc_t *pBufDesc, int *width, int *height) } /* dxControl */ FxBool -dxClose() +dxClose(void) { GDBG_INFO((80, "dxClose:\n")); -/* - * fixme! nulling out this code fixes bug 541... why is unclear??? XXX + +/* fixme! nulling out this code fixes bug 541... why is unclear??? XXX * A little more information... the problem is releasing lpDD1, and * only in fullscreen mode. Temporary refined hack is to not release * lpDD1 in fullscreen mode. Also rearrange code in dxAllocSurfaces @@ -746,6 +746,7 @@ dxClose() } if( lpAux ) IDirectDrawSurface2_Release( lpAux ); if( lpDD ) IDirectDraw2_Release( lpDD ); + if (1 /* !IsFullScreen */) { if( lpDD1 ) IDirectDraw_Release( lpDD1 ); lpDD1 = NULL; @@ -757,8 +758,8 @@ dxClose() lpTriple = NULL; lpAux = NULL; lpDD = NULL; - #endif /* 0 */ + GDBG_INFO((80, "dxClose: Returning TRUE\n")); return FXTRUE; } /* dxClose */ @@ -973,7 +974,7 @@ dxControl(FxU32 code, InitBufDesc_t *pBufDesc, int *width, int *height) return FXTRUE; } /* dxControl */ FxBool -dxClose() +dxClose(void) { #define FN_NAME "dxClose" GDBG_INFO((80, "%s: Setting up VESA mode 640*480*\n", FN_NAME)); diff --git a/glide2x/sst1/init/init96/fxinit96.h b/glide2x/sst1/init/init96/fxinit96.h index d06bd2a..e30c37d 100644 --- a/glide2x/sst1/init/init96/fxinit96.h +++ b/glide2x/sst1/init/init96/fxinit96.h @@ -19,7 +19,6 @@ ** */ - #ifndef _FXINIT96_H_ #define _FXINIT96_H_ @@ -45,7 +44,7 @@ FxBool dxOpen( InitSwapType_t *swapType ); FxBool dxControl(FxU32 control, InitBufDesc_t *pDesc, int *w, int *h); -FxBool dxClose(); +FxBool dxClose(void); void dxSwap(FxU32 code); #else @@ -64,7 +63,7 @@ FxBool linOpen( InitSwapType_t *swapType ); FxBool linControl(FxU32 control, InitBufDesc_t *pDesc, int *w, int *h); -FxBool linClose(); +FxBool linClose(void); void linSwap(FxU32 code); void linFlip(FxU32 buffer); @@ -125,7 +124,6 @@ GDBG_INFO((80, "SET: Register: %s (0x%x) = 0x%x\n",\ #define GET(s) *(GETREADADDR(s)) #endif - #ifdef __cplusplus } #endif diff --git a/glide2x/sst1/init/init96/init96.c b/glide2x/sst1/init/init96/init96.c index 1d711ca..2e142c3 100644 --- a/glide2x/sst1/init/init96/init96.c +++ b/glide2x/sst1/init/init96/init96.c @@ -804,10 +804,13 @@ INITVG96ENTRY(init96MapBoard, FxBool , (void *rd, void *info, FxU16 vID, FxU16 d { int xres=1, yres=1, fbStride; GrScreenResolution_t res = GR_RESOLUTION_NONE; + FxBool rv = init96SetVideo(0, res, 0, 2, 1, 2, 1, regDesc, &xres, &yres, &fbStride ); + if ( !rv ) + return FXFALSE; sst96InitGetTmuInfo((FxU32 *)sstHW, vg96Info); init96RestoreVideo(regDesc); } @@ -2115,16 +2118,21 @@ init96LoadBufRegs(int nBuffers, InitBufDesc_t *pBufDesc, int xRes, pAux->bufOffset = A; } - if (pFront) - GDBG_INFO((80,"F = %.08x, s= %6d\n", pFront->bufOffset, pFront->bufStride)); - if (pBack) + if (pFront) { + GDBG_INFO((80,"F = %.08x, s= %6d\n", pFront->bufOffset, pFront->bufStride)); + } + if (pBack) { GDBG_INFO((80,"B = %.08x, s= %6d\n", pBack ->bufOffset, pBack ->bufStride)); - if (pTriple) + } + if (pTriple) { GDBG_INFO((80,"T = %.08x, s= %6d\n", pTriple ->bufOffset, pTriple ->bufStride)); - if (pAux) + } + if (pAux) { GDBG_INFO((80,"A = %.08x, s= %6d\n", pAux ->bufOffset, pAux ->bufStride)); - if (pFifo) + } + if (pFifo) { GDBG_INFO((80,"C = %.08x, s= %6d\n", pFifo ->bufOffset, pFifo ->bufStride)); + } /* Fill the arrays here */ bI[0].dfbBase = pFront->bufOffset; diff --git a/glide2x/sst1/init/init96/initmcrx.c b/glide2x/sst1/init/init96/initmcrx.c index 42a5ce4..533ef1c 100644 --- a/glide2x/sst1/init/init96/initmcrx.c +++ b/glide2x/sst1/init/init96/initmcrx.c @@ -83,7 +83,8 @@ static Init96HALData mcrxHALData = { initMCRXWrapFIFO, initMCRXUseTiles, initMCRXGetInfo, - NULL /* initMCRXSwapTiles */ + NULL, /* initMCRXSwapTiles */ + NULL }; @@ -162,13 +163,13 @@ INITMCRXENTRY(initMCRXSetVideo, FxBool, (GrScreenResolution_t res, GrScreenRefre { #define FN_NAME "initMCRXSetVideo" FxBool rv = FXTRUE; -#if defined(INIT_ACCESS_DIRECT) && defined( __DOS32__ ) +#if defined(INIT_ACCESS_DIRECT) && defined(__DOS32__) union REGS r0, r1; #endif GDBG_INFO((80, "%s: \n", FN_NAME)); -#if defined(INIT_ACCESS_DIRECT) && defined( __DOS32__ ) +#if defined(INIT_ACCESS_DIRECT) && defined(__DOS32__) switch( res ) { case GR_RESOLUTION_320x200: /* Set up VESA Mode 0x136 - 320x200x16 */ diff --git a/glide2x/sst1/init/init96/lindrvr.c b/glide2x/sst1/init/init96/lindrvr.c index 14621a0..78826d6 100644 --- a/glide2x/sst1/init/init96/lindrvr.c +++ b/glide2x/sst1/init/init96/lindrvr.c @@ -67,7 +67,7 @@ static Window hWndApp = 0; static FxU32 Width = 0; static FxU32 Height = 0; static FxBool IsFullScreen = 0; -static InitBufDesc_t BufDesc[NUM_BUFS] = {0}; +static InitBufDesc_t BufDesc[NUM_BUFS] = { {0,0,0,0,0} }; static XF86VidModeModeInfo **vidModes = 0; static Pixmap pixBack = 0; @@ -120,17 +120,19 @@ linFlip(FxU32 buffer) {} #else +void linExit(void); static FxBool -ErrorMessage(Window win, char *err) +ErrorMessage(Window win, const char *err) { fprintf(stderr, "Error %s \n", err); return FXFALSE; } /* ErrorMessage */ -FxBool linSetup() { +FxBool linSetup(void) { int eventbase, errorbase; int banksize; + unsigned int baseaddr; if (dpy!=0) return FXTRUE; dpy=XOpenDisplay(""); @@ -153,9 +155,10 @@ FxBool linSetup() { } } screenNum=XDefaultScreen(dpy); - XF86DGAGetVideoLL(dpy, screenNum, (int*)&screenPhys, &screenWidth, &banksize, + XF86DGAGetVideoLL(dpy, screenNum, &baseaddr, &screenWidth, &banksize, &screenMem); - screenMem*=1024; + screenPhys = (void *)baseaddr; + screenMem *= 1024; return FXTRUE; } @@ -218,13 +221,14 @@ cvtXToGlideDesc(InitBufDesc_t *pDesc) { dFifo->bufType = INIT_BUFFER_FIFOBUFFER; dFifo->bufOffset = (int)addrFifo-dScreen->bufOffset; dFifo->bufStride = FIFOSIZE; - + GDBG_INFO((80, "cvtXToGlideDesc: dFront->bufOffset = 0x%x\n", dFront->bufOffset)); GDBG_INFO((80, "cvtXToGlideDesc: dBack->bufOffset = 0x%x\n", dBack->bufOffset)); GDBG_INFO((80, "cvtXToGlideDesc: dAux->bufOffset = 0x%x\n", dAux->bufOffset)); GDBG_INFO((80, "cvtXToGlideDesc: dFifo->bufOffset = 0x%x\n", dFifo->bufOffset)); - if (tripleBuffering) + if (tripleBuffering) { GDBG_INFO((80, "cvtXToGlideDesc: dTriple->bufOffset = 0x%x\n", dTriple->bufOffset)); + } GDBG_INFO((80, "F:%.06x %5d B:%.06x %5d B2:%.06x %5d A:%.06x %5d, C:%.06x %5d\n", @@ -250,7 +254,8 @@ doReleasePixmaps() { static void findWindow(Display *dpy, Window hWndApp, void **addrFront) { XWindowAttributes attr; - int x=0, y=0, num; + int x=0, y=0; + unsigned int num; Window root=-1, parent, *children; do { @@ -311,7 +316,7 @@ doAllocPixmaps(int xRes, int yRes, int vRefresh, } static FxBool -getWindowSize(int *width, int *height) { +getWindowSize(unsigned int *width, unsigned int *height) { XWindowAttributes attr; /* Find out how big the window is */ @@ -345,7 +350,7 @@ linOpen( hWindow, sRes, yOrigin, nColBuffers, nAuxBuffers)); if (!linSetup()) return FXFALSE; - atexit(linClose); + atexit(linExit); if (sRes == GR_RESOLUTION_NONE ) { /* In a window */ @@ -461,8 +466,8 @@ linOpen( FxBool linControl(FxU32 code, InitBufDesc_t *pBufDesc, int *width, int *height) { - int i, w, h; - + unsigned int i, w = 0, h = 0; + GDBG_INFO((80, "linControl: code = %d\n", code)); if (IsFullScreen) return FXTRUE; @@ -516,7 +521,7 @@ linControl(FxU32 code, InitBufDesc_t *pBufDesc, int *width, int *height) } /* linControl */ FxBool -linClose() +linClose(void) { GDBG_INFO((80, "linClose:\n")); if (!dpy) return FXTRUE; @@ -538,6 +543,12 @@ linClose() return FXTRUE; } /* linClose */ +void +linExit(void) +{ + linClose(); +} /* linExit */ + void linSwap(FxU32 code) { @@ -571,5 +582,3 @@ linFlip(FxU32 buffer) } /* linFlip */ #endif - - diff --git a/glide2x/sst1/init/initvg/gdebug.c b/glide2x/sst1/init/initvg/gdebug.c index 6e951fa..77da9fd 100644 --- a/glide2x/sst1/init/initvg/gdebug.c +++ b/glide2x/sst1/init/initvg/gdebug.c @@ -37,21 +37,21 @@ #define GETENV getenv -static char *gdbg_myname = "gd"; // default library name -static char gdbg_debuglevel[GDBG_MAX_LEVELS]; // array of debuglevel controls +static char *gdbg_myname = "gd"; // default library name +static char gdbg_debuglevel[GDBG_MAX_LEVELS]; // array of debuglevel controls static long gdbg_errors = 0; static FxBool UseDebugString; -static FILE *gdbg_msgfile = NULL; /*stdout;*/ // GDBG info/error file +static FILE *gdbg_msgfile = NULL; /* stdout; */ // GDBG info/error file //---------------------------------------------------------------------- // initialize gdbg_level from an environment variable //---------------------------------------------------------------------- static char *setRange(char *buf, int val) { - int r0,r1,pos; + int r0,r1,pos=0; sscanf(buf,"%i%n",&r0,&pos); // parse the first integer if (buf[pos]=='-' || buf[pos]==':') // if there's a second @@ -66,7 +66,7 @@ static char *setRange(char *buf, int val) while (r0 <= r1) // now set the debuglevel levels gdbg_debuglevel[r0++] = val; - return buf + pos; // and return rest of string + return buf + pos; // and return rest of string } static void parse(char *env) @@ -74,37 +74,37 @@ static void parse(char *env) int level, pos; do { - if (env[0] == ',') // advance past commas - env++; - if (env[0] == '+') // if + then enable a range - env = setRange(env+1,1); - else if (env[0] == '-') // if - then disable a range - env = setRange(env+1,0); - else { // else just a number - if (EOF == sscanf(env,"%i%n",&level,&pos)) return; - if (pos==0) return; // oops, guess not - if (level >= GDBG_MAX_LEVELS) level = GDBG_MAX_LEVELS-1; - while (level >= 0) // enable the range [0,#] - gdbg_debuglevel[level--] = 1; - env += pos; - } + if (env[0] == ',') // advance past commas + env++; + if (env[0] == '+') // if + then enable a range + env = setRange(env+1,1); + else if (env[0] == '-') // if - then disable a range + env = setRange(env+1,0); + else { // else just a number + if (EOF == sscanf(env,"%i%n",&level,&pos)) return; + if (pos==0) return; // oops, guess not + if (level >= GDBG_MAX_LEVELS) level = GDBG_MAX_LEVELS-1; + while (level >= 0) // enable the range [0,#] + gdbg_debuglevel[level--] = 1; + env += pos; + } } while (env[0] == ','); } -void FX_EXPORT FX_CSTYLE +FX_EXPORT void FX_CSTYLE gdbg_init(void) { - static int done=0; // only execute once + static int done=0; // only execute once char *env; if (done) return; /* I can't init gdbg_msgfile to stdout since it isn't constant so * I do it now */ - gdbg_msgfile = stdout; + gdbg_msgfile = stdout; done = 1; - gdbg_debuglevel[0] = 1; // always enable level 0 + gdbg_debuglevel[0] = 1; // always enable level 0 env = GETENV("GDBG_FILE"); if (env != NULL) GDBG_SET_FILE(env); env = GETENV("GDBG_LEVEL"); @@ -113,42 +113,39 @@ gdbg_init(void) gdbg_info(1,"gdbg_init(): debug level = %s\n",env); } -void FX_EXPORT FX_CSTYLE +FX_EXPORT void FX_CSTYLE gdbg_shutdown(void) { - gdbg_info(1,"gdbg_shutdown()\n"); - if (gdbg_msgfile != stdout) { // close any existing output file - fclose(gdbg_msgfile); - gdbg_msgfile = stdout; - } + gdbg_info(1,"gdbg_shutdown()\n"); + if (gdbg_msgfile != stdout) { // close any existing output file + fclose(gdbg_msgfile); + gdbg_msgfile = stdout; + } } //---------------------------------------------------------------------- // the MAIN message display suboutine - ALL messages come thru here //---------------------------------------------------------------------- -void FX_EXPORT FX_CSTYLE +FX_EXPORT void FX_CSTYLE gdbg_vprintf (const char *format,va_list args) { - - if (gdbg_msgfile != NULL) { - if (!UseDebugString) { - - vfprintf(gdbg_msgfile,format,args); - - fflush(gdbg_msgfile); - } -#ifdef __WIN32__ - else { - char msgString[1024]; - - vsprintf(msgString, format, args); - OutputDebugString(msgString); - } -#endif + if (gdbg_msgfile != NULL) { + if (!UseDebugString) { + vfprintf(gdbg_msgfile,format,args); + fflush(gdbg_msgfile); } +#ifdef __WIN32__ + else { + char msgString[1024]; + + vsprintf(msgString, format, args); + OutputDebugString(msgString); + } +#endif + } } -void FX_EXPORT FX_CSTYLE +FX_EXPORT void FX_CSTYLE gdbg_printf (const char *format, ...) { va_list args; @@ -166,14 +163,14 @@ gdbg_printf (const char *format, ...) // display an INFO message if level <= debug level and return whether // debug level high enough to allow display //---------------------------------------------------------------------- -int FX_EXPORT FX_CSTYLE +FX_EXPORT int FX_CSTYLE gdbg_info (const int level, const char *format, ...) { va_list args; char newformat[4095]; if (!gdbg_debuglevel[level>=GDBG_MAX_LEVELS ? GDBG_MAX_LEVELS-1 : level]) - return(0); + return(0); va_start(args, format); sprintf(newformat, "%s.%d:\t", gdbg_myname,level); strcat(newformat,format); @@ -185,24 +182,24 @@ gdbg_info (const int level, const char *format, ...) //---------------------------------------------------------------------- // same as gdbg_info but does not display INFO header //---------------------------------------------------------------------- -int FX_EXPORT FX_CSTYLE +FX_EXPORT int FX_CSTYLE gdbg_info_more (const int level, const char *format, ...) { va_list args; if (!gdbg_debuglevel[level>=GDBG_MAX_LEVELS ? GDBG_MAX_LEVELS-1 : level]) - return(0); + return(0); va_start(args, format); gdbg_vprintf(format,args); va_end(args); return (1); } - + //---------------------------------------------------------------------- // ALL errors must come thru here, this subroutine adds a preamble // and then displays the message and increments the error counter //---------------------------------------------------------------------- -void FX_EXPORT FX_CSTYLE +FX_EXPORT void FX_CSTYLE gdbg_error (const char *kind, const char *format, ...) { va_list args; @@ -211,53 +208,53 @@ gdbg_error (const char *kind, const char *format, ...) va_start(args, format); sprintf(newformat, "%s error (%s): ", gdbg_myname,kind); - strcat(newformat,format); // add a preamble to message + strcat(newformat,format); // add a preamble to message gdbg_vprintf(newformat,args); - gdbg_errors++; // increment the error counter + gdbg_errors++; // increment the error counter va_end(args); } // return the error counter -int FX_EXPORT FX_CSTYLE +FX_EXPORT int FX_CSTYLE gdbg_get_errors(void) { return gdbg_errors; } // return a debuglevel level -int FX_EXPORT FX_CSTYLE +FX_EXPORT int FX_CSTYLE gdbg_get_debuglevel(const int level) { return gdbg_debuglevel[level>=GDBG_MAX_LEVELS ? GDBG_MAX_LEVELS-1 : level]; } // set a debuglevel level -void FX_EXPORT FX_CSTYLE +FX_EXPORT void FX_CSTYLE gdbg_set_debuglevel(const int level, const int value) { gdbg_debuglevel[level>=GDBG_MAX_LEVELS ? GDBG_MAX_LEVELS-1 : level] = value; } // open up a new output file -int FX_EXPORT FX_CSTYLE +FX_EXPORT int FX_CSTYLE gdbg_set_file(const char *name) { - FILE *outf; + FILE *outf; - if (gdbg_msgfile != stdout) { // close any existing output file - fclose(gdbg_msgfile); - gdbg_msgfile = stdout; - } + if (gdbg_msgfile != stdout) { // close any existing output file + fclose(gdbg_msgfile); + gdbg_msgfile = stdout; + } #ifdef __WIN32__ - else if (!strcmp(name, "DEBUG")) { - gdbg_msgfile = (FILE *) 1; - UseDebugString = 1; - } + else if (!strcmp(name, "DEBUG")) { + gdbg_msgfile = (FILE *) 1; + UseDebugString = 1; + } #endif - else { - outf = fopen(name,"w"); // open up a new one - if (outf) gdbg_msgfile = outf; - return (outf != NULL); - } - return FXTRUE; + else { + outf = fopen(name,"w"); // open up a new one + if (outf) gdbg_msgfile = outf; + return (outf != NULL); + } + return FXTRUE; } diff --git a/glide2x/sst1/init/initvg/info.c b/glide2x/sst1/init/initvg/info.c index 51b81bb..1942791 100644 --- a/glide2x/sst1/init/initvg/info.c +++ b/glide2x/sst1/init/initvg/info.c @@ -185,16 +185,17 @@ getTmuConfigData(FxU32 *sstbase, sst1DeviceInfoStruct *info) readAndSum4x4(sstbase, x,y, &r_sum,&g_sum,&b_sum); if(unDither(r_sum,g_sum,b_sum,&info->tmuConfig) == FXFALSE) - return(FXFALSE); - if(GETENV(("SST_TMUCFG"))) - SSCANF(GETENV(("SST_TMUCFG")), "%i", &info->tmuConfig); + return(FXFALSE); + + if(GETENV(("SST_TMUCFG"))) + SSCANF(GETENV(("SST_TMUCFG")), "%i", &info->tmuConfig); /* reset trex's init registers */ ISET(SST_TREX(sst,0)->trexInit1, info->tmuInit1[0]); ISET(SST_TREX(sst,1)->trexInit1, info->tmuInit1[1]); ISET(SST_TREX(sst,2)->trexInit1, info->tmuInit1[2]); - return(FXTRUE); + return(FXTRUE); } #define SENSE2 0x92F56EB0 @@ -449,13 +450,13 @@ sst1InitGetFbiInfo(FxU32 *sstbase, sst1DeviceInfoStruct *info) { volatile Sstregs *sst = (Sstregs *) sstbase; - info->fbiMemSize = fbiMemSize(sstbase); + info->fbiMemSize = fbiMemSize(sstbase); /* Detect board identification and memory speed */ if(GETENV(("SST_FBICFG"))) - SSCANF(GETENV(("SST_FBICFG")), "%i", &info->fbiConfig); - else - info->fbiConfig = (IGET(sst->fbiInit3) & SST_FBI_MEM_TYPE) >> + SSCANF(GETENV(("SST_FBICFG")), "%i", &info->fbiConfig); + else + info->fbiConfig = (IGET(sst->fbiInit3) & SST_FBI_MEM_TYPE) >> SST_FBI_MEM_TYPE_SHIFT; info->fbiBoardID = (info->fbiConfig >> 2) & 0x1; @@ -465,7 +466,7 @@ sst1InitGetFbiInfo(FxU32 *sstbase, sst1DeviceInfoStruct *info) /* Detect scanline interleaving */ info->sstSliDetect = sst1InitSliDetect(sstbase); - return FXTRUE; + return FXTRUE; } /* @@ -502,85 +503,89 @@ FxBool sst1InitFillDeviceInfo(FxU32 *sstbase, sst1DeviceInfoStruct *info) if(GETENV(("SST_NODEVICEINFO"))) { /* fill device info struct with sane values... */ - INIT_PRINTF(("sst1DeviceInfo: Filling info Struct with default values...\n")); + INIT_PRINTF(("sst1DeviceInfo: Filling info Struct with default values...\n")); - if(GETENV(("SST_FBICFG"))) - SSCANF(GETENV(("SST_FBICFG")), "%i", &info->fbiConfig); - else - info->fbiConfig = 0x0; + if(GETENV(("SST_FBICFG"))) + SSCANF(GETENV(("SST_FBICFG")), "%i", &info->fbiConfig); + else + info->fbiConfig = 0x0; - if(GETENV(("SST_TMUCFG"))) - SSCANF(GETENV(("SST_TMUCFG")), "%i", &info->tmuConfig); - else - info->tmuConfig = 0x0; + if(GETENV(("SST_TMUCFG"))) + SSCANF(GETENV(("SST_TMUCFG")), "%i", &info->tmuConfig); + else + info->tmuConfig = 0x0; - info->numberTmus = 1; - if (info->tmuConfig & FXBIT(6)) /* if TMU 1 exists */ - info->numberTmus++; - if (info->tmuConfig & FXBIT(13)) /* if TMU 2 exists */ - info->numberTmus++; + info->numberTmus = 1; + if (info->tmuConfig & FXBIT(6)) /* if TMU 1 exists */ + info->numberTmus++; + if (info->tmuConfig & FXBIT(13)) /* if TMU 2 exists */ + info->numberTmus++; - info->tmuRevision = info->tmuConfig & 0x7; + info->tmuRevision = info->tmuConfig & 0x7; - if(GETENV(("SST_FBIMEM_SIZE"))) - info->fbiMemSize = ATOI(GETENV(("SST_FBIMEM_SIZE"))); - else - info->fbiMemSize = 2; + if(GETENV(("SST_FBIMEM_SIZE"))) + info->fbiMemSize = ATOI(GETENV(("SST_FBIMEM_SIZE"))); + else + info->fbiMemSize = 2; - if(GETENV(("SST_TMUMEM_SIZE"))) - info->tmuMemSize[0] = ATOI(GETENV(("SST_TMUMEM_SIZE"))); - else - info->tmuMemSize[0] = 2; - info->tmuMemSize[1] = info->tmuMemSize[0]; - info->tmuMemSize[2] = info->tmuMemSize[0]; - } else { - int i; - - for(i=0; i<5; i++) { - if(i) - INIT_PRINTF(("sst1InitFillDeviceInfo(): Retry #%d for chip GetInfo()...\n", i)); - /* GetFbiInfo() must be called before GetTmuInfo() */ - if(sst1InitGetFbiInfo(sstbase, info) == FXFALSE) - continue; - /* get the revision ID of each TMU and verify that they are all the - same */ - if(sst1InitGetTmuInfo(sstbase, info) == FXFALSE) - continue; - break; - } - if(i == 5) - return(FXFALSE); + if(GETENV(("SST_TMUMEM_SIZE"))) + info->tmuMemSize[0] = ATOI(GETENV(("SST_TMUMEM_SIZE"))); + else + info->tmuMemSize[0] = 2; + info->tmuMemSize[1] = info->tmuMemSize[0]; + info->tmuMemSize[2] = info->tmuMemSize[0]; } + else { + int i; + + for (i=0; i<5; i++) { + if (i) + INIT_PRINTF(("sst1InitFillDeviceInfo(): Retry #%d for chip GetInfo()...\n", i)); + /* GetFbiInfo() must be called before GetTmuInfo() */ + if(sst1InitGetFbiInfo(sstbase, info) == FXFALSE) + continue; + /* get the revision ID of each TMU and verify that they are all the + same */ + if(sst1InitGetTmuInfo(sstbase, info) == FXFALSE) + continue; + break; + } + if (i == 5) + return(FXFALSE); + } + INIT_PRINTF(("sst1DeviceInfo: Board ID: Obsidian %s\n", - (info->fbiBoardID) ? "PRO" : "GE")); + (info->fbiBoardID) ? "PRO" : "GE")); INIT_PRINTF(("sst1DeviceInfo: FbiConfig:0x%x, TmuConfig:0x%x\n", - info->fbiConfig, info->tmuConfig)); + info->fbiConfig, info->tmuConfig)); INIT_PRINTF(("sst1DeviceInfo: FBI Revision:%d, TMU Revison:%d, Num TMUs:%d\n", - info->fbiRevision, info->tmuRevision, info->numberTmus)); + info->fbiRevision, info->tmuRevision, info->numberTmus)); INIT_PRINTF(("sst1DeviceInfo: FBI Memory:%d, TMU[0] Memory:%d", - info->fbiMemSize, info->tmuMemSize[0])); - if(info->numberTmus > 1) + info->fbiMemSize, info->tmuMemSize[0])); + if (info->numberTmus > 1) INIT_PRINTF((", TMU[1] Memory:%d", info->tmuMemSize[1])); - if(info->numberTmus > 2) + if (info->numberTmus > 2) INIT_PRINTF((", TMU[2] Memory:%d", info->tmuMemSize[2])); INIT_PRINTF(("\n")); - if(sst1InitUseVoodooFile == FXTRUE) { - if(iniDac == (sst1InitDacStruct *) NULL) - INIT_PRINTF(("sst1DeviceInfo: Dac Type: Unknown")); - else - INIT_PRINTF(("sst1DeviceInfo: Dac Type: %s %s\n", - iniDac->dacManufacturer, iniDac->dacDevice)); - } else { - INIT_PRINTF(("sst1DeviceInfo: Dac Type: ")); - if(info->fbiDacType == SST_FBI_DACTYPE_ATT) - INIT_PRINTF(("AT&T ATT20C409\n")); - else if(info->fbiDacType == SST_FBI_DACTYPE_ICS) - INIT_PRINTF(("ICS ICS5342\n")); - else if(info->fbiDacType == SST_FBI_DACTYPE_TI) - INIT_PRINTF(("TI TVP3409\n")); - else - INIT_PRINTF(("Unknown\n")); - } + + if (sst1InitUseVoodooFile == FXTRUE) { + if(iniDac == NULL) + INIT_PRINTF(("sst1DeviceInfo: Dac Type: Unknown")); + else + INIT_PRINTF(("sst1DeviceInfo: Dac Type: %s %s\n", + iniDac->dacManufacturer, iniDac->dacDevice)); + } + else { + INIT_PRINTF(("sst1DeviceInfo: Dac Type: ")); + if(info->fbiDacType == SST_FBI_DACTYPE_ATT) + INIT_PRINTF(("AT&T ATT20C409\n")); + else if(info->fbiDacType == SST_FBI_DACTYPE_ICS) + INIT_PRINTF(("ICS ICS5342\n")); + else if(info->fbiDacType == SST_FBI_DACTYPE_TI) + INIT_PRINTF(("TI TVP3409\n")); + else + INIT_PRINTF(("Unknown\n")); + } INIT_PRINTF(("sst1DeviceInfo: SliDetect:%d\n", info->sstSliDetect)); return(FXTRUE); diff --git a/glide2x/sst1/init/initvg/parse.c b/glide2x/sst1/init/initvg/parse.c index ccd85d9..56244e0 100644 --- a/glide2x/sst1/init/initvg/parse.c +++ b/glide2x/sst1/init/initvg/parse.c @@ -70,7 +70,7 @@ FX_ENTRY FxBool FX_CALL sst1InitVoodooFile() #else char filename[256], fixedFilename[512], *tmpPtr; char path[512]; - FILE *file = (FILE *) NULL; + FILE *file = NULL; char buffer[1024]; int inCfg, inDac; int i; @@ -111,12 +111,12 @@ FX_ENTRY FxBool FX_CALL sst1InitVoodooFile() break; } } - if(file == (FILE *) NULL) + if(file == NULL) return(FXFALSE); inCfg = inDac = 0; while(sst1InitFgets(buffer, file)) { - buffer[strlen(buffer)-1] = (char) NULL; + buffer[strlen(buffer)-1] = 0; if(!strcmp(buffer, "[CFG]")) { inCfg = 1; inDac = 0; continue; @@ -245,7 +245,7 @@ static void foo(int argc, char **argv) inCfg = inDac = 0; while(sst1InitFgets(buffer, file)) { - buffer[strlen(buffer)-1] = (char) NULL; + buffer[strlen(buffer)-1] = 0; if(!strcmp(buffer, "[CFG]")) { inCfg = 1; inDac = 0; continue; @@ -320,10 +320,9 @@ static void sst1InitFixFilename(char *dst, char *src) *dst++ = *src; src++; } - *dst = (char) NULL; + *dst = 0; } - static int sst1InitFgets(char *string, FILE *stream) { int validChars = 0; @@ -334,7 +333,7 @@ static int sst1InitFgets(char *string, FILE *stream) *ptr++ = (char) charRead; validChars++; if(charRead == '\n') { - *ptr++ = (char) NULL; + *ptr++ = 0; break; } } @@ -393,30 +392,28 @@ static int sst1InitParseFieldCfg(char *string) if((envName = strtok(string, "=")) == NULL) return(0); - if((envVal = strtok((char *) NULL, "=")) == NULL) + if((envVal = strtok(NULL, "=")) == NULL) /* Valid environment variable, NULL value */ return(1); sst1InitToLower(envVal); - if(envVarsBase == (sst1InitEnvVarStruct *) NULL) { - if((envVarsPtr = malloc(sizeof(sst1InitEnvVarStruct))) == - (sst1InitEnvVarStruct *) NULL) + if(envVarsBase == NULL) { + if((envVarsPtr = malloc(sizeof(sst1InitEnvVarStruct))) == NULL) return(0); envVarsBase = envVarsPtr; } else { envVarsPtr = envVarsBase; while(1) { - if(envVarsPtr->nextVar == (sst1InitEnvVarStruct *) NULL) + if(envVarsPtr->nextVar == NULL) break; else envVarsPtr = envVarsPtr->nextVar; } - if((envVarsPtr->nextVar = malloc(sizeof(sst1InitEnvVarStruct))) == - (sst1InitEnvVarStruct *) NULL) + if((envVarsPtr->nextVar = malloc(sizeof(sst1InitEnvVarStruct))) == NULL) return(0); envVarsPtr = envVarsPtr->nextVar; } - envVarsPtr->nextVar = (sst1InitEnvVarStruct *) NULL; + envVarsPtr->nextVar = NULL; strcpy(envVarsPtr->envVariable, envName); strcpy(envVarsPtr->envValue, envVal); @@ -426,64 +423,62 @@ static int sst1InitParseFieldCfg(char *string) static int sst1InitParseFieldDac(char *string) { char *dacFieldReference, *dacFieldValue; - static sst1InitDacStruct *dacPtr = (sst1InitDacStruct *) NULL; + static sst1InitDacStruct *dacPtr = NULL; if((dacFieldReference = strtok(string, "=")) == NULL) return(0); if(!strcmp(dacFieldReference, "MANUFACTURER")) { /* Add new dac device */ - if(dacStructBase == (sst1InitDacStruct *) NULL) { - if((dacPtr = malloc(sizeof(sst1InitDacStruct))) == - (sst1InitDacStruct *) NULL) + if(dacStructBase == NULL) { + if((dacPtr = malloc(sizeof(sst1InitDacStruct))) == NULL) return(0); dacStructBase = dacPtr; } else { dacPtr = dacStructBase; while(1) { - if(dacPtr->nextDac == (sst1InitDacStruct *) NULL) + if(dacPtr->nextDac == NULL) break; else dacPtr = dacPtr->nextDac; } - if((dacPtr->nextDac = malloc(sizeof(sst1InitDacStruct))) == - (sst1InitDacStruct *) NULL) + if((dacPtr->nextDac = malloc(sizeof(sst1InitDacStruct))) == NULL) return(0); dacPtr = dacPtr->nextDac; } - dacPtr->nextDac = (sst1InitDacStruct *) NULL; - dacPtr->dacManufacturer[0] = (char) NULL; - dacPtr->dacDevice[0] = (char) NULL; - dacPtr->detect = (sst1InitDacRdWrStruct *) NULL; - dacPtr->setVideo = (sst1InitDacSetVideoStruct *) NULL; - dacPtr->setMemClk = (sst1InitDacSetMemClkStruct *) NULL; - dacPtr->setVideoMode = (sst1InitDacSetVideoModeStruct *) NULL; - if((dacFieldValue = strtok((char *) NULL, "=")) == NULL) + dacPtr->nextDac = NULL; + dacPtr->dacManufacturer[0] = 0; + dacPtr->dacDevice[0] = 0; + dacPtr->detect = NULL; + dacPtr->setVideo = NULL; + dacPtr->setMemClk = NULL; + dacPtr->setVideoMode = NULL; + if((dacFieldValue = strtok(NULL, "=")) == NULL) return(0); strcpy(dacPtr->dacManufacturer, dacFieldValue); } else if(!strcmp(dacFieldReference, "DEVICE")) { - if((dacFieldValue = strtok((char *) NULL, "=")) == NULL) + if((dacFieldValue = strtok(NULL, "=")) == NULL) return(0); strcpy(dacPtr->dacDevice, dacFieldValue); } else if(!strcmp(dacFieldReference, "DETECT")) { - if((dacFieldValue = strtok((char *) NULL, "=")) == NULL) + if((dacFieldValue = strtok(NULL, "=")) == NULL) return(0); sst1InitToLower(dacFieldValue); if(!sst1InitParseDacRdWrString(dacFieldValue, dacPtr)) return(0); } else if(!strcmp(dacFieldReference, "SETVIDEO")) { - if((dacFieldValue = strtok((char *) NULL, "=")) == NULL) + if((dacFieldValue = strtok(NULL, "=")) == NULL) return(0); sst1InitToLower(dacFieldValue); if(!sst1InitParseSetVideoString(dacFieldValue, dacPtr)) return(0); } else if(!strcmp(dacFieldReference, "SETMEMCLK")) { - if((dacFieldValue = strtok((char *) NULL, "=")) == NULL) + if((dacFieldValue = strtok(NULL, "=")) == NULL) return(0); sst1InitToLower(dacFieldValue); if(!sst1InitParseSetMemClkString(dacFieldValue, dacPtr)) return(0); } else if(!strcmp(dacFieldReference, "SETVIDEOMODE")) { - if((dacFieldValue = strtok((char *) NULL, "=")) == NULL) + if((dacFieldValue = strtok(NULL, "=")) == NULL) return(0); sst1InitToLower(dacFieldValue); if(!sst1InitParseSetVideoModeString(dacFieldValue, dacPtr)) @@ -523,7 +518,7 @@ static int sst1InitParseDacRdWrString(char *string, sst1InitDacStruct *dacBase) dacRdWrPtr = dacRdWrPtr->nextRdWr; } - dacRdWrPtr->nextRdWr = (sst1InitDacRdWrStruct *) NULL; + dacRdWrPtr->nextRdWr = NULL; if(!sst1InitParseDacRdWr(dacRdWrCmd, dacRdWrPtr)) return(0); cntr++; @@ -539,16 +534,16 @@ static int sst1InitParseDacRdWr(char *string, sst1InitDacRdWrStruct *dacRdWrPtr) strcpy(stringCpy, string); if(stringCpy[5] == '(') { - stringCpy[5] = (char) NULL; + stringCpy[5] = 0; addrDataCmd = &stringCpy[6]; } else if(stringCpy[7] == '(') { - stringCpy[7] = (char) NULL; + stringCpy[7] = 0; addrDataCmd = &stringCpy[8]; } else if(stringCpy[8] == '(') { - stringCpy[8] = (char) NULL; + stringCpy[8] = 0; addrDataCmd = &stringCpy[9]; } else if(stringCpy[9] == '(') { - stringCpy[9] = (char) NULL; + stringCpy[9] = 0; addrDataCmd = &stringCpy[10]; } else return(0); @@ -560,7 +555,7 @@ static int sst1InitParseDacRdWr(char *string, sst1InitDacRdWrStruct *dacRdWrPtr) return(0); if(data[strlen(data)-1] != ')') return(0); - data[strlen(data)-1] = (char) NULL; + data[strlen(data)-1] = '\0'; dacRdWrPtr->type = DACRDWR_TYPE_WR; SSCANF(addr, "%i", &dacRdWrPtr->addr); SSCANF(data, "%i", &dacRdWrPtr->data); @@ -573,7 +568,7 @@ static int sst1InitParseDacRdWr(char *string, sst1InitDacRdWrStruct *dacRdWrPtr) return(0); if(data[strlen(data)-1] != ')') return(0); - data[strlen(data)-1] = (char) NULL; + data[strlen(data)-1] = 0; dacRdWrPtr->type = DACRDWR_TYPE_WRMOD_POP; SSCANF(addr, "%i", &dacRdWrPtr->addr); SSCANF(mask, "%i", &dacRdWrPtr->mask); @@ -587,7 +582,7 @@ static int sst1InitParseDacRdWr(char *string, sst1InitDacRdWrStruct *dacRdWrPtr) return(0); if(data[strlen(data)-1] != ')') return(0); - data[strlen(data)-1] = (char) NULL; + data[strlen(data)-1] = 0; dacRdWrPtr->type = DACRDWR_TYPE_RDMODWR; SSCANF(addr, "%i", &dacRdWrPtr->addr); SSCANF(mask, "%i", &dacRdWrPtr->mask); @@ -679,7 +674,7 @@ static int sst1InitParseSetVideoString(char *string, sst1InitDacStruct *dacBase) return(0); dacSetVideoPtr = dacSetVideoPtr->nextSetVideo; } - dacSetVideoPtr->nextSetVideo = (sst1InitDacSetVideoStruct *) NULL; + dacSetVideoPtr->nextSetVideo = NULL; /* Width */ SSCANF(dacRdWrCmd, "%i", &dacSetVideoPtr->width); /* Height */ @@ -713,7 +708,7 @@ static int sst1InitParseSetVideoString(char *string, sst1InitDacStruct *dacBase) return(0); dacRdWrPtr = dacRdWrPtr->nextRdWr; } - dacRdWrPtr->nextRdWr = (sst1InitDacRdWrStruct *) NULL; + dacRdWrPtr->nextRdWr = NULL; if(!sst1InitParseDacRdWr(dacRdWrCmd, dacRdWrPtr)) return(0); cntr++; @@ -753,8 +748,7 @@ static int sst1InitParseSetMemClkString(char *string, return(0); dacSetMemClkPtr = dacSetMemClkPtr->nextSetMemClk; } - dacSetMemClkPtr->nextSetMemClk = (sst1InitDacSetMemClkStruct *) - NULL; + dacSetMemClkPtr->nextSetMemClk = NULL; /* Frequency */ SSCANF(dacRdWrCmd, "%i", &dacSetMemClkPtr->frequency); @@ -777,7 +771,7 @@ static int sst1InitParseSetMemClkString(char *string, return(0); dacRdWrPtr = dacRdWrPtr->nextRdWr; } - dacRdWrPtr->nextRdWr = (sst1InitDacRdWrStruct *) NULL; + dacRdWrPtr->nextRdWr = NULL; if(!sst1InitParseDacRdWr(dacRdWrCmd, dacRdWrPtr)) return(0); cntr++; @@ -817,8 +811,7 @@ static int sst1InitParseSetVideoModeString(char *string, return(0); dacSetVideoModePtr = dacSetVideoModePtr->nextSetVideoMode; } - dacSetVideoModePtr->nextSetVideoMode = - (sst1InitDacSetVideoModeStruct *) NULL; + dacSetVideoModePtr->nextSetVideoMode = NULL; /* video16BPP */ SSCANF(dacRdWrCmd, "%i", &dacSetVideoModePtr->video16BPP); @@ -841,7 +834,7 @@ static int sst1InitParseSetVideoModeString(char *string, return(0); dacRdWrPtr = dacRdWrPtr->nextRdWr; } - dacRdWrPtr->nextRdWr = (sst1InitDacRdWrStruct *) NULL; + dacRdWrPtr->nextRdWr = NULL; if(!sst1InitParseDacRdWr(dacRdWrCmd, dacRdWrPtr)) return(0); cntr++; @@ -873,7 +866,7 @@ static void sst1InitToLower(char *string) FX_ENTRY char * FX_CALL sst1InitGetenv(char *string) { sst1InitEnvVarStruct *envVarsPtr; - char *retVal = (char *) NULL; + char *retVal = NULL; /* Does the real environment variable exist? */ if(myGetenv(string)) diff --git a/glide2x/sst1/init/initvg/print.c b/glide2x/sst1/init/initvg/print.c index 98886e8..831131d 100644 --- a/glide2x/sst1/init/initvg/print.c +++ b/glide2x/sst1/init/initvg/print.c @@ -79,3 +79,4 @@ FX_ENTRY void FX_CALL sst1InitVPrintf(const char *format, va_list args) #ifdef _MSC_VER #pragma optimize ("",on) #endif + diff --git a/glide2x/sst1/init/initvg/sli.c b/glide2x/sst1/init/initvg/sli.c index 044b008..aaddccc 100644 --- a/glide2x/sst1/init/initvg/sli.c +++ b/glide2x/sst1/init/initvg/sli.c @@ -82,7 +82,7 @@ FX_EXPORT FxBool FX_CSTYLE sst1InitSli(FxU32 *sstbase0, FxU32 *sstbase1) return(FXFALSE); PCICFG_RD(SST1_PCI_INIT_ENABLE, j); PCICFG_WR(SST1_PCI_INIT_ENABLE, - (j | SST_SCANLINE_SLV_OWNPCI | SST_SCANLINE_SLI_SLV)); + (j | SST_SCANLINE_SLV_OWNPCI | SST_SCANLINE_SLI_SLV)); ISET(sstSlave->fbiInit1, IGET(sstSlave->fbiInit1) | (SST_VIDEO_RESET | SST_EN_SCANLINE_INTERLEAVE)); sst1InitIdleFBINoNOP(sstbase1); @@ -319,7 +319,7 @@ FX_EXPORT FxBool FX_CSTYLE sst1InitSli(FxU32 *sstbase0, FxU32 *sstbase1) return(FXFALSE); PCICFG_RD(SST1_PCI_INIT_ENABLE, j); PCICFG_WR(SST1_PCI_INIT_ENABLE, - (j & ~(SST_SCANLINE_SLV_OWNPCI | SST_SCANLINE_SLI_SLV))); + (j & ~(SST_SCANLINE_SLV_OWNPCI | SST_SCANLINE_SLI_SLV))); MasterPhysAddr = sst1CurrentBoard->physAddr; sst1InitReturnStatus(sstbase0); /* flush pci packer with reads */ sst1InitReturnStatus(sstbase0); @@ -330,7 +330,7 @@ FX_EXPORT FxBool FX_CSTYLE sst1InitSli(FxU32 *sstbase0, FxU32 *sstbase1) return(FXFALSE); PCICFG_RD(SST1_PCI_INIT_ENABLE, j); PCICFG_WR(SST1_PCI_INIT_ENABLE, - ((j & ~(SST_SCANLINE_SLV_OWNPCI)) | SST_SCANLINE_SLI_SLV)); + ((j & ~(SST_SCANLINE_SLV_OWNPCI)) | SST_SCANLINE_SLI_SLV)); /* Map both boards to same Master physical address */ PCICFG_WR(PCI_BASE_ADDRESS_0, MasterPhysAddr); sst1InitReturnStatus(sstbase0); /* flush pci packer with reads */ @@ -430,17 +430,16 @@ FX_EXPORT FxBool FX_CSTYLE sst1InitShutdownSli(FxU32 *sstbase) PCICFG_RD(SST1_PCI_INIT_ENABLE, j); PCICFG_WR(SST1_PCI_INIT_ENABLE, (j | SST_SCANLINE_SLV_OWNPCI | SST_SCANLINE_SLI_SLV | - SST_INITWR_EN | SST_PCI_FIFOWR_EN)); + SST_INITWR_EN | SST_PCI_FIFOWR_EN)); PCICFG_RD(SST1_PCI_INIT_ENABLE, j); /* delay */ ISET(sstSlave->fbiInit1, IGET(sstSlave->fbiInit1) & ~SST_EN_SCANLINE_INTERLEAVE); PCICFG_RD(SST1_PCI_INIT_ENABLE, j); PCICFG_WR(SST1_PCI_INIT_ENABLE, - (j & ~(SST_SCANLINE_SLV_OWNPCI | SST_SCANLINE_SLI_SLV))); + (j & ~(SST_SCANLINE_SLV_OWNPCI | SST_SCANLINE_SLI_SLV))); PCICFG_RD(SST1_PCI_INIT_ENABLE, j); /* delay */ sst1InitIdle((FxU32 *) sstSlave); - if(IGET(sstSlave->fbiInit1) & SST_EN_SCANLINE_INTERLEAVE) { if(++cntr < 10) continue; diff --git a/glide2x/sst1/init/initvg/sst1init.c b/glide2x/sst1/init/initvg/sst1init.c index b828df9..f297754 100644 --- a/glide2x/sst1/init/initvg/sst1init.c +++ b/glide2x/sst1/init/initvg/sst1init.c @@ -706,7 +706,7 @@ FX_EXPORT FxBool FX_CSTYLE sst1InitShutdown(FxU32 *sstbase) #endif if(GETENV(("SST_NOSHUTDOWN"))) - INIT_PRINTF(("sst1InitShutdown(): Bypassing shutdown with SST_NOSHUTDOWN\n", n)); + INIT_PRINTF(("sst1InitShutdown(): Bypassing shutdown with SST_NOSHUTDOWN\n")); n = 0; while(!GETENV(("SST_NOSHUTDOWN"))) { diff --git a/glide2x/sst1/init/initvg/sst1init.h b/glide2x/sst1/init/initvg/sst1init.h index 5f746f8..11a5673 100644 --- a/glide2x/sst1/init/initvg/sst1init.h +++ b/glide2x/sst1/init/initvg/sst1init.h @@ -103,13 +103,13 @@ #define IGET(A) A #define ISET(A,D) A = (D) #else -#define IGET(A) sst1InitRead32((FxU32 *) &(A)) -#define ISET(A,D) sst1InitWrite32((FxU32 *) &(A), D) +#define IGET(A) sst1InitRead32 ((FxU32 *) &(A)) +#define ISET(A,D) sst1InitWrite32((FxU32 *) &(A), D) #endif /* ** P6 Fence -** +** ** Here's the stuff to do P6 Fencing. This is required for the ** certain things on the P6 */ @@ -136,14 +136,16 @@ p6Fence(void); #define P6FENCE {_asm xchg eax, p6FenceVar} -#elif defined(__GNUC__) -#if defined(__i386__) +#elif defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)) #define P6FENCE asm("xchg %%eax,%0" \ : /* no outputs */ \ : "m" (p6FenceVar) \ : "eax" \ ); -#endif +#elif defined(__GNUC__) && defined(__ia64__) +# define P6FENCE asm volatile ("mf.a" ::: "memory"); +#elif defined(__GNUC__) && defined(__alpha__) +# define P6FENCE asm volatile("mb" ::: "memory"); #else #error "P6 Fencing in-line assembler code needs to be added for this compiler" #endif diff --git a/glide3x/h3/glide3/src/fxgasm.c b/glide3x/h3/glide3/src/fxgasm.c index f187e60..35094dd 100644 --- a/glide3x/h3/glide3/src/fxgasm.c +++ b/glide3x/h3/glide3/src/fxgasm.c @@ -76,7 +76,7 @@ main (int argc, char **argv) printf("#define kTriProcOffset 0x%lXUL\n", (unsigned long)offsetof(struct GrGC_s, triSetupProc)); - + printf("/* The # of 2-byte entries in the hw fog table */\n"); printf("#define kInternalFogTableEntryCount 0x%X\n", (unsigned int)sizeof(dummyRegs.fogTable) >> 1); @@ -193,7 +193,7 @@ main (int argc, char **argv) #if GL_X86 OFFSET (gr,CPUType,"CPUType\t\t"); #endif - OFFSET (gr,tlsOffset,"tlsOffset\t\t"); + OFFSET (gr,tlsOffset,"tlsOffset\t\t"); OFFSET (gr, pool.f255,"pool_f255"); SIZEOF (gr.GCs[0].state,"GrState\t"); SIZEOF (gr.GCs[0],"GC\t"); diff --git a/glide3x/h5/glide3/src/fxgasm.c b/glide3x/h5/glide3/src/fxgasm.c index 4444f64..14d7d97 100644 --- a/glide3x/h5/glide3/src/fxgasm.c +++ b/glide3x/h5/glide3/src/fxgasm.c @@ -76,7 +76,7 @@ main (int argc, char **argv) printf("#define kTriProcOffset 0x%lXUL\n", (unsigned long)offsetof(struct GrGC_s, triSetupProc)); - + printf("/* The # of 2-byte entries in the hw fog table */\n"); printf("#define kInternalFogTableEntryCount 0x%X\n", (unsigned int)sizeof(dummyRegs.fogTable) >> 1); diff --git a/glide3x/sst1/glide3/src/fxgasm.c b/glide3x/sst1/glide3/src/fxgasm.c index df27c9e..267b830 100644 --- a/glide3x/sst1/glide3/src/fxgasm.c +++ b/glide3x/sst1/glide3/src/fxgasm.c @@ -79,7 +79,7 @@ main (int argc, char **argv) printf("#ifndef __FX_INLINE_H__\n"); printf("#define __FX_INLINE_H__\n"); printf("\n"); - + printf("/* The # of 2-byte entries in the hw fog table */\n"); printf("#define kInternalFogTableEntryCount 0x%X\n", (unsigned int)sizeof(dummyRegs.fogTable) >> 1); @@ -113,7 +113,7 @@ main (int argc, char **argv) HWOFFSET (sst,FvC.y,"FVCY\t\t"); HWOFFSET (sst,FtriangleCMD,"FTRIANGLECMD\t"); #else -#error "Update fxgasm.c for this chip" +#error "Update fxgasm.c for this chip" #endif NEWLINE; #ifdef GLIDE_USE_ALT_REGMAP diff --git a/glide3x/sst1/init/init.c b/glide3x/sst1/init/init.c index 27bdf5f..73b8595 100644 --- a/glide3x/sst1/init/init.c +++ b/glide3x/sst1/init/init.c @@ -19,7 +19,6 @@ ** */ - #include "init.h" #include "fxinit.h" @@ -32,13 +31,13 @@ #define _outp outp #define _outpw outpw #endif -#if defined(__linux__) +#if defined(__linux__) #define _inp(port) pioInByte(port) #define _outp(port, data) pioOutByte(port, data) #define _outpw(port, data) pioOutWord(port, data); - #endif + #ifdef __DJGPP__ #include #endif @@ -67,12 +66,10 @@ static inline void _outp_asm (unsigned short _port, unsigned char _data) { #include - /*------------------------------------------------------------------- Module Constants -------------------------------------------------------------------*/ - static InitContext contexts[NUM_3DFX_PRODUCTS]; /* pool of device contexts */ InitContext @@ -186,7 +183,7 @@ initEnumHardware( InitHWEnumCallback *cb ) FxU8 regVal; _outp(0x3d4, 0x3f); regVal = _inp(0x3d5); - + if (!(regVal & (1 << 2))) /* we're not there */ continue; } @@ -209,15 +206,14 @@ initEnumHardware( InitHWEnumCallback *cb ) (FxU32)hwInfo[numDevicesInSystem].regs.hwDep.VG96RegDesc.partnerRegPtr; hwInfo[numDevicesInSystem].hwDep.vg96Info.vg96BaseAddr = (FxU32)hwInfo[numDevicesInSystem].regs.hwDep.VG96RegDesc.baseAddress; - + numDevicesInSystem++; - } + } #else # error "Do hardware enumeration for this chip!" #endif } } - /* Sanity Check for SLI detection */ for( device = 0; device < numDevicesInSystem; device++ ) { @@ -362,7 +358,7 @@ initDeviceSelect( FxU32 devNumber ) context = &contexts[hwInfo[devNumber].hwClass]; context->info = hwInfo[devNumber]; rv = FXTRUE; - } + } return rv; @@ -678,7 +674,6 @@ void initIOCtl( FxU32 token, void *argument ) { -------------------------------------------------------------------*/ FxBool initControl( FxU32 code) { - FxBool rv; GDBG_INFO((80, "initControl: code = %d, context=%.08x\n", code, context)); diff --git a/glide3x/sst1/init/init96/init96.c b/glide3x/sst1/init/init96/init96.c index 5afe520..4bef972 100644 --- a/glide3x/sst1/init/init96/init96.c +++ b/glide3x/sst1/init/init96/init96.c @@ -495,8 +495,8 @@ get96(FxU32 *addr) const char *envVal;\ unsigned int u; \ val = constant;\ - if ( (envVal = myGetenv(envStr)) && \ - (sscanf(envVal, "%x", &u) == 1) ) { \ + if (((envVal = myGetenv(envStr)) != NULL) && \ + (sscanf(envVal, "%x", &u) == 1)) { \ val = u; \ GDBG_INFO((80,\ "%s: The environment variable %s == 0x%x overloaded a register value\n", \ @@ -715,7 +715,6 @@ INITVG96ENTRY(init96MapBoard, FxBool , (void *rd, void *info, FxU16 vID, FxU16 d break; } - GDBG_INFO((80, "init96MapBoard: Mapping card into linear memory\n")); regDesc->hwDep.VG96RegDesc.baseAddress = @@ -815,8 +814,8 @@ INITVG96ENTRY(init96MapBoard, FxBool , (void *rd, void *info, FxU16 vID, FxU16 d { int xres=1, yres=1, fbStride; GrScreenResolution_t res = GR_RESOLUTION_NONE; - FxBool rv = FXTRUE; - rv = init96SetVideo(0, res, + FxBool rv = + init96SetVideo(0, res, 0, 2, 1, 2, 1, regDesc, &xres, &yres, &fbStride ); diff --git a/glide3x/sst1/init/initvg/info.c b/glide3x/sst1/init/initvg/info.c index 0672a7b..3be59b6 100644 --- a/glide3x/sst1/init/initvg/info.c +++ b/glide3x/sst1/init/initvg/info.c @@ -185,11 +185,11 @@ getTmuConfigData(FxU32 *sstbase, sst1DeviceInfoStruct *info) readAndSum4x4(sstbase, x,y, &r_sum,&g_sum,&b_sum); if(unDither(r_sum,g_sum,b_sum,&info->tmuConfig) == FXFALSE) - return(FXFALSE); - + return(FXFALSE); + if(GETENV(("SST_TMUCFG")) && - (SSCANF(GETENV(("SST_TMUCFG")), "%i", &i) == 1)) - info->tmuConfig = i; + (SSCANF(GETENV(("SST_TMUCFG")), "%i", &i) == 1)) + info->tmuConfig = i; /* reset trex's init registers */ ISET(SST_TREX(sst,0)->trexInit1, info->tmuInit1[0]); @@ -503,83 +503,87 @@ FxBool sst1InitFillDeviceInfo(FxU32 *sstbase, sst1DeviceInfoStruct *info) if(GETENV(("SST_NODEVICEINFO"))) { /* fill device info struct with sane values... */ - INIT_PRINTF(("sst1DeviceInfo: Filling info Struct with default values...\n")); + INIT_PRINTF(("sst1DeviceInfo: Filling info Struct with default values...\n")); - if(!GETENV(("SST_FBICFG")) || - (SSCANF(GETENV(("SST_FBICFG")), "%i", &info->fbiConfig) != 1)) - info->fbiConfig = 0x0; + if(!GETENV(("SST_FBICFG")) || + (SSCANF(GETENV(("SST_FBICFG")), "%i", &info->fbiConfig) != 1)) + info->fbiConfig = 0x0; - if(!GETENV(("SST_TMUCFG")) || - (SSCANF(GETENV(("SST_TMUCFG")), "%i", &info->tmuConfig) != 1)) - info->tmuConfig = 0x0; + if(!GETENV(("SST_TMUCFG")) || + (SSCANF(GETENV(("SST_TMUCFG")), "%i", &info->tmuConfig) != 1)) + info->tmuConfig = 0x0; - info->numberTmus = 1; - if (info->tmuConfig & FXBIT(6)) /* if TMU 1 exists */ - info->numberTmus++; - if (info->tmuConfig & FXBIT(13)) /* if TMU 2 exists */ - info->numberTmus++; + info->numberTmus = 1; + if (info->tmuConfig & FXBIT(6)) /* if TMU 1 exists */ + info->numberTmus++; + if (info->tmuConfig & FXBIT(13)) /* if TMU 2 exists */ + info->numberTmus++; - info->tmuRevision = info->tmuConfig & 0x7; + info->tmuRevision = info->tmuConfig & 0x7; - if(GETENV(("SST_FBIMEM_SIZE"))) - info->fbiMemSize = ATOI(GETENV(("SST_FBIMEM_SIZE"))); - else - info->fbiMemSize = 2; + if(GETENV(("SST_FBIMEM_SIZE"))) + info->fbiMemSize = ATOI(GETENV(("SST_FBIMEM_SIZE"))); + else + info->fbiMemSize = 2; - if(GETENV(("SST_TMUMEM_SIZE"))) - info->tmuMemSize[0] = ATOI(GETENV(("SST_TMUMEM_SIZE"))); - else - info->tmuMemSize[0] = 2; - info->tmuMemSize[1] = info->tmuMemSize[0]; - info->tmuMemSize[2] = info->tmuMemSize[0]; - } else { - int i; - - for(i=0; i<5; i++) { - if(i) - INIT_PRINTF(("sst1InitFillDeviceInfo(): Retry #%d for chip GetInfo()...\n", i)); - /* GetFbiInfo() must be called before GetTmuInfo() */ - if(sst1InitGetFbiInfo(sstbase, info) == FXFALSE) - continue; - /* get the revision ID of each TMU and verify that they are all the - same */ - if(sst1InitGetTmuInfo(sstbase, info) == FXFALSE) - continue; - break; - } - if(i == 5) - return(FXFALSE); + if(GETENV(("SST_TMUMEM_SIZE"))) + info->tmuMemSize[0] = ATOI(GETENV(("SST_TMUMEM_SIZE"))); + else + info->tmuMemSize[0] = 2; + info->tmuMemSize[1] = info->tmuMemSize[0]; + info->tmuMemSize[2] = info->tmuMemSize[0]; } + else { + int i; + + for (i=0; i<5; i++) { + if (i) + INIT_PRINTF(("sst1InitFillDeviceInfo(): Retry #%d for chip GetInfo()...\n", i)); + /* GetFbiInfo() must be called before GetTmuInfo() */ + if(sst1InitGetFbiInfo(sstbase, info) == FXFALSE) + continue; + /* get the revision ID of each TMU and verify that they are all the + same */ + if(sst1InitGetTmuInfo(sstbase, info) == FXFALSE) + continue; + break; + } + if (i == 5) + return(FXFALSE); + } + INIT_PRINTF(("sst1DeviceInfo: Board ID: Obsidian %s\n", - (info->fbiBoardID) ? "PRO" : "GE")); + (info->fbiBoardID) ? "PRO" : "GE")); INIT_PRINTF(("sst1DeviceInfo: FbiConfig:0x%x, TmuConfig:0x%x\n", - info->fbiConfig, info->tmuConfig)); + info->fbiConfig, info->tmuConfig)); INIT_PRINTF(("sst1DeviceInfo: FBI Revision:%d, TMU Revison:%d, Num TMUs:%d\n", - info->fbiRevision, info->tmuRevision, info->numberTmus)); + info->fbiRevision, info->tmuRevision, info->numberTmus)); INIT_PRINTF(("sst1DeviceInfo: FBI Memory:%d, TMU[0] Memory:%d", - info->fbiMemSize, info->tmuMemSize[0])); - if(info->numberTmus > 1) + info->fbiMemSize, info->tmuMemSize[0])); + if (info->numberTmus > 1) INIT_PRINTF((", TMU[1] Memory:%d", info->tmuMemSize[1])); - if(info->numberTmus > 2) + if (info->numberTmus > 2) INIT_PRINTF((", TMU[2] Memory:%d", info->tmuMemSize[2])); INIT_PRINTF(("\n")); - if(sst1InitUseVoodooFile == FXTRUE) { - if(iniDac == (sst1InitDacStruct *) NULL) - INIT_PRINTF(("sst1DeviceInfo: Dac Type: Unknown")); - else - INIT_PRINTF(("sst1DeviceInfo: Dac Type: %s %s\n", - iniDac->dacManufacturer, iniDac->dacDevice)); - } else { - INIT_PRINTF(("sst1DeviceInfo: Dac Type: ")); - if(info->fbiDacType == SST_FBI_DACTYPE_ATT) - INIT_PRINTF(("AT&T ATT20C409\n")); - else if(info->fbiDacType == SST_FBI_DACTYPE_ICS) - INIT_PRINTF(("ICS ICS5342\n")); - else if(info->fbiDacType == SST_FBI_DACTYPE_TI) - INIT_PRINTF(("TI TVP3409\n")); - else - INIT_PRINTF(("Unknown\n")); - } + + if (sst1InitUseVoodooFile == FXTRUE) { + if(iniDac == NULL) + INIT_PRINTF(("sst1DeviceInfo: Dac Type: Unknown")); + else + INIT_PRINTF(("sst1DeviceInfo: Dac Type: %s %s\n", + iniDac->dacManufacturer, iniDac->dacDevice)); + } + else { + INIT_PRINTF(("sst1DeviceInfo: Dac Type: ")); + if(info->fbiDacType == SST_FBI_DACTYPE_ATT) + INIT_PRINTF(("AT&T ATT20C409\n")); + else if(info->fbiDacType == SST_FBI_DACTYPE_ICS) + INIT_PRINTF(("ICS ICS5342\n")); + else if(info->fbiDacType == SST_FBI_DACTYPE_TI) + INIT_PRINTF(("TI TVP3409\n")); + else + INIT_PRINTF(("Unknown\n")); + } INIT_PRINTF(("sst1DeviceInfo: SliDetect:%d\n", info->sstSliDetect)); return(FXTRUE); diff --git a/glide3x/sst1/init/initvg/init.rc b/glide3x/sst1/init/initvg/init.rc index d86fff2..a0bb46a 100644 --- a/glide3x/sst1/init/initvg/init.rc +++ b/glide3x/sst1/init/initvg/init.rc @@ -16,13 +16,6 @@ ** THE UNITED STATES. ** ** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED -** -** Revision 1.1.2.1 2004/03/02 07:56:05 dborca -** Bastardised Glide3x for SST1 -** -** Revision 1.1.1.1 1999/12/07 21:49:06 joseph -** Initial checkin into SourceForge. -** */ #define OFFICIAL 1 diff --git a/glide3x/sst1/init/initvg/sli.c b/glide3x/sst1/init/initvg/sli.c index 2d90e37..a11406d 100644 --- a/glide3x/sst1/init/initvg/sli.c +++ b/glide3x/sst1/init/initvg/sli.c @@ -83,7 +83,7 @@ FX_EXPORT FxBool FX_CSTYLE sst1InitSli(FxU32 *sstbase0, FxU32 *sstbase1) return(FXFALSE); PCICFG_RD(SST1_PCI_INIT_ENABLE, j); PCICFG_WR(SST1_PCI_INIT_ENABLE, - (j | SST_SCANLINE_SLV_OWNPCI | SST_SCANLINE_SLI_SLV)); + (j | SST_SCANLINE_SLV_OWNPCI | SST_SCANLINE_SLI_SLV)); ISET(sstSlave->fbiInit1, IGET(sstSlave->fbiInit1) | (SST_VIDEO_RESET | SST_EN_SCANLINE_INTERLEAVE)); sst1InitIdleFBINoNOP(sstbase1); @@ -145,10 +145,10 @@ FX_EXPORT FxBool FX_CSTYLE sst1InitSli(FxU32 *sstbase0, FxU32 *sstbase1) (SSCANF(GETENV(("SST_SLIS_VOUT_CLKDEL")), "%i", &i) == 1)) slaveVOutClkDel = i; if(GETENV(("SST_SLIS_PVOUT_CLKDEL")) && - (SSCANF(GETENV(("SST_SLIS_PVOUT_CLKDEL")), "%i", &i) == 1)) + (SSCANF(GETENV(("SST_SLIS_PVOUT_CLKDEL")), "%i", &i) == 1)) slavePVOutClkDel = i; if(GETENV(("SST_SLIS_VIN_CLKDEL")) && - (SSCANF(GETENV(("SST_SLIS_VIN_CLKDEL")), "%i", &i) == 1)) + (SSCANF(GETENV(("SST_SLIS_VIN_CLKDEL")), "%i", &i) == 1)) slaveVInClkDel = i; INIT_PRINTF(("sst1InitSli(): slaveVinClkdel=0x%x, slaveVOutClkDel=0x%x, slavePVOutClkDel=0x%x\n", slaveVInClkDel, slaveVOutClkDel, slavePVOutClkDel)); @@ -266,13 +266,13 @@ FX_EXPORT FxBool FX_CSTYLE sst1InitSli(FxU32 *sstbase0, FxU32 *sstbase1) masterVOutClkDel = 0; masterPVOutClkDel = 3; if(GETENV(("SST_SLIM_VOUT_CLKDEL")) && - (SSCANF(GETENV(("SST_SLIM_VOUT_CLKDEL")), "%i", &i) == 1)) + (SSCANF(GETENV(("SST_SLIM_VOUT_CLKDEL")), "%i", &i) == 1)) masterVOutClkDel = i; if(GETENV(("SST_SLIM_PVOUT_CLKDEL")) && - (SSCANF(GETENV(("SST_SLIM_PVOUT_CLKDEL")), "%i", &i) == 1)) + (SSCANF(GETENV(("SST_SLIM_PVOUT_CLKDEL")), "%i", &i) == 1)) masterPVOutClkDel = i; if(GETENV(("SST_SLIM_VIN_CLKDEL")) && - (SSCANF(GETENV(("SST_SLIM_VIN_CLKDEL")), "%i", &i) == 1)) + (SSCANF(GETENV(("SST_SLIM_VIN_CLKDEL")), "%i", &i) == 1)) masterVInClkDel = i; INIT_PRINTF(("sst1InitSli(): masterVinClkdel=0x%x, masterVOutClkDel=0x%x, masterPVOutClkDel=0x%x\n", masterVInClkDel, masterVOutClkDel, masterPVOutClkDel)); @@ -326,7 +326,7 @@ FX_EXPORT FxBool FX_CSTYLE sst1InitSli(FxU32 *sstbase0, FxU32 *sstbase1) return(FXFALSE); PCICFG_RD(SST1_PCI_INIT_ENABLE, j); PCICFG_WR(SST1_PCI_INIT_ENABLE, - (j & ~(SST_SCANLINE_SLV_OWNPCI | SST_SCANLINE_SLI_SLV))); + (j & ~(SST_SCANLINE_SLV_OWNPCI | SST_SCANLINE_SLI_SLV))); MasterPhysAddr = sst1CurrentBoard->physAddr; sst1InitReturnStatus(sstbase0); /* flush pci packer with reads */ sst1InitReturnStatus(sstbase0); @@ -337,7 +337,7 @@ FX_EXPORT FxBool FX_CSTYLE sst1InitSli(FxU32 *sstbase0, FxU32 *sstbase1) return(FXFALSE); PCICFG_RD(SST1_PCI_INIT_ENABLE, j); PCICFG_WR(SST1_PCI_INIT_ENABLE, - ((j & ~(SST_SCANLINE_SLV_OWNPCI)) | SST_SCANLINE_SLI_SLV)); + ((j & ~(SST_SCANLINE_SLV_OWNPCI)) | SST_SCANLINE_SLI_SLV)); /* Map both boards to same Master physical address */ PCICFG_WR(PCI_BASE_ADDRESS_0, MasterPhysAddr); sst1InitReturnStatus(sstbase0); /* flush pci packer with reads */ @@ -375,7 +375,7 @@ FX_EXPORT FxBool FX_CSTYLE sst1InitSli(FxU32 *sstbase0, FxU32 *sstbase1) FxU32 clearColor = 0x0; if(GETENV(("SST_VIDEO_CLEARCOLOR")) && - (SSCANF(GETENV(("SST_VIDEO_CLEARCOLOR")), "%i", &i) == 1)) + (SSCANF(GETENV(("SST_VIDEO_CLEARCOLOR")), "%i", &i) == 1)) clearColor = i; ISET(sstMaster->c1, clearColor); ISET(sstMaster->c0, clearColor); @@ -438,17 +438,16 @@ FX_EXPORT FxBool FX_CSTYLE sst1InitShutdownSli(FxU32 *sstbase) PCICFG_RD(SST1_PCI_INIT_ENABLE, j); PCICFG_WR(SST1_PCI_INIT_ENABLE, (j | SST_SCANLINE_SLV_OWNPCI | SST_SCANLINE_SLI_SLV | - SST_INITWR_EN | SST_PCI_FIFOWR_EN)); + SST_INITWR_EN | SST_PCI_FIFOWR_EN)); PCICFG_RD(SST1_PCI_INIT_ENABLE, j); /* delay */ ISET(sstSlave->fbiInit1, IGET(sstSlave->fbiInit1) & ~SST_EN_SCANLINE_INTERLEAVE); PCICFG_RD(SST1_PCI_INIT_ENABLE, j); PCICFG_WR(SST1_PCI_INIT_ENABLE, - (j & ~(SST_SCANLINE_SLV_OWNPCI | SST_SCANLINE_SLI_SLV))); + (j & ~(SST_SCANLINE_SLV_OWNPCI | SST_SCANLINE_SLI_SLV))); PCICFG_RD(SST1_PCI_INIT_ENABLE, j); /* delay */ sst1InitIdle((FxU32 *) sstSlave); - if(IGET(sstSlave->fbiInit1) & SST_EN_SCANLINE_INTERLEAVE) { if(++cntr < 10) continue; diff --git a/glide3x/sst1/init/initvg/sst1init.h b/glide3x/sst1/init/initvg/sst1init.h index 4757770..6b8905c 100644 --- a/glide3x/sst1/init/initvg/sst1init.h +++ b/glide3x/sst1/init/initvg/sst1init.h @@ -103,13 +103,13 @@ #define IGET(A) A #define ISET(A,D) A = (D) #else -#define IGET(A) sst1InitRead32((FxU32 *)(void *)&(A)) -#define ISET(A,D) sst1InitWrite32((FxU32 *)(void *)&(A), D) +#define IGET(A) sst1InitRead32 ((FxU32 *)(void *)&(A)) +#define ISET(A,D) sst1InitWrite32((FxU32 *)(void *)&(A), D) #endif /* ** P6 Fence -** +** ** Here's the stuff to do P6 Fencing. This is required for the ** certain things on the P6 */