⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pmapi.h

📁 BIOS emulator and interface to Realmode X86 Emulator Library Can emulate a PCI Graphic Controller V
💻 H
📖 第 1 页 / 共 2 页
字号:
/******************************************************************************					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:	Header file for the OS Portability Manager Library, which*				contains functions to implement OS specific services in a*				generic, cross platform API. Porting the OS Portability*				Manager library is the first step to porting any SciTech*				products to a new platform.*****************************************************************************/#ifndef	__PMAPI_H#define	__PMAPI_H#include "scitech.h"#include "pcilib.h"#include "ztimerc.h"/*--------------------------- Macros and Typedefs -------------------------*//* You will need to define one of the following before you compile this * library for it to work correctly with the DOS extender that you are * using when compiling for extended DOS: * *		TNT			- Phar Lap TNT DOS Extender *		DOS4GW		- Rational DOS/4GW, DOS/4GW Pro, Causeway and PMODE/W *		DJGPP		- DJGPP port of GNU C++ * * If none is specified, we will automatically determine which operating * system is being targetted and the following will be defined (provided by * scitech.h header file): * *		__MSDOS16__		- Default for 16 bit MSDOS mode *		__MSDOS32__		- Default for 32 bit MSDOS *		__WINDOWS16__	- Default for 16 bit Windows *		__WINDOWS32__	- Default for 32 bit Windows * * One of the following will be defined automatically for you to select * which memory model is in effect: * *		REALMODE	- 16 bit real mode (large memory model) *		PM286		- 16 protected mode (large memory model) *		PM386		- 32 protected mode (flat memory model) */#if defined(__UNIX__) && !defined(_MAX_PATH)#define _MAX_PATH 256#endif#if defined(TNT) || defined(DOSX) || defined(X32VM) || defined(DPMI32)		\	|| defined(DOS4GW) || defined(DJGPP) || defined(__WINDOWS32__)			\	|| defined(__MSDOS32__) || defined(__UNIX__) || defined(__WIN32_VXD__) \	|| defined(__32BIT__) || defined(__SMX32__) || defined(__RTTARGET__)#define	PM386#elif defined(DPMI16) || defined(__WINDOWS16__)#define	PM286#else#define	REALMODE#endif#pragma pack(1)/* Provide the typedefs for the PM_int386 functions, which issue native * interrupts in real or protected mode and can pass extended registers * around. */struct _PMDWORDREGS {	ulong	eax,ebx,ecx,edx,esi,edi,cflag;	};struct _PMWORDREGS {	ushort 	ax,ax_hi;	ushort 	bx,bx_hi;	ushort 	cx,cx_hi;	ushort 	dx,dx_hi;	ushort 	si,si_hi;	ushort 	di,di_hi;	ushort	cflag,cflag_hi;	};struct _PMBYTEREGS {	uchar	al, ah;	ushort ax_hi;	uchar	bl, bh;	ushort bx_hi;	uchar	cl, ch; ushort cx_hi;	uchar	dl, dh; ushort dx_hi;	};typedef union {	struct  _PMDWORDREGS e;	struct  _PMWORDREGS  x;	struct  _PMBYTEREGS  h;	} PMREGS;typedef struct {	ushort  es;	ushort  cs;	ushort  ss;	ushort	ds;	ushort	fs;	ushort	gs;	} PMSREGS;/* Provide definitions for the real mode register structures passed to * the PM_int86() and PM_int86x() routines. Note that we provide our own * functions to do this for 16-bit code that calls the PM_int386 functions. */typedef PMREGS 	RMREGS;typedef PMSREGS	RMSREGS;typedef struct {	long	edi;	long	esi;	long	ebp;	long	reserved;	long	ebx;	long	edx;	long	ecx;	long	eax;	short	flags;	short	es,ds,fs,gs,ip,cs,sp,ss;	} DPMI_regs;/* Define a macro for creating physical base addresses from segment:offset */#define MK_PHYS(s,o)  (((ulong)(s) << 4) + (ulong)(o))/* Define the different types of modes supported. This is a global variable * that can be used to determine the type at runtime which will contain * one of these values. */typedef enum {	PM_realMode,	PM_286,	PM_386	} PM_mode_enum;/* Define types passed to PM_enableWriteCombine */#define PM_MTRR_UNCACHABLE 	0#define PM_MTRR_WRCOMB     	1#define PM_MTRR_WRTHROUGH  	4#define PM_MTRR_WRPROT     	5#define PM_MTRR_WRBACK    	6#define PM_MTRR_MAX    		6/* Error codes returned by PM_enableWriteCombine */#define PM_MTRR_ERR_OK					0#define PM_MTRR_NOT_SUPPORTED           -1#define PM_MTRR_ERR_PARAMS              -2#define PM_MTRR_ERR_NOT_4KB_ALIGNED     -3#define PM_MTRR_ERR_BELOW_1MB           -4#define PM_MTRR_ERR_NOT_ALIGNED         -5#define PM_MTRR_ERR_OVERLAP             -6#define PM_MTRR_ERR_TYPE_MISMATCH       -7#define PM_MTRR_ERR_NONE_FREE           -8#define	PM_MTRR_ERR_NOWRCOMB			-9#define	PM_MTRR_ERR_NO_OS_SUPPORT		-10/* Flags passed to suspend application callback */#define PM_DEACTIVATE		1#define	PM_REACTIVATE  		2/* Return codes that the application can return from the suspend application * callback registered with the PM library. See the MGL documentation for * more details. */#define	PM_NO_DEACTIVATE   	0#define	PM_SUSPEND_APP    	1#define	PM_NO_SUSPEND_APP	2#if		defined(__WIN32_VXD__)#define	PMAPI	_ASMAPI			/* 'C' calling conventions for VxD's	*/#define	PMAPIP	_ASMAPIP#elif	defined(__WINDOWS32__)#define	PMAPI	_DLLASM			/* 'C' calling conventions for Win32	*/#define	PMAPIP	_DLLASMP#elif	defined(__WINDOWS16__)#define	PMAPI	_DLLAPI			/* Pascal calling conventions for Win16	*/#define	PMAPIP	_DLLAPIP#elif   defined(__BEOS__)#define PMAPI _ASMAPI#define PMAPIP _ASMAPIP#else#define	PMAPI	_ASMAPI			/* 'C' calling conventions otherwise	*/#define	PMAPIP	_ASMAPIP#endif/* Internal typedef to override DPMI_int86 handler */typedef ibool (PMAPIP DPMI_handler_t)(DPMI_regs *regs);void PMAPI DPMI_setInt10Handler(DPMI_handler_t handler);/* Type definitions for a window handle for console modes */#if		defined(__DRIVER__) || defined(__WIN32_VXD__)typedef	void		*PM_HWND;	/* Pointer for portable drivers 		*/typedef	void		*PM_MODULE;	/* Module handle for portable drivers	*/#elif	defined(__WINDOWS__)#ifdef	DECLARE_HANDLEtypedef	HWND		PM_HWND;	/* Real window handle 					*/typedef	HINSTANCE	PM_MODULE;	/* Win32 DLL handle						*/#elsetypedef	void		*PM_HWND;	/* Place holder if windows.h not included */typedef	void		*PM_MODULE;	/* Place holder if windows.h not included */#endif#elif	defined(__USE_X11__)typedef	struct {	Window		*window;	Display		*display;	} PM_HWND;					/* X11 window handle */#elif	defined(__OS2__)typedef	void	*PM_HWND;typedef	void	*PM_MODULE;#elif	defined(__LINUX__)typedef	int		PM_HWND;		/* Console id for fullscreen Linux */typedef	void	*PM_MODULE;#elif	defined(__QNX__)typedef	int		PM_HWND;		/* Console id for fullscreen QNX */typedef	void	*PM_MODULE;#elif	defined(__RTTARGET__)typedef	int		PM_HWND;		/* Placeholder for RTTarget-32 */typedef	void	*PM_MODULE;#elif	defined(__REALDOS__)typedef	int		PM_HWND;		/* Placeholder for fullscreen DOS */typedef	void	*PM_MODULE;		/* Placeholder for fullscreen DOS */#elif	defined(__SMX32__)typedef	int		PM_HWND;		/* Placeholder for fullscreen SMX */typedef	void	*PM_MODULE;#else#error	PM library not ported to this platform yet!#endif/* Type definition for code pointers */typedef void (*__codePtr)();/* Type definition for a C based interrupt handler */typedef void (PMAPIP PM_intHandler)(void);/* Type definition for the fatal cleanup handler */typedef void (PMAPIP PM_fatalCleanupHandler)(void);/* Structure defining all the PM API functions as exported to * the binary portable DLL's. */typedef struct {	ulong	dwSize;	int 	(PMAPIP PM_getModeType)(void);	void *	(PMAPIP PM_getBIOSPointer)(void);	void * 	(PMAPIP PM_getA0000Pointer)(void);	void * 	(PMAPIP PM_mapPhysicalAddr)(ulong base,ulong limit,ibool isCached);	void *	(PMAPIP PM_mallocShared)(long size);	int		(PMAPIP PM_mapShared)(void *ptr);	void	(PMAPIP PM_freeShared)(void *ptr);	void *	(PMAPIP PM_mapToProcess)(void *linear,ulong limit);	void *	(PMAPIP PM_mapRealPointer)(uint r_seg,uint r_off);	void *	(PMAPIP PM_allocRealSeg)(uint size,uint *r_seg,uint *r_off);	void	(PMAPIP PM_freeRealSeg)(void *mem);	void *	(PMAPIP PM_allocLockedMem)(uint size,ulong *physAddr);	void	(PMAPIP PM_freeLockedMem)(void *p,uint size);	void 	(PMAPIP PM_callRealMode)(uint seg,uint off, RMREGS *regs,RMSREGS *sregs);	int 	(PMAPIP PM_int86)(int intno, RMREGS *in, RMREGS *out);	int 	(PMAPIP PM_int86x)(int intno, RMREGS *in, RMREGS *out,RMSREGS *sregs);	void	(PMAPIP DPMI_int86)(int intno, DPMI_regs *regs);	void	(PMAPIP PM_availableMemory)(ulong *physical,ulong *total);	void *	(PMAPIP PM_getVESABuf)(uint *len,uint *rseg,uint *roff);	long	(PMAPIP PM_getOSType)(void);	void	(PMAPIP PM_fatalError)(const char *msg);	void	(PMAPIP PM_setBankA)(int bank);	void	(PMAPIP PM_setBankAB)(int bank);	void 	(PMAPIP PM_setCRTStart)(int x,int y,int waitVRT);	const char * (PMAPIP PM_getCurrentPath)(void);	const char * (PMAPIP PM_getVBEAFPath)(void);	const char * (PMAPIP PM_getNucleusPath)(void);	const char * (PMAPIP PM_getNucleusConfigPath)(void);	const char * (PMAPIP PM_getUniqueID)(void);	const char * (PMAPIP PM_getMachineName)(void);	ibool 	(PMAPIP VF_available)(void);	void * 	(PMAPIP VF_init)(ulong baseAddr,int bankSize,int codeLen,void *bankFunc);	void 	(PMAPIP VF_exit)(void);	PM_HWND	(PMAPIP PM_openConsole)(PM_HWND hwndUser,int device,int xRes,int yRes,int bpp,ibool fullScreen);	int		(PMAPIP PM_getConsoleStateSize)(void);	void	(PMAPIP PM_saveConsoleState)(void *stateBuf,PM_HWND hwndConsole);	void	(PMAPIP PM_restoreConsoleState)(const void *stateBuf,PM_HWND hwndConsole);	void	(PMAPIP PM_closeConsole)(PM_HWND hwndConsole);	void 	(PMAPIP PM_setOSCursorLocation)(int x,int y);	void 	(PMAPIP PM_setOSScreenWidth)(int width,int height);	int		(PMAPIP PM_enableWriteCombine)(ulong base,ulong length,uint type);	void	(PMAPIP PM_backslash)(char *filename);	int 	(PMAPIP PM_lockDataPages)(void *p,uint len);	int 	(PMAPIP PM_unlockDataPages)(void *p,uint len);	int 	(PMAPIP PM_lockCodePages)(__codePtr p,uint len);	int 	(PMAPIP PM_unlockCodePages)(__codePtr p,uint len);	ibool	(PMAPIP PM_setRealTimeClockHandler)(PM_intHandler ih,int frequency);	void	(PMAPIP PM_setRealTimeClockFrequency)(int frequency);	void 	(PMAPIP PM_restoreRealTimeClockHandler)(void);	ibool 	(PMAPIP PM_doBIOSPOST)(ushort axVal,ulong BIOSPhysAddr,void *BIOSPtr,ulong BIOSLen);	char 	(PMAPIP PM_getBootDrive)(void);	void  	(PMAPIP PM_freePhysicalAddr)(void *ptr,ulong limit);	uchar	(PMAPIP PM_inpb)(int port);	ushort	(PMAPIP PM_inpw)(int port);	ulong	(PMAPIP PM_inpd)(int port);	void	(PMAPIP PM_outpb)(int port,uchar val);	void	(PMAPIP PM_outpw)(int port,ushort val);	void	(PMAPIP PM_outpd)(int port,ulong val);	void	(PMAPIP PM_changeResolution)(PM_HWND hwndConsole,int xRes,int yRes,int bpp);	void	(PMAPIP PM_setSuspendAppCallback)(int (_ASMAPIP saveState)(int flags));	ibool	(PMAPIP PM_haveBIOSAccess)(void);	int		(PMAPIP PM_kbhit)(void);	int		(PMAPIP PM_getch)(void);	ibool 	(PMAPIP PM_findBPD)(const char *dllname,char *bpdpath);	ulong 	(PMAPIP PM_getPhysicalAddr)(void *p);	void	(PMAPIP PM_sleep)(ulong milliseconds);	int		(PMAPIP PM_getCOMPort)(int port);	int		(PMAPIP PM_getLPTPort)(int port);	PM_MODULE (PMAPIP PM_loadLibrary)(const char *szDLLName);	void * 	(PMAPIP PM_getProcAddress)(PM_MODULE hModule,const char *szProcName);	void	(PMAPIP PM_freeLibrary)(PM_MODULE hModule);	int		(PMAPIP PCI_enumerate)(PCIDeviceInfo info[],int maxDevices);	ulong 	(PMAPIP PCI_accessReg)(int index,ulong value,int func,PCIDeviceInfo *info);	ibool	(PMAPIP PCI_setHardwareIRQ)(PCIDeviceInfo *info,uint intPin,uint IRQ);	void	(PMAPIP PCI_generateSpecialCyle)(uint bus,ulong specialCycleData);	void	(PMAPIP PCI_mapShared)(void);	ulong 	(PMAPIP PCIBIOS_getEntry)(void);	uint	(PMAPIP CPU_getProcessorType)(void);	ibool	(PMAPIP CPU_haveMMX)(void);	ibool	(PMAPIP CPU_have3DNow)(void);	ibool	(PMAPIP CPU_haveKNI)(void);	ibool	(PMAPIP CPU_haveRDTSC)(void);	ulong	(PMAPIP CPU_getProcessorSpeed)(void);	void	(PMAPIP ZTimerInit)(void);	void 	(PMAPIP LZTimerOn)(void);	ulong	(PMAPIP LZTimerLap)(void);	void 	(PMAPIP LZTimerOff)(void);	ulong 	(PMAPIP LZTimerCount)(void);	void 	(PMAPIP LZTimerOnExt)(LZTimerObject *tm);	ulong	(PMAPIP LZTimerLapExt)(LZTimerObject *tm);	void 	(PMAPIP LZTimerOffExt)(LZTimerObject *tm);	ulong 	(PMAPIP LZTimerCountExt)(LZTimerObject *tm);	void	(PMAPIP ULZTimerOn)(void);	ulong	(PMAPIP ULZTimerLap)(void);	void	(PMAPIP ULZTimerOff)(void);	ulong	(PMAPIP ULZTimerCount)(void);	ulong	(PMAPIP ULZReadTime)(void);	ulong	(PMAPIP ULZElapsedTime)(ulong start,ulong finish);	void	(PMAPIP ULZTimerResolution)(float *resolution);	} PM_imports;#pragma pack()/*---------------------------- Global variables ---------------------------*/#ifdef  __cplusplus

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -