?? pmapi.h
字號(hào):
/****************************************************************************** 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"#if !defined(__WIN32_VXD__) && !defined(__OS2_VDD__) && !defined(__NT_DRIVER__)#include <stdio.h>#include <stdlib.h>#endif/*--------------------------- 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;#ifdef __MSDOS__/* Register structure passed to PM_VxDCall function */typedef struct { ulong eax; ulong ebx; ulong ecx; ulong edx; ulong esi; ulong edi; ushort ds,es; } VXD_regs;#endif#define PM_MAX_DRIVE 3#define PM_MAX_PATH 256#define PM_FILE_INVALID (void*)0xFFFFFFFF/* Structure for generic directory traversal and management. Also the same * values are passed to PM_setFileAttr to change the file attributes. */typedef struct { ulong dwSize; ulong attrib; ulong sizeLo; ulong sizeHi; char name[PM_MAX_PATH]; } PM_findData;/* Macro to compute the byte offset of a field in a structure of type type */#define PM_FIELD_OFFSET(type,field) ((long)&(((type*)0)->field))/* Marcto to compute the address of the base of the structure given its type, * and an address of a field within the structure. */#define PM_CONTAINING_RECORD(address, type, field) \ ((type*)( \ (char*)(address) - \ (char*)(&((type*)0)->field)))/* Flags stored in the PM_findData structure, and also values passed to * PM_setFileAttr to change the file attributes. */#define PM_FILE_NORMAL 0x00000000#define PM_FILE_READONLY 0x00000001#define PM_FILE_DIRECTORY 0x00000002#define PM_FILE_ARCHIVE 0x00000004#define PM_FILE_HIDDEN 0x00000008#define PM_FILE_SYSTEM 0x00000010/* Flags returned by the PM_splitpath function */#define PM_HAS_WILDCARDS 0x01#define PM_HAS_EXTENSION 0x02#define PM_HAS_FILENAME 0x04#define PM_HAS_DIRECTORY 0x08#define PM_HAS_DRIVE 0x10/* Structure passed to the PM_setFileTime functions */typedef struct { short sec; /* Seconds */ short min; /* Minutes */ short hour; /* Hour (0--23) */ short day; /* Day of month (1--31) */ short mon; /* Month (0--11) */ short year; /* Year (calendar year minus 1900) */ } PM_time;/* 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/* Values passed to the PM_DMACProgram function */#define PM_DMA_READ_ONESHOT 0x44 /* One-shot DMA read */#define PM_DMA_WRITE_ONESHOT 0x48 /* One-shot DMA write */#define PM_DMA_READ_AUTOINIT 0x54 /* Auto-init DMA read */#define PM_DMA_WRITE_AUTOINIT 0x58 /* Auto-init DMA write *//* 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_SUSPEND_APP 0#define PM_NO_SUSPEND_APP 1/****************************************************************************REMARKS:This enumeration defines the type values passed to the PM_agpReservePhysicalfunction, to define how the physical memory mapping should be handled.The PM_agpUncached type indicates that the memory should be allocated asuncached memory.The PM_agpWriteCombine type indicates that write combining should be enabledfor physical memory mapping. This is used for framebuffer write combing andspeeds up direct framebuffer writes to the memory.The PM_agpIntelDCACHE type indicates that memory should come from the Inteli81x Display Cache (or DCACHE) memory pool. This flag is specific to theIntel i810 and i815 controllers, and should not be passed for any othercontroller type.HEADER:pmapi.hMEMBERS:PM_agpUncached - Indicates that the memory should be uncachedPM_agpWriteCombine - Indicates that the memory should be write combinedPM_agpIntelDCACHE - Indicates that the memory should come from DCACHE pool****************************************************************************/typedef enum { PM_agpUncached, PM_agpWriteCombine, PM_agpIntelDCACHE } PM_agpMemoryType;/* Defines the size of an system memory page */#define PM_PAGE_SIZE 4096/* Type definition for a physical memory address */typedef unsigned long PM_physAddr;/* Define a bad physical address returned by map physical functions */#define PM_BAD_PHYS_ADDRESS 0xFFFFFFFF/* Type definition for the 12-byte lock handle for locking linear memory */typedef struct { ulong h[3]; } PM_lockHandle;/* 'C' calling conventions always */#define PMAPI _ASMAPI#define PMAPIP _ASMAPIP/* 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__) || defined(__NT_DRIVER__)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;#elif defined(__SNAP__)typedef void *PM_HWND;typedef void *PM_MODULE;#else#error PM library not ported to this platform yet!#endif/* Type definition for code pointers */
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -