From 221838cc7eb178370ff62aa05920a582e12ac322 Mon Sep 17 00:00:00 2001 From: Jason Jin Date: Tue, 10 Jul 2007 09:03:22 +0800 Subject: Remove the bios emulator from MAI board. The bios emulator in the MAI board can not pass compile and have a lot of crap in it. remove it and will have a clean and small bios emulator in the drivers directory which can be uesed for every board. Signed-off-by: Jason Jin --- .../bios_emulator/scitech/src/pm/tests/altbrk.c | 90 ---- .../bios_emulator/scitech/src/pm/tests/altcrit.c | 85 ---- .../bios_emulator/scitech/src/pm/tests/biosptr.c | 92 ---- .../MAI/bios_emulator/scitech/src/pm/tests/block.c | 69 --- board/MAI/bios_emulator/scitech/src/pm/tests/brk.c | 78 ---- .../bios_emulator/scitech/src/pm/tests/callreal.c | 107 ----- .../bios_emulator/scitech/src/pm/tests/checks.c | 100 ---- board/MAI/bios_emulator/scitech/src/pm/tests/cpu.c | 46 -- .../bios_emulator/scitech/src/pm/tests/critical.c | 70 --- .../MAI/bios_emulator/scitech/src/pm/tests/getch.c | 501 --------------------- .../bios_emulator/scitech/src/pm/tests/isvesa.c | 110 ----- board/MAI/bios_emulator/scitech/src/pm/tests/key.c | 92 ---- .../MAI/bios_emulator/scitech/src/pm/tests/key15.c | 96 ---- .../bios_emulator/scitech/src/pm/tests/memtest.c | 106 ----- .../MAI/bios_emulator/scitech/src/pm/tests/mouse.c | 109 ----- .../bios_emulator/scitech/src/pm/tests/restore.c | 81 ---- board/MAI/bios_emulator/scitech/src/pm/tests/rtc.c | 92 ---- .../MAI/bios_emulator/scitech/src/pm/tests/save.c | 69 --- .../bios_emulator/scitech/src/pm/tests/showpci.c | 253 ----------- .../MAI/bios_emulator/scitech/src/pm/tests/tick.c | 94 ---- .../bios_emulator/scitech/src/pm/tests/timerc.c | 87 ---- .../scitech/src/pm/tests/timercpp.cpp | 107 ----- .../MAI/bios_emulator/scitech/src/pm/tests/uswc.c | 311 ------------- .../bios_emulator/scitech/src/pm/tests/vftest.c | 78 ---- .../MAI/bios_emulator/scitech/src/pm/tests/video.c | 199 -------- 25 files changed, 3122 deletions(-) delete mode 100644 board/MAI/bios_emulator/scitech/src/pm/tests/altbrk.c delete mode 100644 board/MAI/bios_emulator/scitech/src/pm/tests/altcrit.c delete mode 100644 board/MAI/bios_emulator/scitech/src/pm/tests/biosptr.c delete mode 100644 board/MAI/bios_emulator/scitech/src/pm/tests/block.c delete mode 100644 board/MAI/bios_emulator/scitech/src/pm/tests/brk.c delete mode 100644 board/MAI/bios_emulator/scitech/src/pm/tests/callreal.c delete mode 100644 board/MAI/bios_emulator/scitech/src/pm/tests/checks.c delete mode 100644 board/MAI/bios_emulator/scitech/src/pm/tests/cpu.c delete mode 100644 board/MAI/bios_emulator/scitech/src/pm/tests/critical.c delete mode 100644 board/MAI/bios_emulator/scitech/src/pm/tests/getch.c delete mode 100644 board/MAI/bios_emulator/scitech/src/pm/tests/isvesa.c delete mode 100644 board/MAI/bios_emulator/scitech/src/pm/tests/key.c delete mode 100644 board/MAI/bios_emulator/scitech/src/pm/tests/key15.c delete mode 100644 board/MAI/bios_emulator/scitech/src/pm/tests/memtest.c delete mode 100644 board/MAI/bios_emulator/scitech/src/pm/tests/mouse.c delete mode 100644 board/MAI/bios_emulator/scitech/src/pm/tests/restore.c delete mode 100644 board/MAI/bios_emulator/scitech/src/pm/tests/rtc.c delete mode 100644 board/MAI/bios_emulator/scitech/src/pm/tests/save.c delete mode 100644 board/MAI/bios_emulator/scitech/src/pm/tests/showpci.c delete mode 100644 board/MAI/bios_emulator/scitech/src/pm/tests/tick.c delete mode 100644 board/MAI/bios_emulator/scitech/src/pm/tests/timerc.c delete mode 100644 board/MAI/bios_emulator/scitech/src/pm/tests/timercpp.cpp delete mode 100644 board/MAI/bios_emulator/scitech/src/pm/tests/uswc.c delete mode 100644 board/MAI/bios_emulator/scitech/src/pm/tests/vftest.c delete mode 100644 board/MAI/bios_emulator/scitech/src/pm/tests/video.c (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 deleted file mode 100644 index ba90262..0000000 --- a/board/MAI/bios_emulator/scitech/src/pm/tests/altbrk.c +++ /dev/null @@ -1,90 +0,0 @@ -/**************************************************************************** -* -* SciTech OS Portability Manager Library -* -* ======================================================================== -* -* The contents of this file are subject to the SciTech MGL Public -* License Version 1.0 (the "License"); you may not use this file -* except in compliance with the License. You may obtain a copy of -* the License at http://www.scitechsoft.com/mgl-license.txt -* -* Software distributed under the License is distributed on an -* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or -* implied. See the License for the specific language governing -* rights and limitations under the License. -* -* The Original Code is Copyright (C) 1991-1998 SciTech Software, Inc. -* -* The Initial Developer of the Original Code is SciTech Software, Inc. -* All Rights Reserved. -* -* ======================================================================== -* -* -* Language: ANSI C -* Environment: any -* -* Description: Test program to check the ability to install a C based -* control C/break interrupt handler. Note that this -* alternate version does not work with all extenders. -* -* Functions tested: PM_installAltBreakHandler() -* PM_restoreBreakHandler() -* -* -****************************************************************************/ - -#include -#include -#include "pmapi.h" - -volatile int breakHit = false; -volatile int ctrlCHit = false; - -#pragma off (check_stack) /* No stack checking under Watcom */ - -void PMAPI breakHandler(uint bHit) -{ - if (bHit) - breakHit = true; - else - 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; - } - - 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"); - } - - 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 deleted file mode 100644 index e137307..0000000 --- a/board/MAI/bios_emulator/scitech/src/pm/tests/altcrit.c +++ /dev/null @@ -1,85 +0,0 @@ -/**************************************************************************** -* -* SciTech OS Portability Manager Library -* -* ======================================================================== -* -* The contents of this file are subject to the SciTech MGL Public -* License Version 1.0 (the "License"); you may not use this file -* except in compliance with the License. You may obtain a copy of -* the License at http://www.scitechsoft.com/mgl-license.txt -* -* Software distributed under the License is distributed on an -* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or -* implied. See the License for the specific language governing -* rights and limitations under the License. -* -* The Original Code is Copyright (C) 1991-1998 SciTech Software, Inc. -* -* The Initial Developer of the Original Code is SciTech Software, Inc. -* All Rights Reserved. -* -* ======================================================================== -* -* -* Language: ANSI C -* Environment: any -* -* Description: Test program to check the ability to install a C based -* critical error handler. -* -* Functions tested: PM_installCriticalHandler() -* PM_criticalError() -* PM_restoreCriticalHandler() -* -* -****************************************************************************/ - -#include -#include -#include "pmapi.h" - -volatile uint criticalError = false; -volatile uint axValue; -volatile uint diValue; - -#pragma off (check_stack) /* No stack checking under Watcom */ - -uint PMAPI criticalHandler(uint axVal,uint diVal) -{ - criticalError = true; - axValue = axVal; - diValue = diVal; - return 3; /* Tell MS-DOS to fail the operation */ -} - -int main(void) -{ - FILE *f; - - 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; - } - - 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); - } - else - 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 deleted file mode 100644 index 5fa3382..0000000 --- a/board/MAI/bios_emulator/scitech/src/pm/tests/biosptr.c +++ /dev/null @@ -1,92 +0,0 @@ -/**************************************************************************** -* -* SciTech OS Portability Manager Library -* -* ======================================================================== -* -* The contents of this file are subject to the SciTech MGL Public -* License Version 1.0 (the "License"); you may not use this file -* except in compliance with the License. You may obtain a copy of -* the License at http://www.scitechsoft.com/mgl-license.txt -* -* Software distributed under the License is distributed on an -* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or -* implied. See the License for the specific language governing -* rights and limitations under the License. -* -* The Original Code is Copyright (C) 1991-1998 SciTech Software, Inc. -* -* The Initial Developer of the Original Code is SciTech Software, Inc. -* All Rights Reserved. -* -* ======================================================================== -* -* Language: ANSI C -* Environment: any -* -* Description: Test program to check the ability to manipulate the -* BIOS data area from protected mode using the PM -* library. Compile and link with the appropriate command -* line for your DOS extender. -* -* Functions tested: PM_getBIOSSelector() -* PM_getLong() -* PM_getByte() -* PM_getWord() -* -****************************************************************************/ - -#include -#include -#include "pmapi.h" - -/* Macros to obtain values from the BIOS data area */ - -#define TICKS() PM_getLong(bios+0x6C) -#define KB_STAT PM_getByte(bios+0x17) -#define KB_HEAD PM_getWord(bios+0x1A) -#define KB_TAIL PM_getWord(bios+0x1C) - -/* Macros for working with the keyboard buffer */ - -#define KB_HIT() (KB_HEAD != KB_TAIL) -#define CTRL() (KB_STAT & 4) -#define SHIFT() (KB_STAT & 2) -#define ESC 0x1B - -/* Selector for BIOS data area */ - -uchar *bios; - -int main(void) -{ - int c,done = 0; - - 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; - } - - 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; - } - } - - 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 deleted file mode 100644 index 15d503c..0000000 --- a/board/MAI/bios_emulator/scitech/src/pm/tests/block.c +++ /dev/null @@ -1,69 +0,0 @@ -/**************************************************************************** -* -* SciTech OS Portability Manager Library -* -* ======================================================================== -* -* The contents of this file are subject to the SciTech MGL Public -* License Version 1.0 (the "License"); you may not use this file -* except in compliance with the License. You may obtain a copy of -* the License at http://www.scitechsoft.com/mgl-license.txt -* -* Software distributed under the License is distributed on an -* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or -* implied. See the License for the specific language governing -* rights and limitations under the License. -* -* The Original Code is Copyright (C) 1991-1998 SciTech Software, Inc. -* -* The Initial Developer of the Original Code is SciTech Software, Inc. -* All Rights Reserved. -* -* ======================================================================== -* -* Language: ANSI C -* Environment: Any -* -* Description: Test program for the PM_blockUntilTimeout function. -* -****************************************************************************/ - -#include -#include "pmapi.h" - -#define DELAY_MSECS 1100 -#define LOOPS 5 - -/*-------------------------- Implementation -------------------------------*/ - -/* The following routine takes a long count in microseconds and outputs - * a string representing the count in seconds. It could be modified to - * return a pointer to a static string representing the count rather - * than printing it out. - */ - -void ReportTime(ulong count) -{ - ulong secs; - - secs = count / 1000000L; - count = count - secs * 1000000L; - printf("Time taken: %lu.%06lu seconds\n",secs,count); -} - -int main(void) -{ - int i; - - printf("Detecting processor information ..."); - fflush(stdout); - printf("\n\n%s\n", CPU_getProcessorName()); - ZTimerInit(); - LZTimerOn(); - for (i = 0; i < LOOPS; i++) { - 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 deleted file mode 100644 index 10b6446..0000000 --- a/board/MAI/bios_emulator/scitech/src/pm/tests/brk.c +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** -* -* SciTech OS Portability Manager Library -* -* ======================================================================== -* -* The contents of this file are subject to the SciTech MGL Public -* License Version 1.0 (the "License"); you may not use this file -* except in compliance with the License. You may obtain a copy of -* the License at http://www.scitechsoft.com/mgl-license.txt -* -* Software distributed under the License is distributed on an -* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or -* implied. See the License for the specific language governing -* rights and limitations under the License. -* -* The Original Code is Copyright (C) 1991-1998 SciTech Software, Inc. -* -* The Initial Developer of the Original Code is SciTech Software, Inc. -* All Rights Reserved. -* -* ======================================================================== -* -* -* Language: ANSI C -* Environment: any -* -* Description: Test program to check the ability to install a C based -* control C/break interrupt handler. -* -* Functions tested: PM_installBreakHandler() -* PM_ctrlCHit() -* PM_ctrlBreakHit() -* PM_restoreBreakHandler() -* -* -****************************************************************************/ - -#include -#include -#include "pmapi.h" - -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; - } - - 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"); - } - - 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 deleted file mode 100644 index 4d37cab..0000000 --- a/board/MAI/bios_emulator/scitech/src/pm/tests/callreal.c +++ /dev/null @@ -1,107 +0,0 @@ -/**************************************************************************** -* -* SciTech OS Portability Manager Library -* -* ======================================================================== -* -* The contents of this file are subject to the SciTech MGL Public -* License Version 1.0 (the "License"); you may not use this file -* except in compliance with the License. You may obtain a copy of -* the License at http://www.scitechsoft.com/mgl-license.txt -* -* Software distributed under the License is distributed on an -* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or -* implied. See the License for the specific language governing -* rights and limitations under the License. -* -* The Original Code is Copyright (C) 1991-1998 SciTech Software, Inc. -* -* The Initial Developer of the Original Code is SciTech Software, Inc. -* All Rights Reserved. -* -* ======================================================================== -* -* Language: ANSI C -* Environment: any -* -* Description: Test program to check the ability to call a real mode -* procedure. We simply copy a terribly simple assembly -* language routine into a real mode block that we allocate, -* and then attempt to call the routine and verify that it -* was successful. -* -* Functions tested: PM_allocRealSeg() -* PM_freeRealSeg() -* PM_callRealMode() -* -****************************************************************************/ - -#include -#include -#include -#include "pmapi.h" - -/* Block of real mode code we will eventually call */ - -static unsigned char realModeCode[] = { - 0x93, /* xchg ax,bx */ - 0x87, 0xCA, /* xchg cx,dx */ - 0xCB /* retf */ - }; - -int main(void) -{ - RMREGS regs; - RMSREGS sregs; - uchar *p; - unsigned r_seg,r_off; - - 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; - } - - /* 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); - } - - /* Copy the real mode code */ - memcpy(p,realModeCode,sizeof(realModeCode)); - - /* Now call the real mode code */ - regs.x.ax = 1; - regs.x.bx = 2; - regs.x.cx = 3; - regs.x.dx = 4; - regs.x.si = 5; - regs.x.di = 6; - sregs.es = 7; - 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); - } - else - printf("Real mode call succeeded!\n"); - - /* Free the memory we allocated */ - PM_freeRealSeg(p); - return 0; -} diff --git a/board/MAI/bios_emulator/scitech/src/pm/tests/checks.c b/board/MAI/bios_emulator/scitech/src/pm/tests/checks.c deleted file mode 100644 index 5933ac9..0000000 --- a/board/MAI/bios_emulator/scitech/src/pm/tests/checks.c +++ /dev/null @@ -1,100 +0,0 @@ -/**************************************************************************** -* -* SciTech OS Portability Manager Library -* -* ======================================================================== -* -* The contents of this file are subject to the SciTech MGL Public -* License Version 1.0 (the "License"); you may not use this file -* except in compliance with the License. You may obtain a copy of -* the License at http://www.scitechsoft.com/mgl-license.txt -* -* Software distributed under the License is distributed on an -* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or -* implied. See the License for the specific language governing -* rights and limitations under the License. -* -* The Original Code is Copyright (C) 1991-1998 SciTech Software, Inc. -* -* The Initial Developer of the Original Code is SciTech Software, Inc. -* All Rights Reserved. -* -* ======================================================================== -* -* Language: ANSI C -* Environment: Any -* -* Description: Main module for building checked builds of products with -* assertions and trace code. -* -****************************************************************************/ - -#include "scitech.h" -#include -#include -#include -#ifdef __WINDOWS__ -#define WIN32_LEAN_AND_MEAN -#define STRICT -#include -#endif - -#ifdef CHECKED - -/*---------------------------- Global variables ---------------------------*/ - -#define LOGFILE "\\scitech.log" - -void (*_CHK_fail)(int fatal,const char *msg,const char *cond,const char *file,int line) = _CHK_defaultFail; - -/*---------------------------- Implementation -----------------------------*/ - -/**************************************************************************** -DESCRIPTION: -Handles fatal error and warning conditions for checked builds. - -HEADER: -scitech.h - -REMARKS: -This function is called whenever an inline check or warning fails in any -of the SciTech runtime libraries. Warning conditions simply cause the -condition to be logged to the log file and send to the system debugger -under Window. Fatal error conditions do all of the above, and then -terminate the program with a fatal error conditions. - -This handler may be overriden by the user code if necessary to replace it -with a different handler (the MGL for instance overrides this and replaces -it with a handler that does an MGL_exit() before terminating the application -so that it will clean up correctly. -****************************************************************************/ -void _CHK_defaultFail( - int fatal, - const char *msg, - const char *cond, - const char *file, - int line) -{ - char buf[256]; - FILE *log = fopen(LOGFILE, "at+"); - - sprintf(buf,msg,cond,file,line); - if (log) { - fputs(buf,log); - fflush(log); - fclose(log); -#ifdef __WINDOWS__ - OutputDebugStr(buf); -#endif - } - if (fatal) { -#ifdef __WINDOWS__ - MessageBox(NULL, buf,"Fatal Error!",MB_ICONEXCLAMATION); -#else - fputs(buf,stderr); -#endif - 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 deleted file mode 100644 index 30e5dd3..0000000 --- a/board/MAI/bios_emulator/scitech/src/pm/tests/cpu.c +++ /dev/null @@ -1,46 +0,0 @@ -/**************************************************************************** -* -* SciTech OS Portability Manager Library -* -* ======================================================================== -* -* The contents of this file are subject to the SciTech MGL Public -* License Version 1.0 (the "License"); you may not use this file -* except in compliance with the License. You may obtain a copy of -* the License at http://www.scitechsoft.com/mgl-license.txt -* -* Software distributed under the License is distributed on an -* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or -* implied. See the License for the specific language governing -* rights and limitations under the License. -* -* The Original Code is Copyright (C) 1991-1998 SciTech Software, Inc. -* -* The Initial Developer of the Original Code is SciTech Software, Inc. -* All Rights Reserved. -* -* ======================================================================== -* -* Language: ANSI C -* Environment: Any -* -* Description: Test program for the CPU detection code. -* -****************************************************************************/ - -#include "ztimer.h" -#include "pmapi.h" -#include -#include - -/*----------------------------- Implementation ----------------------------*/ - -int main(void) -{ - printf("Detecting processor information ..."); - fflush(stdout); - printf("\n\n%s\n", CPU_getProcessorName()); - if (CPU_haveRDTSC()) - 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 deleted file mode 100644 index 60f1251..0000000 --- a/board/MAI/bios_emulator/scitech/src/pm/tests/critical.c +++ /dev/null @@ -1,70 +0,0 @@ -/**************************************************************************** -* -* SciTech OS Portability Manager Library -* -* ======================================================================== -* -* The contents of this file are subject to the SciTech MGL Public -* License Version 1.0 (the "License"); you may not use this file -* except in compliance with the License. You may obtain a copy of -* the License at http://www.scitechsoft.com/mgl-license.txt -* -* Software distributed under the License is distributed on an -* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or -* implied. See the License for the specific language governing -* rights and limitations under the License. -* -* The Original Code is Copyright (C) 1991-1998 SciTech Software, Inc. -* -* The Initial Developer of the Original Code is SciTech Software, Inc. -* All Rights Reserved. -* -* ======================================================================== -* -* -* Language: ANSI C -* Environment: any -* -* Description: Test program to check the ability to install a C based -* critical error handler. -* -* Functions tested: PM_installAltCriticalHandler() -* PM_restoreCriticalHandler() -* -* -****************************************************************************/ - -#include -#include -#include "pmapi.h" - -int main(void) -{ - FILE *f; - int axcode,dicode; - - 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; - } - - 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); - } - 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 deleted file mode 100644 index 06c2180..0000000 --- a/board/MAI/bios_emulator/scitech/src/pm/tests/getch.c +++ /dev/null @@ -1,501 +0,0 @@ -/**************************************************************************** -* -* SciTech OS Portability Manager Library -* -* ======================================================================== -* -* The contents of this file are subject to the SciTech MGL Public -* License Version 1.0 (the "License"); you may not use this file -* except in compliance with the License. You may obtain a copy of -* the License at http://www.scitechsoft.com/mgl-license.txt -* -* Software distributed under the License is distributed on an -* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or -* implied. See the License for the specific language governing -* rights and limitations under the License. -* -* The Original Code is Copyright (C) 1991-1998 SciTech Software, Inc. -* -* The Initial Developer of the Original Code is SciTech Software, Inc. -* All Rights Reserved. -* -* ======================================================================== -* -* Language: ANSI C -* Environment: Any -* -* Description: Test program to test out the cross platform event handling -* library. -* -****************************************************************************/ - -#include -#include -#include -#include "pmapi.h" -#include "event.h" - -/* Translation table for key codes */ - -typedef struct { - int code; - char *name; - } KeyEntry; - -KeyEntry ASCIICodes[] = { - {ASCII_ctrlA ,"ASCII_ctrlA"}, - {ASCII_ctrlB ,"ASCII_ctrlB"}, - {ASCII_ctrlC ,"ASCII_ctrlC"}, - {ASCII_ctrlD ,"ASCII_ctrlD"}, - {ASCII_ctrlE ,"ASCII_ctrlE"}, - {ASCII_ctrlF ,"ASCII_ctrlF"}, - {ASCII_ctrlG ,"ASCII_ctrlG"}, - {ASCII_backspace ,"ASCII_backspace"}, - {ASCII_ctrlH ,"ASCII_ctrlH"}, - {ASCII_tab ,"ASCII_tab"}, - {ASCII_ctrlI ,"ASCII_ctrlI"}, - {ASCII_ctrlJ ,"ASCII_ctrlJ"}, - {ASCII_ctrlK ,"ASCII_ctrlK"}, - {ASCII_ctrlL ,"ASCII_ctrlL"}, - {ASCII_enter ,"ASCII_enter"}, - {ASCII_ctrlM ,"ASCII_ctrlM"}, - {ASCII_ctrlN ,"ASCII_ctrlN"}, - {ASCII_ctrlO ,"ASCII_ctrlO"}, - {ASCII_ctrlP ,"ASCII_ctrlP"}, - {ASCII_ctrlQ ,"ASCII_ctrlQ"}, - {ASCII_ctrlR ,"ASCII_ctrlR"}, - {ASCII_ctrlS ,"ASCII_ctrlS"}, - {ASCII_ctrlT ,"ASCII_ctrlT"}, - {ASCII_ctrlU ,"ASCII_ctrlU"}, - {ASCII_ctrlV ,"ASCII_ctrlV"}, - {ASCII_ctrlW ,"ASCII_ctrlW"}, - {ASCII_ctrlX ,"ASCII_ctrlX"}, - {ASCII_ctrlY ,"ASCII_ctrlY"}, - {ASCII_ctrlZ ,"ASCII_ctrlZ"}, - {ASCII_esc ,"ASCII_esc"}, - {ASCII_space ,"ASCII_space"}, - {ASCII_exclamation ,"ASCII_exclamation"}, - {ASCII_quote ,"ASCII_quote"}, - {ASCII_pound ,"ASCII_pound"}, - {ASCII_dollar ,"ASCII_dollar"}, - {ASCII_percent ,"ASCII_percent"}, - {ASCII_ampersand ,"ASCII_ampersand"}, - {ASCII_apostrophe ,"ASCII_apostrophe"}, - {ASCII_leftBrace ,"ASCII_leftBrace"}, - {ASCII_rightBrace ,"ASCII_rightBrace"}, - {ASCII_times ,"ASCII_times"}, - {ASCII_plus ,"ASCII_plus"}, - {ASCII_comma ,"ASCII_comma"}, - {ASCII_minus ,"ASCII_minus"}, - {ASCII_period ,"ASCII_period"}, - {ASCII_divide ,"ASCII_divide"}, - {ASCII_0 ,"ASCII_0"}, - {ASCII_1 ,"ASCII_1"}, - {ASCII_2 ,"ASCII_2"}, - {ASCII_3 ,"ASCII_3"}, - {ASCII_4 ,"ASCII_4"}, - {ASCII_5 ,"ASCII_5"}, - {ASCII_6 ,"ASCII_6"}, - {ASCII_7 ,"ASCII_7"}, - {ASCII_8 ,"ASCII_8"}, - {ASCII_9 ,"ASCII_9"}, - {ASCII_colon ,"ASCII_colon"}, - {ASCII_semicolon ,"ASCII_semicolon"}, - {ASCII_lessThan ,"ASCII_lessThan"}, - {ASCII_equals ,"ASCII_equals"}, - {ASCII_greaterThan ,"ASCII_greaterThan"}, - {ASCII_question ,"ASCII_question"}, - {ASCII_at ,"ASCII_at"}, - {ASCII_A ,"ASCII_A"}, - {ASCII_B ,"ASCII_B"}, - {ASCII_C ,"ASCII_C"}, - {ASCII_D ,"ASCII_D"}, - {ASCII_E ,"ASCII_E"}, - {ASCII_F ,"ASCII_F"}, - {ASCII_G ,"ASCII_G"}, - {ASCII_H ,"ASCII_H"}, - {ASCII_I ,"ASCII_I"}, - {ASCII_J ,"ASCII_J"}, - {ASCII_K ,"ASCII_K"}, - {ASCII_L ,"ASCII_L"}, - {ASCII_M ,"ASCII_M"}, - {ASCII_N ,"ASCII_N"}, - {ASCII_O ,"ASCII_O"}, - {ASCII_P ,"ASCII_P"}, - {ASCII_Q ,"ASCII_Q"}, - {ASCII_R ,"ASCII_R"}, - {ASCII_S ,"ASCII_S"}, - {ASCII_T ,"ASCII_T"}, - {ASCII_U ,"ASCII_U"}, - {ASCII_V ,"ASCII_V"}, - {ASCII_W ,"ASCII_W"}, - {ASCII_X ,"ASCII_X"}, - {ASCII_Y ,"ASCII_Y"}, - {ASCII_Z ,"ASCII_Z"}, - {ASCII_leftSquareBrace ,"ASCII_leftSquareBrace"}, - {ASCII_backSlash ,"ASCII_backSlash"}, - {ASCII_rightSquareBrace ,"ASCII_rightSquareBrace"}, - {ASCII_caret ,"ASCII_caret"}, - {ASCII_underscore ,"ASCII_underscore"}, - {ASCII_leftApostrophe ,"ASCII_leftApostrophe"}, - {ASCII_a ,"ASCII_a"}, - {ASCII_b ,"ASCII_b"}, - {ASCII_c ,"ASCII_c"}, - {ASCII_d ,"ASCII_d"}, - {ASCII_e ,"ASCII_e"}, - {ASCII_f ,"ASCII_f"}, - {ASCII_g ,"ASCII_g"}, - {ASCII_h ,"ASCII_h"}, - {ASCII_i ,"ASCII_i"}, - {ASCII_j ,"ASCII_j"}, - {ASCII_k ,"ASCII_k"}, - {ASCII_l ,"ASCII_l"}, - {ASCII_m ,"ASCII_m"}, - {ASCII_n ,"ASCII_n"}, - {ASCII_o ,"ASCII_o"}, - {ASCII_p ,"ASCII_p"}, - {ASCII_q ,"ASCII_q"}, - {ASCII_r ,"ASCII_r"}, - {ASCII_s ,"ASCII_s"}, - {ASCII_t ,"ASCII_t"}, - {ASCII_u ,"ASCII_u"}, - {ASCII_v ,"ASCII_v"}, - {ASCII_w ,"ASCII_w"}, - {ASCII_x ,"ASCII_x"}, - {ASCII_y ,"ASCII_y"}, - {ASCII_z ,"ASCII_z"}, - {ASCII_leftCurlyBrace ,"ASCII_leftCurlyBrace"}, - {ASCII_verticalBar ,"ASCII_verticalBar"}, - {ASCII_rightCurlyBrace ,"ASCII_rightCurlyBrace"}, - {ASCII_tilde ,"ASCII_tilde"}, - {0 ,"ASCII_unknown"}, - }; - -KeyEntry ScanCodes[] = { - {KB_padEnter ,"KB_padEnter"}, - {KB_padMinus ,"KB_padMinus"}, - {KB_padPlus ,"KB_padPlus"}, - {KB_padTimes ,"KB_padTimes"}, - {KB_padDivide ,"KB_padDivide"}, - {KB_padLeft ,"KB_padLeft"}, - {KB_padRight ,"KB_padRight"}, - {KB_padUp ,"KB_padUp"}, - {KB_padDown ,"KB_padDown"}, - {KB_padInsert ,"KB_padInsert"}, - {KB_padDelete ,"KB_padDelete"}, - {KB_padHome ,"KB_padHome"}, - {KB_padEnd ,"KB_padEnd"}, - {KB_padPageUp ,"KB_padPageUp"}, - {KB_padPageDown ,"KB_padPageDown"}, - {KB_padCenter ,"KB_padCenter"}, - {KB_F1 ,"KB_F1"}, - {KB_F2 ,"KB_F2"}, - {KB_F3 ,"KB_F3"}, - {KB_F4 ,"KB_F4"}, - {KB_F5 ,"KB_F5"}, - {KB_F6 ,"KB_F6"}, - {KB_F7 ,"KB_F7"}, - {KB_F8 ,"KB_F8"}, - {KB_F9 ,"KB_F9"}, - {KB_F10 ,"KB_F10"}, - {KB_F11 ,"KB_F11"}, - {KB_F12 ,"KB_F12"}, - {KB_left ,"KB_left"}, - {KB_right ,"KB_right"}, - {KB_up ,"KB_up"}, - {KB_down ,"KB_down"}, - {KB_insert ,"KB_insert"}, - {KB_delete ,"KB_delete"}, - {KB_home ,"KB_home"}, - {KB_end ,"KB_end"}, - {KB_pageUp ,"KB_pageUp"}, - {KB_pageDown ,"KB_pageDown"}, - {KB_capsLock ,"KB_capsLock"}, - {KB_numLock ,"KB_numLock"}, - {KB_scrollLock ,"KB_scrollLock"}, - {KB_leftShift ,"KB_leftShift"}, - {KB_rightShift ,"KB_rightShift"}, - {KB_leftCtrl ,"KB_leftCtrl"}, - {KB_rightCtrl ,"KB_rightCtrl"}, - {KB_leftAlt ,"KB_leftAlt"}, - {KB_rightAlt ,"KB_rightAlt"}, - {KB_leftWindows ,"KB_leftWindows"}, - {KB_rightWindows ,"KB_rightWindows"}, - {KB_menu ,"KB_menu"}, - {KB_sysReq ,"KB_sysReq"}, - {KB_esc ,"KB_esc"}, - {KB_1 ,"KB_1"}, - {KB_2 ,"KB_2"}, - {KB_3 ,"KB_3"}, - {KB_4 ,"KB_4"}, - {KB_5 ,"KB_5"}, - {KB_6 ,"KB_6"}, - {KB_7 ,"KB_7"}, - {KB_8 ,"KB_8"}, - {KB_9 ,"KB_9"}, - {KB_0 ,"KB_0"}, - {KB_minus ,"KB_minus"}, - {KB_equals ,"KB_equals"}, - {KB_backSlash ,"KB_backSlash"}, - {KB_backspace ,"KB_backspace"}, - {KB_tab ,"KB_tab"}, - {KB_Q ,"KB_Q"}, - {KB_W ,"KB_W"}, - {KB_E ,"KB_E"}, - {KB_R ,"KB_R"}, - {KB_T ,"KB_T"}, - {KB_Y ,"KB_Y"}, - {KB_U ,"KB_U"}, - {KB_I ,"KB_I"}, - {KB_O ,"KB_O"}, - {KB_P ,"KB_P"}, - {KB_leftSquareBrace ,"KB_leftSquareBrace"}, - {KB_rightSquareBrace ,"KB_rightSquareBrace"}, - {KB_enter ,"KB_enter"}, - {KB_A ,"KB_A"}, - {KB_S ,"KB_S"}, - {KB_D ,"KB_D"}, - {KB_F ,"KB_F"}, - {KB_G ,"KB_G"}, - {KB_H ,"KB_H"}, - {KB_J ,"KB_J"}, - {KB_K ,"KB_K"}, - {KB_L ,"KB_L"}, - {KB_semicolon ,"KB_semicolon"}, - {KB_apostrophe ,"KB_apostrophe"}, - {KB_Z ,"KB_Z"}, - {KB_X ,"KB_X"}, - {KB_C ,"KB_C"}, - {KB_V ,"KB_V"}, - {KB_B ,"KB_B"}, - {KB_N ,"KB_N"}, - {KB_M ,"KB_M"}, - {KB_comma ,"KB_comma"}, - {KB_period ,"KB_period"}, - {KB_divide ,"KB_divide"}, - {KB_space ,"KB_space"}, - {KB_tilde ,"KB_tilde"}, - {0 ,"KB_unknown"}, - }; - -/**************************************************************************** -PARAMETERS: -x - X coordinate of the mouse cursor position (screen coordinates) -y - Y coordinate of the mouse cursor position (screen coordinates) - -REMARKS: -This gets called periodically to move the mouse. It will get called when -the mouse may not have actually moved, so check if it has before redrawing -it. -****************************************************************************/ -void EVTAPI moveMouse( - int x, - int y) -{ -} - -/**************************************************************************** -PARAMETERS: -code - Code to translate -keys - Table of translation key values to look up - -REMARKS: -Simple function to look up the printable name for the keyboard code. -****************************************************************************/ -KeyEntry *FindKey( - int code, - KeyEntry *keys) -{ - KeyEntry *key; - - for (key = keys; key->code != 0; key++) { - if (key->code == code) - break; - } - return key; -} - -/**************************************************************************** -PARAMETERS: -evt - Event to display modifiers for - -REMARKS: -Function to display shift modifiers flags -****************************************************************************/ -void DisplayModifiers( - event_t *evt) -{ - if (evt->modifiers & EVT_LEFTBUT) - printf(", LBUT"); - if (evt->modifiers & EVT_RIGHTBUT) - printf(", RBUT"); - if (evt->modifiers & EVT_MIDDLEBUT) - 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_CTRLSTATE) { - 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"); - } -} - -/**************************************************************************** -PARAMETERS: -msg - Message to display for type of event -evt - Event to display - -REMARKS: -Function to display the status of the keyboard event to the screen. -****************************************************************************/ -void DisplayKey( - char *msg, - event_t *evt) -{ - KeyEntry *ascii,*scan; - char ch = EVT_asciiCode(evt->message); - - 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 : ' '); - DisplayModifiers(evt); - printf("\n"); -} - -/**************************************************************************** -PARAMETERS: -msg - Message to display for type of event -evt - Event to display - -REMARKS: -Function to display the status of the mouse event to the screen. -****************************************************************************/ -void DisplayMouse( - char *msg, - event_t *evt) -{ - printf("%s: ", msg); - if (evt->message & EVT_LEFTBMASK) - printf("LEFT "); - if (evt->message & EVT_RIGHTBMASK) - printf("RIGHT "); - if (evt->message & EVT_MIDDLEBMASK) - 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("\n"); -} - -/**************************************************************************** -PARAMETERS: -msg - Message to display for type of event -evt - Event to display - -REMARKS: -Function to display the status of the joystick event to the screen. -****************************************************************************/ -void DisplayJoy( - char *msg, - 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'); -} - -/**************************************************************************** -REMARKS: -Joystick calibration routine -****************************************************************************/ -void CalibrateJoy(void) -{ - event_t evt; - if(EVT_joyIsPresent()){ - printf("Joystick Calibration\nMove the joystick to the upper left corner and press any button.\n"); - EVT_halt(&evt, EVT_JOYCLICK); - EVT_halt(&evt, EVT_JOYCLICK); - EVT_joySetUpperLeft(); - printf("Move the joystick to the lower right corner and press any button.\n"); - EVT_halt(&evt, EVT_JOYCLICK); - EVT_halt(&evt, EVT_JOYCLICK); - EVT_joySetLowerRight(); - printf("Move the joystick to center position and press any button.\n"); - EVT_halt(&evt, EVT_JOYCLICK); - EVT_halt(&evt, EVT_JOYCLICK); - EVT_joySetCenter(); - printf("Joystick calibrated\n"); - } -} - -/**************************************************************************** -REMARKS: -Main program entry point -****************************************************************************/ -int main(void) -{ - event_t evt; - ibool done = false; - PM_HWND hwndConsole; - - hwndConsole = PM_openConsole(0,0,0,0,0,true); - EVT_init(&moveMouse); - 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_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 deleted file mode 100644 index 67ad245..0000000 --- a/board/MAI/bios_emulator/scitech/src/pm/tests/isvesa.c +++ /dev/null @@ -1,110 +0,0 @@ -/**************************************************************************** -* -* SciTech OS Portability Manager Library -* -* ======================================================================== -* -* The contents of this file are subject to the SciTech MGL Public -* License Version 1.0 (the "License"); you may not use this file -* except in compliance with the License. You may obtain a copy of -* the License at http://www.scitechsoft.com/mgl-license.txt -* -* Software distributed under the License is distributed on an -* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or -* implied. See the License for the specific language governing -* rights and limitations under the License. -* -* The Original Code is Copyright (C) 1991-1998 SciTech Software, Inc. -* -* The Initial Developer of the Original Code is SciTech Software, Inc. -* All Rights Reserved. -* -* ======================================================================== -* -* Language: ANSI C -* Environment: any -* -* Description: Test program to check the ability to allocate real mode -* memory and to call real mode interrupt handlers such as -* the VESA VBE BIOS from protected mode. Compile and link -* with the appropriate command line for your DOS extender. -* -* Functions tested: PM_getVESABuf() -* PM_mapRealPointer() -* PM_int86x() -* -****************************************************************************/ - -#include -#include -#include -#include "pmapi.h" - -/* SuperVGA information block */ - -#pragma pack(1) - -typedef struct { - char VESASignature[4]; /* 'VESA' 4 byte signature */ - short VESAVersion; /* VBE version number */ - ulong OEMStringPtr; /* Far pointer to OEM string */ - ulong Capabilities; /* Capabilities of video card */ - ulong VideoModePtr; /* Far pointer to supported modes */ - short TotalMemory; /* Number of 64kb memory blocks */ - char reserved[236]; /* Pad to 256 byte block size */ - } VgaInfoBlock; - -#pragma pack() - -int main(void) -{ - RMREGS regs; - RMSREGS sregs; - VgaInfoBlock vgaInfo; - ushort *mode; - uint vgLen; - uchar *vgPtr; - unsigned r_vgseg,r_vgoff; - - 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; - } - - /* 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); - } - - /* Call the VESA VBE to see if it is out there */ - regs.x.ax = 0x4F00; - regs.x.di = r_vgoff; - sregs.es = r_vgseg; - memcpy(vgPtr,"VBE2",4); - 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++; - } - } - else - 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 deleted file mode 100644 index dba8885..0000000 --- a/board/MAI/bios_emulator/scitech/src/pm/tests/key.c +++ /dev/null @@ -1,92 +0,0 @@ -/**************************************************************************** -* -* SciTech OS Portability Manager Library -* -* ======================================================================== -* -* The contents of this file are subject to the SciTech MGL Public -* License Version 1.0 (the "License"); you may not use this file -* except in compliance with the License. You may obtain a copy of -* the License at http://www.scitechsoft.com/mgl-license.txt -* -* Software distributed under the License is distributed on an -* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or -* implied. See the License for the specific language governing -* rights and limitations under the License. -* -* The Original Code is Copyright (C) 1991-1998 SciTech Software, Inc. -* -* The Initial Developer of the Original Code is SciTech Software, Inc. -* All Rights Reserved. -* -* ======================================================================== -* -* -* Language: ANSI C -* Environment: any -* -* Description: Test program to check the ability to install a C based -* keyboard interrupt handler. -* -* Functions tested: PM_setKeyHandler() -* PM_chainPrevKey() -* PM_restoreKeyHandler() -* -* -****************************************************************************/ - -#include -#include -#include "pmapi.h" - -volatile long count = 0; - -#pragma off (check_stack) /* No stack checking under Watcom */ - -void PMAPI keyHandler(void) -{ - count++; - PM_chainPrevKey(); /* Chain to previous handler */ -} - -int main(void) -{ - int ch; - PM_lockHandle lh; - - 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; - } - - /* 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 - * function is well less than 100 bytes (and an entire 4k page will - * need to be locked by the server anyway). - */ - PM_lockCodePages((__codePtr)keyHandler,100,&lh); - PM_lockDataPages((void*)&count,sizeof(count),&lh); - PM_installBreakHandler(); /* We *DONT* want Ctrl-Breaks! */ - PM_setKeyHandler(keyHandler); - 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); - } - - PM_restoreKeyHandler(); - PM_restoreBreakHandler(); - PM_unlockDataPages((void*)&count,sizeof(count),&lh); - PM_unlockCodePages((__codePtr)keyHandler,100,&lh); - printf("\n\nKeyboard handler was called %ld times\n", count); - return 0; -} diff --git a/board/MAI/bios_emulator/scitech/src/pm/tests/key15.c b/board/MAI/bios_emulator/scitech/src/pm/tests/key15.c deleted file mode 100644 index b0b94be..0000000 --- a/board/MAI/bios_emulator/scitech/src/pm/tests/key15.c +++ /dev/null @@ -1,96 +0,0 @@ -/**************************************************************************** -* -* SciTech OS Portability Manager Library -* -* ======================================================================== -* -* The contents of this file are subject to the SciTech MGL Public -* License Version 1.0 (the "License"); you may not use this file -* except in compliance with the License. You may obtain a copy of -* the License at http://www.scitechsoft.com/mgl-license.txt -* -* Software distributed under the License is distributed on an -* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or -* implied. See the License for the specific language governing -* rights and limitations under the License. -* -* The Original Code is Copyright (C) 1991-1998 SciTech Software, Inc. -* -* The Initial Developer of the Original Code is SciTech Software, Inc. -* All Rights Reserved. -* -* ======================================================================== -* -* -* Language: ANSI C -* Environment: any -* -* Description: Test program to check the ability to install a C based -* keyboard Int 15h interrupt handler. This is an alternate -* way to intercept scancodes from the keyboard by hooking -* the Int 15h keyboard intercept callout. -* -* Functions tested: PM_setKey15Handler() -* PM_restoreKey15Handler() -* -* -****************************************************************************/ - -#include -#include -#include "pmapi.h" - -volatile long count = 0; -volatile short lastScanCode = 0; - -#pragma off (check_stack) /* No stack checking under Watcom */ - -short PMAPI keyHandler(short scanCode) -{ - count++; - lastScanCode = scanCode; - return scanCode; /* Let BIOS process as normal */ -} - -int main(void) -{ - int ch; - PM_lockHandle lh; - - 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; - } - - /* 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 - * function is well less than 100 bytes (and an entire 4k page will - * need to be locked by the server anyway). - */ - PM_lockCodePages((__codePtr)keyHandler,100,&lh); - PM_lockDataPages((void*)&count,sizeof(count),&lh); - PM_installBreakHandler(); /* We *DONT* want Ctrl-Break's! */ - PM_setKey15Handler(keyHandler); - 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); - } - - PM_restoreKey15Handler(); - PM_restoreBreakHandler(); - PM_unlockDataPages((void*)&count,sizeof(count),&lh); - PM_unlockCodePages((__codePtr)keyHandler,100,&lh); - printf("\n\nKeyboard handler was called %ld times\n", count); - printf("Last scan code %04X\n", lastScanCode); - return 0; -} diff --git a/board/MAI/bios_emulator/scitech/src/pm/tests/memtest.c b/board/MAI/bios_emulator/scitech/src/pm/tests/memtest.c deleted file mode 100644 index a2c655b..0000000 --- a/board/MAI/bios_emulator/scitech/src/pm/tests/memtest.c +++ /dev/null @@ -1,106 +0,0 @@ -/**************************************************************************** -* -* SciTech OS Portability Manager Library -* -* ======================================================================== -* -* The contents of this file are subject to the SciTech MGL Public -* License Version 1.0 (the "License"); you may not use this file -* except in compliance with the License. You may obtain a copy of -* the License at http://www.scitechsoft.com/mgl-license.txt -* -* Software distributed under the License is distributed on an -* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or -* implied. See the License for the specific language governing -* rights and limitations under the License. -* -* The Original Code is Copyright (C) 1991-1998 SciTech Software, Inc. -* -* The Initial Developer of the Original Code is SciTech Software, Inc. -* All Rights Reserved. -* -* ======================================================================== -* -* -* Language: ANSI C -* Environment: any -* -* Description: Test program to determine just how much memory can be -* allocated with the compiler in use. Compile and link -* with the appropriate command line for your DOS extender. -* -* Functions tested: PM_malloc() -* PM_availableMemory() -* -* -****************************************************************************/ - -#include -#include -#include -#include -#include "pmapi.h" - -#ifdef __16BIT__ -#define MAXALLOC 64 -#else -#define MAXALLOC 2000 -#endif - -int main(void) -{ - int i; - ulong allocs; - ulong physical,total; - char *p,*pa[MAXALLOC]; - - 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; - } - - printf("Memory available at start:\n"); - PM_availableMemory(&physical,&total); - printf(" Physical memory: %ld Kb\n", physical / 1024); - 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; - } - - printf("\n\nAllocated total of %lu bytes\n", 10 * (allocs << 10)); - - printf("\nMemory available at end:\n"); - PM_availableMemory(&physical,&total); - printf(" Physical memory: %ld Kb\n", physical / 1024); - printf(" Total (including virtual): %ld Kb\n", total / 1024); - - for (i = allocs-1; i >= 0; 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"); - PM_availableMemory(&physical,&total); - printf(" Physical memory: %ld Kb\n", physical / 1024); - printf(" Total (including virtual): %ld Kb\n", total / 1024); - - return 0; -} diff --git a/board/MAI/bios_emulator/scitech/src/pm/tests/mouse.c b/board/MAI/bios_emulator/scitech/src/pm/tests/mouse.c deleted file mode 100644 index 2765a0d..0000000 --- a/board/MAI/bios_emulator/scitech/src/pm/tests/mouse.c +++ /dev/null @@ -1,109 +0,0 @@ -/**************************************************************************** -* -* SciTech OS Portability Manager Library -* -* ======================================================================== -* -* The contents of this file are subject to the SciTech MGL Public -* License Version 1.0 (the "License"); you may not use this file -* except in compliance with the License. You may obtain a copy of -* the License at http://www.scitechsoft.com/mgl-license.txt -* -* Software distributed under the License is distributed on an -* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or -* implied. See the License for the specific language governing -* rights and limitations under the License. -* -* The Original Code is Copyright (C) 1991-1998 SciTech Software, Inc. -* -* The Initial Developer of the Original Code is SciTech Software, Inc. -* All Rights Reserved. -* -* ======================================================================== -* -* -* Language: ANSI C -* Environment: any -* -* Description: Test program to check the ability to install an assembly -* language mouse interrupt handler. We use assembly language -* as it must be a far function and should swap to a local -* 32 bit stack if it is going to call any C based code (which -* we do in this example). -* -* Functions tested: PM_installMouseHandler() -* PM_int86() -* -* -****************************************************************************/ - -#include -#include -#include "pmapi.h" - -volatile long count = 0; - -#pragma off (check_stack) /* No stack checking under Watcom */ - -void PMAPI mouseHandler( - uint mask, - uint butstate, - int x, - int y, - int mickeyX, - int mickeyY) -{ - mask = mask; /* We dont use any of the parameters */ - butstate = butstate; - x = x; - y = y; - mickeyX = mickeyX; - mickeyY = mickeyY; - count++; -} - -int main(void) -{ - RMREGS regs; - PM_lockHandle lh; - - 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; - } - - 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); - } - - /* 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 - * function is well less than 100 bytes (and an entire 4k page will - * need to be locked by the server anyway). - */ - 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("Mouse handler installed - Hit any key to exit\n"); - PM_getch(); - - PM_restoreMouseHandler(); - PM_unlockDataPages((void*)&count,sizeof(count),&lh); - PM_unlockCodePages((__codePtr)mouseHandler,100,&lh); - printf("Mouse handler was called %ld times\n", count); - return 0; -} diff --git a/board/MAI/bios_emulator/scitech/src/pm/tests/restore.c b/board/MAI/bios_emulator/scitech/src/pm/tests/restore.c deleted file mode 100644 index e00be75..0000000 --- a/board/MAI/bios_emulator/scitech/src/pm/tests/restore.c +++ /dev/null @@ -1,81 +0,0 @@ -/**************************************************************************** -* -* SciTech OS Portability Manager Library -* -* ======================================================================== -* -* The contents of this file are subject to the SciTech MGL Public -* License Version 1.0 (the "License"); you may not use this file -* except in compliance with the License. You may obtain a copy of -* the License at http://www.scitechsoft.com/mgl-license.txt -* -* Software distributed under the License is distributed on an -* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or -* implied. See the License for the specific language governing -* rights and limitations under the License. -* -* The Original Code is Copyright (C) 1991-1998 SciTech Software, Inc. -* -* The Initial Developer of the Original Code is SciTech Software, Inc. -* All Rights Reserved. -* -* ======================================================================== -* -* Language: ANSI C -* Environment: Linux/QNX -* -* Description: Program to restore the console state state from a previously -* saved state if the program crashed while the console -* was in graphics mode. -* -****************************************************************************/ - -#include -#include -#include "pmapi.h" - -void setVideoMode(int mode) -{ - RMREGS r; - - r.x.ax = mode; - PM_int86(0x10, &r, &r); -} - -int main(void) -{ - PM_HWND hwndConsole; - 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; - } - fread(&stateSize,1,sizeof(stateSize),f); - if (stateSize != PM_getConsoleStateSize()) { - 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; - } - fread(stateBuf,1,stateSize,f); - fclose(f); - - /* Open the console */ - hwndConsole = PM_openConsole(0,0,0,0,0,true); - - /* Forcibly set 80x25 text mode using the BIOS */ - setVideoMode(0x3); - - /* Restore the previous console state */ - PM_restoreConsoleState(stateBuf,0); - PM_closeConsole(hwndConsole); - PM_free(stateBuf); - 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 deleted file mode 100644 index acef922..0000000 --- a/board/MAI/bios_emulator/scitech/src/pm/tests/rtc.c +++ /dev/null @@ -1,92 +0,0 @@ -/**************************************************************************** -* -* SciTech OS Portability Manager Library -* -* ======================================================================== -* -* The contents of this file are subject to the SciTech MGL Public -* License Version 1.0 (the "License"); you may not use this file -* except in compliance with the License. You may obtain a copy of -* the License at http://www.scitechsoft.com/mgl-license.txt -* -* Software distributed under the License is distributed on an -* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or -* implied. See the License for the specific language governing -* rights and limitations under the License. -* -* The Original Code is Copyright (C) 1991-1998 SciTech Software, Inc. -* -* The Initial Developer of the Original Code is SciTech Software, Inc. -* All Rights Reserved. -* -* ======================================================================== -* -* Language: ANSI C -* Environment: any -* -* Description: Test program to check the ability to install a C based -* Real Time Clock interrupt handler. -* -* Functions tested: PM_setRealTimeClockHandler() -* PM_restoreRealTimeClockHandler() -* -****************************************************************************/ - -#include -#include -#include "pmapi.h" - -volatile long count = 0; - -#pragma off (check_stack) /* No stack checking under Watcom */ - -void PMAPI RTCHandler(void) -{ - count++; -} - -int main(void) -{ - long oldCount; - PM_lockHandle lh; - - 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; - } - - /* 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 - * function is well less than 100 bytes (and an entire 4k page will - * need to be locked by the server anyway). - */ - PM_lockCodePages((__codePtr)RTCHandler,100,&lh); - PM_lockDataPages((void*)&count,sizeof(count),&lh); - PM_installBreakHandler(); /* We *DONT* want Ctrl-Breaks! */ - PM_setRealTimeClockHandler(RTCHandler,128); - 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; - } - } - - PM_restoreRealTimeClockHandler(); - PM_restoreBreakHandler(); - PM_unlockDataPages((void*)&count,sizeof(count),&lh); - PM_unlockCodePages((__codePtr)RTCHandler,100,&lh); - printf("RealTimeClock handler was called %ld times\n", count); - return 0; -} diff --git a/board/MAI/bios_emulator/scitech/src/pm/tests/save.c b/board/MAI/bios_emulator/scitech/src/pm/tests/save.c deleted file mode 100644 index f732456..0000000 --- a/board/MAI/bios_emulator/scitech/src/pm/tests/save.c +++ /dev/null @@ -1,69 +0,0 @@ -/**************************************************************************** -* -* SciTech OS Portability Manager Library -* -* ======================================================================== -* -* The contents of this file are subject to the SciTech MGL Public -* License Version 1.0 (the "License"); you may not use this file -* except in compliance with the License. You may obtain a copy of -* the License at http://www.scitechsoft.com/mgl-license.txt -* -* Software distributed under the License is distributed on an -* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or -* implied. See the License for the specific language governing -* rights and limitations under the License. -* -* The Original Code is Copyright (C) 1991-1998 SciTech Software, Inc. -* -* The Initial Developer of the Original Code is SciTech Software, Inc. -* All Rights Reserved. -* -* ======================================================================== -* -* Language: ANSI C -* Environment: Linux/QNX -* -* Description: Program to save the console state state so that it can -* be later restored if the program crashed while the console -* was in graphics mode. -* -****************************************************************************/ - -#include -#include -#include "pmapi.h" - -int main(void) -{ - PM_HWND hwndConsole; - ulong stateSize; - void *stateBuf; - FILE *f; - - /* Allocate a buffer to save console state and save the state */ - 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_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"); - else { - 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 deleted file mode 100644 index be275e1..0000000 --- a/board/MAI/bios_emulator/scitech/src/pm/tests/showpci.c +++ /dev/null @@ -1,253 +0,0 @@ -/**************************************************************************** -* -* SciTech OS Portability Manager Library -* -* ======================================================================== -* -* The contents of this file are subject to the SciTech MGL Public -* License Version 1.0 (the "License"); you may not use this file -* except in compliance with the License. You may obtain a copy of -* the License at http://www.scitechsoft.com/mgl-license.txt -* -* Software distributed under the License is distributed on an -* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or -* implied. See the License for the specific language governing -* rights and limitations under the License. -* -* The Original Code is Copyright (C) 1991-1998 SciTech Software, Inc. -* -* The Initial Developer of the Original Code is SciTech Software, Inc. -* All Rights Reserved. -* -* ======================================================================== -* -* Language: ANSI C -* Environment: any -* -* Description: Test program to test the PCI library functions. -* -****************************************************************************/ - -#include "pmapi.h" -#include "pcilib.h" -#include -#include -#include -#include - -/*------------------------- Global Variables ------------------------------*/ - -static int NumPCI = -1; -static PCIDeviceInfo *PCI; -static int *BridgeIndex; -static int *DeviceIndex; -static int NumBridges; -static PCIDeviceInfo *AGPBridge = NULL; -static int NumDevices; - -/*-------------------------- Implementation -------------------------------*/ - -/**************************************************************************** -REMARKS: -Enumerates the PCI bus and dumps the PCI configuration information to the -log file. -****************************************************************************/ -static void EnumeratePCI(void) -{ - int i,index; - PCIDeviceInfo *info; - - printf("Displaying enumeration of PCI bus (%d devices, %d display devices)\n", - NumPCI, NumDevices); - for (index = 0; index < NumDevices; 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("\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("\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("\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("\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); - } - printf("\n"); -} - -/**************************************************************************** -RETURNS: -Number of display devices found. - -REMARKS: -This function enumerates the number of available display devices on the -PCI bus, and returns the number found. -****************************************************************************/ -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 (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; - - /* 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; - } - } - } - } - } - - /* Enumerate all PCI and bridge devices to standard output */ - EnumeratePCI(); - } - return NumDevices; -} - -int main(void) -{ - /* Enumerate all PCI devices */ - PM_init(); - if (PCI_enumerateDevices() < 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 deleted file mode 100644 index 378725e..0000000 --- a/board/MAI/bios_emulator/scitech/src/pm/tests/tick.c +++ /dev/null @@ -1,94 +0,0 @@ -/**************************************************************************** -* -* SciTech OS Portability Manager Library -* -* ======================================================================== -* -* The contents of this file are subject to the SciTech MGL Public -* License Version 1.0 (the "License"); you may not use this file -* except in compliance with the License. You may obtain a copy of -* the License at http://www.scitechsoft.com/mgl-license.txt -* -* Software distributed under the License is distributed on an -* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or -* implied. See the License for the specific language governing -* rights and limitations under the License. -* -* The Original Code is Copyright (C) 1991-1998 SciTech Software, Inc. -* -* The Initial Developer of the Original Code is SciTech Software, Inc. -* All Rights Reserved. -* -* ======================================================================== -* -* Language: ANSI C -* Environment: any -* -* Description: Test program to check the ability to install a C based -* timer interrupt handler. -* -* Functions tested: PM_setTimerHandler() -* PM_chainPrevTimer(); -* PM_restoreTimerHandler() -* -****************************************************************************/ - -#include -#include -#include "pmapi.h" - -volatile long count = 0; - -#pragma off (check_stack) /* No stack checking under Watcom */ - -void PMAPI timerHandler(void) -{ - PM_chainPrevTimer(); /* Chain to previous handler */ - count++; -} - -int main(void) -{ - long oldCount; - PM_lockHandle lh; - - 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; - } - - /* 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 - * function is well less than 100 bytes (and an entire 4k page will - * need to be locked by the server anyway). - */ - PM_lockCodePages((__codePtr)timerHandler,100,&lh); - PM_lockDataPages((void*)&count,sizeof(count),&lh); - PM_installBreakHandler(); /* We *DONT* want Ctrl-Breaks! */ - PM_setTimerHandler(timerHandler); - 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; - } - } - - PM_restoreTimerHandler(); - PM_restoreBreakHandler(); - PM_unlockDataPages((void*)&count,sizeof(count),&lh); - PM_unlockCodePages((__codePtr)timerHandler,100,&lh); - printf("Timer handler was called %ld times\n", count); - return 0; -} diff --git a/board/MAI/bios_emulator/scitech/src/pm/tests/timerc.c b/board/MAI/bios_emulator/scitech/src/pm/tests/timerc.c deleted file mode 100644 index 7fa77b7..0000000 --- a/board/MAI/bios_emulator/scitech/src/pm/tests/timerc.c +++ /dev/null @@ -1,87 +0,0 @@ -/**************************************************************************** -* -* SciTech OS Portability Manager Library -* -* ======================================================================== -* -* The contents of this file are subject to the SciTech MGL Public -* License Version 1.0 (the "License"); you may not use this file -* except in compliance with the License. You may obtain a copy of -* the License at http://www.scitechsoft.com/mgl-license.txt -* -* Software distributed under the License is distributed on an -* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or -* implied. See the License for the specific language governing -* rights and limitations under the License. -* -* The Original Code is Copyright (C) 1991-1998 SciTech Software, Inc. -* -* The Initial Developer of the Original Code is SciTech Software, Inc. -* All Rights Reserved. -* -* ======================================================================== -* -* Language: ANSI C -* Environment: Any -* -* Description: Test program for the Zen Timer Library. -* -****************************************************************************/ - -#include -#include "pmapi.h" -#include "ztimer.h" - -#define DELAY_SECS 10 - -/*-------------------------- Implementation -------------------------------*/ - -/* The following routine takes a long count in microseconds and outputs - * a string representing the count in seconds. It could be modified to - * return a pointer to a static string representing the count rather - * than printing it out. - */ - -void ReportTime(ulong count) -{ - ulong secs; - - secs = count / 1000000L; - count = count - secs * 1000000L; - printf("Time taken: %lu.%06lu seconds\n",secs,count); -} - -int i,j; /* NON register variables! */ - -int main(void) -{ -#ifdef LONG_TEST - ulong start,finish; -#endif - - printf("Processor type: %d %ld MHz\n", CPU_getProcessorType(), CPU_getProcessorSpeed(true)); - - ZTimerInit(); - - /* Test the long period Zen Timer (we don't check for overflow coz - * it would take tooooo long!) - */ - - LZTimerOn(); - for (j = 0; j < 10; j++) - for (i = 0; i < 20000; i++) - i = i; - LZTimerOff(); - ReportTime(LZTimerCount()); - - /* Test the ultra long period Zen Timer */ -#ifdef LONG_TEST - start = ULZReadTime(); - delay(DELAY_SECS * 1000); - finish = ULZReadTime(); - printf("Delay of %d secs took %d 1/10ths of a second\n", - DELAY_SECS,ULZElapsedTime(start,finish)); -#endif - - return 0; -} diff --git a/board/MAI/bios_emulator/scitech/src/pm/tests/timercpp.cpp b/board/MAI/bios_emulator/scitech/src/pm/tests/timercpp.cpp deleted file mode 100644 index 1258a4b..0000000 --- a/board/MAI/bios_emulator/scitech/src/pm/tests/timercpp.cpp +++ /dev/null @@ -1,107 +0,0 @@ -/**************************************************************************** -* -* SciTech OS Portability Manager Library -* -* ======================================================================== -* -* The contents of this file are subject to the SciTech MGL Public -* License Version 1.0 (the "License"); you may not use this file -* except in compliance with the License. You may obtain a copy of -* the License at http://www.scitechsoft.com/mgl-license.txt -* -* Software distributed under the License is distributed on an -* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or -* implied. See the License for the specific language governing -* rights and limitations under the License. -* -* The Original Code is Copyright (C) 1991-1998 SciTech Software, Inc. -* -* The Initial Developer of the Original Code is SciTech Software, Inc. -* All Rights Reserved. -* -* ======================================================================== -* -* Language: C++ 3.0 -* Environment: Any -* -* Description: Test program for the Zen Timer Library C++ interface. -* -****************************************************************************/ - -#include -#include "pmapi.h" -#include "ztimer.h" - -/*-------------------------- Implementation -------------------------------*/ - -int i,j,k; /* NON register variables! */ - -void dummy() {} - -int main(void) -{ - LZTimer ltimer; - ULZTimer ultimer; - - ZTimerInit(); - - /* Test the long period Zen Timer (we don't check for overflow coz - * it would take tooooo long!) - */ - - cout << endl; - ultimer.restart(); - ltimer.start(); - for (j = 0; j < 10; j++) - for (i = 0; i < 20000; i++) - dummy(); - ltimer.stop(); - ultimer.stop(); - cout << "LCount: " << ltimer.count() << endl; - cout << "Time: " << ltimer << " secs\n"; - cout << "ULCount: " << ultimer.count() << endl; - cout << "ULTime: " << ultimer << " secs\n"; - - cout << endl << "Timing ... \n"; - ultimer.restart(); - ltimer.restart(); - for (j = 0; j < 200; j++) - for (i = 0; i < 20000; i++) - dummy(); - ltimer.stop(); - ultimer.stop(); - cout << "LCount: " << ltimer.count() << endl; - cout << "Time: " << ltimer << " secs\n"; - cout << "ULCount: " << ultimer.count() << endl; - cout << "ULTime: " << ultimer << " secs\n"; - - /* Test the lap function of the long period Zen Timer */ - - cout << endl << "Timing ... \n"; - ultimer.restart(); - ltimer.restart(); - for (j = 0; j < 20; j++) { - for (k = 0; k < 10; k++) - for (i = 0; i < 20000; i++) - dummy(); - cout << "lap: " << ltimer.lap() << endl; - } - ltimer.stop(); - ultimer.stop(); - cout << "LCount: " << ltimer.count() << endl; - cout << "Time: " << ltimer << " secs\n"; - cout << "ULCount: " << ultimer.count() << endl; - cout << "ULTime: " << ultimer << " secs\n"; - -#ifdef LONG_TEST - /* Test the ultra long period Zen Timer */ - - ultimer.start(); - delay(DELAY_SECS * 1000); - ultimer.stop(); - cout << "Delay of " << DELAY_SECS << " secs took " << ultimer.count() - << " 1/10ths of a second\n"; - cout << "Time: " << ultimer << " secs\n"; -#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 deleted file mode 100644 index f0c7bd6..0000000 --- a/board/MAI/bios_emulator/scitech/src/pm/tests/uswc.c +++ /dev/null @@ -1,311 +0,0 @@ -/**************************************************************************** -* -* SciTech OS Portability Manager Library -* -* ======================================================================== -* -* The contents of this file are subject to the SciTech MGL Public -* License Version 1.0 (the "License"); you may not use this file -* except in compliance with the License. You may obtain a copy of -* the License at http://www.scitechsoft.com/mgl-license.txt -* -* Software distributed under the License is distributed on an -* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or -* implied. See the License for the specific language governing -* rights and limitations under the License. -* -* The Original Code is Copyright (C) 1991-1998 SciTech Software, Inc. -* -* The Initial Developer of the Original Code is SciTech Software, Inc. -* All Rights Reserved. -* -* ======================================================================== -* -* Language: ANSI C -* Environment: any -* -* Description: Simple test program to test the write combine functions. -* -* Note that this program should never be used in a production -* environment, because write combining needs to be handled -* with more intimate knowledge of the display hardware than -* you can obtain by simply examining the PCI configuration -* space. -* -****************************************************************************/ - -#include "pmapi.h" -#include "pcilib.h" -#include -#include -#include -#include - -/*------------------------- Global Variables ------------------------------*/ - -static int NumPCI = -1; -static PCIDeviceInfo *PCI; -static int *BridgeIndex; -static int *DeviceIndex; -static int NumBridges; -static PCIDeviceInfo *AGPBridge = NULL; -static int NumDevices; - -/*-------------------------- Implementation -------------------------------*/ - -/**************************************************************************** -RETURNS: -Number of display devices found. - -REMARKS: -This function enumerates the number of available display devices on the -PCI bus, and returns the number found. -****************************************************************************/ -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 (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; - - /* 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; - } - } - } - } - } - } - return NumDevices; -} - -/**************************************************************************** -REMARKS: -Enumerates useful information about attached display devices. -****************************************************************************/ -static void ShowDisplayDevices(void) -{ - int i,index; - - printf("Displaying enumeration of %d PCI display devices\n", NumDevices); - 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); - } - printf("\n"); -} - -/**************************************************************************** -REMARKS: -Dumps the value for a write combine region to the display. -****************************************************************************/ -static char *DecodeWCType( - uint type) -{ - static char *names[] = { - "UNCACHABLE", - "WRCOMB", - "UNKNOWN", - "UNKNOWN", - "WRTHROUGH", - "WRPROT", - "WRBACK", - }; - if (type <= PM_MTRR_MAX) - return names[type]; - return "UNKNOWN"; -} - -/**************************************************************************** -REMARKS: -Dumps the value for a write combine region to the display. -****************************************************************************/ -static void PMAPI EnumWriteCombine( - ulong base, - ulong length, - uint type) -{ - printf("%08lX %-10ld %s\n", base, length / 1024, DecodeWCType(type)); -} - -/**************************************************************************** -PARAMETERS: -err - Error to log - -REMARKS: -Function to log an error message if the MTRR write combining attempt failed. -****************************************************************************/ -static void LogMTRRError( - int err) -{ - if (err == PM_MTRR_ERR_OK) - 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; - } - exit(-1); -} - -/**************************************************************************** -REMARKS: -Shows all write combine regions. -****************************************************************************/ -static void ShowWriteCombine(void) -{ - printf("Base Length(KB) Type\n"); - LogMTRRError(PM_enumWriteCombine(EnumWriteCombine)); - printf("\n"); -} - -/**************************************************************************** -REMARKS: -Dumps the value for a write combine region to the display. -****************************************************************************/ -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)); - } - } - printf("\n"); - ShowDisplayDevices(); - ShowWriteCombine(); -} - -/**************************************************************************** -REMARKS: -Dumps the value for a write combine region to the display. -****************************************************************************/ -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)); - } - } - printf("\n"); - ShowDisplayDevices(); - ShowWriteCombine(); -} - -int main(int argc,char *argv[]) -{ - PM_init(); - if (PCI_enumerateDevices() < 1) { - printf("No PCI display devices found!\n"); - return -1; - } - if (argc < 2) { - printf("usage: uswc [-show -on -off]\n\n"); - ShowDisplayDevices(); - return -1; - } - if (stricmp(argv[1],"-show") == 0) - ShowWriteCombine(); - else if (stricmp(argv[1],"-on") == 0) - EnableWriteCombine(); - else if (stricmp(argv[1],"-off") == 0) - 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 deleted file mode 100644 index b7e3bb7..0000000 --- a/board/MAI/bios_emulator/scitech/src/pm/tests/vftest.c +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** -* -* SciTech OS Portability Manager Library -* -* ======================================================================== -* -* The contents of this file are subject to the SciTech MGL Public -* License Version 1.0 (the "License"); you may not use this file -* except in compliance with the License. You may obtain a copy of -* the License at http://www.scitechsoft.com/mgl-license.txt -* -* Software distributed under the License is distributed on an -* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or -* implied. See the License for the specific language governing -* rights and limitations under the License. -* -* The Original Code is Copyright (C) 1991-1998 SciTech Software, Inc. -* -* The Initial Developer of the Original Code is SciTech Software, Inc. -* All Rights Reserved. -* -* ======================================================================== -* -* Filename: $Workfile$ -* Version: $Revision: 1.1 $ -* -* Language: ANSI C -* Environment: any -* -* Description: Test program to test the VFlat virtual framebuffer functions. -* -* Functions tested: VF_available() -* VF_init() -* VF_exit() -* -* $Date: 2002/10/02 15:35:21 $ $Author: hfrieden $ -* -****************************************************************************/ - -#include -#include -#include "pmapi.h" - -uchar code[] = { - 0xC3, /* ret */ - }; - -int main(void) -{ - void *vfBuffer; - - 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; - } - - if (!VF_available()) { - 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); - } - 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 deleted file mode 100644 index 92adcdd..0000000 --- a/board/MAI/bios_emulator/scitech/src/pm/tests/video.c +++ /dev/null @@ -1,199 +0,0 @@ -/**************************************************************************** -* -* SciTech OS Portability Manager Library -* -* ======================================================================== -* -* The contents of this file are subject to the SciTech MGL Public -* License Version 1.0 (the "License"); you may not use this file -* except in compliance with the License. You may obtain a copy of -* the License at http://www.scitechsoft.com/mgl-license.txt -* -* Software distributed under the License is distributed on an -* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or -* implied. See the License for the specific language governing -* rights and limitations under the License. -* -* The Original Code is Copyright (C) 1991-1998 SciTech Software, Inc. -* -* The Initial Developer of the Original Code is SciTech Software, Inc. -* All Rights Reserved. -* -* ======================================================================== -* -* Language: ANSI C -* Environment: any -* -* Description: Test program to check the ability to generate real mode -* interrupts and to be able to obtain direct access to the -* video memory from protected mode. Compile and link with -* the appropriate command line for your DOS extender. -* -* Functions tested: PM_getBIOSSelector() -* PM_mapPhysicalAddr() -* PM_int86() -* -****************************************************************************/ - -#include -#include -#include "pmapi.h" - -uchar *bios; /* Pointer to BIOS data area */ -uchar *videoPtr; /* Pointer to VGA framebuffer */ -void *stateBuf; /* Console state save buffer */ - -/* Routine to return the current video mode number */ - -int getVideoMode(void) -{ - return PM_getByte(bios+0x49); -} - -/* Routine to set a specified video mode */ - -void setVideoMode(int mode) -{ - RMREGS r; - - r.x.ax = mode; - PM_int86(0x10, &r, &r); -} - -/* Routine to clear a rectangular region on the display by calling the - * video BIOS. - */ - -void clearScreen(int startx, int starty, int endx, int endy, unsigned char attr) -{ - RMREGS r; - - r.x.ax = 0x0600; - r.h.bh = attr; - r.h.cl = startx; - r.h.ch = starty; - r.h.dl = endx; - r.h.dh = endy; - PM_int86(0x10, &r, &r); -} - -/* Routine to fill a rectangular region on the display using direct - * video writes. - */ - -#define SCREEN(x,y) (videoPtr + ((y) * 160) + ((x) << 1)) - -void fill(int startx, int starty, int endx, int endy, unsigned char c, - unsigned char attr) -{ - unsigned char *v; - int x,y; - - for (y = starty; y <= endy; y++) { - v = SCREEN(startx,y); - for (x = startx; x <= endx; x++) { - *v++ = c; - *v++ = attr; - } - } -} - -/* Routine to display a single character using direct video writes */ - -void writeChar(int x, int y, unsigned char c, unsigned char attr) -{ - unsigned char *v = SCREEN(x,y); - *v++ = c; - *v = attr; -} - -/* Routine to draw a border around a rectangular area using direct video - * writes. - */ - -static unsigned char border_chars[] = { - 186, 205, 201, 187, 200, 188 /* double box chars */ - }; - -void border(int startx, int starty, int endx, int endy, unsigned char attr) -{ - unsigned char *v; - unsigned char *b; - int i; - - b = border_chars; - - for (i = starty+1; i < endy; i++) { - 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; - } - for (i = startx+1, v = SCREEN(startx+1, endy); i < endx; i++) { - *v++ = *b; - *v++ = attr; - } - b++; - writeChar(startx, starty, *b++, attr); - writeChar(endx, starty, *b++, attr); - writeChar(startx, endy, *b++, attr); - writeChar(endx, endy, *b++, attr); -} - -int main(void) -{ - int orgMode; - PM_HWND hwndConsole; - - 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; - } - - 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"); - PM_getch(); - - /* 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); - } - 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); - } - - /* Draw some text on the screen */ - fill(0, 0, 79, 24, 176, 0x1E); - border(0, 0, 79, 24, 0x1F); - PM_getch(); - clearScreen(0, 0, 79, 24, 0x7); - - /* Restore the console state on exit */ - PM_restoreConsoleState(stateBuf,0); - PM_free(stateBuf); - PM_closeConsole(hwndConsole); - - /* Display useful status information */ - printf("\n"); - printf("Original Video Mode = %02X\n", orgMode); - printf("BIOS Pointer = %08X\n", (int)bios); - printf("Video Memory = %08X\n", (int)videoPtr); - return 0; -} -- cgit v1.1