diff --git a/glide2x/cvg/init/canopus.c b/glide2x/cvg/init/canopus.c index 26a911e..10e4d98 100644 --- a/glide2x/cvg/init/canopus.c +++ b/glide2x/cvg/init/canopus.c @@ -17,7 +17,6 @@ ** ** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED ** -** ** Initialization code for initializing canpus cards w/ assymetric ** inter-chip buses. ** @@ -92,12 +91,12 @@ sst1InitComputeClkParamsATT_Int(FFLOAT dwFreq, sst1ClkTimingStruct *clkTiming) lBestErr = 99999999; sNBest = 0; sMBest = 0; - lRatio = (unsigned long)((dwFreq*10l)/(FI/100l)) * lPDiv; // lRatio in [1/1000] + lRatio = (FxU32)((dwFreq*10l)/(FI/100l)) * lPDiv; // lRatio in [1/1000] for ( sN= (NMID-NDELTA); sN <= (NMID+NDELTA); sN++ ) { sM = (unsigned short)((lRatio * sN + 500) / 1000l); if (sM > MMAX) sM = MMAX; - lActual = (unsigned long)((FI * sM) / (sN * lPDiv)); + lActual = (FxU32)((FI * sM) / (sN * lPDiv)); lError = (lActual > dwFreq) ? (lActual - dwFreq) : (dwFreq - lActual); if ( lError < lBestErr ) { sNBest = sN; @@ -110,7 +109,7 @@ sst1InitComputeClkParamsATT_Int(FFLOAT dwFreq, sst1ClkTimingStruct *clkTiming) sM++; if (sM > MMAX) sM = MMAX; - lActual = (unsigned long)((FI * sM) / (sN * lPDiv)); + lActual = (FxU32)((FI * sM) / (sN * lPDiv)); lError = (lActual > dwFreq) ? (lActual - dwFreq) : (dwFreq - lActual); if ( lError < lBestErr) { sNBest = sN; diff --git a/glide2x/cvg/init/canopus.h b/glide2x/cvg/init/canopus.h index eceeead..cdec29b 100644 --- a/glide2x/cvg/init/canopus.h +++ b/glide2x/cvg/init/canopus.h @@ -17,16 +17,14 @@ ** ** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED ** -** */ #ifndef _CANOPUS_H_ #define _CANOPUS_H_ // if we use FFLOAT as an integer, we need to handle clocks in Hz -#define CLOCK_MULTIPLIER 1000000L -typedef unsigned long FFLOAT; -typedef unsigned long DDOUBLE; +#define CLOCK_MULTIPLIER 1000000L +typedef FxU32 FFLOAT; /* FixMe!! Is this right? */ #define CANOPUS_ID 0x10UL diff --git a/glide2x/cvg/init/dac.c b/glide2x/cvg/init/dac.c index fe717e9..b4e409e 100644 --- a/glide2x/cvg/init/dac.c +++ b/glide2x/cvg/init/dac.c @@ -17,7 +17,6 @@ ** ** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED ** -** ** Initialization code for initializing supported SST-1 DACs ** */ @@ -560,7 +559,7 @@ sst1InitComputeClkParams(float freq, sst1ClkTimingStruct* clkTiming) return sst1InitComputeClkParamsTI(freq, clkTiming); } else if (sst1CurrentBoard->fbiVideoDacType == SST_FBI_DACTYPE_PROXY) { FxU32 i; - FxBool retval; + FxBool retval = FXTRUE; sst1DeviceInfoStruct *saveBoard; /* if we are a single board SLI (proxy dac) we need to do all changes @@ -589,7 +588,7 @@ sst1InitComputeClkParams(float freq, sst1ClkTimingStruct* clkTiming) FxBool sst1InitComputeClkParamsATT(float freq, sst1ClkTimingStruct *clkTiming) { - float vcoFreqDivide, freqMultRatio, clkError; + float vcoFreqDivide = 0.0f, freqMultRatio, clkError; float clkErrorMin; FxU32 p, n, m, nPlusTwo; int mPlusTwo; @@ -623,7 +622,7 @@ FxBool sst1InitComputeClkParamsATT(float freq, sst1ClkTimingStruct freqMultRatio = (freq * vcoFreqDivide) * (float) 0.06984216; /* Calculate proper N and M parameters which yield the lowest error */ - clkErrorMin = (float) 9999.; n = 0; + clkErrorMin = (float) 9999.; n = 0; m = 0; for(nPlusTwo = 3; nPlusTwo < 32; nPlusTwo++) { #ifdef DIRECTX mPlusTwo = FTOL( (((float) nPlusTwo * freqMultRatio) + (float) 0.5) ); @@ -694,7 +693,7 @@ FxBool sst1InitComputeClkParamsTI(float freq, sst1ClkTimingStruct /* Loop through all the possible combinations and find the frequency with the least error */ - clkErrorMin = (float) 9999.; nBest = 9999; + clkErrorMin = (float) 9999.; pBest = 9999; nBest = 9999; mBest = 9999; for(p=0; p<4; p++) { for(m=0; m<64; m++) { for(n=0; n<5; n++) { diff --git a/glide2x/cvg/init/fxremap.c b/glide2x/cvg/init/fxremap.c index 2b54c3c..a2b08ea 100644 --- a/glide2x/cvg/init/fxremap.c +++ b/glide2x/cvg/init/fxremap.c @@ -41,14 +41,14 @@ static FxBool FindHole(RangeStruct *conflict); static FxU32 SnapToDecentAddress(FxU32 address,RangeStruct *conflict); static FxBool fits_in_hole(RangeStruct *begin,FxU32 end,RangeStruct *hole,RangeStruct *conflict); static FxBool fits_under(RangeStruct *first,FxU32 minimum,RangeStruct *hole,RangeStruct *conflict); -static FxU32 pciGetType(long i); +static FxU32 pciGetType(int i); static void pciGetRange(PciRegister reg,FxU32 device_number,FxU32 *data); static FxBool pciGetAddress(PciRegister reg,FxU32 device_number,FxU32 *data); static void ForceCleanUp(void); static FxBool FindNecessaryCards(void); -static FxBool IsCardVoodoo(long i); -static FxBool IsCardS3(long i); +static FxBool IsCardVoodoo(int i); +static FxBool IsCardS3(int i); static void AddMapEntry(FxU32 address,FxU32 range,FxU32 id,FxBool VoodooCard,FxBool S3Card); #if 0 /* not used */ static void HandleMemoryOverlap(void); @@ -63,7 +63,7 @@ static RangeStruct hole[80]; #endif static RangeStruct *first_entry; static RangeStruct *last_entry; -static long entries=0; +static int entries=0; static RangeStruct master_hole; static FxU32 conflicts_found=0; @@ -142,7 +142,7 @@ static void GetMemoryMap(void) { FxU32 temp,temp2; FxU32 type; - long devNum; + int devNum; int fn; /* function number iterator */ int maxFnNumber; int multi_fn = 0; @@ -277,12 +277,12 @@ static void AddMapEntry(FxU32 address,FxU32 range,FxU32 id,FxBool VoodooCard,FxB RangeStruct *temp,*cur,*next; //jcochrane@3dfx.com - long entry=0; + int entry=0; FxU32 tmp_address=0; //END #if 0 - static long test_entry=0; + static int test_entry=0; address=test_data[test_entry].address; range=~(test_data[test_entry++].range - 0x1); @@ -563,7 +563,7 @@ static void ForceCleanUp(void) static FxBool FindNecessaryCards(void) { FxBool voodoo_found=FXFALSE; - long i; + int i; for (i=0;i> 13) & 0x7; @@ -621,7 +621,7 @@ static FxBool IsCardVoodoo(long i) return FXFALSE; } -static FxBool IsCardS3(long i) +static FxBool IsCardS3(int i) { FxU32 vendor,dev_id; diff --git a/glide2x/cvg/init/gamma.c b/glide2x/cvg/init/gamma.c index 7640388..6b7f3af 100644 --- a/glide2x/cvg/init/gamma.c +++ b/glide2x/cvg/init/gamma.c @@ -17,7 +17,6 @@ ** ** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED ** -** ** Initialization code for loading SST-1 gamma tables ** */ diff --git a/glide2x/cvg/init/gdebug.c b/glide2x/cvg/init/gdebug.c index 49fe30f..ad87581 100644 --- a/glide2x/cvg/init/gdebug.c +++ b/glide2x/cvg/init/gdebug.c @@ -65,7 +65,7 @@ EngDebugPrint( 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 int gdbg_errors = 0; #ifdef KERNEL @@ -86,7 +86,7 @@ void setLevel(int level, int value) #ifndef KERNEL_NT // when the simulator runs in kernal mode there is no C runtime library -// so we need to call a kernal printf. +// so we need to call a kernal printf. extern int __cdecl klvfprintf(FILE *stream, const char *format, va_list arg ) ; @@ -102,7 +102,7 @@ static FILE *gdbg_msgfile = NULL; /* stdout; */ // GDBG info/error file //---------------------------------------------------------------------- static const char *setRange(const 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 @@ -158,15 +158,14 @@ gdbg_init(void) /* I can't init gdbg_msgfile to stdout since it isn't constant so * I do it now */ gdbg_msgfile = stdout; - #if __MWERKS__ SIOUXSettings.standalone = false; SIOUXSettings.setupmenus = false; SIOUXSettings.autocloseonquit = true; SIOUXSettings.asktosaveonclose = false; -#endif - +#endif + #ifdef KERNEL // put code in here to set the default level gdbg_debuglevel[0] = 1; // always enable level 0 @@ -193,7 +192,7 @@ gdbg_shutdown(void) #ifndef KERNEL if (gdbg_msgfile != stdout) { // close any existing output file #if USE_DEBUG_STRING - if (!UseDebugString) + if (!UseDebugString) #endif /* USE_DEBUG_STRING */ fclose(gdbg_msgfile); gdbg_msgfile = stdout; @@ -286,7 +285,7 @@ gdbg_printf (const char *format, ...) __asm lea eax, (format+4); __asm mov ebx, format; MyPrintf(); -#endif /* #ifndef KERNEL */ +#endif /* #ifndef KERNEL */ } @@ -358,7 +357,7 @@ gdbg_info_more (const int level, const char *format, ...) #endif /* #ifndef KERNEL */ return (1); } - + static GDBGErrorProc errorProcList[3]; FX_EXPORT int FX_CSTYLE gdbg_error_set_callback(GDBGErrorProc p) @@ -474,15 +473,16 @@ gdbg_set_file(const char *name) if (!strcmp(name, "DEBUG")) { gdbg_msgfile = (FILE *) 1; UseDebugString = 1; - } else + } else #endif /* USE_DEBUG_STRING */ { outf = fopen(name,"w"); // open up a new one if (outf) gdbg_msgfile = outf; + return (outf != NULL); } - return (outf != NULL); + return 1; #else /* #ifndef KERNEL */ return 0; -#endif /* #ifndef KERNEL */ +#endif /* #ifndef KERNEL */ } diff --git a/glide2x/cvg/init/info.c b/glide2x/cvg/init/info.c index 5905eb7..4e314b0 100644 --- a/glide2x/cvg/init/info.c +++ b/glide2x/cvg/init/info.c @@ -17,7 +17,6 @@ ** ** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED ** -** ** Routines to detect memory size, strapping pin, and other initialization ** configuration information. ** @@ -44,10 +43,10 @@ static FxBool readAndSum4x4(FxU32 *sstbase, FxU32 x, FxU32 y, - FxU32 *r_sum, FxU32 *g_sum, FxU32 *b_sum) + FxU32 *r_sum, FxU32 *g_sum, FxU32 *b_sum) { FxU32 rd_x, rd_y; - FxU32 rd_col; + FxU32 rd_col = 0; FxU32 rd_r, rd_g, rd_b; SstRegs *sst = (SstRegs *) sstbase; @@ -83,7 +82,7 @@ readAndSum4x4(FxU32 *sstbase, FxU32 x, FxU32 y, } INIT_INFO((3,"sums: r_sum=0x%03x g_sum=0x%03x b_sum=0x%03x\n", *r_sum, *g_sum, *b_sum)); - return(FXTRUE); + return(FXTRUE); } /* xxx - Give these guys some meaningful comments */ @@ -154,7 +153,7 @@ initSumTables(FxU32 *sstbase) } g_tbl[g_sum] = tst_color; } - return(FXTRUE); + return(FXTRUE); } /* remove dither to derive actual 24-bit RGB value */ @@ -167,7 +166,7 @@ unDither(FxU32 r_sum, FxU32 g_sum, FxU32 b_sum, FxU32 *result) return(FXFALSE); } *result = (rb_tbl[r_sum] << 16) | (g_tbl[g_sum] << 8) | rb_tbl[b_sum]; - return(FXTRUE); + return(FXTRUE); } static FxBool @@ -176,7 +175,7 @@ getTmuConfigData(FxU32 *sstbase, sst1DeviceInfoStruct *info) int x=0, y=0; FxU32 r_sum, g_sum, b_sum; SstRegs *sst = (SstRegs *) sstbase; - FxU32 tmuRevision; + FxU32 tmuRevision; /* set trex's (all 3) to output configuration bits */ ISET(SST_TREX(sst,0)->trexInit1, info->tmuInit1[0] | (1 << 18)); @@ -192,12 +191,12 @@ getTmuConfigData(FxU32 *sstbase, sst1DeviceInfoStruct *info) drawTriangle(sst,x,y,36); readAndSum4x4(sstbase, x,y, &r_sum,&g_sum,&b_sum); - if(GETENV(("SSTV2_TEXMAP_DISABLE"))) { - info->tmuConfig = 0x0; - } else { - if(unDither(r_sum,g_sum,b_sum,&info->tmuConfig) == FXFALSE) - return(FXFALSE); - } + if(GETENV(("SSTV2_TEXMAP_DISABLE"))) { + info->tmuConfig = 0x0; + } else { + if(unDither(r_sum,g_sum,b_sum,&info->tmuConfig) == FXFALSE) + return(FXFALSE); + } ///////////////////////// // Get new revision... @@ -216,16 +215,16 @@ getTmuConfigData(FxU32 *sstbase, sst1DeviceInfoStruct *info) drawTriangle(sst,x,y,36); readAndSum4x4(sstbase, x,y, &r_sum,&g_sum,&b_sum); - if(unDither(r_sum,g_sum,b_sum,&tmuRevision) == FXFALSE) - return(FXFALSE); + if(unDither(r_sum,g_sum,b_sum,&tmuRevision) == FXFALSE) + return(FXFALSE); - info->tmuFab[0] = (tmuRevision >> 4) & 0xf; - info->tmuFab[1] = (tmuRevision >> 12) & 0xf; - info->tmuFab[2] = (tmuRevision >> 20) & 0xf; + info->tmuFab[0] = (tmuRevision >> 4) & 0xf; + info->tmuFab[1] = (tmuRevision >> 12) & 0xf; + info->tmuFab[2] = (tmuRevision >> 20) & 0xf; - /* Adjust configuration structure for "new" revision ID */ - info->tmuConfig &= ~(0x7 | (0x7<<7) | (0x7<<14)); - info->tmuConfig |= (((tmuRevision & 0x7) + 3) | + /* Adjust configuration structure for "new" revision ID */ + info->tmuConfig &= ~(0x7 | (0x7<<7) | (0x7<<14)); + info->tmuConfig |= (((tmuRevision & 0x7) + 3) | ((((tmuRevision >> 8) & 0x7) + 3) << 7) | ((((tmuRevision >> 16) & 0x7) + 3) << 14)); @@ -234,10 +233,10 @@ getTmuConfigData(FxU32 *sstbase, sst1DeviceInfoStruct *info) ISET(SST_TREX(sst,1)->trexInit1, info->tmuInit1[1]); ISET(SST_TREX(sst,2)->trexInit1, info->tmuInit1[2]); - if(GETENV(("SSTV2_TMUCFG"))) - SSCANF(GETENV(("SSTV2_TMUCFG")), "%ld", &info->tmuConfig); + if(GETENV(("SSTV2_TMUCFG"))) + SSCANF(GETENV(("SSTV2_TMUCFG")), "%ld", &info->tmuConfig); - return(FXTRUE); + return(FXTRUE); } #define SENSE2 0x92F56EB0 @@ -257,10 +256,10 @@ static FxU32 sense(FxU32 *sstbase, sst1DeviceInfoStruct *info, FxU32 tmu, ISET(sst->texBaseAddr, 0x200000>>3); /* set to 2 MB */ ISET(texAddr[0], SENSE2); /* write a random value */ - + ISET(sst->texBaseAddr, 0x100000>>3); /* set to 1 MB */ ISET(texAddr[0], SENSE1); /* write a random value */ - + ISET(sst->texBaseAddr, 0x000000>>3); /* set to 0 MB */ ISET(texAddr[0], SENSE0); /* write a random value */ @@ -287,19 +286,19 @@ sst1InitGetTmuMemory(FxU32 *sstbase, sst1DeviceInfoStruct *info, FxU32 tmu, INIT_INFO((1,"sst1InitGetTmuMemory(0x%x, , %d)\n", sstbase,tmu)); - if(GETENV(("SSTV2_TMU_MEMSIZE"))) { - *TmuMemorySize = ATOI(GETENV(("SSTV2_TMU_MEMSIZE"))); - // If user specifies 2 MBytes on a 4 MBytes board, disable the - // second RAS so that apps which may incorrectly store data in the - // upper 2 Mbytes will not function properly... - if(*TmuMemorySize == 2) { - info->tmuInit0[tmu] &= ~SST_EN_TEX_MEM_SECOND_RAS; - sst1InitIdle(sstbase); - ISET(SST_TREX(sst,tmu)->trexInit0, info->tmuInit0[tmu]); - sst1InitIdle(sstbase); - } - return(FXTRUE); + if(GETENV(("SSTV2_TMU_MEMSIZE"))) { + *TmuMemorySize = ATOI(GETENV(("SSTV2_TMU_MEMSIZE"))); + /* If user specifies 2 MBytes on a 4 MBytes board, disable the + * second RAS so that apps which may incorrectly store data in the + * upper 2 Mbytes will not function properly... */ + if (*TmuMemorySize == 2) { + info->tmuInit0[tmu] &= ~SST_EN_TEX_MEM_SECOND_RAS; + sst1InitIdle(sstbase); + ISET(SST_TREX(sst,tmu)->trexInit0, info->tmuInit0[tmu]); + sst1InitIdle(sstbase); } + return(FXTRUE); + } ISET(sst->lfbMode, SST_LFB_RGBALANES_ARGB | SST_LFB_READFRONTBUFFER); ISET(sst->fbzMode, SST_DRAWBUFFER_FRONT | SST_RGBWRMASK); @@ -330,7 +329,7 @@ sst1InitGetTmuMemory(FxU32 *sstbase, sst1DeviceInfoStruct *info, FxU32 tmu, if (data == SENSE0) {*TmuMemorySize = 1; return(FXTRUE);} INIT_PRINTF(("sst1InitGetTmuMemory() ERROR: Could not detect memory size.\n")); - return(FXFALSE); + return(FXFALSE); } /*--------------------------------------------------------------------------- @@ -344,50 +343,49 @@ sst1InitGetTmuInfo(FxU32 *sstbase, sst1DeviceInfoStruct *info) FxU32 trev; if(initSumTables(sstbase) == FXFALSE) - return(FXFALSE); + return(FXFALSE); if(getTmuConfigData(sstbase,info) == FXFALSE) - return(FXFALSE); + return(FXFALSE); info->numberTmus = 1; - if(GETENV(("SSTV2_TEXMAP_DISABLE"))) { - info->tmuRevision = 4; - sst1InitGetTmuMemory(sstbase, info, 0, &info->tmuMemSize[0]); - info->tmuMemSize[0] = 2; - } else { - /* Get TMU memory size */ - info->tmuRevision = info->tmuConfig & 0x7; - if(sst1InitGetTmuMemory(sstbase, info, 0, &info->tmuMemSize[0]) == - FXFALSE) - return(FXFALSE); - } + if(GETENV(("SSTV2_TEXMAP_DISABLE"))) { + info->tmuRevision = 4; + sst1InitGetTmuMemory(sstbase, info, 0, &info->tmuMemSize[0]); + info->tmuMemSize[0] = 2; + } else { + /* Get TMU memory size */ + info->tmuRevision = info->tmuConfig & 0x7; + if(sst1InitGetTmuMemory(sstbase, info, 0, &info->tmuMemSize[0]) == FXFALSE) + return(FXFALSE); + } INIT_INFO((1,"TMU0 memory = %d MB\n", info->tmuMemSize[0])); if (info->tmuConfig & FXBIT(6)) { /* if TMU 1 exists */ info->numberTmus++; /* increment TMU count */ trev = (info->tmuConfig>>7) & 0x7; /* get its revision */ -#if 0 // Ignore for now... +#if 0 /* Ignore for now... */ if (info->tmuRevision != trev) { INIT_PRINTF(("sst1InitGetDeviceInfo: ERROR, multiple different TMU revision IDs detected\n")); return(FXFALSE); } #endif - if(sst1InitGetTmuMemory(sstbase, info, 1, &info->tmuMemSize[1]) == FXFALSE) - return(FXFALSE); + if (sst1InitGetTmuMemory(sstbase, info, 1, &info->tmuMemSize[1]) == FXFALSE) + return(FXFALSE); } if (info->tmuConfig & FXBIT(13)) { /* if TMU 2 exists */ info->numberTmus++; /* increment TMU count */ trev = (info->tmuConfig>>14) & 0x7; /* get its revision */ -#if 0 // Ignore for now... +#if 0 /* Ignore for now... */ if (info->tmuRevision != trev) { INIT_PRINTF(("sst1InitGetDeviceInfo: ERROR, multiple different TMU revision IDs detected\n")); return(FXFALSE); } #endif - if(sst1InitGetTmuMemory(sstbase, info, 2, &info->tmuMemSize[2]) == FXFALSE) - return(FXFALSE); + if(sst1InitGetTmuMemory(sstbase, info, 2, &info->tmuMemSize[2]) == FXFALSE) + return(FXFALSE); } - if(GETENV(("SSTV2_NUM_TMUS"))) - info->numberTmus = ATOI(GETENV(("SSTV2_NUM_TMUS"))); + if (GETENV(("SSTV2_NUM_TMUS"))) + info->numberTmus = ATOI(GETENV(("SSTV2_NUM_TMUS"))); INIT_INFO((1,"numberTMus = %d\n", info->numberTmus)); return(FXTRUE); @@ -420,7 +418,7 @@ static int fbiMemSize(FxU32 *sstbase) /* Enable dram refresh, disable memory fifo, and setup memory */ /* for rendering */ ISET(sst->fbiInit0, IGET(sst->fbiInit0) & ~SST_MEM_FIFO_EN); - ISET(sst->fbiInit2, IGET(sst->fbiInit2) | SST_EN_DRAM_REFRESH); + ISET(sst->fbiInit2, IGET(sst->fbiInit2) | SST_EN_DRAM_REFRESH); sst1InitIdleFBI(sstbase); /* Setup Basic rendering datapath */ @@ -429,7 +427,7 @@ static int fbiMemSize(FxU32 *sstbase) ISET(sst->fbzMode, SST_RGBWRMASK | SST_ZAWRMASK | SST_DRAWBUFFER_FRONT); sst1InitIdleFBI(sstbase); - sst1InitSetResolution(sstbase, &SST_VREZ_800X600_60, 1); + sst1InitSetResolution(sstbase, &SST_VREZ_800X600_60, 1); sst1InitIdleFBI(sstbase); ISET(sst->lfbMode, SST_LFB_ZZ | SST_LFB_WRITEFRONTBUFFER | @@ -447,7 +445,7 @@ static int fbiMemSize(FxU32 *sstbase) sst1InitIdleFBI(sstbase); if((LFB_GETPIXEL(128, 100) == 0xdead) && (LFB_GETPIXEL(200, 200) == 0x55aa)) { - retval = 4; + retval = 4; ISET(sst->lfbMode, (SST_LFB_565 | SST_LFB_READBACKBUFFER)); sst1InitIdleFBI(sstbase); goto fbiMemSizeDone; @@ -455,7 +453,7 @@ static int fbiMemSize(FxU32 *sstbase) /* Check for 2 MBytes... */ /* Write to color buffer in 640x480 resolution */ - sst1InitSetResolution(sstbase, &SST_VREZ_640X480_60, 0); + sst1InitSetResolution(sstbase, &SST_VREZ_640X480_60, 0); ISET(sst->lfbMode, SST_LFB_565 | SST_LFB_WRITEFRONTBUFFER | SST_LFB_READFRONTBUFFER); sst1InitIdleFBI(sstbase); @@ -474,7 +472,7 @@ static int fbiMemSize(FxU32 *sstbase) ISET(sst->lfbMode, (SST_LFB_565 | SST_LFB_READBACKBUFFER)); sst1InitIdleFBI(sstbase); if(LFB_GETPIXEL(178, 436) == 0xaa55) { - retval = 2; + retval = 2; goto fbiMemSizeDone; } @@ -491,7 +489,7 @@ check1MByte: sst1InitIdleFBI(sstbase); if((LFB_GETPIXEL(10, 10) == 0xdead) && (LFB_GETPIXEL(100, 200) == 0x5a5a)) - retval = 1; + retval = 1; fbiMemSizeDone: /* Restore init registers to original state */ @@ -508,24 +506,24 @@ sst1InitGetFbiInfo(FxU32 *sstbase, sst1DeviceInfoStruct *info) { SstRegs *sst = (SstRegs *) sstbase; - info->fbiMemSize = fbiMemSize(sstbase); - + info->fbiMemSize = fbiMemSize(sstbase); + /* Detect board identification and memory speed */ if(GETENV(("SSTV2_FBICFG"))) - SSCANF(GETENV(("SSTV2_FBICFG")), "%ld", &info->fbiConfig); - else - info->fbiConfig = (IGET(sst->fbiInit3) & SST_FBI_MEM_TYPE) >> + SSCANF(GETENV(("SSTV2_FBICFG")), "%ld", &info->fbiConfig); + else + info->fbiConfig = (IGET(sst->fbiInit3) & SST_FBI_MEM_TYPE) >> SST_FBI_MEM_TYPE_SHIFT; - + info->fbiBoardID = (IGET(sst->fbiInit5) >> 5) & 0xf; if(IGET(sst->fbiInit7) & BIT(0)) info->fbiBoardID |= 0x10; - + /* Detect scanline interleaving */ info->sliPaired = sst1InitSliPaired(sstbase); - info->sliDetected = sst1InitSliDetect(sstbase); - - return FXTRUE; + info->sliDetected = sst1InitSliDetect(sstbase); + + return FXTRUE; } /* @@ -535,8 +533,7 @@ sst1InitGetFbiInfo(FxU32 *sstbase, sst1DeviceInfoStruct *info) ** been allocated ** */ -FX_EXPORT FxBool FX_CSTYLE sst1InitGetDeviceInfo(FxU32 *sstbase, - sst1DeviceInfoStruct *info) +FX_EXPORT FxBool FX_CSTYLE sst1InitGetDeviceInfo(FxU32 *sstbase, sst1DeviceInfoStruct *info) { FxBool retval; @@ -562,90 +559,92 @@ FxBool sst1InitFillDeviceInfo(FxU32 *sstbase, sst1DeviceInfoStruct *info) if(GETENV(("SSTV2_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(("SSTV2_FBICFG"))) - SSCANF(GETENV(("SSTV2_FBICFG")), "%ld", &info->fbiConfig); - else - info->fbiConfig = 0x0; + if(GETENV(("SSTV2_FBICFG"))) + SSCANF(GETENV(("SSTV2_FBICFG")), "%ld", &info->fbiConfig); + else + info->fbiConfig = 0x0; - if(GETENV(("SSTV2_TMUCFG"))) - SSCANF(GETENV(("SSTV2_TMUCFG")), "%ld", &info->tmuConfig); - else - info->tmuConfig = 0x0; + if(GETENV(("SSTV2_TMUCFG"))) + SSCANF(GETENV(("SSTV2_TMUCFG")), "%ld", &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(("SSTV2_FBI_MEMSIZE"))) - info->fbiMemSize = ATOI(GETENV(("SSTV2_FBI_MEMSIZE"))); - else - info->fbiMemSize = 2; + if(GETENV(("SSTV2_FBI_MEMSIZE"))) + info->fbiMemSize = ATOI(GETENV(("SSTV2_FBI_MEMSIZE"))); + else + info->fbiMemSize = 2; - if(GETENV(("SSTV2_TMU_MEMSIZE"))) - info->tmuMemSize[0] = ATOI(GETENV(("SSTV2_TMU_MEMSIZE"))); - 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(("SSTV2_TMU_MEMSIZE"))) + info->tmuMemSize[0] = ATOI(GETENV(("SSTV2_TMU_MEMSIZE"))); + else + info->tmuMemSize[0] = 2; + info->tmuMemSize[1] = info->tmuMemSize[0]; + info->tmuMemSize[2] = info->tmuMemSize[0]; } - // Measure silicon performance - sst1InitMeasureSiProcess(sstbase, 0); // measure NAND-tree - sst1InitMeasureSiProcess(sstbase, 1); // measure NOR-tree + else { + int i; - INIT_PRINTF(("sst1DeviceInfo: Board ID: %d\n", info->fbiBoardID)); + 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); + } + /* Measure silicon performance */ + sst1InitMeasureSiProcess(sstbase, 0); /* measure NAND-tree */ + sst1InitMeasureSiProcess(sstbase, 1); /* measure NOR-tree */ + + INIT_PRINTF(("sst1DeviceInfo: Board ID: %d\n", info->fbiBoardID)); 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", + 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->fbiVideoDacType == SST_FBI_DACTYPE_ATT) - INIT_PRINTF(("AT&T ATT20C409\n")); - else if(info->fbiVideoDacType == SST_FBI_DACTYPE_ICS) - INIT_PRINTF(("ICS ICS5342\n")); - else if(info->fbiVideoDacType == SST_FBI_DACTYPE_TI) - INIT_PRINTF(("TI TVP3409\n")); - else if(info->fbiVideoDacType == SST_FBI_DACTYPE_PROXY) - INIT_PRINTF(("(SLI PROXY)\n")); - else - INIT_PRINTF(("Unknown\n")); - } + } + else { + INIT_PRINTF(("sst1DeviceInfo: Dac Type: ")); + if(info->fbiVideoDacType == SST_FBI_DACTYPE_ATT) + INIT_PRINTF(("AT&T ATT20C409\n")); + else if(info->fbiVideoDacType == SST_FBI_DACTYPE_ICS) + INIT_PRINTF(("ICS ICS5342\n")); + else if(info->fbiVideoDacType == SST_FBI_DACTYPE_TI) + INIT_PRINTF(("TI TVP3409\n")); + else if(info->fbiVideoDacType == SST_FBI_DACTYPE_PROXY) + INIT_PRINTF(("(SLI PROXY)\n")); + else + INIT_PRINTF(("Unknown\n")); + } INIT_PRINTF(("sst1DeviceInfo: SLI Detected:%d\n", info->sliDetected)); return(FXTRUE); diff --git a/glide2x/cvg/init/parse.c b/glide2x/cvg/init/parse.c index f2e8856..cdc987c 100644 --- a/glide2x/cvg/init/parse.c +++ b/glide2x/cvg/init/parse.c @@ -17,7 +17,6 @@ ** ** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED ** -** ** Parsing code for grabbing information from "voodoo2.ini" initialization file ** */ @@ -78,7 +77,7 @@ FX_ENTRY FxBool FX_CALL sst1InitVoodooFile() #ifndef DIRECTX int inCfg, inDac; - FILE *file = (FILE *) NULL; + FILE *file = NULL; char buffer[1024], filename[256]; int helper = (getenv(("SSTV2_DEBUGDAC"))) ? 1 : 0; @@ -228,7 +227,7 @@ FX_ENTRY FxBool FX_CALL sst1InitVoodooFile() inCfg = inDac = 0; while(sst1InitFgets(buffer, file)) { - buffer[strlen(buffer)-1] = (char) NULL; + buffer[strlen(buffer)-1] = 0; if(!strcmp(buffer, "[VOODOO2]")) { inCfg = 1; inDac = 0; continue; @@ -359,7 +358,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; @@ -435,7 +434,7 @@ static void sst1InitFixFilename(char *dst, char *src) *dst++ = *src; src++; } - *dst = (char) NULL; + *dst = 0; } @@ -449,7 +448,7 @@ static int sst1InitFgets(char *string, FILE *stream) *ptr++ = (char) charRead; validChars++; if(charRead == '\n') { - *ptr++ = (char) NULL; + *ptr++ = 0; break; } } @@ -508,7 +507,7 @@ 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); @@ -516,25 +515,23 @@ static int sst1InitParseFieldCfg(char *string) sst1InitToLower(envName); 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); @@ -544,64 +541,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; + 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((char *) 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)) @@ -641,7 +636,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++; @@ -657,16 +652,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); @@ -678,7 +673,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); @@ -691,7 +686,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); @@ -705,7 +700,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); @@ -722,7 +717,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; SSCANF(addr, "%i", &dacRdWrPtr->addr); SSCANF(data, "%i", &dacRdWrPtr->data); } @@ -799,7 +794,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 */ @@ -833,7 +828,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++; @@ -873,8 +868,7 @@ static int sst1InitParseSetMemClkString(char *string, return(0); dacSetMemClkPtr = dacSetMemClkPtr->nextSetMemClk; } - dacSetMemClkPtr->nextSetMemClk = (sst1InitDacSetMemClkStruct *) - NULL; + dacSetMemClkPtr->nextSetMemClk = NULL; /* Frequency */ SSCANF(dacRdWrCmd, "%i", &dacSetMemClkPtr->frequency); @@ -897,7 +891,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++; @@ -937,8 +931,7 @@ static int sst1InitParseSetVideoModeString(char *string, return(0); dacSetVideoModePtr = dacSetVideoModePtr->nextSetVideoMode; } - dacSetVideoModePtr->nextSetVideoMode = - (sst1InitDacSetVideoModeStruct *) NULL; + dacSetVideoModePtr->nextSetVideoMode = NULL; /* video16BPP */ SSCANF(dacRdWrCmd, "%i", &dacSetVideoModePtr->video16BPP); @@ -961,7 +954,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++; diff --git a/glide2x/cvg/init/print.c b/glide2x/cvg/init/print.c index a9577cc..0aba471 100644 --- a/glide2x/cvg/init/print.c +++ b/glide2x/cvg/init/print.c @@ -17,7 +17,6 @@ ** ** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED ** -** ** Print functions for SST-1 Initialization routines */ #ifdef _MSC_VER diff --git a/glide2x/cvg/init/sli.c b/glide2x/cvg/init/sli.c index 34db83e..0335acd 100644 --- a/glide2x/cvg/init/sli.c +++ b/glide2x/cvg/init/sli.c @@ -17,7 +17,6 @@ ** ** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED ** -** ** Initialization code for initializing scanline interleaving ** */ @@ -182,7 +181,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); @@ -226,7 +225,7 @@ FX_EXPORT FxBool FX_CSTYLE sst1InitSli(FxU32 *sstbase0, FxU32 *sstbase1) ~(SST_VIDEO_CLK_SLAVE_OE_EN | SST_VID_CLK_2X_OUT_OE_EN)) | SST_VID_CLK_DAC_DATA16_SEL); ISET(sstSlave->fbiInit1, IGET(sstSlave->fbiInit1) & - ~SST_VIDEO_VID_CLK_SLAVE); + ~SST_VIDEO_VID_CLK_SLAVE); sst1CurrentBoard->fbiInit6 &= ~SST_SLI_SYNC_MASTER; sst1CurrentBoard->fbiInit6 = ((sst1CurrentBoard->fbiInit6 & ~(SST_SLI_SWAP_VACTIVE | SST_SLI_SWAP_VACTIVE_DRAG)) | @@ -371,7 +370,7 @@ FX_EXPORT FxBool FX_CSTYLE sst1InitSli(FxU32 *sstbase0, FxU32 *sstbase1) SST_VIDEO_CLK_SLAVE_OE_EN | SST_VID_CLK_2X_OUT_OE_EN | SST_VID_CLK_DAC_DATA16_SEL); ISET(sstMaster->fbiInit1, IGET(sstMaster->fbiInit1) & - ~SST_VIDEO_VID_CLK_SLAVE); + ~SST_VIDEO_VID_CLK_SLAVE); sst1CurrentBoard->fbiInit6 |= SST_SLI_SYNC_MASTER; sst1CurrentBoard->fbiInit6 = ((sst1CurrentBoard->fbiInit6 & ~(SST_SLI_SWAP_VACTIVE | SST_SLI_SWAP_VACTIVE_DRAG)) | @@ -379,7 +378,7 @@ FX_EXPORT FxBool FX_CSTYLE sst1InitSli(FxU32 *sstbase0, FxU32 *sstbase1) (videoWindowActiveDrag<fbiInit6, sst1CurrentBoard->fbiInit6); - // Following work well up to around 100 MHz... + // Following work well up to around 100 MHz... // masterVInClkDel = 2; // masterVOutClkDel = 0; // masterPVOutClkDel = 0; @@ -458,7 +457,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[0]; sst1InitReturnStatus(sstbase0); // flush pci packer with reads sst1InitReturnStatus(sstbase0); @@ -581,13 +580,13 @@ FX_EXPORT FxBool FX_CSTYLE sst1InitSli(FxU32 *sstbase0, FxU32 *sstbase1) sst1InitReturnStatus(sstbase0); sst1InitReturnStatus(sstbase1); - // De-assert reset to Graphics core... + // De-assert reset to Graphics core... ISET(sstMaster->fbiInit0, IGET(sstMaster->fbiInit0) & ~SST_GRX_RESET); sst1InitReturnStatus(sstbase0); ISET(sstSlave->fbiInit0, IGET(sstSlave->fbiInit0) & ~SST_GRX_RESET); sst1InitReturnStatus(sstbase1); - // De-assert reset to Video core... + // De-assert reset to Video core... ISET(sstMaster->fbiInit1, IGET(sstMaster->fbiInit1) & ~SST_VIDEO_RESET); sst1InitReturnStatus(sstbase0); ISET(sstSlave->fbiInit1, IGET(sstSlave->fbiInit1) & ~SST_VIDEO_RESET); diff --git a/glide2x/cvg/init/sst1init.c b/glide2x/cvg/init/sst1init.c index adafd1f..11f47e4 100644 --- a/glide2x/cvg/init/sst1init.c +++ b/glide2x/cvg/init/sst1init.c @@ -196,8 +196,7 @@ FX_EXPORT FxU32 * FX_CSTYLE sst1InitMapBoardDirect(FxU32 BoardNumber, FxU32 deviceID; // 0x0002 - Look for a Voodoo2 board (0xFFFF - Find any 3Dfx board) FxU32 sizeOfCard = 0x1000000; // 16 MBytes of addr space for SST-1 FxU32 *sstbase; - FxU32 n; - FxU32 j; + FxU32 j, n; FxU32 sstv2_noremap = 0; if( GETENV( ("SSTV2_DEVICEID") ) ) diff --git a/glide2x/cvg/init/util.c b/glide2x/cvg/init/util.c index 600003c..719b04a 100644 --- a/glide2x/cvg/init/util.c +++ b/glide2x/cvg/init/util.c @@ -17,7 +17,6 @@ ** ** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED ** -** ** Utility routines for SST-1 Initialization code ** */ diff --git a/glide2x/cvg/init/video.c b/glide2x/cvg/init/video.c index 44c8dd0..9e53803 100644 --- a/glide2x/cvg/init/video.c +++ b/glide2x/cvg/init/video.c @@ -17,7 +17,6 @@ ** ** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED ** -** ** Initialization code for initializing SST-1 video unit ** */ diff --git a/glide2x/sst1/init/init96/dxdrvr.c b/glide2x/sst1/init/init96/dxdrvr.c index 196bbed..fbb1409 100644 --- a/glide2x/sst1/init/init96/dxdrvr.c +++ b/glide2x/sst1/init/init96/dxdrvr.c @@ -104,7 +104,6 @@ static LPDIRECTDRAW2 lpDD = NULL; static LPDIRECTDRAW lpDD1 = NULL; - FxBool ErrorMessage(HWND hWnd, char *err) { @@ -114,7 +113,6 @@ ErrorMessage(HWND hWnd, char *err) } /* ErrorMessage */ - /* * Takes a DirectDraw Surface object (LPDIRECTDRAWSURFACE), looks up its * description (DDSURFACEDESC), and returns a pointer to the surface and its @@ -141,7 +139,6 @@ _dxSurfaceToBufDesc(LPDIRECTDRAWSURFACE lpSurf, InitBufDesc_t *pDesc) } /* _dxSurfaceToBufDesc */ - /* * Convert front, back and aux surfaces from DDraw to Glide bufDescriptors. */ @@ -222,7 +219,6 @@ _dxDDrawToGlideDesc(InitBufDesc_t *pDesc) } /* _dxDDrawToGlideDesc */ - /* * Allocate (or re-allocate for WM_SIZE) buffers from DDraw. */ @@ -286,7 +282,7 @@ _dxAllocSurfaces(int xRes, int yRes, int vRefresh, InitBufDesc_t *pDesc) lpClipper = NULL; lpFront = NULL; lpBack = NULL; - lpTriple = NULL; + lpTriple = NULL; lpAux = NULL; if ( !IsFullScreen ) { /* In a window */ @@ -308,7 +304,7 @@ _dxAllocSurfaces(int xRes, int yRes, int vRefresh, InitBufDesc_t *pDesc) ddsd.dwSize = sizeof( ddsd ); ddsd.dwFlags = DDSD_CAPS; ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE | DDSCAPS_3DDEVICE; - + if (IDirectDraw2_CreateSurface( lpDD, &ddsd, &lpFront, 0 ) != DD_OK) return ErrorMessage(hWndApp, "Couldn't allocate primary surface!"); @@ -332,13 +328,13 @@ _dxAllocSurfaces(int xRes, int yRes, int vRefresh, InitBufDesc_t *pDesc) ddsd.dwHeight = yRes; ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY | DDSCAPS_3DDEVICE; - + if (IDirectDraw2_CreateSurface( lpDD, &ddsd, &lpBack, 0 ) != DD_OK) return ErrorMessage(hWndApp, "Couldn't allocate secondary surface!" ); GDBG_INFO((80, "_dxAS: Back buffer allocated!\n")); - /* + /* * Always allocate Aux Buffer Surface * XXX - (use nAuxBuffers, and deal with 8bpp for alpha) */ @@ -348,14 +344,13 @@ _dxAllocSurfaces(int xRes, int yRes, int vRefresh, InitBufDesc_t *pDesc) ddsd.dwHeight = yRes; ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY | DDSCAPS_3DDEVICE; - + if (IDirectDraw2_CreateSurface( lpDD, &ddsd, &lpAux, 0 ) != DD_OK) return ErrorMessage(hWndApp, "Couldn't allocate aux surface" ); GDBG_INFO((80, "_dxAS: Aux Buffer allocated!\n")); } else { - /* Full screen - Set Exclusive Mode, change resolution, */ GDBG_INFO((80, "_dxAS: Setting Full screen exclusive mode!\n")); @@ -426,18 +421,18 @@ _dxReallocSurfaces(int xRes, int yRes, int vRefresh, InitBufDesc_t *pDesc) /* for now this is a goddamn baseball bat it can be trimmed down */ if ( !IsFullScreen ) { /* this *REALLY* should be called for fullscreen */ - if( lpClipper) IDirectDrawClipper_Release( lpClipper); + if( lpClipper) IDirectDrawClipper_Release ( lpClipper); if( lpAux ) IDirectDrawSurface2_Release( lpAux ); if( lpBack ) IDirectDrawSurface2_Release( lpBack ); - if( lpTriple ) IDirectDrawSurface2_Release( lpTriple ); + if( lpTriple ) IDirectDrawSurface2_Release( lpTriple ); if( lpFront ) IDirectDrawSurface2_Release( lpFront ); - + lpClipper = NULL; lpFront = NULL; lpBack = NULL; lpTriple = NULL; lpAux = NULL; - + /* Verify screen pixel format is 16bpp, and set cooperative level */ ddsd.dwSize = sizeof( ddsd ); @@ -445,7 +440,7 @@ _dxReallocSurfaces(int xRes, int yRes, int vRefresh, InitBufDesc_t *pDesc) ddsd.dwSize = sizeof( ddsd ); ddsd.dwFlags = DDSD_CAPS; ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE | DDSCAPS_3DDEVICE; - + if (IDirectDraw2_CreateSurface( lpDD, &ddsd, &lpFront, 0 ) != DD_OK) { errorMessage = "Couldn't allocate primary surface!"; goto FUBAR; @@ -475,13 +470,13 @@ _dxReallocSurfaces(int xRes, int yRes, int vRefresh, InitBufDesc_t *pDesc) ddsd.dwHeight = yRes; ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY | DDSCAPS_3DDEVICE; - + if (IDirectDraw2_CreateSurface( lpDD, &ddsd, &lpBack, 0 ) != DD_OK) { errorMessage = "Couldn't allocate secondary surface!"; goto FUBAR; } - /* + /* * Always allocate Aux Buffer Surface * XXX - (use nAuxBuffers, and deal with 8bpp for alpha) */ @@ -491,7 +486,7 @@ _dxReallocSurfaces(int xRes, int yRes, int vRefresh, InitBufDesc_t *pDesc) ddsd.dwHeight = yRes; ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY | DDSCAPS_3DDEVICE; - + if (IDirectDraw2_CreateSurface( lpDD, &ddsd, &lpAux, 0 ) != DD_OK) { errorMessage = "Couldn't allocate aux surface"; goto FUBAR; @@ -500,10 +495,10 @@ _dxReallocSurfaces(int xRes, int yRes, int vRefresh, InitBufDesc_t *pDesc) return _dxDDrawToGlideDesc(pDesc); FUBAR: /* if you don't free these you can't make another attempt */ - if( lpClipper) IDirectDrawClipper_Release( lpClipper); + if( lpClipper) IDirectDrawClipper_Release ( lpClipper); if( lpAux ) IDirectDrawSurface2_Release( lpAux ); if( lpBack ) IDirectDrawSurface2_Release( lpBack ); - if( lpTriple ) IDirectDrawSurface2_Release( lpTriple ); + if( lpTriple ) IDirectDrawSurface2_Release( lpTriple ); if( lpFront ) IDirectDrawSurface2_Release( lpFront ); lpClipper = NULL; lpFront = NULL; @@ -606,10 +601,10 @@ dxOpen( #ifdef H3D if ((sRes < GR_RESOLUTION_MIN) || (sRes > GR_RESOLUTION_MAX) && - (!GR_RESOLUTION_IS_AUTOFLIPPED(sRes)) ) + (!GR_RESOLUTION_IS_AUTOFLIPPED(sRes)) ) #else if ((sRes < GR_RESOLUTION_320x200) || - (sRes > GR_RESOLUTION_512x256)) + (sRes > GR_RESOLUTION_512x256)) #endif return ErrorMessage(hWndApp, "Bad Fullscreen resolution"); @@ -641,7 +636,6 @@ dxOpen( return ErrorMessage(hWndApp, "failed dxOpen"); #endif - GDBG_INFO((80, "_dxAllocSurfaces OK!!!\n")); for (i=0; i< NUM_BUFS; i++) { @@ -650,7 +644,7 @@ dxOpen( GDBG_INFO((80, "\tbufMagic = 0x%x\n", pBufDesc[i].bufMagic)); GDBG_INFO((80, "\tbufType = 0x%x\n", pBufDesc[i].bufType)); GDBG_INFO((80, "\tbufOffset = 0x%x\n", pBufDesc[i].bufOffset)); - GDBG_INFO((80, "\tbufStride = 0x%x\n", pBufDesc[i].bufStride)); + GDBG_INFO((80, "\tbufStride = 0x%x\n", pBufDesc[i].bufStride)); GDBG_INFO((80, "\tbufBPP = 0x%x\n", pBufDesc[i].bufBPP)); } @@ -748,14 +742,14 @@ dxClose(void) if( lpDD ) IDirectDraw2_Release( lpDD ); if (1 /* !IsFullScreen */) { - if( lpDD1 ) IDirectDraw_Release( lpDD1 ); - lpDD1 = NULL; + if( lpDD1 ) IDirectDraw_Release( lpDD1 ); + lpDD1 = NULL; } lpClipper = NULL; lpFront = NULL; lpBack = NULL; - lpTriple = NULL; + lpTriple = NULL; lpAux = NULL; lpDD = NULL; #endif /* 0 */ @@ -779,7 +773,7 @@ dxSwap(FxU32 code) src.right = Width-1; src.top = 0; src.bottom = Height-1; - + dest = src; point.x = 0; point.y = 0; @@ -795,10 +789,10 @@ dxSwap(FxU32 code) &src, DDBLT_WAIT, NULL ); - + while( IDirectDrawSurface_GetBltStatus( lpFront, DDGBS_ISBLTDONE ) != DD_OK ); - + if ( hr != DD_OK ) { ErrorMessage(hWndApp, "Couldn't blit!\n"); } @@ -872,7 +866,6 @@ dxOpen( GDBG_INFO((80, "%s: Unimplemented resolution\n", FN_NAME)); break; } - #define WAITLOOP {\ volatile int waitfoo;\ @@ -944,7 +937,7 @@ dxOpen( #ifdef GDBG_INFO_ON { - int i; + int i; for (i = 0; i < 5; i++) { GDBG_INFO((80, "%s: pBufDesc[%d] = 0x%x:\n", @@ -998,5 +991,3 @@ dxSwap(FxU32 code) { } /* dxSwap */ #endif /* __DOS32__ || (defined(__WIN32__) && !defined(INIT_ACCESS_DDRAW) */ - - diff --git a/glide2x/sst1/init/init96/fxinit96.h b/glide2x/sst1/init/init96/fxinit96.h index e30c37d..40fbecd 100644 --- a/glide2x/sst1/init/init96/fxinit96.h +++ b/glide2x/sst1/init/init96/fxinit96.h @@ -40,7 +40,7 @@ FxBool dxOpen( int nAux, InitBufDesc_t *pBufDesc, int *width, - int *height, + int *height, InitSwapType_t *swapType ); FxBool dxControl(FxU32 control, InitBufDesc_t *pDesc, int *w, int *h); @@ -59,7 +59,7 @@ FxBool linOpen( int nAux, InitBufDesc_t *pBufDesc, int *width, - int *height, + int *height, InitSwapType_t *swapType ); FxBool linControl(FxU32 control, InitBufDesc_t *pDesc, int *w, int *h); diff --git a/glide2x/sst1/init/initvg/dac.c b/glide2x/sst1/init/initvg/dac.c index 1a9c896..aa5b3cf 100644 --- a/glide2x/sst1/init/initvg/dac.c +++ b/glide2x/sst1/init/initvg/dac.c @@ -513,7 +513,7 @@ FX_EXPORT FxBool FX_CSTYLE sst1InitGrxClk(FxU32 *sstbase) FxBool sst1InitComputeClkParams(float freq, sst1ClkTimingStruct *clkTiming) { - float vcoFreqDivide, freqMultRatio, clkError; + float vcoFreqDivide = 0.0f, freqMultRatio, clkError; float clkErrorMin; FxU32 p, n, m, nPlusTwo; int mPlusTwo; @@ -547,7 +547,7 @@ FxBool sst1InitComputeClkParams(float freq, sst1ClkTimingStruct freqMultRatio = (freq * vcoFreqDivide) * (float) 0.06984216; /* Calculate proper N and M parameters which yield the lowest error */ - clkErrorMin = (float) 9999.; n = 0; + clkErrorMin = (float) 9999.; n = 0; m = 0; for(nPlusTwo = 3; nPlusTwo < 32; nPlusTwo++) { #ifdef DIRECTX mPlusTwo = FTOL( (((float) nPlusTwo * freqMultRatio) + (float) 0.5) ); diff --git a/glide2x/sst1/init/initvg/gamma.c b/glide2x/sst1/init/initvg/gamma.c index 22838c7..48160d2 100644 --- a/glide2x/sst1/init/initvg/gamma.c +++ b/glide2x/sst1/init/initvg/gamma.c @@ -96,7 +96,7 @@ FX_EXPORT FxBool FX_CSTYLE sst1InitGammaRGB(FxU32 *sstbase, double gammaR, FxU32 gammaTableR[256]; FxU32 gammaTableG[256]; FxU32 gammaTableB[256]; - FxBool sstVideoIsReset; + FxBool sstVideoIsReset = FXFALSE; static FxBool calledBefore = FXFALSE; volatile Sstregs *sst = (Sstregs *) sstbase; @@ -178,7 +178,7 @@ FxU32 *r, FxU32 *g, FxU32 *b) FxU32 gammaTableR[256]; FxU32 gammaTableG[256]; FxU32 gammaTableB[256]; - FxBool sstVideoIsReset; + FxBool sstVideoIsReset = FXFALSE; static FxBool calledBefore = FXFALSE; volatile Sstregs *sst = (Sstregs *) sstbase; diff --git a/glide2x/sst1/init/initvg/info.c b/glide2x/sst1/init/initvg/info.c index 1942791..03b415a 100644 --- a/glide2x/sst1/init/initvg/info.c +++ b/glide2x/sst1/init/initvg/info.c @@ -40,7 +40,7 @@ readAndSum4x4(FxU32 *sstbase, FxU32 x, FxU32 y, FxU32 *r_sum, FxU32 *g_sum, FxU32 *b_sum) { FxU32 rd_x, rd_y; - FxU32 rd_col; + FxU32 rd_col = 0; FxU32 rd_r, rd_g, rd_b; volatile Sstregs *sst = (Sstregs *) sstbase; @@ -76,7 +76,7 @@ readAndSum4x4(FxU32 *sstbase, FxU32 x, FxU32 y, } INIT_INFO((3,"sums: r_sum=0x%03x g_sum=0x%03x b_sum=0x%03x\n", *r_sum, *g_sum, *b_sum)); - return(FXTRUE); + return(FXTRUE); } /* xxx - Give these guys some meaningful comments */ @@ -147,7 +147,7 @@ initSumTables(FxU32 *sstbase) } g_tbl[g_sum] = tst_color; } - return(FXTRUE); + return(FXTRUE); } /* remove dither to derive actual 24-bit RGB value */ @@ -160,7 +160,7 @@ unDither(FxU32 r_sum, FxU32 g_sum, FxU32 b_sum, FxU32 *result) return(FXFALSE); } *result = (rb_tbl[r_sum] << 16) | (g_tbl[g_sum] << 8) | rb_tbl[b_sum]; - return(FXTRUE); + return(FXTRUE); } static FxBool @@ -243,10 +243,10 @@ sst1InitGetTmuMemory(FxU32 *sstbase, sst1DeviceInfoStruct *info, FxU32 tmu, INIT_INFO((1,"sst1InitGetTmuMemory(0x%x, , %d)\n", sstbase,tmu)); - if(GETENV(("SST_TMUMEM_SIZE"))) { - *TmuMemorySize = ATOI(GETENV(("SST_TMUMEM_SIZE"))); - return(FXTRUE); - } + if(GETENV(("SST_TMUMEM_SIZE"))) { + *TmuMemorySize = ATOI(GETENV(("SST_TMUMEM_SIZE"))); + return(FXTRUE); + } ISET(sst->lfbMode, SST_LFB_RGBALANES_ARGB | SST_LFB_READFRONTBUFFER); ISET(sst->fbzMode, SST_DRAWBUFFER_FRONT | SST_RGBWRMASK); @@ -291,21 +291,21 @@ sst1InitGetTmuInfo(FxU32 *sstbase, sst1DeviceInfoStruct *info) FxU32 trev; if(initSumTables(sstbase) == FXFALSE) - return(FXFALSE); + return(FXFALSE); if(getTmuConfigData(sstbase,info) == FXFALSE) - return(FXFALSE); + return(FXFALSE); - /* TMU memory speed */ - /* tmuClkFixed is no longer used... */ - info->tmuClkFixed = 0x0; - /* tmuMemSpeed is legacy, and is not used by either Obsidian GE or Pro Fab */ - info->tmuMemSpeed = 0; + /* TMU memory speed */ + /* tmuClkFixed is no longer used... */ + info->tmuClkFixed = 0x0; + /* tmuMemSpeed is legacy, and is not used by either Obsidian GE or Pro Fab */ + info->tmuMemSpeed = 0; /* count the TMUs and verify that all TMUs are the same revision */ info->tmuRevision = info->tmuConfig & 0x7; info->numberTmus = 1; if(sst1InitGetTmuMemory(sstbase, info, 0, &info->tmuMemSize[0]) == FXFALSE) - return(FXFALSE); + return(FXFALSE); INIT_INFO((1,"TMU0 memory = %d MB\n", info->tmuMemSize[0])); if (info->tmuConfig & FXBIT(6)) { /* if TMU 1 exists */ info->numberTmus++; /* increment TMU count */ @@ -314,7 +314,7 @@ sst1InitGetTmuInfo(FxU32 *sstbase, sst1DeviceInfoStruct *info) INIT_PRINTF(("sst1InitGetDeviceInfo: ERROR, multiple different TMU revision IDs detected\n")); return(FXFALSE); } - if(sst1InitGetTmuMemory(sstbase, info, 1, &info->tmuMemSize[1]) == FXFALSE) + if(sst1InitGetTmuMemory(sstbase, info, 1, &info->tmuMemSize[1]) == FXFALSE) return(FXFALSE); } if (info->tmuConfig & FXBIT(13)) { /* if TMU 2 exists */ @@ -324,7 +324,7 @@ sst1InitGetTmuInfo(FxU32 *sstbase, sst1DeviceInfoStruct *info) INIT_PRINTF(("sst1InitGetDeviceInfo: ERROR, multiple different TMU revision IDs detected\n")); return(FXFALSE); } - if(sst1InitGetTmuMemory(sstbase, info, 2, &info->tmuMemSize[2]) == FXFALSE) + if(sst1InitGetTmuMemory(sstbase, info, 2, &info->tmuMemSize[2]) == FXFALSE) return(FXFALSE); } INIT_INFO((1,"numberTMus = %d\n", info->numberTmus)); @@ -358,7 +358,7 @@ static int fbiMemSize(FxU32 *sstbase) /* Enable dram refresh, disable memory fifo, and setup memory */ /* for rendering */ ISET(sst->fbiInit0, IGET(sst->fbiInit0) & ~SST_MEM_FIFO_EN); - ISET(sst->fbiInit2, IGET(sst->fbiInit2) | SST_EN_DRAM_REFRESH); + ISET(sst->fbiInit2, IGET(sst->fbiInit2) | SST_EN_DRAM_REFRESH); sst1InitIdleFBI(sstbase); /* Setup Basic rendering datapath */ @@ -370,7 +370,7 @@ static int fbiMemSize(FxU32 *sstbase) if(sst1InitSliDetect(sstbase)) /* SLI cannot support 4 MBytes... */ goto check2MByte; - sst1InitSetResolution(sstbase, &SST_VREZ_800X600_60, 1); + sst1InitSetResolution(sstbase, &SST_VREZ_800X600_60, 1); sst1InitIdleFBI(sstbase); ISET(sst->lfbMode, SST_LFB_ZZ | SST_LFB_WRITEFRONTBUFFER | @@ -388,7 +388,7 @@ static int fbiMemSize(FxU32 *sstbase) sst1InitIdleFBI(sstbase); if((LFB_GETPIXEL(128, 100) == 0xdead) && (LFB_GETPIXEL(200, 200) == 0x55aa)) { - retval = 4; + retval = 4; ISET(sst->lfbMode, (SST_LFB_565 | SST_LFB_READBACKBUFFER)); sst1InitIdleFBI(sstbase); goto fbiMemSizeDone; @@ -397,7 +397,7 @@ static int fbiMemSize(FxU32 *sstbase) check2MByte: /* Check for 2 MBytes... */ /* Write to color buffer in 640x480 resolution */ - sst1InitSetResolution(sstbase, &SST_VREZ_640X480_60, 0); + sst1InitSetResolution(sstbase, &SST_VREZ_640X480_60, 0); ISET(sst->lfbMode, SST_LFB_565 | SST_LFB_WRITEFRONTBUFFER | SST_LFB_READFRONTBUFFER); sst1InitIdleFBI(sstbase); @@ -416,7 +416,7 @@ check2MByte: ISET(sst->lfbMode, (SST_LFB_565 | SST_LFB_READBACKBUFFER)); sst1InitIdleFBI(sstbase); if(LFB_GETPIXEL(178, 436) == 0xaa55) { - retval = 2; + retval = 2; goto fbiMemSizeDone; } @@ -433,7 +433,7 @@ check1MByte: sst1InitIdleFBI(sstbase); if((LFB_GETPIXEL(10, 10) == 0xdead) && (LFB_GETPIXEL(100, 200) == 0x5a5a)) - retval = 1; + retval = 1; fbiMemSizeDone: /* Restore init registers to original state */ diff --git a/glide3x/cvg/init/info.c b/glide3x/cvg/init/info.c index 2fdc701..0a5dab5 100644 --- a/glide3x/cvg/init/info.c +++ b/glide3x/cvg/init/info.c @@ -43,7 +43,7 @@ static FxBool readAndSum4x4(FxU32 *sstbase, FxU32 x, FxU32 y, - FxU32 *r_sum, FxU32 *g_sum, FxU32 *b_sum) + FxU32 *r_sum, FxU32 *g_sum, FxU32 *b_sum) { FxU32 rd_x, rd_y; FxU32 rd_col = 0; @@ -82,7 +82,7 @@ readAndSum4x4(FxU32 *sstbase, FxU32 x, FxU32 y, } INIT_INFO((3,"sums: r_sum=0x%03x g_sum=0x%03x b_sum=0x%03x\n", *r_sum, *g_sum, *b_sum)); - return(FXTRUE); + return(FXTRUE); } /* xxx - Give these guys some meaningful comments */ @@ -153,7 +153,7 @@ initSumTables(FxU32 *sstbase) } g_tbl[g_sum] = tst_color; } - return(FXTRUE); + return(FXTRUE); } /* remove dither to derive actual 24-bit RGB value */ @@ -166,7 +166,7 @@ unDither(FxU32 r_sum, FxU32 g_sum, FxU32 b_sum, FxU32 *result) return(FXFALSE); } *result = (rb_tbl[r_sum] << 16) | (g_tbl[g_sum] << 8) | rb_tbl[b_sum]; - return(FXTRUE); + return(FXTRUE); } static FxBool @@ -175,7 +175,7 @@ getTmuConfigData(FxU32 *sstbase, sst1DeviceInfoStruct *info) int x=0, y=0; FxU32 r_sum, g_sum, b_sum; SstRegs *sst = (SstRegs *) sstbase; - FxU32 tmuRevision; + FxU32 tmuRevision; /* set trex's (all 3) to output configuration bits */ ISET(SST_TREX(sst,0)->trexInit1, info->tmuInit1[0] | (1 << 18)); @@ -191,12 +191,12 @@ getTmuConfigData(FxU32 *sstbase, sst1DeviceInfoStruct *info) drawTriangle(sst,x,y,36); readAndSum4x4(sstbase, x,y, &r_sum,&g_sum,&b_sum); - if(GETENV(("SSTV2_TEXMAP_DISABLE"))) { - info->tmuConfig = 0x0; - } else { - if(unDither(r_sum,g_sum,b_sum,&info->tmuConfig) == FXFALSE) - return(FXFALSE); - } + if(GETENV(("SSTV2_TEXMAP_DISABLE"))) { + info->tmuConfig = 0x0; + } else { + if(unDither(r_sum,g_sum,b_sum,&info->tmuConfig) == FXFALSE) + return(FXFALSE); + } ///////////////////////// // Get new revision... @@ -215,16 +215,16 @@ getTmuConfigData(FxU32 *sstbase, sst1DeviceInfoStruct *info) drawTriangle(sst,x,y,36); readAndSum4x4(sstbase, x,y, &r_sum,&g_sum,&b_sum); - if(unDither(r_sum,g_sum,b_sum,&tmuRevision) == FXFALSE) - return(FXFALSE); + if(unDither(r_sum,g_sum,b_sum,&tmuRevision) == FXFALSE) + return(FXFALSE); - info->tmuFab[0] = (tmuRevision >> 4) & 0xf; - info->tmuFab[1] = (tmuRevision >> 12) & 0xf; - info->tmuFab[2] = (tmuRevision >> 20) & 0xf; + info->tmuFab[0] = (tmuRevision >> 4) & 0xf; + info->tmuFab[1] = (tmuRevision >> 12) & 0xf; + info->tmuFab[2] = (tmuRevision >> 20) & 0xf; - /* Adjust configuration structure for "new" revision ID */ - info->tmuConfig &= ~(0x7 | (0x7<<7) | (0x7<<14)); - info->tmuConfig |= (((tmuRevision & 0x7) + 3) | + /* Adjust configuration structure for "new" revision ID */ + info->tmuConfig &= ~(0x7 | (0x7<<7) | (0x7<<14)); + info->tmuConfig |= (((tmuRevision & 0x7) + 3) | ((((tmuRevision >> 8) & 0x7) + 3) << 7) | ((((tmuRevision >> 16) & 0x7) + 3) << 14)); @@ -233,14 +233,14 @@ getTmuConfigData(FxU32 *sstbase, sst1DeviceInfoStruct *info) ISET(SST_TREX(sst,1)->trexInit1, info->tmuInit1[1]); ISET(SST_TREX(sst,2)->trexInit1, info->tmuInit1[2]); - if(GETENV(("SSTV2_TMUCFG"))) - { - FxU32 u; - if (SSCANF(GETENV(("SSTV2_TMUCFG")), "%u", &u) == 1) - info->tmuConfig = u; - } + if(GETENV(("SSTV2_TMUCFG"))) + { + FxU32 u; + if (SSCANF(GETENV(("SSTV2_TMUCFG")), "%u", &u) == 1) + info->tmuConfig = u; + } - return(FXTRUE); + return(FXTRUE); } #define SENSE2 0x92F56EB0 @@ -260,10 +260,10 @@ static FxU32 sense(FxU32 *sstbase, sst1DeviceInfoStruct *info, FxU32 tmu, ISET(sst->texBaseAddr, 0x200000>>3); /* set to 2 MB */ ISET(texAddr[0], SENSE2); /* write a random value */ - + ISET(sst->texBaseAddr, 0x100000>>3); /* set to 1 MB */ ISET(texAddr[0], SENSE1); /* write a random value */ - + ISET(sst->texBaseAddr, 0x000000>>3); /* set to 0 MB */ ISET(texAddr[0], SENSE0); /* write a random value */ @@ -290,19 +290,19 @@ sst1InitGetTmuMemory(FxU32 *sstbase, sst1DeviceInfoStruct *info, FxU32 tmu, INIT_INFO((1,"sst1InitGetTmuMemory(0x%x, , %d)\n", sstbase,tmu)); - if(GETENV(("SSTV2_TMU_MEMSIZE"))) { - *TmuMemorySize = ATOI(GETENV(("SSTV2_TMU_MEMSIZE"))); - // If user specifies 2 MBytes on a 4 MBytes board, disable the - // second RAS so that apps which may incorrectly store data in the - // upper 2 Mbytes will not function properly... - if(*TmuMemorySize == 2) { - info->tmuInit0[tmu] &= ~SST_EN_TEX_MEM_SECOND_RAS; - sst1InitIdle(sstbase); - ISET(SST_TREX(sst,tmu)->trexInit0, info->tmuInit0[tmu]); - sst1InitIdle(sstbase); - } - return(FXTRUE); + if(GETENV(("SSTV2_TMU_MEMSIZE"))) { + *TmuMemorySize = ATOI(GETENV(("SSTV2_TMU_MEMSIZE"))); + /* If user specifies 2 MBytes on a 4 MBytes board, disable the + * second RAS so that apps which may incorrectly store data in the + * upper 2 Mbytes will not function properly... */ + if (*TmuMemorySize == 2) { + info->tmuInit0[tmu] &= ~SST_EN_TEX_MEM_SECOND_RAS; + sst1InitIdle(sstbase); + ISET(SST_TREX(sst,tmu)->trexInit0, info->tmuInit0[tmu]); + sst1InitIdle(sstbase); } + return(FXTRUE); + } ISET(sst->lfbMode, SST_LFB_RGBALANES_ARGB | SST_LFB_READFRONTBUFFER); ISET(sst->fbzMode, SST_DRAWBUFFER_FRONT | SST_RGBWRMASK); @@ -333,7 +333,7 @@ sst1InitGetTmuMemory(FxU32 *sstbase, sst1DeviceInfoStruct *info, FxU32 tmu, if (data == SENSE0) {*TmuMemorySize = 1; return(FXTRUE);} INIT_PRINTF(("sst1InitGetTmuMemory() ERROR: Could not detect memory size.\n")); - return(FXFALSE); + return(FXFALSE); } /*--------------------------------------------------------------------------- @@ -347,50 +347,49 @@ sst1InitGetTmuInfo(FxU32 *sstbase, sst1DeviceInfoStruct *info) FxU32 trev; if(initSumTables(sstbase) == FXFALSE) - return(FXFALSE); + return(FXFALSE); if(getTmuConfigData(sstbase,info) == FXFALSE) - return(FXFALSE); + return(FXFALSE); info->numberTmus = 1; - if(GETENV(("SSTV2_TEXMAP_DISABLE"))) { - info->tmuRevision = 4; - sst1InitGetTmuMemory(sstbase, info, 0, &info->tmuMemSize[0]); - info->tmuMemSize[0] = 2; - } else { - /* Get TMU memory size */ - info->tmuRevision = info->tmuConfig & 0x7; - if(sst1InitGetTmuMemory(sstbase, info, 0, &info->tmuMemSize[0]) == - FXFALSE) - return(FXFALSE); - } + if(GETENV(("SSTV2_TEXMAP_DISABLE"))) { + info->tmuRevision = 4; + sst1InitGetTmuMemory(sstbase, info, 0, &info->tmuMemSize[0]); + info->tmuMemSize[0] = 2; + } else { + /* Get TMU memory size */ + info->tmuRevision = info->tmuConfig & 0x7; + if(sst1InitGetTmuMemory(sstbase, info, 0, &info->tmuMemSize[0]) == FXFALSE) + return(FXFALSE); + } INIT_INFO((1,"TMU0 memory = %d MB\n", info->tmuMemSize[0])); if (info->tmuConfig & FXBIT(6)) { /* if TMU 1 exists */ info->numberTmus++; /* increment TMU count */ trev = (info->tmuConfig>>7) & 0x7; /* get its revision */ -#if 0 // Ignore for now... +#if 0 /* Ignore for now... */ if (info->tmuRevision != trev) { INIT_PRINTF(("sst1InitGetDeviceInfo: ERROR, multiple different TMU revision IDs detected\n")); return(FXFALSE); } #endif - if(sst1InitGetTmuMemory(sstbase, info, 1, &info->tmuMemSize[1]) == FXFALSE) - return(FXFALSE); + if (sst1InitGetTmuMemory(sstbase, info, 1, &info->tmuMemSize[1]) == FXFALSE) + return(FXFALSE); } if (info->tmuConfig & FXBIT(13)) { /* if TMU 2 exists */ info->numberTmus++; /* increment TMU count */ trev = (info->tmuConfig>>14) & 0x7; /* get its revision */ -#if 0 // Ignore for now... +#if 0 /* Ignore for now... */ if (info->tmuRevision != trev) { INIT_PRINTF(("sst1InitGetDeviceInfo: ERROR, multiple different TMU revision IDs detected\n")); return(FXFALSE); } #endif - if(sst1InitGetTmuMemory(sstbase, info, 2, &info->tmuMemSize[2]) == FXFALSE) - return(FXFALSE); + if(sst1InitGetTmuMemory(sstbase, info, 2, &info->tmuMemSize[2]) == FXFALSE) + return(FXFALSE); } - if(GETENV(("SSTV2_NUM_TMUS"))) - info->numberTmus = ATOI(GETENV(("SSTV2_NUM_TMUS"))); + if (GETENV(("SSTV2_NUM_TMUS"))) + info->numberTmus = ATOI(GETENV(("SSTV2_NUM_TMUS"))); INIT_INFO((1,"numberTMus = %d\n", info->numberTmus)); return(FXTRUE); @@ -423,7 +422,7 @@ static int fbiMemSize(FxU32 *sstbase) /* Enable dram refresh, disable memory fifo, and setup memory */ /* for rendering */ ISET(sst->fbiInit0, IGET(sst->fbiInit0) & ~SST_MEM_FIFO_EN); - ISET(sst->fbiInit2, IGET(sst->fbiInit2) | SST_EN_DRAM_REFRESH); + ISET(sst->fbiInit2, IGET(sst->fbiInit2) | SST_EN_DRAM_REFRESH); sst1InitIdleFBI(sstbase); /* Setup Basic rendering datapath */ @@ -432,7 +431,7 @@ static int fbiMemSize(FxU32 *sstbase) ISET(sst->fbzMode, SST_RGBWRMASK | SST_ZAWRMASK | SST_DRAWBUFFER_FRONT); sst1InitIdleFBI(sstbase); - sst1InitSetResolution(sstbase, &SST_VREZ_800X600_60, 1); + sst1InitSetResolution(sstbase, &SST_VREZ_800X600_60, 1); sst1InitIdleFBI(sstbase); ISET(sst->lfbMode, SST_LFB_ZZ | SST_LFB_WRITEFRONTBUFFER | @@ -450,7 +449,7 @@ static int fbiMemSize(FxU32 *sstbase) sst1InitIdleFBI(sstbase); if((LFB_GETPIXEL(128, 100) == 0xdead) && (LFB_GETPIXEL(200, 200) == 0x55aa)) { - retval = 4; + retval = 4; ISET(sst->lfbMode, (SST_LFB_565 | SST_LFB_READBACKBUFFER)); sst1InitIdleFBI(sstbase); goto fbiMemSizeDone; @@ -458,7 +457,7 @@ static int fbiMemSize(FxU32 *sstbase) /* Check for 2 MBytes... */ /* Write to color buffer in 640x480 resolution */ - sst1InitSetResolution(sstbase, &SST_VREZ_640X480_60, 0); + sst1InitSetResolution(sstbase, &SST_VREZ_640X480_60, 0); ISET(sst->lfbMode, SST_LFB_565 | SST_LFB_WRITEFRONTBUFFER | SST_LFB_READFRONTBUFFER); sst1InitIdleFBI(sstbase); @@ -477,7 +476,7 @@ static int fbiMemSize(FxU32 *sstbase) ISET(sst->lfbMode, (SST_LFB_565 | SST_LFB_READBACKBUFFER)); sst1InitIdleFBI(sstbase); if(LFB_GETPIXEL(178, 436) == 0xaa55) { - retval = 2; + retval = 2; goto fbiMemSizeDone; } @@ -494,7 +493,7 @@ check1MByte: sst1InitIdleFBI(sstbase); if((LFB_GETPIXEL(10, 10) == 0xdead) && (LFB_GETPIXEL(100, 200) == 0x5a5a)) - retval = 1; + retval = 1; fbiMemSizeDone: /* Restore init registers to original state */ @@ -513,24 +512,24 @@ sst1InitGetFbiInfo(FxU32 *sstbase, sst1DeviceInfoStruct *info) SstRegs *sst = (SstRegs *) sstbase; info->fbiMemSize = fbiMemSize(sstbase); - + /* Detect board identification and memory speed */ if(GETENV(("SSTV2_FBICFG")) && (SSCANF(GETENV(("SSTV2_FBICFG")), "%u", &u) == 1)) info->fbiConfig = u; else - info->fbiConfig = (IGET(sst->fbiInit3) & SST_FBI_MEM_TYPE) >> + info->fbiConfig = (IGET(sst->fbiInit3) & SST_FBI_MEM_TYPE) >> SST_FBI_MEM_TYPE_SHIFT; - + info->fbiBoardID = (IGET(sst->fbiInit5) >> 5) & 0xf; if(IGET(sst->fbiInit7) & BIT(0)) info->fbiBoardID |= 0x10; - + /* Detect scanline interleaving */ info->sliPaired = sst1InitSliPaired(sstbase); - info->sliDetected = sst1InitSliDetect(sstbase); - - return FXTRUE; + info->sliDetected = sst1InitSliDetect(sstbase); + + return FXTRUE; } /* @@ -540,8 +539,7 @@ sst1InitGetFbiInfo(FxU32 *sstbase, sst1DeviceInfoStruct *info) ** been allocated ** */ -FX_EXPORT FxBool FX_CSTYLE sst1InitGetDeviceInfo(FxU32 *sstbase, - sst1DeviceInfoStruct *info) +FX_EXPORT FxBool FX_CSTYLE sst1InitGetDeviceInfo(FxU32 *sstbase, sst1DeviceInfoStruct *info) { FxBool retval; @@ -560,7 +558,7 @@ FX_EXPORT FxBool FX_CSTYLE sst1InitGetDeviceInfo(FxU32 *sstbase, FxBool sst1InitFillDeviceInfo(FxU32 *sstbase, sst1DeviceInfoStruct *info) { FxU32 u; - + if(!sstbase) return(FXFALSE); @@ -569,92 +567,94 @@ FxBool sst1InitFillDeviceInfo(FxU32 *sstbase, sst1DeviceInfoStruct *info) if(GETENV(("SSTV2_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(("SSTV2_FBICFG")) && - (SSCANF(GETENV(("SSTV2_FBICFG")), "%u", &u) == 1)) - info->fbiConfig = u; - else - info->fbiConfig = 0x0; + if(GETENV(("SSTV2_FBICFG")) && + (SSCANF(GETENV(("SSTV2_FBICFG")), "%u", &u) == 1)) + info->fbiConfig = u; + else + info->fbiConfig = 0x0; - if(GETENV(("SSTV2_TMUCFG")) && - (SSCANF(GETENV(("SSTV2_TMUCFG")), "%u", &u) == 1)) - info->tmuConfig = u; - else - info->tmuConfig = 0x0; + if(GETENV(("SSTV2_TMUCFG")) && + (SSCANF(GETENV(("SSTV2_TMUCFG")), "%u", &u) == 1)) + info->tmuConfig = u; + 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(("SSTV2_FBI_MEMSIZE"))) - info->fbiMemSize = ATOI(GETENV(("SSTV2_FBI_MEMSIZE"))); - else - info->fbiMemSize = 2; + if(GETENV(("SSTV2_FBI_MEMSIZE"))) + info->fbiMemSize = ATOI(GETENV(("SSTV2_FBI_MEMSIZE"))); + else + info->fbiMemSize = 2; - if(GETENV(("SSTV2_TMU_MEMSIZE"))) - info->tmuMemSize[0] = ATOI(GETENV(("SSTV2_TMU_MEMSIZE"))); - 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(("SSTV2_TMU_MEMSIZE"))) + info->tmuMemSize[0] = ATOI(GETENV(("SSTV2_TMU_MEMSIZE"))); + else + info->tmuMemSize[0] = 2; + info->tmuMemSize[1] = info->tmuMemSize[0]; + info->tmuMemSize[2] = info->tmuMemSize[0]; } - // Measure silicon performance - sst1InitMeasureSiProcess(sstbase, 0); // measure NAND-tree - sst1InitMeasureSiProcess(sstbase, 1); // measure NOR-tree + else { + int i; - INIT_PRINTF(("sst1DeviceInfo: Board ID: %d\n", info->fbiBoardID)); + 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); + } + /* Measure silicon performance */ + sst1InitMeasureSiProcess(sstbase, 0); /* measure NAND-tree */ + sst1InitMeasureSiProcess(sstbase, 1); /* measure NOR-tree */ + + INIT_PRINTF(("sst1DeviceInfo: Board ID: %d\n", info->fbiBoardID)); 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", + 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->fbiVideoDacType == SST_FBI_DACTYPE_ATT) - INIT_PRINTF(("AT&T ATT20C409\n")); - else if(info->fbiVideoDacType == SST_FBI_DACTYPE_ICS) - INIT_PRINTF(("ICS ICS5342\n")); - else if(info->fbiVideoDacType == SST_FBI_DACTYPE_TI) - INIT_PRINTF(("TI TVP3409\n")); - else if(info->fbiVideoDacType == SST_FBI_DACTYPE_PROXY) - INIT_PRINTF(("(SLI PROXY)\n")); - else - INIT_PRINTF(("Unknown\n")); - } + } + else { + INIT_PRINTF(("sst1DeviceInfo: Dac Type: ")); + if(info->fbiVideoDacType == SST_FBI_DACTYPE_ATT) + INIT_PRINTF(("AT&T ATT20C409\n")); + else if(info->fbiVideoDacType == SST_FBI_DACTYPE_ICS) + INIT_PRINTF(("ICS ICS5342\n")); + else if(info->fbiVideoDacType == SST_FBI_DACTYPE_TI) + INIT_PRINTF(("TI TVP3409\n")); + else if(info->fbiVideoDacType == SST_FBI_DACTYPE_PROXY) + INIT_PRINTF(("(SLI PROXY)\n")); + else + INIT_PRINTF(("Unknown\n")); + } INIT_PRINTF(("sst1DeviceInfo: SLI Detected:%d\n", info->sliDetected)); return(FXTRUE); diff --git a/glide3x/cvg/init/sli.c b/glide3x/cvg/init/sli.c index 3d3ed04..18e8b72 100644 --- a/glide3x/cvg/init/sli.c +++ b/glide3x/cvg/init/sli.c @@ -182,7 +182,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); @@ -226,7 +226,7 @@ FX_EXPORT FxBool FX_CSTYLE sst1InitSli(FxU32 *sstbase0, FxU32 *sstbase1) ~(SST_VIDEO_CLK_SLAVE_OE_EN | SST_VID_CLK_2X_OUT_OE_EN)) | SST_VID_CLK_DAC_DATA16_SEL); ISET(sstSlave->fbiInit1, IGET(sstSlave->fbiInit1) & - ~SST_VIDEO_VID_CLK_SLAVE); + ~SST_VIDEO_VID_CLK_SLAVE); sst1CurrentBoard->fbiInit6 &= ~SST_SLI_SYNC_MASTER; sst1CurrentBoard->fbiInit6 = ((sst1CurrentBoard->fbiInit6 & ~(SST_SLI_SWAP_VACTIVE | SST_SLI_SWAP_VACTIVE_DRAG)) | @@ -374,7 +374,7 @@ FX_EXPORT FxBool FX_CSTYLE sst1InitSli(FxU32 *sstbase0, FxU32 *sstbase1) SST_VIDEO_CLK_SLAVE_OE_EN | SST_VID_CLK_2X_OUT_OE_EN | SST_VID_CLK_DAC_DATA16_SEL); ISET(sstMaster->fbiInit1, IGET(sstMaster->fbiInit1) & - ~SST_VIDEO_VID_CLK_SLAVE); + ~SST_VIDEO_VID_CLK_SLAVE); sst1CurrentBoard->fbiInit6 |= SST_SLI_SYNC_MASTER; sst1CurrentBoard->fbiInit6 = ((sst1CurrentBoard->fbiInit6 & ~(SST_SLI_SWAP_VACTIVE | SST_SLI_SWAP_VACTIVE_DRAG)) | @@ -382,7 +382,7 @@ FX_EXPORT FxBool FX_CSTYLE sst1InitSli(FxU32 *sstbase0, FxU32 *sstbase1) (videoWindowActiveDrag<fbiInit6, sst1CurrentBoard->fbiInit6); - // Following work well up to around 100 MHz... + // Following work well up to around 100 MHz... // masterVInClkDel = 2; // masterVOutClkDel = 0; // masterPVOutClkDel = 0; @@ -464,7 +464,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[0]; sst1InitReturnStatus(sstbase0); // flush pci packer with reads sst1InitReturnStatus(sstbase0); @@ -587,13 +587,13 @@ FX_EXPORT FxBool FX_CSTYLE sst1InitSli(FxU32 *sstbase0, FxU32 *sstbase1) sst1InitReturnStatus(sstbase0); sst1InitReturnStatus(sstbase1); - // De-assert reset to Graphics core... + // De-assert reset to Graphics core... ISET(sstMaster->fbiInit0, IGET(sstMaster->fbiInit0) & ~SST_GRX_RESET); sst1InitReturnStatus(sstbase0); ISET(sstSlave->fbiInit0, IGET(sstSlave->fbiInit0) & ~SST_GRX_RESET); sst1InitReturnStatus(sstbase1); - // De-assert reset to Video core... + // De-assert reset to Video core... ISET(sstMaster->fbiInit1, IGET(sstMaster->fbiInit1) & ~SST_VIDEO_RESET); sst1InitReturnStatus(sstbase0); ISET(sstSlave->fbiInit1, IGET(sstSlave->fbiInit1) & ~SST_VIDEO_RESET); diff --git a/glide3x/sst1/init/init96/dxdrvr.c b/glide3x/sst1/init/init96/dxdrvr.c index 4001150..7ec791a 100644 --- a/glide3x/sst1/init/init96/dxdrvr.c +++ b/glide3x/sst1/init/init96/dxdrvr.c @@ -123,7 +123,6 @@ static LPDIRECTDRAW2 lpDD = NULL; static LPDIRECTDRAW lpDD1 = NULL; - FxBool ErrorMessage(HWND hWnd, char *err) { @@ -133,7 +132,6 @@ ErrorMessage(HWND hWnd, char *err) } /* ErrorMessage */ - /* * Takes a DirectDraw Surface object (LPDIRECTDRAWSURFACE), looks up its * description (DDSURFACEDESC), and returns a pointer to the surface and its @@ -160,7 +158,6 @@ _dxSurfaceToBufDesc(LPDIRECTDRAWSURFACE lpSurf, InitBufDesc_t *pDesc) } /* _dxSurfaceToBufDesc */ - /* * Convert front, back and aux surfaces from DDraw to Glide bufDescriptors. */ @@ -241,7 +238,6 @@ _dxDDrawToGlideDesc(InitBufDesc_t *pDesc) } /* _dxDDrawToGlideDesc */ - /* * Allocate (or re-allocate for WM_SIZE) buffers from DDraw. */ @@ -305,7 +301,7 @@ _dxAllocSurfaces(int xRes, int yRes, int vRefresh, InitBufDesc_t *pDesc) lpClipper = NULL; lpFront = NULL; lpBack = NULL; - lpTriple = NULL; + lpTriple = NULL; lpAux = NULL; if ( !IsFullScreen ) { /* In a window */ @@ -327,7 +323,7 @@ _dxAllocSurfaces(int xRes, int yRes, int vRefresh, InitBufDesc_t *pDesc) ddsd.dwSize = sizeof( ddsd ); ddsd.dwFlags = DDSD_CAPS; ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE | DDSCAPS_3DDEVICE; - + if (IDirectDraw2_CreateSurface( lpDD, &ddsd, &lpFront, 0 ) != DD_OK) return ErrorMessage(hWndApp, "Couldn't allocate primary surface!"); @@ -351,13 +347,13 @@ _dxAllocSurfaces(int xRes, int yRes, int vRefresh, InitBufDesc_t *pDesc) ddsd.dwHeight = yRes; ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY | DDSCAPS_3DDEVICE; - + if (IDirectDraw2_CreateSurface( lpDD, &ddsd, &lpBack, 0 ) != DD_OK) return ErrorMessage(hWndApp, "Couldn't allocate secondary surface!" ); GDBG_INFO((80, "_dxAS: Back buffer allocated!\n")); - /* + /* * Always allocate Aux Buffer Surface * XXX - (use nAuxBuffers, and deal with 8bpp for alpha) */ @@ -367,14 +363,13 @@ _dxAllocSurfaces(int xRes, int yRes, int vRefresh, InitBufDesc_t *pDesc) ddsd.dwHeight = yRes; ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY | DDSCAPS_3DDEVICE; - + if (IDirectDraw2_CreateSurface( lpDD, &ddsd, &lpAux, 0 ) != DD_OK) return ErrorMessage(hWndApp, "Couldn't allocate aux surface" ); GDBG_INFO((80, "_dxAS: Aux Buffer allocated!\n")); } else { - /* Full screen - Set Exclusive Mode, change resolution, */ GDBG_INFO((80, "_dxAS: Setting Full screen exclusive mode!\n")); @@ -445,18 +440,18 @@ _dxReallocSurfaces(int xRes, int yRes, int vRefresh, InitBufDesc_t *pDesc) /* for now this is a goddamn baseball bat it can be trimmed down */ if ( !IsFullScreen ) { /* this *REALLY* should be called for fullscreen */ - if( lpClipper) IDirectDrawClipper_Release( lpClipper); + if( lpClipper) IDirectDrawClipper_Release ( lpClipper); if( lpAux ) IDirectDrawSurface2_Release( lpAux ); if( lpBack ) IDirectDrawSurface2_Release( lpBack ); - if( lpTriple ) IDirectDrawSurface2_Release( lpTriple ); + if( lpTriple ) IDirectDrawSurface2_Release( lpTriple ); if( lpFront ) IDirectDrawSurface2_Release( lpFront ); - + lpClipper = NULL; lpFront = NULL; lpBack = NULL; lpTriple = NULL; lpAux = NULL; - + /* Verify screen pixel format is 16bpp, and set cooperative level */ ddsd.dwSize = sizeof( ddsd ); @@ -464,7 +459,7 @@ _dxReallocSurfaces(int xRes, int yRes, int vRefresh, InitBufDesc_t *pDesc) ddsd.dwSize = sizeof( ddsd ); ddsd.dwFlags = DDSD_CAPS; ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE | DDSCAPS_3DDEVICE; - + if (IDirectDraw2_CreateSurface( lpDD, &ddsd, &lpFront, 0 ) != DD_OK) { errorMessage = "Couldn't allocate primary surface!"; goto FUBAR; @@ -494,13 +489,13 @@ _dxReallocSurfaces(int xRes, int yRes, int vRefresh, InitBufDesc_t *pDesc) ddsd.dwHeight = yRes; ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY | DDSCAPS_3DDEVICE; - + if (IDirectDraw2_CreateSurface( lpDD, &ddsd, &lpBack, 0 ) != DD_OK) { errorMessage = "Couldn't allocate secondary surface!"; goto FUBAR; } - /* + /* * Always allocate Aux Buffer Surface * XXX - (use nAuxBuffers, and deal with 8bpp for alpha) */ @@ -510,7 +505,7 @@ _dxReallocSurfaces(int xRes, int yRes, int vRefresh, InitBufDesc_t *pDesc) ddsd.dwHeight = yRes; ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY | DDSCAPS_3DDEVICE; - + if (IDirectDraw2_CreateSurface( lpDD, &ddsd, &lpAux, 0 ) != DD_OK) { errorMessage = "Couldn't allocate aux surface"; goto FUBAR; @@ -519,10 +514,10 @@ _dxReallocSurfaces(int xRes, int yRes, int vRefresh, InitBufDesc_t *pDesc) return _dxDDrawToGlideDesc(pDesc); FUBAR: /* if you don't free these you can't make another attempt */ - if( lpClipper) IDirectDrawClipper_Release( lpClipper); + if( lpClipper) IDirectDrawClipper_Release ( lpClipper); if( lpAux ) IDirectDrawSurface2_Release( lpAux ); if( lpBack ) IDirectDrawSurface2_Release( lpBack ); - if( lpTriple ) IDirectDrawSurface2_Release( lpTriple ); + if( lpTriple ) IDirectDrawSurface2_Release( lpTriple ); if( lpFront ) IDirectDrawSurface2_Release( lpFront ); lpClipper = NULL; lpFront = NULL; @@ -625,10 +620,10 @@ dxOpen( #ifdef H3D if ((sRes < GR_RESOLUTION_MIN) || (sRes > GR_RESOLUTION_MAX) && - (!GR_RESOLUTION_IS_AUTOFLIPPED(sRes)) ) + (!GR_RESOLUTION_IS_AUTOFLIPPED(sRes)) ) #else if ((sRes < GR_RESOLUTION_320x200) || - (sRes > GR_RESOLUTION_512x256)) + (sRes > GR_RESOLUTION_512x256)) #endif return ErrorMessage(hWndApp, "Bad Fullscreen resolution"); @@ -660,7 +655,6 @@ dxOpen( return ErrorMessage(hWndApp, "failed dxOpen"); #endif - GDBG_INFO((80, "_dxAllocSurfaces OK!!!\n")); for (i=0; i< NUM_BUFS; i++) { @@ -669,7 +663,7 @@ dxOpen( GDBG_INFO((80, "\tbufMagic = 0x%x\n", pBufDesc[i].bufMagic)); GDBG_INFO((80, "\tbufType = 0x%x\n", pBufDesc[i].bufType)); GDBG_INFO((80, "\tbufOffset = 0x%x\n", pBufDesc[i].bufOffset)); - GDBG_INFO((80, "\tbufStride = 0x%x\n", pBufDesc[i].bufStride)); + GDBG_INFO((80, "\tbufStride = 0x%x\n", pBufDesc[i].bufStride)); GDBG_INFO((80, "\tbufBPP = 0x%x\n", pBufDesc[i].bufBPP)); } @@ -776,16 +770,16 @@ dxClose(void) if( lpDD ) IDirectDraw2_Release( lpDD ); if (1 /* !IsFullScreen */) { - if( lpDD1 ) IDirectDraw_Release( lpDD1 ); - lpDD1 = NULL; + if( lpDD1 ) IDirectDraw_Release( lpDD1 ); + lpDD1 = NULL; } lpClipper = NULL; lpFront = NULL; lpBack = NULL; - lpTriple = NULL; + lpTriple = NULL; lpAux = NULL; - lpDD = NULL; + lpDD = NULL; #endif /* 0 */ GDBG_INFO((80, "dxClose: Returning TRUE\n")); @@ -807,7 +801,7 @@ dxSwap(FxU32 code) src.right = Width-1; src.top = 0; src.bottom = Height-1; - + dest = src; point.x = 0; point.y = 0; @@ -823,10 +817,10 @@ dxSwap(FxU32 code) &src, DDBLT_WAIT, NULL ); - + while( IDirectDrawSurface_GetBltStatus( lpFront, DDGBS_ISBLTDONE ) != DD_OK ); - + if ( hr != DD_OK ) { ErrorMessage(hWndApp, "Couldn't blit!\n"); } @@ -900,7 +894,6 @@ dxOpen( GDBG_INFO((80, "%s: Unimplemented resolution\n", FN_NAME)); break; } - #define WAITLOOP {\ volatile int waitfoo;\ @@ -972,7 +965,7 @@ dxOpen( #ifdef GDBG_INFO_ON { - int i; + int i; for (i = 0; i < 5; i++) { GDBG_INFO((80, "%s: pBufDesc[%d] = 0x%x:\n", @@ -1026,5 +1019,3 @@ dxSwap(FxU32 code) { } /* dxSwap */ #endif /* __DOS32__ || (defined(__WIN32__) && !defined(INIT_ACCESS_DDRAW) */ - - diff --git a/glide3x/sst1/init/initvg/info.c b/glide3x/sst1/init/initvg/info.c index 3be59b6..4bd8955 100644 --- a/glide3x/sst1/init/initvg/info.c +++ b/glide3x/sst1/init/initvg/info.c @@ -37,7 +37,7 @@ static FxBool readAndSum4x4(FxU32 *sstbase, FxU32 x, FxU32 y, - FxU32 *r_sum, FxU32 *g_sum, FxU32 *b_sum) + FxU32 *r_sum, FxU32 *g_sum, FxU32 *b_sum) { FxU32 rd_x, rd_y; FxU32 rd_col = 0; @@ -76,7 +76,7 @@ readAndSum4x4(FxU32 *sstbase, FxU32 x, FxU32 y, } INIT_INFO((3,"sums: r_sum=0x%03x g_sum=0x%03x b_sum=0x%03x\n", *r_sum, *g_sum, *b_sum)); - return(FXTRUE); + return(FXTRUE); } /* xxx - Give these guys some meaningful comments */ @@ -147,7 +147,7 @@ initSumTables(FxU32 *sstbase) } g_tbl[g_sum] = tst_color; } - return(FXTRUE); + return(FXTRUE); } /* remove dither to derive actual 24-bit RGB value */ @@ -160,7 +160,7 @@ unDither(FxU32 r_sum, FxU32 g_sum, FxU32 b_sum, FxU32 *result) return(FXFALSE); } *result = (rb_tbl[r_sum] << 16) | (g_tbl[g_sum] << 8) | rb_tbl[b_sum]; - return(FXTRUE); + return(FXTRUE); } static FxBool @@ -244,10 +244,10 @@ sst1InitGetTmuMemory(FxU32 *sstbase, sst1DeviceInfoStruct *info, FxU32 tmu, INIT_INFO((1,"sst1InitGetTmuMemory(0x%x, , %d)\n", sstbase,tmu)); - if(GETENV(("SST_TMUMEM_SIZE"))) { - *TmuMemorySize = ATOI(GETENV(("SST_TMUMEM_SIZE"))); - return(FXTRUE); - } + if(GETENV(("SST_TMUMEM_SIZE"))) { + *TmuMemorySize = ATOI(GETENV(("SST_TMUMEM_SIZE"))); + return(FXTRUE); + } ISET(sst->lfbMode, SST_LFB_RGBALANES_ARGB | SST_LFB_READFRONTBUFFER); ISET(sst->fbzMode, SST_DRAWBUFFER_FRONT | SST_RGBWRMASK); @@ -278,7 +278,7 @@ sst1InitGetTmuMemory(FxU32 *sstbase, sst1DeviceInfoStruct *info, FxU32 tmu, if (data == SENSE0) {*TmuMemorySize = 1; return(FXTRUE);} INIT_PRINTF(("sst1InitGetTmuMemory() ERROR: Could not detect memory size.\n")); - return(FXFALSE); + return(FXFALSE); } /*--------------------------------------------------------------------------- @@ -292,21 +292,21 @@ sst1InitGetTmuInfo(FxU32 *sstbase, sst1DeviceInfoStruct *info) FxU32 trev; if(initSumTables(sstbase) == FXFALSE) - return(FXFALSE); + return(FXFALSE); if(getTmuConfigData(sstbase,info) == FXFALSE) - return(FXFALSE); + return(FXFALSE); - /* TMU memory speed */ - /* tmuClkFixed is no longer used... */ - info->tmuClkFixed = 0x0; - /* tmuMemSpeed is legacy, and is not used by either Obsidian GE or Pro Fab */ - info->tmuMemSpeed = 0; + /* TMU memory speed */ + /* tmuClkFixed is no longer used... */ + info->tmuClkFixed = 0x0; + /* tmuMemSpeed is legacy, and is not used by either Obsidian GE or Pro Fab */ + info->tmuMemSpeed = 0; /* count the TMUs and verify that all TMUs are the same revision */ info->tmuRevision = info->tmuConfig & 0x7; info->numberTmus = 1; if(sst1InitGetTmuMemory(sstbase, info, 0, &info->tmuMemSize[0]) == FXFALSE) - return(FXFALSE); + return(FXFALSE); INIT_INFO((1,"TMU0 memory = %d MB\n", info->tmuMemSize[0])); if (info->tmuConfig & FXBIT(6)) { /* if TMU 1 exists */ info->numberTmus++; /* increment TMU count */ @@ -315,7 +315,7 @@ sst1InitGetTmuInfo(FxU32 *sstbase, sst1DeviceInfoStruct *info) INIT_PRINTF(("sst1InitGetDeviceInfo: ERROR, multiple different TMU revision IDs detected\n")); return(FXFALSE); } - if(sst1InitGetTmuMemory(sstbase, info, 1, &info->tmuMemSize[1]) == FXFALSE) + if(sst1InitGetTmuMemory(sstbase, info, 1, &info->tmuMemSize[1]) == FXFALSE) return(FXFALSE); } if (info->tmuConfig & FXBIT(13)) { /* if TMU 2 exists */ @@ -325,7 +325,7 @@ sst1InitGetTmuInfo(FxU32 *sstbase, sst1DeviceInfoStruct *info) INIT_PRINTF(("sst1InitGetDeviceInfo: ERROR, multiple different TMU revision IDs detected\n")); return(FXFALSE); } - if(sst1InitGetTmuMemory(sstbase, info, 2, &info->tmuMemSize[2]) == FXFALSE) + if(sst1InitGetTmuMemory(sstbase, info, 2, &info->tmuMemSize[2]) == FXFALSE) return(FXFALSE); } INIT_INFO((1,"numberTMus = %d\n", info->numberTmus)); @@ -359,7 +359,7 @@ static int fbiMemSize(FxU32 *sstbase) /* Enable dram refresh, disable memory fifo, and setup memory */ /* for rendering */ ISET(sst->fbiInit0, IGET(sst->fbiInit0) & ~SST_MEM_FIFO_EN); - ISET(sst->fbiInit2, IGET(sst->fbiInit2) | SST_EN_DRAM_REFRESH); + ISET(sst->fbiInit2, IGET(sst->fbiInit2) | SST_EN_DRAM_REFRESH); sst1InitIdleFBI(sstbase); /* Setup Basic rendering datapath */ @@ -371,7 +371,7 @@ static int fbiMemSize(FxU32 *sstbase) if(sst1InitSliDetect(sstbase)) /* SLI cannot support 4 MBytes... */ goto check2MByte; - sst1InitSetResolution(sstbase, &SST_VREZ_800X600_60, 1); + sst1InitSetResolution(sstbase, &SST_VREZ_800X600_60, 1); sst1InitIdleFBI(sstbase); ISET(sst->lfbMode, SST_LFB_ZZ | SST_LFB_WRITEFRONTBUFFER | @@ -389,7 +389,7 @@ static int fbiMemSize(FxU32 *sstbase) sst1InitIdleFBI(sstbase); if((LFB_GETPIXEL(128, 100) == 0xdead) && (LFB_GETPIXEL(200, 200) == 0x55aa)) { - retval = 4; + retval = 4; ISET(sst->lfbMode, (SST_LFB_565 | SST_LFB_READBACKBUFFER)); sst1InitIdleFBI(sstbase); goto fbiMemSizeDone; @@ -398,7 +398,7 @@ static int fbiMemSize(FxU32 *sstbase) check2MByte: /* Check for 2 MBytes... */ /* Write to color buffer in 640x480 resolution */ - sst1InitSetResolution(sstbase, &SST_VREZ_640X480_60, 0); + sst1InitSetResolution(sstbase, &SST_VREZ_640X480_60, 0); ISET(sst->lfbMode, SST_LFB_565 | SST_LFB_WRITEFRONTBUFFER | SST_LFB_READFRONTBUFFER); sst1InitIdleFBI(sstbase); @@ -417,7 +417,7 @@ check2MByte: ISET(sst->lfbMode, (SST_LFB_565 | SST_LFB_READBACKBUFFER)); sst1InitIdleFBI(sstbase); if(LFB_GETPIXEL(178, 436) == 0xaa55) { - retval = 2; + retval = 2; goto fbiMemSizeDone; } @@ -434,7 +434,7 @@ check1MByte: sst1InitIdleFBI(sstbase); if((LFB_GETPIXEL(10, 10) == 0xdead) && (LFB_GETPIXEL(100, 200) == 0x5a5a)) - retval = 1; + retval = 1; fbiMemSizeDone: /* Restore init registers to original state */ @@ -476,8 +476,7 @@ sst1InitGetFbiInfo(FxU32 *sstbase, sst1DeviceInfoStruct *info) ** been allocated ** */ -FX_EXPORT FxBool FX_CSTYLE sst1InitGetDeviceInfo(FxU32 *sstbase, - sst1DeviceInfoStruct *info) +FX_EXPORT FxBool FX_CSTYLE sst1InitGetDeviceInfo(FxU32 *sstbase, sst1DeviceInfoStruct *info) { FxBool retval; @@ -574,15 +573,15 @@ FxBool sst1InitFillDeviceInfo(FxU32 *sstbase, sst1DeviceInfoStruct *info) 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: 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));