From 8bde7f776c77b343aca29b8c7b58464d915ac245 Mon Sep 17 00:00:00 2001 From: wdenk Date: Fri, 27 Jun 2003 21:31:46 +0000 Subject: * Code cleanup: - remove trailing white space, trailing empty lines, C++ comments, etc. - split cmd_boot.c (separate cmd_bdinfo.c and cmd_load.c) * Patches by Kenneth Johansson, 25 Jun 2003: - major rework of command structure (work done mostly by Michal Cendrowski and Joakim Kristiansen) --- .../bios_emulator/scitech/src/pm/tests/altbrk.c | 52 ++-- .../bios_emulator/scitech/src/pm/tests/altcrit.c | 28 +- .../bios_emulator/scitech/src/pm/tests/biosptr.c | 38 +-- .../MAI/bios_emulator/scitech/src/pm/tests/block.c | 6 +- board/MAI/bios_emulator/scitech/src/pm/tests/brk.c | 48 ++-- .../bios_emulator/scitech/src/pm/tests/callreal.c | 46 ++-- .../bios_emulator/scitech/src/pm/tests/checks.c | 18 +- board/MAI/bios_emulator/scitech/src/pm/tests/cpu.c | 2 +- .../bios_emulator/scitech/src/pm/tests/critical.c | 26 +- .../MAI/bios_emulator/scitech/src/pm/tests/getch.c | 134 +++++----- .../bios_emulator/scitech/src/pm/tests/isvesa.c | 46 ++-- board/MAI/bios_emulator/scitech/src/pm/tests/key.c | 26 +- .../MAI/bios_emulator/scitech/src/pm/tests/key15.c | 26 +- .../bios_emulator/scitech/src/pm/tests/memtest.c | 46 ++-- .../MAI/bios_emulator/scitech/src/pm/tests/mouse.c | 32 +-- .../bios_emulator/scitech/src/pm/tests/restore.c | 23 +- board/MAI/bios_emulator/scitech/src/pm/tests/rtc.c | 34 +-- .../MAI/bios_emulator/scitech/src/pm/tests/save.c | 27 +- .../bios_emulator/scitech/src/pm/tests/showpci.c | 292 ++++++++++----------- .../MAI/bios_emulator/scitech/src/pm/tests/tick.c | 34 +-- .../bios_emulator/scitech/src/pm/tests/timerc.c | 6 +- .../MAI/bios_emulator/scitech/src/pm/tests/uswc.c | 268 +++++++++---------- .../bios_emulator/scitech/src/pm/tests/vftest.c | 32 +-- .../MAI/bios_emulator/scitech/src/pm/tests/video.c | 63 +++-- 24 files changed, 675 insertions(+), 678 deletions(-) (limited to 'board/MAI/bios_emulator/scitech/src/pm/tests') diff --git a/board/MAI/bios_emulator/scitech/src/pm/tests/altbrk.c b/board/MAI/bios_emulator/scitech/src/pm/tests/altbrk.c index 5d899b7a67..ba90262745 100644 --- a/board/MAI/bios_emulator/scitech/src/pm/tests/altbrk.c +++ b/board/MAI/bios_emulator/scitech/src/pm/tests/altbrk.c @@ -47,43 +47,43 @@ volatile int ctrlCHit = false; void PMAPI breakHandler(uint bHit) { if (bHit) - breakHit = true; + breakHit = true; else - ctrlCHit = true; + ctrlCHit = true; } int main(void) { printf("Program running in "); switch (PM_getModeType()) { - case PM_realMode: - printf("real mode.\n\n"); - break; - case PM_286: - printf("16 bit protected mode.\n\n"); - break; - case PM_386: - printf("32 bit protected mode.\n\n"); - break; - } + case PM_realMode: + printf("real mode.\n\n"); + break; + case PM_286: + printf("16 bit protected mode.\n\n"); + break; + case PM_386: + printf("32 bit protected mode.\n\n"); + break; + } PM_installAltBreakHandler(breakHandler); printf("Control C/Break interrupt handler installed\n"); while (1) { - if (ctrlCHit) { - printf("Code termimated with Ctrl-C.\n"); - break; - } - if (breakHit) { - printf("Code termimated with Ctrl-Break.\n"); - break; - } - if (PM_kbhit() && PM_getch() == 0x1B) { - printf("No break code detected!\n"); - break; - } - printf("Hit Ctrl-C or Ctrl-Break to exit!\n"); - } + if (ctrlCHit) { + printf("Code termimated with Ctrl-C.\n"); + break; + } + if (breakHit) { + printf("Code termimated with Ctrl-Break.\n"); + break; + } + if (PM_kbhit() && PM_getch() == 0x1B) { + printf("No break code detected!\n"); + break; + } + printf("Hit Ctrl-C or Ctrl-Break to exit!\n"); + } PM_restoreBreakHandler(); return 0; diff --git a/board/MAI/bios_emulator/scitech/src/pm/tests/altcrit.c b/board/MAI/bios_emulator/scitech/src/pm/tests/altcrit.c index c5390f68a9..e13730758e 100644 --- a/board/MAI/bios_emulator/scitech/src/pm/tests/altcrit.c +++ b/board/MAI/bios_emulator/scitech/src/pm/tests/altcrit.c @@ -59,27 +59,27 @@ int main(void) printf("Program running in "); switch (PM_getModeType()) { - case PM_realMode: - printf("real mode.\n\n"); - break; - case PM_286: - printf("16 bit protected mode.\n\n"); - break; - case PM_386: - printf("32 bit protected mode.\n\n"); - break; - } + case PM_realMode: + printf("real mode.\n\n"); + break; + case PM_286: + printf("16 bit protected mode.\n\n"); + break; + case PM_386: + printf("32 bit protected mode.\n\n"); + break; + } PM_installAltCriticalHandler(criticalHandler); printf("Critical Error handler installed - trying to read from A: drive...\n"); f = fopen("a:\bog.bog","rb"); if (f) fclose(f); if (criticalError) { - printf("Critical error occured on INT 21h function %02X!\n", - axValue >> 8); - } + printf("Critical error occured on INT 21h function %02X!\n", + axValue >> 8); + } else - printf("Critical error was not caught!\n"); + printf("Critical error was not caught!\n"); PM_restoreCriticalHandler(); return 0; } diff --git a/board/MAI/bios_emulator/scitech/src/pm/tests/biosptr.c b/board/MAI/bios_emulator/scitech/src/pm/tests/biosptr.c index 43668487af..5fa3382483 100644 --- a/board/MAI/bios_emulator/scitech/src/pm/tests/biosptr.c +++ b/board/MAI/bios_emulator/scitech/src/pm/tests/biosptr.c @@ -64,29 +64,29 @@ int main(void) printf("Program running in "); switch (PM_getModeType()) { - case PM_realMode: - printf("real mode.\n\n"); - break; - case PM_286: - printf("16 bit protected mode.\n\n"); - break; - case PM_386: - printf("32 bit protected mode.\n\n"); - break; - } + case PM_realMode: + printf("real mode.\n\n"); + break; + case PM_286: + printf("16 bit protected mode.\n\n"); + break; + case PM_386: + printf("32 bit protected mode.\n\n"); + break; + } bios = PM_getBIOSPointer(); printf("Hit any key to test, Ctrl-Shift-Esc to quit\n"); while (!done) { - if (KB_HIT()) { - c = PM_getch(); - if (c == 0) PM_getch(); - printf("TIME=%-8lX ST=%02X CHAR=%02X ", TICKS(), KB_STAT, c); - printf("\n"); - if ((c == ESC) && SHIFT() && CTRL())/* Ctrl-Shift-Esc */ - break; - } - } + if (KB_HIT()) { + c = PM_getch(); + if (c == 0) PM_getch(); + printf("TIME=%-8lX ST=%02X CHAR=%02X ", TICKS(), KB_STAT, c); + printf("\n"); + if ((c == ESC) && SHIFT() && CTRL())/* Ctrl-Shift-Esc */ + break; + } + } return 0; } diff --git a/board/MAI/bios_emulator/scitech/src/pm/tests/block.c b/board/MAI/bios_emulator/scitech/src/pm/tests/block.c index e948872956..15d503c0de 100644 --- a/board/MAI/bios_emulator/scitech/src/pm/tests/block.c +++ b/board/MAI/bios_emulator/scitech/src/pm/tests/block.c @@ -61,9 +61,9 @@ int main(void) ZTimerInit(); LZTimerOn(); for (i = 0; i < LOOPS; i++) { - PM_blockUntilTimeout(DELAY_MSECS); - ReportTime(LZTimerLap()); - } + PM_blockUntilTimeout(DELAY_MSECS); + ReportTime(LZTimerLap()); + } LZTimerOff(); return 0; } diff --git a/board/MAI/bios_emulator/scitech/src/pm/tests/brk.c b/board/MAI/bios_emulator/scitech/src/pm/tests/brk.c index 3561fee921..10b644656e 100644 --- a/board/MAI/bios_emulator/scitech/src/pm/tests/brk.c +++ b/board/MAI/bios_emulator/scitech/src/pm/tests/brk.c @@ -44,34 +44,34 @@ int main(void) { printf("Program running in "); switch (PM_getModeType()) { - case PM_realMode: - printf("real mode.\n\n"); - break; - case PM_286: - printf("16 bit protected mode.\n\n"); - break; - case PM_386: - printf("32 bit protected mode.\n\n"); - break; - } + case PM_realMode: + printf("real mode.\n\n"); + break; + case PM_286: + printf("16 bit protected mode.\n\n"); + break; + case PM_386: + printf("32 bit protected mode.\n\n"); + break; + } PM_installBreakHandler(); printf("Control C/Break interrupt handler installed\n"); while (1) { - if (PM_ctrlCHit(1)) { - printf("Code termimated with Ctrl-C.\n"); - break; - } - if (PM_ctrlBreakHit(1)) { - printf("Code termimated with Ctrl-Break.\n"); - break; - } - if (PM_kbhit() && PM_getch() == 0x1B) { - printf("No break code detected!\n"); - break; - } - printf("Hit Ctrl-C or Ctrl-Break to exit!\n"); - } + if (PM_ctrlCHit(1)) { + printf("Code termimated with Ctrl-C.\n"); + break; + } + if (PM_ctrlBreakHit(1)) { + printf("Code termimated with Ctrl-Break.\n"); + break; + } + if (PM_kbhit() && PM_getch() == 0x1B) { + printf("No break code detected!\n"); + break; + } + printf("Hit Ctrl-C or Ctrl-Break to exit!\n"); + } PM_restoreBreakHandler(); return 0; diff --git a/board/MAI/bios_emulator/scitech/src/pm/tests/callreal.c b/board/MAI/bios_emulator/scitech/src/pm/tests/callreal.c index 3897ce9999..4d37cab465 100644 --- a/board/MAI/bios_emulator/scitech/src/pm/tests/callreal.c +++ b/board/MAI/bios_emulator/scitech/src/pm/tests/callreal.c @@ -58,22 +58,22 @@ int main(void) printf("Program running in "); switch (PM_getModeType()) { - case PM_realMode: - printf("real mode.\n\n"); - break; - case PM_286: - printf("16 bit protected mode.\n\n"); - break; - case PM_386: - printf("32 bit protected mode.\n\n"); - break; - } + case PM_realMode: + printf("real mode.\n\n"); + break; + case PM_286: + printf("16 bit protected mode.\n\n"); + break; + case PM_386: + printf("32 bit protected mode.\n\n"); + break; + } /* Allocate a the block of real mode memory */ if ((p = PM_allocRealSeg(sizeof(realModeCode), &r_seg, &r_off)) == NULL) { - printf("Unable to allocate real mode memory!\n"); - exit(1); - } + printf("Unable to allocate real mode memory!\n"); + exit(1); + } /* Copy the real mode code */ memcpy(p,realModeCode,sizeof(realModeCode)); @@ -89,17 +89,17 @@ int main(void) sregs.ds = 8; PM_callRealMode(r_seg,r_off,®s,&sregs); if (regs.x.ax != 2 || regs.x.bx != 1 || regs.x.cx != 4 || regs.x.dx != 3 - || regs.x.si != 5 || regs.x.di != 6 || sregs.es != 7 - || sregs.ds != 8) { - printf("Real mode call failed!\n"); - printf("\n"); - printf("ax = %04X, bx = %04X, cx = %04X, dx = %04X\n", - regs.x.ax,regs.x.bx,regs.x.cx,regs.x.dx); - printf("si = %04X, di = %04X, es = %04X, ds = %04X\n", - regs.x.si,regs.x.di,sregs.es,sregs.ds); - } + || regs.x.si != 5 || regs.x.di != 6 || sregs.es != 7 + || sregs.ds != 8) { + printf("Real mode call failed!\n"); + printf("\n"); + printf("ax = %04X, bx = %04X, cx = %04X, dx = %04X\n", + regs.x.ax,regs.x.bx,regs.x.cx,regs.x.dx); + printf("si = %04X, di = %04X, es = %04X, ds = %04X\n", + regs.x.si,regs.x.di,sregs.es,sregs.ds); + } else - printf("Real mode call succeeded!\n"); + printf("Real mode call succeeded!\n"); /* Free the memory we allocated */ PM_freeRealSeg(p); diff --git a/board/MAI/bios_emulator/scitech/src/pm/tests/checks.c b/board/MAI/bios_emulator/scitech/src/pm/tests/checks.c index 81737e17d7..5933ac9f73 100644 --- a/board/MAI/bios_emulator/scitech/src/pm/tests/checks.c +++ b/board/MAI/bios_emulator/scitech/src/pm/tests/checks.c @@ -80,21 +80,21 @@ void _CHK_defaultFail( sprintf(buf,msg,cond,file,line); if (log) { - fputs(buf,log); - fflush(log); - fclose(log); + fputs(buf,log); + fflush(log); + fclose(log); #ifdef __WINDOWS__ - OutputDebugStr(buf); + OutputDebugStr(buf); #endif - } + } if (fatal) { #ifdef __WINDOWS__ - MessageBox(NULL, buf,"Fatal Error!",MB_ICONEXCLAMATION); + MessageBox(NULL, buf,"Fatal Error!",MB_ICONEXCLAMATION); #else - fputs(buf,stderr); + fputs(buf,stderr); #endif - exit(-1); - } + exit(-1); + } } #endif /* CHECKED */ diff --git a/board/MAI/bios_emulator/scitech/src/pm/tests/cpu.c b/board/MAI/bios_emulator/scitech/src/pm/tests/cpu.c index 34abb2418d..30e5dd30df 100644 --- a/board/MAI/bios_emulator/scitech/src/pm/tests/cpu.c +++ b/board/MAI/bios_emulator/scitech/src/pm/tests/cpu.c @@ -41,6 +41,6 @@ int main(void) fflush(stdout); printf("\n\n%s\n", CPU_getProcessorName()); if (CPU_haveRDTSC()) - printf("\nProcessor supports Read Time Stamp Counter performance timer.\n"); + printf("\nProcessor supports Read Time Stamp Counter performance timer.\n"); return 0; } diff --git a/board/MAI/bios_emulator/scitech/src/pm/tests/critical.c b/board/MAI/bios_emulator/scitech/src/pm/tests/critical.c index 21ec9946f7..60f1251a5d 100644 --- a/board/MAI/bios_emulator/scitech/src/pm/tests/critical.c +++ b/board/MAI/bios_emulator/scitech/src/pm/tests/critical.c @@ -45,25 +45,25 @@ int main(void) printf("Program running in "); switch (PM_getModeType()) { - case PM_realMode: - printf("real mode.\n\n"); - break; - case PM_286: - printf("16 bit protected mode.\n\n"); - break; - case PM_386: - printf("32 bit protected mode.\n\n"); - break; - } + case PM_realMode: + printf("real mode.\n\n"); + break; + case PM_286: + printf("16 bit protected mode.\n\n"); + break; + case PM_386: + printf("32 bit protected mode.\n\n"); + break; + } PM_installCriticalHandler(); printf("Critical Error handler installed - trying to read from A: drive...\n"); f = fopen("a:\bog.bog","rb"); if (f) fclose(f); if (PM_criticalError(&axcode,&dicode,1)) { - printf("Critical error occured on INT 21h function %02X!\n", - axcode >> 8); - } + printf("Critical error occured on INT 21h function %02X!\n", + axcode >> 8); + } else printf("Critical error was not caught!\n"); PM_restoreCriticalHandler(); return 0; diff --git a/board/MAI/bios_emulator/scitech/src/pm/tests/getch.c b/board/MAI/bios_emulator/scitech/src/pm/tests/getch.c index c70f7ee3c3..06c2180ceb 100644 --- a/board/MAI/bios_emulator/scitech/src/pm/tests/getch.c +++ b/board/MAI/bios_emulator/scitech/src/pm/tests/getch.c @@ -309,9 +309,9 @@ KeyEntry *FindKey( KeyEntry *key; for (key = keys; key->code != 0; key++) { - if (key->code == code) - break; - } + if (key->code == code) + break; + } return key; } @@ -326,29 +326,29 @@ void DisplayModifiers( event_t *evt) { if (evt->modifiers & EVT_LEFTBUT) - printf(", LBUT"); + printf(", LBUT"); if (evt->modifiers & EVT_RIGHTBUT) - printf(", RBUT"); + printf(", RBUT"); if (evt->modifiers & EVT_MIDDLEBUT) - printf(", MBUT"); + printf(", MBUT"); if (evt->modifiers & EVT_SHIFTKEY) { - if (evt->modifiers & EVT_LEFTSHIFT) - printf(", LSHIFT"); - if (evt->modifiers & EVT_RIGHTSHIFT) - printf(", RSHIFT"); - } + if (evt->modifiers & EVT_LEFTSHIFT) + printf(", LSHIFT"); + if (evt->modifiers & EVT_RIGHTSHIFT) + printf(", RSHIFT"); + } if (evt->modifiers & EVT_CTRLSTATE) { - if (evt->modifiers & EVT_LEFTCTRL) - printf(", LCTRL"); - if (evt->modifiers & EVT_RIGHTCTRL) - printf(", RCTRL"); - } + if (evt->modifiers & EVT_LEFTCTRL) + printf(", LCTRL"); + if (evt->modifiers & EVT_RIGHTCTRL) + printf(", RCTRL"); + } if (evt->modifiers & EVT_ALTSTATE) { - if (evt->modifiers & EVT_LEFTALT) - printf(", LALT"); - if (evt->modifiers & EVT_RIGHTALT) - printf(", RALT"); - } + if (evt->modifiers & EVT_LEFTALT) + printf(", LALT"); + if (evt->modifiers & EVT_RIGHTALT) + printf(", RALT"); + } } /**************************************************************************** @@ -369,7 +369,7 @@ void DisplayKey( ascii = FindKey(ch,ASCIICodes); scan = FindKey(EVT_scanCode(evt->message),ScanCodes); printf("%s: 0x%04X -> %s, %s, '%c'", - msg, (int)evt->message & 0xFFFF, scan->name, ascii->name, isprint(ch) ? ch : ' '); + msg, (int)evt->message & 0xFFFF, scan->name, ascii->name, isprint(ch) ? ch : ' '); DisplayModifiers(evt); printf("\n"); } @@ -388,15 +388,15 @@ void DisplayMouse( { printf("%s: ", msg); if (evt->message & EVT_LEFTBMASK) - printf("LEFT "); + printf("LEFT "); if (evt->message & EVT_RIGHTBMASK) - printf("RIGHT "); + printf("RIGHT "); if (evt->message & EVT_MIDDLEBMASK) - printf("MIDDLE "); + printf("MIDDLE "); printf("abs(%d,%d), rel(%d,%d)", evt->where_x, evt->where_y, evt->relative_x, evt->relative_y); DisplayModifiers(evt); if (evt->message & EVT_DBLCLICK) - printf(", DBLCLICK"); + printf(", DBLCLICK"); printf("\n"); } @@ -413,12 +413,12 @@ void DisplayJoy( event_t *evt) { printf("%s: Joy1(%4d,%4d,%c%c), Joy2(%4d,%4d,%c%c)\n", msg, - evt->where_x,evt->where_y, - (evt->message & EVT_JOY1_BUTTONA) ? 'A' : 'a', - (evt->message & EVT_JOY1_BUTTONB) ? 'B' : 'b', - evt->relative_x,evt->relative_y, - (evt->message & EVT_JOY2_BUTTONA) ? 'A' : 'a', - (evt->message & EVT_JOY2_BUTTONB) ? 'B' : 'b'); + evt->where_x,evt->where_y, + (evt->message & EVT_JOY1_BUTTONA) ? 'A' : 'a', + (evt->message & EVT_JOY1_BUTTONB) ? 'B' : 'b', + evt->relative_x,evt->relative_y, + (evt->message & EVT_JOY2_BUTTONA) ? 'A' : 'a', + (evt->message & EVT_JOY2_BUTTONB) ? 'B' : 'b'); } /**************************************************************************** @@ -460,41 +460,41 @@ int main(void) EVT_setMouseRange(1024,768); CalibrateJoy(); do { - EVT_pollJoystick(); - if (EVT_getNext(&evt,EVT_EVERYEVT)) { - switch (evt.what) { - case EVT_KEYDOWN: - DisplayKey("EVT_KEYDOWN ", &evt); - if (EVT_scanCode(evt.message) == KB_esc) - done = true; - break; - case EVT_KEYREPEAT: - DisplayKey("EVT_KEYREPEAT", &evt); - break; - case EVT_KEYUP: - DisplayKey("EVT_KEYUP ", &evt); - break; - case EVT_MOUSEDOWN: - DisplayMouse("EVT_MOUSEDOWN", &evt); - break; - case EVT_MOUSEAUTO: - DisplayMouse("EVT_MOUSEAUTO", &evt); - break; - case EVT_MOUSEUP: - DisplayMouse("EVT_MOUSEUP ", &evt); - break; - case EVT_MOUSEMOVE: - DisplayMouse("EVT_MOUSEMOVE", &evt); - break; - case EVT_JOYCLICK: - DisplayJoy("EVT_JOYCLICK ", &evt); - break; - case EVT_JOYMOVE: - DisplayJoy("EVT_JOYMOVE ", &evt); - break; - } - } - } while (!done); + EVT_pollJoystick(); + if (EVT_getNext(&evt,EVT_EVERYEVT)) { + switch (evt.what) { + case EVT_KEYDOWN: + DisplayKey("EVT_KEYDOWN ", &evt); + if (EVT_scanCode(evt.message) == KB_esc) + done = true; + break; + case EVT_KEYREPEAT: + DisplayKey("EVT_KEYREPEAT", &evt); + break; + case EVT_KEYUP: + DisplayKey("EVT_KEYUP ", &evt); + break; + case EVT_MOUSEDOWN: + DisplayMouse("EVT_MOUSEDOWN", &evt); + break; + case EVT_MOUSEAUTO: + DisplayMouse("EVT_MOUSEAUTO", &evt); + break; + case EVT_MOUSEUP: + DisplayMouse("EVT_MOUSEUP ", &evt); + break; + case EVT_MOUSEMOVE: + DisplayMouse("EVT_MOUSEMOVE", &evt); + break; + case EVT_JOYCLICK: + DisplayJoy("EVT_JOYCLICK ", &evt); + break; + case EVT_JOYMOVE: + DisplayJoy("EVT_JOYMOVE ", &evt); + break; + } + } + } while (!done); EVT_exit(); PM_closeConsole(hwndConsole); return 0; diff --git a/board/MAI/bios_emulator/scitech/src/pm/tests/isvesa.c b/board/MAI/bios_emulator/scitech/src/pm/tests/isvesa.c index 9c02452bb3..67ad2456e8 100644 --- a/board/MAI/bios_emulator/scitech/src/pm/tests/isvesa.c +++ b/board/MAI/bios_emulator/scitech/src/pm/tests/isvesa.c @@ -68,24 +68,24 @@ int main(void) printf("Program running in "); switch (PM_getModeType()) { - case PM_realMode: - printf("real mode.\n\n"); - break; - case PM_286: - printf("16 bit protected mode.\n\n"); - break; - case PM_386: - printf("32 bit protected mode.\n\n"); - break; - } + case PM_realMode: + printf("real mode.\n\n"); + break; + case PM_286: + printf("16 bit protected mode.\n\n"); + break; + case PM_386: + printf("32 bit protected mode.\n\n"); + break; + } /* Allocate a 256 byte block of real memory for communicating with * the VESA BIOS. */ if ((vgPtr = PM_getVESABuf(&vgLen,&r_vgseg,&r_vgoff)) == NULL) { - printf("Unable to allocate VESA memory buffer!\n"); - exit(1); - } + printf("Unable to allocate VESA memory buffer!\n"); + exit(1); + } /* Call the VESA VBE to see if it is out there */ regs.x.ax = 0x4F00; @@ -95,16 +95,16 @@ int main(void) PM_int86x(0x10, ®s, ®s, &sregs); memcpy(&vgaInfo,vgPtr,sizeof(VgaInfoBlock)); if (regs.x.ax == 0x4F && strncmp(vgaInfo.VESASignature,"VESA",4) == 0) { - printf("VESA VBE version %d.%d BIOS detected\n\n", - vgaInfo.VESAVersion >> 8, vgaInfo.VESAVersion & 0xF); - printf("Available video modes:\n"); - mode = PM_mapRealPointer(vgaInfo.VideoModePtr >> 16, vgaInfo.VideoModePtr & 0xFFFF); - while (*mode != 0xFFFF) { - printf(" %04hXh (%08X)\n", *mode, (int)mode); - mode++; - } - } + printf("VESA VBE version %d.%d BIOS detected\n\n", + vgaInfo.VESAVersion >> 8, vgaInfo.VESAVersion & 0xF); + printf("Available video modes:\n"); + mode = PM_mapRealPointer(vgaInfo.VideoModePtr >> 16, vgaInfo.VideoModePtr & 0xFFFF); + while (*mode != 0xFFFF) { + printf(" %04hXh (%08X)\n", *mode, (int)mode); + mode++; + } + } else - printf("VESA VBE not found\n"); + printf("VESA VBE not found\n"); return 0; } diff --git a/board/MAI/bios_emulator/scitech/src/pm/tests/key.c b/board/MAI/bios_emulator/scitech/src/pm/tests/key.c index cf89f79fb7..dba88853c2 100644 --- a/board/MAI/bios_emulator/scitech/src/pm/tests/key.c +++ b/board/MAI/bios_emulator/scitech/src/pm/tests/key.c @@ -56,16 +56,16 @@ int main(void) printf("Program running in "); switch (PM_getModeType()) { - case PM_realMode: - printf("real mode.\n\n"); - break; - case PM_286: - printf("16 bit protected mode.\n\n"); - break; - case PM_386: - printf("32 bit protected mode.\n\n"); - break; - } + case PM_realMode: + printf("real mode.\n\n"); + break; + case PM_286: + printf("16 bit protected mode.\n\n"); + break; + case PM_386: + printf("32 bit protected mode.\n\n"); + break; + } /* Install our timer handler and lock handler pages in memory. It is * difficult to get the size of a function in C, but we know our @@ -79,9 +79,9 @@ int main(void) printf("Keyboard interrupt handler installed - Type some characters and\n"); printf("hit ESC to exit\n"); while ((ch = PM_getch()) != 0x1B) { - printf("%c", ch); - fflush(stdout); - } + printf("%c", ch); + fflush(stdout); + } PM_restoreKeyHandler(); PM_restoreBreakHandler(); diff --git a/board/MAI/bios_emulator/scitech/src/pm/tests/key15.c b/board/MAI/bios_emulator/scitech/src/pm/tests/key15.c index 5c0d27a174..b0b94be9c2 100644 --- a/board/MAI/bios_emulator/scitech/src/pm/tests/key15.c +++ b/board/MAI/bios_emulator/scitech/src/pm/tests/key15.c @@ -59,16 +59,16 @@ int main(void) printf("Program running in "); switch (PM_getModeType()) { - case PM_realMode: - printf("real mode.\n\n"); - break; - case PM_286: - printf("16 bit protected mode.\n\n"); - break; - case PM_386: - printf("32 bit protected mode.\n\n"); - break; - } + case PM_realMode: + printf("real mode.\n\n"); + break; + case PM_286: + printf("16 bit protected mode.\n\n"); + break; + case PM_386: + printf("32 bit protected mode.\n\n"); + break; + } /* Install our timer handler and lock handler pages in memory. It is * difficult to get the size of a function in C, but we know our @@ -82,9 +82,9 @@ int main(void) printf("Keyboard interrupt handler installed - Type some characters and\n"); printf("hit ESC to exit\n"); while ((ch = PM_getch()) != 0x1B) { - printf("%c", ch); - fflush(stdout); - } + printf("%c", ch); + fflush(stdout); + } PM_restoreKey15Handler(); PM_restoreBreakHandler(); diff --git a/board/MAI/bios_emulator/scitech/src/pm/tests/memtest.c b/board/MAI/bios_emulator/scitech/src/pm/tests/memtest.c index 221bfb1a02..a2c655b4a3 100644 --- a/board/MAI/bios_emulator/scitech/src/pm/tests/memtest.c +++ b/board/MAI/bios_emulator/scitech/src/pm/tests/memtest.c @@ -56,16 +56,16 @@ int main(void) printf("Program running in "); switch (PM_getModeType()) { - case PM_realMode: - printf("real mode.\n\n"); - break; - case PM_286: - printf("16 bit protected mode.\n\n"); - break; - case PM_386: - printf("32 bit protected mode.\n\n"); - break; - } + case PM_realMode: + printf("real mode.\n\n"); + break; + case PM_286: + printf("16 bit protected mode.\n\n"); + break; + case PM_386: + printf("32 bit protected mode.\n\n"); + break; + } printf("Memory available at start:\n"); PM_availableMemory(&physical,&total); @@ -73,18 +73,18 @@ int main(void) printf(" Total (including virtual): %ld Kb\n", total / 1024); printf("\n"); for (allocs = i = 0; i < MAXALLOC; i++) { - if ((pa[i] = PM_malloc(10*1024)) != 0) { /* in 10k blocks */ - p = pa[allocs]; - memset(p, 0, 10*1024); /* touch every byte */ - *p = 'x'; /* do something, anything with */ - p[1023] = 'y'; /* the allocated memory */ - allocs++; - printf("Allocated %lu bytes\r", 10*(allocs << 10)); - } - else break; - if (PM_kbhit() && (PM_getch() == 0x1B)) - break; - } + if ((pa[i] = PM_malloc(10*1024)) != 0) { /* in 10k blocks */ + p = pa[allocs]; + memset(p, 0, 10*1024); /* touch every byte */ + *p = 'x'; /* do something, anything with */ + p[1023] = 'y'; /* the allocated memory */ + allocs++; + printf("Allocated %lu bytes\r", 10*(allocs << 10)); + } + else break; + if (PM_kbhit() && (PM_getch() == 0x1B)) + break; + } printf("\n\nAllocated total of %lu bytes\n", 10 * (allocs << 10)); @@ -94,7 +94,7 @@ int main(void) printf(" Total (including virtual): %ld Kb\n", total / 1024); for (i = allocs-1; i >= 0; i--) - PM_free(pa[i]); + PM_free(pa[i]); printf("\nMemory available after freeing all blocks (note that under protected mode\n"); printf("this will most likely not be correct after freeing blocks):\n\n"); diff --git a/board/MAI/bios_emulator/scitech/src/pm/tests/mouse.c b/board/MAI/bios_emulator/scitech/src/pm/tests/mouse.c index 5b426517c8..2765a0d1cc 100644 --- a/board/MAI/bios_emulator/scitech/src/pm/tests/mouse.c +++ b/board/MAI/bios_emulator/scitech/src/pm/tests/mouse.c @@ -69,23 +69,23 @@ int main(void) printf("Program running in "); switch (PM_getModeType()) { - case PM_realMode: - printf("real mode.\n\n"); - break; - case PM_286: - printf("16 bit protected mode.\n\n"); - break; - case PM_386: - printf("32 bit protected mode.\n\n"); - break; - } + case PM_realMode: + printf("real mode.\n\n"); + break; + case PM_286: + printf("16 bit protected mode.\n\n"); + break; + case PM_386: + printf("32 bit protected mode.\n\n"); + break; + } regs.x.ax = 33; /* Mouse function 33 - Software reset */ PM_int86(0x33,®s,®s); if (regs.x.bx == 0) { - printf("No mouse installed.\n"); - exit(1); - } + printf("No mouse installed.\n"); + exit(1); + } /* Install our mouse handler and lock handler pages in memory. It is * difficult to get the size of a function in C, but we know our @@ -95,9 +95,9 @@ int main(void) PM_lockCodePages((__codePtr)mouseHandler,100,&lh); PM_lockDataPages((void*)&count,sizeof(count),&lh); if (!PM_setMouseHandler(0xFFFF, mouseHandler)) { - printf("Unable to install mouse handler!\n"); - exit(1); - } + printf("Unable to install mouse handler!\n"); + exit(1); + } printf("Mouse handler installed - Hit any key to exit\n"); PM_getch(); diff --git a/board/MAI/bios_emulator/scitech/src/pm/tests/restore.c b/board/MAI/bios_emulator/scitech/src/pm/tests/restore.c index b808052c02..e00be750e3 100644 --- a/board/MAI/bios_emulator/scitech/src/pm/tests/restore.c +++ b/board/MAI/bios_emulator/scitech/src/pm/tests/restore.c @@ -45,24 +45,24 @@ void setVideoMode(int mode) int main(void) { PM_HWND hwndConsole; - ulong stateSize; + ulong stateSize; void *stateBuf; FILE *f; /* Write the saved console state buffer to disk */ if ((f = fopen("/etc/pmsave.dat","rb")) == NULL) { - printf("Unable to open /etc/pmsave.dat for reading!\n"); - return -1; - } + printf("Unable to open /etc/pmsave.dat for reading!\n"); + return -1; + } fread(&stateSize,1,sizeof(stateSize),f); if (stateSize != PM_getConsoleStateSize()) { - printf("Size mismatch in /etc/pmsave.dat!\n"); - return -1; - } + printf("Size mismatch in /etc/pmsave.dat!\n"); + return -1; + } if ((stateBuf = PM_malloc(stateSize)) == NULL) { - printf("Unable to allocate console state buffer!\n"); - return -1; - } + printf("Unable to allocate console state buffer!\n"); + return -1; + } fread(stateBuf,1,stateSize,f); fclose(f); @@ -71,7 +71,7 @@ int main(void) /* Forcibly set 80x25 text mode using the BIOS */ setVideoMode(0x3); - + /* Restore the previous console state */ PM_restoreConsoleState(stateBuf,0); PM_closeConsole(hwndConsole); @@ -79,4 +79,3 @@ int main(void) printf("Console state successfully restored from /etc/pmsave.dat\n"); return 0; } - diff --git a/board/MAI/bios_emulator/scitech/src/pm/tests/rtc.c b/board/MAI/bios_emulator/scitech/src/pm/tests/rtc.c index 07c6eaafd4..acef9226a8 100644 --- a/board/MAI/bios_emulator/scitech/src/pm/tests/rtc.c +++ b/board/MAI/bios_emulator/scitech/src/pm/tests/rtc.c @@ -52,16 +52,16 @@ int main(void) printf("Program running in "); switch (PM_getModeType()) { - case PM_realMode: - printf("real mode.\n\n"); - break; - case PM_286: - printf("16 bit protected mode.\n\n"); - break; - case PM_386: - printf("32 bit protected mode.\n\n"); - break; - } + case PM_realMode: + printf("real mode.\n\n"); + break; + case PM_286: + printf("16 bit protected mode.\n\n"); + break; + case PM_386: + printf("32 bit protected mode.\n\n"); + break; + } /* Install our timer handler and lock handler pages in memory. It is * difficult to get the size of a function in C, but we know our @@ -75,13 +75,13 @@ int main(void) printf("RealTimeClock interrupt handler installed - Hit ESC to exit\n"); oldCount = count; while (1) { - if (PM_kbhit() && (PM_getch() == 0x1B)) - break; - if (count != oldCount) { - printf("Tick, Tock: %ld\n", count); - oldCount = count; - } - } + if (PM_kbhit() && (PM_getch() == 0x1B)) + break; + if (count != oldCount) { + printf("Tick, Tock: %ld\n", count); + oldCount = count; + } + } PM_restoreRealTimeClockHandler(); PM_restoreBreakHandler(); diff --git a/board/MAI/bios_emulator/scitech/src/pm/tests/save.c b/board/MAI/bios_emulator/scitech/src/pm/tests/save.c index be96968f62..f7324562f8 100644 --- a/board/MAI/bios_emulator/scitech/src/pm/tests/save.c +++ b/board/MAI/bios_emulator/scitech/src/pm/tests/save.c @@ -37,7 +37,7 @@ int main(void) { PM_HWND hwndConsole; - ulong stateSize; + ulong stateSize; void *stateBuf; FILE *f; @@ -45,26 +45,25 @@ int main(void) hwndConsole = PM_openConsole(0,0,0,0,0,true); stateSize = PM_getConsoleStateSize(); if ((stateBuf = PM_malloc(stateSize)) == NULL) { - PM_closeConsole(hwndConsole); - printf("Unable to allocate console state buffer!\n"); - return -1; - } + PM_closeConsole(hwndConsole); + printf("Unable to allocate console state buffer!\n"); + return -1; + } PM_saveConsoleState(stateBuf,0); - + /* Restore the console state on exit */ PM_restoreConsoleState(stateBuf,0); PM_closeConsole(hwndConsole); - + /* Write the saved console state buffer to disk */ if ((f = fopen("/etc/pmsave.dat","wb")) == NULL) - printf("Unable to open /etc/pmsave/dat for writing!\n"); + printf("Unable to open /etc/pmsave/dat for writing!\n"); else { - fwrite(&stateSize,1,sizeof(stateSize),f); - fwrite(stateBuf,1,stateSize,f); - fclose(f); - printf("Console state successfully saved to /etc/pmsave.dat\n"); - } + fwrite(&stateSize,1,sizeof(stateSize),f); + fwrite(stateBuf,1,stateSize,f); + fclose(f); + printf("Console state successfully saved to /etc/pmsave.dat\n"); + } PM_free(stateBuf); return 0; } - diff --git a/board/MAI/bios_emulator/scitech/src/pm/tests/showpci.c b/board/MAI/bios_emulator/scitech/src/pm/tests/showpci.c index 8222b86024..be275e1a04 100644 --- a/board/MAI/bios_emulator/scitech/src/pm/tests/showpci.c +++ b/board/MAI/bios_emulator/scitech/src/pm/tests/showpci.c @@ -58,123 +58,123 @@ static void EnumeratePCI(void) PCIDeviceInfo *info; printf("Displaying enumeration of PCI bus (%d devices, %d display devices)\n", - NumPCI, NumDevices); + NumPCI, NumDevices); for (index = 0; index < NumDevices; index++) - printf(" Display device %d is PCI device %d\n",index,DeviceIndex[index]); + printf(" Display device %d is PCI device %d\n",index,DeviceIndex[index]); printf("\n"); printf("Bus Slot Fnc DeviceID SubSystem Rev Class IRQ Int Cmd\n"); for (i = 0; i < NumPCI; i++) { - printf("%2d %2d %2d %04X:%04X %04X:%04X %02X %02X:%02X %02X %02X %04X ", - PCI[i].slot.p.Bus, - PCI[i].slot.p.Device, - PCI[i].slot.p.Function, - PCI[i].VendorID, - PCI[i].DeviceID, - PCI[i].u.type0.SubSystemVendorID, - PCI[i].u.type0.SubSystemID, - PCI[i].RevID, - PCI[i].BaseClass, - PCI[i].SubClass, - PCI[i].u.type0.InterruptLine, - PCI[i].u.type0.InterruptPin, - PCI[i].Command); - for (index = 0; index < NumDevices; index++) { - if (DeviceIndex[index] == i) - break; - } - if (index < NumDevices) - printf("<- %d\n", index); - else - printf("\n"); - } + printf("%2d %2d %2d %04X:%04X %04X:%04X %02X %02X:%02X %02X %02X %04X ", + PCI[i].slot.p.Bus, + PCI[i].slot.p.Device, + PCI[i].slot.p.Function, + PCI[i].VendorID, + PCI[i].DeviceID, + PCI[i].u.type0.SubSystemVendorID, + PCI[i].u.type0.SubSystemID, + PCI[i].RevID, + PCI[i].BaseClass, + PCI[i].SubClass, + PCI[i].u.type0.InterruptLine, + PCI[i].u.type0.InterruptPin, + PCI[i].Command); + for (index = 0; index < NumDevices; index++) { + if (DeviceIndex[index] == i) + break; + } + if (index < NumDevices) + printf("<- %d\n", index); + else + printf("\n"); + } printf("\n"); printf("DeviceID Stat Ifc Cch Lat Hdr BIST\n"); for (i = 0; i < NumPCI; i++) { - printf("%04X:%04X %04X %02X %02X %02X %02X %02X ", - PCI[i].VendorID, - PCI[i].DeviceID, - PCI[i].Status, - PCI[i].Interface, - PCI[i].CacheLineSize, - PCI[i].LatencyTimer, - PCI[i].HeaderType, - PCI[i].BIST); - for (index = 0; index < NumDevices; index++) { - if (DeviceIndex[index] == i) - break; - } - if (index < NumDevices) - printf("<- %d\n", index); - else - printf("\n"); - } + printf("%04X:%04X %04X %02X %02X %02X %02X %02X ", + PCI[i].VendorID, + PCI[i].DeviceID, + PCI[i].Status, + PCI[i].Interface, + PCI[i].CacheLineSize, + PCI[i].LatencyTimer, + PCI[i].HeaderType, + PCI[i].BIST); + for (index = 0; index < NumDevices; index++) { + if (DeviceIndex[index] == i) + break; + } + if (index < NumDevices) + printf("<- %d\n", index); + else + printf("\n"); + } printf("\n"); printf("DeviceID Base10h Base14h Base18h Base1Ch Base20h Base24h ROMBase\n"); for (i = 0; i < NumPCI; i++) { - printf("%04X:%04X %08lX %08lX %08lX %08lX %08lX %08lX %08lX ", - PCI[i].VendorID, - PCI[i].DeviceID, - PCI[i].u.type0.BaseAddress10, - PCI[i].u.type0.BaseAddress14, - PCI[i].u.type0.BaseAddress18, - PCI[i].u.type0.BaseAddress1C, - PCI[i].u.type0.BaseAddress20, - PCI[i].u.type0.BaseAddress24, - PCI[i].u.type0.ROMBaseAddress); - for (index = 0; index < NumDevices; index++) { - if (DeviceIndex[index] == i) - break; - } - if (index < NumDevices) - printf("<- %d\n", index); - else - printf("\n"); - } + printf("%04X:%04X %08lX %08lX %08lX %08lX %08lX %08lX %08lX ", + PCI[i].VendorID, + PCI[i].DeviceID, + PCI[i].u.type0.BaseAddress10, + PCI[i].u.type0.BaseAddress14, + PCI[i].u.type0.BaseAddress18, + PCI[i].u.type0.BaseAddress1C, + PCI[i].u.type0.BaseAddress20, + PCI[i].u.type0.BaseAddress24, + PCI[i].u.type0.ROMBaseAddress); + for (index = 0; index < NumDevices; index++) { + if (DeviceIndex[index] == i) + break; + } + if (index < NumDevices) + printf("<- %d\n", index); + else + printf("\n"); + } printf("\n"); printf("DeviceID BAR10Len BAR14Len BAR18Len BAR1CLen BAR20Len BAR24Len ROMLen\n"); for (i = 0; i < NumPCI; i++) { - printf("%04X:%04X %08lX %08lX %08lX %08lX %08lX %08lX %08lX ", - PCI[i].VendorID, - PCI[i].DeviceID, - PCI[i].u.type0.BaseAddress10Len, - PCI[i].u.type0.BaseAddress14Len, - PCI[i].u.type0.BaseAddress18Len, - PCI[i].u.type0.BaseAddress1CLen, - PCI[i].u.type0.BaseAddress20Len, - PCI[i].u.type0.BaseAddress24Len, - PCI[i].u.type0.ROMBaseAddressLen); - for (index = 0; index < NumDevices; index++) { - if (DeviceIndex[index] == i) - break; - } - if (index < NumDevices) - printf("<- %d\n", index); - else - printf("\n"); - } + printf("%04X:%04X %08lX %08lX %08lX %08lX %08lX %08lX %08lX ", + PCI[i].VendorID, + PCI[i].DeviceID, + PCI[i].u.type0.BaseAddress10Len, + PCI[i].u.type0.BaseAddress14Len, + PCI[i].u.type0.BaseAddress18Len, + PCI[i].u.type0.BaseAddress1CLen, + PCI[i].u.type0.BaseAddress20Len, + PCI[i].u.type0.BaseAddress24Len, + PCI[i].u.type0.ROMBaseAddressLen); + for (index = 0; index < NumDevices; index++) { + if (DeviceIndex[index] == i) + break; + } + if (index < NumDevices) + printf("<- %d\n", index); + else + printf("\n"); + } printf("\n"); printf("Displaying enumeration of %d bridge devices\n",NumBridges); printf("\n"); printf("DeviceID P# S# B# IOB IOL MemBase MemLimit PreBase PreLimit Ctrl\n"); for (i = 0; i < NumBridges; i++) { - info = (PCIDeviceInfo*)&PCI[BridgeIndex[i]]; - printf("%04X:%04X %02X %02X %02X %04X %04X %08X %08X %08X %08X %04X\n", - info->VendorID, - info->DeviceID, - info->u.type1.PrimaryBusNumber, - info->u.type1.SecondayBusNumber, - info->u.type1.SubordinateBusNumber, - ((u16)info->u.type1.IOBase << 8) & 0xF000, - info->u.type1.IOLimit ? - ((u16)info->u.type1.IOLimit << 8) | 0xFFF : 0, - ((u32)info->u.type1.MemoryBase << 16) & 0xFFF00000, - info->u.type1.MemoryLimit ? - ((u32)info->u.type1.MemoryLimit << 16) | 0xFFFFF : 0, - ((u32)info->u.type1.PrefetchableMemoryBase << 16) & 0xFFF00000, - info->u.type1.PrefetchableMemoryLimit ? - ((u32)info->u.type1.PrefetchableMemoryLimit << 16) | 0xFFFFF : 0, - info->u.type1.BridgeControl); - } + info = (PCIDeviceInfo*)&PCI[BridgeIndex[i]]; + printf("%04X:%04X %02X %02X %02X %04X %04X %08X %08X %08X %08X %04X\n", + info->VendorID, + info->DeviceID, + info->u.type1.PrimaryBusNumber, + info->u.type1.SecondayBusNumber, + info->u.type1.SubordinateBusNumber, + ((u16)info->u.type1.IOBase << 8) & 0xF000, + info->u.type1.IOLimit ? + ((u16)info->u.type1.IOLimit << 8) | 0xFFF : 0, + ((u32)info->u.type1.MemoryBase << 16) & 0xFFF00000, + info->u.type1.MemoryLimit ? + ((u32)info->u.type1.MemoryLimit << 16) | 0xFFFFF : 0, + ((u32)info->u.type1.PrefetchableMemoryBase << 16) & 0xFFF00000, + info->u.type1.PrefetchableMemoryLimit ? + ((u32)info->u.type1.PrefetchableMemoryLimit << 16) | 0xFFFFF : 0, + info->u.type1.BridgeControl); + } printf("\n"); } @@ -191,63 +191,63 @@ static int PCI_enumerateDevices(void) int i,j; PCIDeviceInfo *info; - // If this is the first time we have been called, enumerate all - // devices on the PCI bus. + /* If this is the first time we have been called, enumerate all */ + /* devices on the PCI bus. */ if (NumPCI == -1) { - if ((NumPCI = PCI_getNumDevices()) == 0) - return -1; - PCI = malloc(NumPCI * sizeof(PCI[0])); - BridgeIndex = malloc(NumPCI * sizeof(BridgeIndex[0])); - DeviceIndex = malloc(NumPCI * sizeof(DeviceIndex[0])); - if (!PCI || !BridgeIndex || !DeviceIndex) - return -1; - for (i = 0; i < NumPCI; i++) - PCI[i].dwSize = sizeof(PCI[i]); - if (PCI_enumerate(PCI) == 0) - return -1; + if ((NumPCI = PCI_getNumDevices()) == 0) + return -1; + PCI = malloc(NumPCI * sizeof(PCI[0])); + BridgeIndex = malloc(NumPCI * sizeof(BridgeIndex[0])); + DeviceIndex = malloc(NumPCI * sizeof(DeviceIndex[0])); + if (!PCI || !BridgeIndex || !DeviceIndex) + return -1; + for (i = 0; i < NumPCI; i++) + PCI[i].dwSize = sizeof(PCI[i]); + if (PCI_enumerate(PCI) == 0) + return -1; - // Build a list of all PCI bridge devices - for (i = 0,NumBridges = 0,BridgeIndex[0] = -1; i < NumPCI; i++) { - if (PCI[i].BaseClass == PCI_BRIDGE_CLASS) - BridgeIndex[NumBridges++] = i; - } + /* Build a list of all PCI bridge devices */ + for (i = 0,NumBridges = 0,BridgeIndex[0] = -1; i < NumPCI; i++) { + if (PCI[i].BaseClass == PCI_BRIDGE_CLASS) + BridgeIndex[NumBridges++] = i; + } - // Now build a list of all display class devices - for (i = 0,NumDevices = 1,DeviceIndex[0] = -1; i < NumPCI; i++) { - if (PCI_IS_DISPLAY_CLASS(&PCI[i])) { - if ((PCI[i].Command & 0x3) == 0x3) - DeviceIndex[0] = i; - else - DeviceIndex[NumDevices++] = i; - if (PCI[i].slot.p.Bus != 0) { - // This device is on a different bus than the primary - // PCI bus, so it is probably an AGP device. Find the - // AGP bus device that controls that bus so we can - // control it. - for (j = 0; j < NumBridges; j++) { - info = (PCIDeviceInfo*)&PCI[BridgeIndex[j]]; - if (info->u.type1.SecondayBusNumber == PCI[i].slot.p.Bus) { - AGPBridge = info; - break; - } - } - } - } - } + /* Now build a list of all display class devices */ + for (i = 0,NumDevices = 1,DeviceIndex[0] = -1; i < NumPCI; i++) { + if (PCI_IS_DISPLAY_CLASS(&PCI[i])) { + if ((PCI[i].Command & 0x3) == 0x3) + DeviceIndex[0] = i; + else + DeviceIndex[NumDevices++] = i; + if (PCI[i].slot.p.Bus != 0) { + /* This device is on a different bus than the primary */ + /* PCI bus, so it is probably an AGP device. Find the */ + /* AGP bus device that controls that bus so we can */ + /* control it. */ + for (j = 0; j < NumBridges; j++) { + info = (PCIDeviceInfo*)&PCI[BridgeIndex[j]]; + if (info->u.type1.SecondayBusNumber == PCI[i].slot.p.Bus) { + AGPBridge = info; + break; + } + } + } + } + } - // Enumerate all PCI and bridge devices to standard output - EnumeratePCI(); - } + /* Enumerate all PCI and bridge devices to standard output */ + EnumeratePCI(); + } return NumDevices; } int main(void) { - // Enumerate all PCI devices + /* Enumerate all PCI devices */ PM_init(); if (PCI_enumerateDevices() < 1) { - printf("No PCI display devices found!\n"); - return -1; - } + printf("No PCI display devices found!\n"); + return -1; + } return 0; } diff --git a/board/MAI/bios_emulator/scitech/src/pm/tests/tick.c b/board/MAI/bios_emulator/scitech/src/pm/tests/tick.c index ee1014fb9f..378725ebe6 100644 --- a/board/MAI/bios_emulator/scitech/src/pm/tests/tick.c +++ b/board/MAI/bios_emulator/scitech/src/pm/tests/tick.c @@ -54,16 +54,16 @@ int main(void) printf("Program running in "); switch (PM_getModeType()) { - case PM_realMode: - printf("real mode.\n\n"); - break; - case PM_286: - printf("16 bit protected mode.\n\n"); - break; - case PM_386: - printf("32 bit protected mode.\n\n"); - break; - } + case PM_realMode: + printf("real mode.\n\n"); + break; + case PM_286: + printf("16 bit protected mode.\n\n"); + break; + case PM_386: + printf("32 bit protected mode.\n\n"); + break; + } /* Install our timer handler and lock handler pages in memory. It is * difficult to get the size of a function in C, but we know our @@ -77,13 +77,13 @@ int main(void) printf("Timer interrupt handler installed - Hit ESC to exit\n"); oldCount = count; while (1) { - if (PM_kbhit() && (PM_getch() == 0x1B)) - break; - if (count != oldCount) { - printf("Tick, Tock: %ld\n", count); - oldCount = count; - } - } + if (PM_kbhit() && (PM_getch() == 0x1B)) + break; + if (count != oldCount) { + printf("Tick, Tock: %ld\n", count); + oldCount = count; + } + } PM_restoreTimerHandler(); PM_restoreBreakHandler(); diff --git a/board/MAI/bios_emulator/scitech/src/pm/tests/timerc.c b/board/MAI/bios_emulator/scitech/src/pm/tests/timerc.c index 55e95a85d6..7fa77b77b8 100644 --- a/board/MAI/bios_emulator/scitech/src/pm/tests/timerc.c +++ b/board/MAI/bios_emulator/scitech/src/pm/tests/timerc.c @@ -69,8 +69,8 @@ int main(void) LZTimerOn(); for (j = 0; j < 10; j++) - for (i = 0; i < 20000; i++) - i = i; + for (i = 0; i < 20000; i++) + i = i; LZTimerOff(); ReportTime(LZTimerCount()); @@ -80,7 +80,7 @@ int main(void) delay(DELAY_SECS * 1000); finish = ULZReadTime(); printf("Delay of %d secs took %d 1/10ths of a second\n", - DELAY_SECS,ULZElapsedTime(start,finish)); + DELAY_SECS,ULZElapsedTime(start,finish)); #endif return 0; diff --git a/board/MAI/bios_emulator/scitech/src/pm/tests/uswc.c b/board/MAI/bios_emulator/scitech/src/pm/tests/uswc.c index 0892e25f3a..f0c7bd6311 100644 --- a/board/MAI/bios_emulator/scitech/src/pm/tests/uswc.c +++ b/board/MAI/bios_emulator/scitech/src/pm/tests/uswc.c @@ -66,50 +66,50 @@ static int PCI_enumerateDevices(void) int i,j; PCIDeviceInfo *info; - // If this is the first time we have been called, enumerate all - // devices on the PCI bus. + /* If this is the first time we have been called, enumerate all */ + /* devices on the PCI bus. */ if (NumPCI == -1) { - if ((NumPCI = PCI_getNumDevices()) == 0) - return -1; - PCI = malloc(NumPCI * sizeof(PCI[0])); - BridgeIndex = malloc(NumPCI * sizeof(BridgeIndex[0])); - DeviceIndex = malloc(NumPCI * sizeof(DeviceIndex[0])); - if (!PCI || !BridgeIndex || !DeviceIndex) - return -1; - for (i = 0; i < NumPCI; i++) - PCI[i].dwSize = sizeof(PCI[i]); - if (PCI_enumerate(PCI) == 0) - return -1; + if ((NumPCI = PCI_getNumDevices()) == 0) + return -1; + PCI = malloc(NumPCI * sizeof(PCI[0])); + BridgeIndex = malloc(NumPCI * sizeof(BridgeIndex[0])); + DeviceIndex = malloc(NumPCI * sizeof(DeviceIndex[0])); + if (!PCI || !BridgeIndex || !DeviceIndex) + return -1; + for (i = 0; i < NumPCI; i++) + PCI[i].dwSize = sizeof(PCI[i]); + if (PCI_enumerate(PCI) == 0) + return -1; - // Build a list of all PCI bridge devices - for (i = 0,NumBridges = 0,BridgeIndex[0] = -1; i < NumPCI; i++) { - if (PCI[i].BaseClass == PCI_BRIDGE_CLASS) - BridgeIndex[NumBridges++] = i; - } + /* Build a list of all PCI bridge devices */ + for (i = 0,NumBridges = 0,BridgeIndex[0] = -1; i < NumPCI; i++) { + if (PCI[i].BaseClass == PCI_BRIDGE_CLASS) + BridgeIndex[NumBridges++] = i; + } - // Now build a list of all display class devices - for (i = 0,NumDevices = 1,DeviceIndex[0] = -1; i < NumPCI; i++) { - if (PCI_IS_DISPLAY_CLASS(&PCI[i])) { - if ((PCI[i].Command & 0x3) == 0x3) - DeviceIndex[0] = i; - else - DeviceIndex[NumDevices++] = i; - if (PCI[i].slot.p.Bus != 0) { - // This device is on a different bus than the primary - // PCI bus, so it is probably an AGP device. Find the - // AGP bus device that controls that bus so we can - // control it. - for (j = 0; j < NumBridges; j++) { - info = (PCIDeviceInfo*)&PCI[BridgeIndex[j]]; - if (info->u.type1.SecondayBusNumber == PCI[i].slot.p.Bus) { - AGPBridge = info; - break; - } - } - } - } - } - } + /* Now build a list of all display class devices */ + for (i = 0,NumDevices = 1,DeviceIndex[0] = -1; i < NumPCI; i++) { + if (PCI_IS_DISPLAY_CLASS(&PCI[i])) { + if ((PCI[i].Command & 0x3) == 0x3) + DeviceIndex[0] = i; + else + DeviceIndex[NumDevices++] = i; + if (PCI[i].slot.p.Bus != 0) { + /* This device is on a different bus than the primary */ + /* PCI bus, so it is probably an AGP device. Find the */ + /* AGP bus device that controls that bus so we can */ + /* control it. */ + for (j = 0; j < NumBridges; j++) { + info = (PCIDeviceInfo*)&PCI[BridgeIndex[j]]; + if (info->u.type1.SecondayBusNumber == PCI[i].slot.p.Bus) { + AGPBridge = info; + break; + } + } + } + } + } + } return NumDevices; } @@ -125,17 +125,17 @@ static void ShowDisplayDevices(void) printf("\n"); printf("DeviceID SubSystem Base10h (length ) Base14h (length )\n"); for (index = 0; index < NumDevices; index++) { - i = DeviceIndex[index]; - printf("%04X:%04X %04X:%04X %08lX (%6ld KB) %08lX (%6ld KB)\n", - PCI[i].VendorID, - PCI[i].DeviceID, - PCI[i].u.type0.SubSystemVendorID, - PCI[i].u.type0.SubSystemID, - PCI[i].u.type0.BaseAddress10, - PCI[i].u.type0.BaseAddress10Len / 1024, - PCI[i].u.type0.BaseAddress14, - PCI[i].u.type0.BaseAddress14Len / 1024); - } + i = DeviceIndex[index]; + printf("%04X:%04X %04X:%04X %08lX (%6ld KB) %08lX (%6ld KB)\n", + PCI[i].VendorID, + PCI[i].DeviceID, + PCI[i].u.type0.SubSystemVendorID, + PCI[i].u.type0.SubSystemID, + PCI[i].u.type0.BaseAddress10, + PCI[i].u.type0.BaseAddress10Len / 1024, + PCI[i].u.type0.BaseAddress14, + PCI[i].u.type0.BaseAddress14Len / 1024); + } printf("\n"); } @@ -147,16 +147,16 @@ static char *DecodeWCType( uint type) { static char *names[] = { - "UNCACHABLE", - "WRCOMB", - "UNKNOWN", - "UNKNOWN", - "WRTHROUGH", - "WRPROT", - "WRBACK", - }; + "UNCACHABLE", + "WRCOMB", + "UNKNOWN", + "UNKNOWN", + "WRTHROUGH", + "WRPROT", + "WRBACK", + }; if (type <= PM_MTRR_MAX) - return names[type]; + return names[type]; return "UNKNOWN"; } @@ -183,42 +183,42 @@ static void LogMTRRError( int err) { if (err == PM_MTRR_ERR_OK) - return; + return; switch (err) { - case PM_MTRR_NOT_SUPPORTED: - printf("Failed: MTRR is not supported by host CPU\n"); - break; - case PM_MTRR_ERR_PARAMS: - printf("Failed: Invalid parameters passed to PM_enableWriteCombined!\n"); - break; - case PM_MTRR_ERR_NOT_4KB_ALIGNED: - printf("Failed: Address is not 4Kb aligned!\n"); - break; - case PM_MTRR_ERR_BELOW_1MB: - printf("Failed: Addresses below 1Mb cannot be write combined!\n"); - break; - case PM_MTRR_ERR_NOT_ALIGNED: - printf("Failed: Address is not correctly aligned for processor!\n"); - break; - case PM_MTRR_ERR_OVERLAP: - printf("Failed: Address overlaps an existing region!\n"); - break; - case PM_MTRR_ERR_TYPE_MISMATCH: - printf("Failed: Adress is contained with existing region, but type is different!\n"); - break; - case PM_MTRR_ERR_NONE_FREE: - printf("Failed: Out of MTRR registers!\n"); - break; - case PM_MTRR_ERR_NOWRCOMB: - printf("Failed: This processor does not support write combining!\n"); - break; - case PM_MTRR_ERR_NO_OS_SUPPORT: - printf("Failed: MTRR is not supported by host OS\n"); - break; - default: - printf("Failed: UNKNOWN ERROR!\n"); - break; - } + case PM_MTRR_NOT_SUPPORTED: + printf("Failed: MTRR is not supported by host CPU\n"); + break; + case PM_MTRR_ERR_PARAMS: + printf("Failed: Invalid parameters passed to PM_enableWriteCombined!\n"); + break; + case PM_MTRR_ERR_NOT_4KB_ALIGNED: + printf("Failed: Address is not 4Kb aligned!\n"); + break; + case PM_MTRR_ERR_BELOW_1MB: + printf("Failed: Addresses below 1Mb cannot be write combined!\n"); + break; + case PM_MTRR_ERR_NOT_ALIGNED: + printf("Failed: Address is not correctly aligned for processor!\n"); + break; + case PM_MTRR_ERR_OVERLAP: + printf("Failed: Address overlaps an existing region!\n"); + break; + case PM_MTRR_ERR_TYPE_MISMATCH: + printf("Failed: Adress is contained with existing region, but type is different!\n"); + break; + case PM_MTRR_ERR_NONE_FREE: + printf("Failed: Out of MTRR registers!\n"); + break; + case PM_MTRR_ERR_NOWRCOMB: + printf("Failed: This processor does not support write combining!\n"); + break; + case PM_MTRR_ERR_NO_OS_SUPPORT: + printf("Failed: MTRR is not supported by host OS\n"); + break; + default: + printf("Failed: UNKNOWN ERROR!\n"); + break; + } exit(-1); } @@ -242,20 +242,20 @@ static void EnableWriteCombine(void) int i,index; for (index = 0; index < NumDevices; index++) { - i = DeviceIndex[index]; - if (PCI[i].u.type0.BaseAddress10 & 0x8) { - LogMTRRError(PM_enableWriteCombine( - PCI[i].u.type0.BaseAddress10 & 0xFFFFFFF0, - PCI[i].u.type0.BaseAddress10Len, - PM_MTRR_WRCOMB)); - } - if (PCI[i].u.type0.BaseAddress14 & 0x8) { - LogMTRRError(PM_enableWriteCombine( - PCI[i].u.type0.BaseAddress14 & 0xFFFFFFF0, - PCI[i].u.type0.BaseAddress14Len, - PM_MTRR_WRCOMB)); - } - } + i = DeviceIndex[index]; + if (PCI[i].u.type0.BaseAddress10 & 0x8) { + LogMTRRError(PM_enableWriteCombine( + PCI[i].u.type0.BaseAddress10 & 0xFFFFFFF0, + PCI[i].u.type0.BaseAddress10Len, + PM_MTRR_WRCOMB)); + } + if (PCI[i].u.type0.BaseAddress14 & 0x8) { + LogMTRRError(PM_enableWriteCombine( + PCI[i].u.type0.BaseAddress14 & 0xFFFFFFF0, + PCI[i].u.type0.BaseAddress14Len, + PM_MTRR_WRCOMB)); + } + } printf("\n"); ShowDisplayDevices(); ShowWriteCombine(); @@ -270,20 +270,20 @@ static void DisableWriteCombine(void) int i,index; for (index = 0; index < NumDevices; index++) { - i = DeviceIndex[index]; - if (PCI[i].u.type0.BaseAddress10 & 0x8) { - LogMTRRError(PM_enableWriteCombine( - PCI[i].u.type0.BaseAddress10 & 0xFFFFFFF0, - PCI[i].u.type0.BaseAddress10Len, - PM_MTRR_UNCACHABLE)); - } - if (PCI[i].u.type0.BaseAddress14 & 0x8) { - LogMTRRError(PM_enableWriteCombine( - PCI[i].u.type0.BaseAddress14 & 0xFFFFFFF0, - PCI[i].u.type0.BaseAddress14Len, - PM_MTRR_UNCACHABLE)); - } - } + i = DeviceIndex[index]; + if (PCI[i].u.type0.BaseAddress10 & 0x8) { + LogMTRRError(PM_enableWriteCombine( + PCI[i].u.type0.BaseAddress10 & 0xFFFFFFF0, + PCI[i].u.type0.BaseAddress10Len, + PM_MTRR_UNCACHABLE)); + } + if (PCI[i].u.type0.BaseAddress14 & 0x8) { + LogMTRRError(PM_enableWriteCombine( + PCI[i].u.type0.BaseAddress14 & 0xFFFFFFF0, + PCI[i].u.type0.BaseAddress14Len, + PM_MTRR_UNCACHABLE)); + } + } printf("\n"); ShowDisplayDevices(); ShowWriteCombine(); @@ -293,19 +293,19 @@ int main(int argc,char *argv[]) { PM_init(); if (PCI_enumerateDevices() < 1) { - printf("No PCI display devices found!\n"); - return -1; - } + printf("No PCI display devices found!\n"); + return -1; + } if (argc < 2) { - printf("usage: uswc [-show -on -off]\n\n"); - ShowDisplayDevices(); - return -1; - } + printf("usage: uswc [-show -on -off]\n\n"); + ShowDisplayDevices(); + return -1; + } if (stricmp(argv[1],"-show") == 0) - ShowWriteCombine(); + ShowWriteCombine(); else if (stricmp(argv[1],"-on") == 0) - EnableWriteCombine(); + EnableWriteCombine(); else if (stricmp(argv[1],"-off") == 0) - DisableWriteCombine(); + DisableWriteCombine(); return 0; } diff --git a/board/MAI/bios_emulator/scitech/src/pm/tests/vftest.c b/board/MAI/bios_emulator/scitech/src/pm/tests/vftest.c index 633a76d2b7..b7e3bb7846 100644 --- a/board/MAI/bios_emulator/scitech/src/pm/tests/vftest.c +++ b/board/MAI/bios_emulator/scitech/src/pm/tests/vftest.c @@ -51,27 +51,27 @@ int main(void) printf("Program running in "); switch (PM_getModeType()) { - case PM_realMode: - printf("real mode.\n\n"); - break; - case PM_286: - printf("16 bit protected mode.\n\n"); - break; - case PM_386: - printf("32 bit protected mode.\n\n"); - break; - } + case PM_realMode: + printf("real mode.\n\n"); + break; + case PM_286: + printf("16 bit protected mode.\n\n"); + break; + case PM_386: + printf("32 bit protected mode.\n\n"); + break; + } if (!VF_available()) { - printf("Virtual Linear Framebuffer not available.\n"); - exit(1); - } + printf("Virtual Linear Framebuffer not available.\n"); + exit(1); + } vfBuffer = VF_init(0xA0000,64,sizeof(code),code); if (!vfBuffer) { - printf("Failure to initialise Virtual Linear Framebuffer!\n"); - exit(1); - } + printf("Failure to initialise Virtual Linear Framebuffer!\n"); + exit(1); + } VF_exit(); printf("Virtual Linear Framebuffer set up successfully!\n"); return 0; diff --git a/board/MAI/bios_emulator/scitech/src/pm/tests/video.c b/board/MAI/bios_emulator/scitech/src/pm/tests/video.c index 7f6f67f67e..92adcddd49 100644 --- a/board/MAI/bios_emulator/scitech/src/pm/tests/video.c +++ b/board/MAI/bios_emulator/scitech/src/pm/tests/video.c @@ -90,12 +90,12 @@ void fill(int startx, int starty, int endx, int endy, unsigned char c, int x,y; for (y = starty; y <= endy; y++) { - v = SCREEN(startx,y); - for (x = startx; x <= endx; x++) { - *v++ = c; - *v++ = attr; - } - } + v = SCREEN(startx,y); + for (x = startx; x <= endx; x++) { + *v++ = c; + *v++ = attr; + } + } } /* Routine to display a single character using direct video writes */ @@ -124,18 +124,18 @@ void border(int startx, int starty, int endx, int endy, unsigned char attr) b = border_chars; for (i = starty+1; i < endy; i++) { - writeChar(startx, i, *b, attr); - writeChar(endx, i, *b, attr); - } + writeChar(startx, i, *b, attr); + writeChar(endx, i, *b, attr); + } b++; for (i = startx+1, v = SCREEN(startx+1, starty); i < endx; i++) { - *v++ = *b; - *v++ = attr; - } + *v++ = *b; + *v++ = attr; + } for (i = startx+1, v = SCREEN(startx+1, endy); i < endx; i++) { - *v++ = *b; - *v++ = attr; - } + *v++ = *b; + *v++ = attr; + } b++; writeChar(startx, starty, *b++, attr); writeChar(endx, starty, *b++, attr); @@ -150,16 +150,16 @@ int main(void) printf("Program running in "); switch (PM_getModeType()) { - case PM_realMode: - printf("real mode.\n\n"); - break; - case PM_286: - printf("16 bit protected mode.\n\n"); - break; - case PM_386: - printf("32 bit protected mode.\n\n"); - break; - } + case PM_realMode: + printf("real mode.\n\n"); + break; + case PM_286: + printf("16 bit protected mode.\n\n"); + break; + case PM_386: + printf("32 bit protected mode.\n\n"); + break; + } hwndConsole = PM_openConsole(0,0,0,0,0,true); printf("Hit any key to start 80x25 text mode and perform some direct video output.\n"); @@ -167,17 +167,17 @@ int main(void) /* Allocate a buffer to save console state and save the state */ if ((stateBuf = PM_malloc(PM_getConsoleStateSize())) == NULL) { - printf("Unable to allocate console state buffer!\n"); - exit(1); - } + printf("Unable to allocate console state buffer!\n"); + exit(1); + } PM_saveConsoleState(stateBuf,0); bios = PM_getBIOSPointer(); orgMode = getVideoMode(); setVideoMode(0x3); if ((videoPtr = PM_mapPhysicalAddr(0xB8000,0xFFFF,true)) == NULL) { - printf("Unable to obtain pointer to framebuffer!\n"); - exit(1); - } + printf("Unable to obtain pointer to framebuffer!\n"); + exit(1); + } /* Draw some text on the screen */ fill(0, 0, 79, 24, 176, 0x1E); @@ -197,4 +197,3 @@ int main(void) printf("Video Memory = %08X\n", (int)videoPtr); return 0; } - -- cgit v1.2.3