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

📄 pmapi.h

📁 uboot在arm处理器s3c2410的移植代码
💻 H
📖 第 1 页 / 共 3 页
字号:
typedef void (*__codePtr)();/* Type definition for a C based interrupt handler */typedef void (PMAPIP PM_intHandler)(void);typedef ibool (PMAPIP PM_irqHandler)(void);/* Hardware IRQ handle used to save and restore the hardware IRQ */typedef void *PM_IRQHandle;/* Type definition for the fatal cleanup handler */typedef void (PMAPIP PM_fatalCleanupHandler)(void);/* Type defifinition for save state callback function */typedef int (PMAPIP PM_saveState_cb)(int flags);/* Type definintion for enum write combined callback function */typedef void (PMAPIP PM_enumWriteCombine_t)(ulong base,ulong length,uint type);/* 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);    void *  reserved1;    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,ibool contiguous,ibool below16Meg);    void    (PMAPIP PM_freeLockedMem)(void *p,uint size,ibool contiguous);    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);    char *  (PMAPIP PM_getCurrentPath)(char *path,int maxLen);    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,PM_lockHandle *lockHandle);    int     (PMAPIP PM_unlockDataPages)(void *p,uint len,PM_lockHandle *lockHandle);    int     (PMAPIP PM_lockCodePages)(__codePtr p,uint len,PM_lockHandle *lockHandle);    int     (PMAPIP PM_unlockCodePages)(__codePtr p,uint len,PM_lockHandle *lockHandle);    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 *  reserved2;    void    (PMAPIP PM_setSuspendAppCallback)(PM_saveState_cb saveState);    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[]);    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 *  reserved3;    ulong   (PMAPIP PCIBIOS_getEntry)(void);    uint    (PMAPIP CPU_getProcessorType)(void);    ibool   (PMAPIP CPU_haveMMX)(void);    ibool   (PMAPIP CPU_have3DNow)(void);    ibool   (PMAPIP CPU_haveSSE)(void);    ibool   (PMAPIP CPU_haveRDTSC)(void);    ulong   (PMAPIP CPU_getProcessorSpeed)(ibool accurate);    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)(ulong *resolution);    void *  (PMAPIP PM_findFirstFile)(const char *filename,PM_findData *findData);    ibool   (PMAPIP PM_findNextFile)(void *handle,PM_findData *findData);    void    (PMAPIP PM_findClose)(void *handle);    void    (PMAPIP PM_makepath)(char *p,const char *drive,const char *dir,const char *name,const char *ext);    int     (PMAPIP PM_splitpath)(const char *fn,char *drive,char *dir,char *name,char *ext);    ibool   (PMAPIP PM_driveValid)(char drive);    void    (PMAPIP PM_getdcwd)(int drive,char *dir,int len);    void    (PMAPIP PM_setFileAttr)(const char *filename,uint attrib);    ibool   (PMAPIP PM_mkdir)(const char *filename);    ibool   (PMAPIP PM_rmdir)(const char *filename);    uint    (PMAPIP PM_getFileAttr)(const char *filename);    ibool   (PMAPIP PM_getFileTime)(const char *filename,ibool gmtTime,PM_time *time);    ibool   (PMAPIP PM_setFileTime)(const char *filename,ibool gmtTime,PM_time *time);    char *  (PMAPIP CPU_getProcessorName)(void);    int     (PMAPIP PM_getVGAStateSize)(void);    void    (PMAPIP PM_saveVGAState)(void *stateBuf);    void    (PMAPIP PM_restoreVGAState)(const void *stateBuf);    void    (PMAPIP PM_vgaBlankDisplay)(void);    void    (PMAPIP PM_vgaUnblankDisplay)(void);    void    (PMAPIP PM_blockUntilTimeout)(ulong milliseconds);    void    (PMAPIP _PM_add64)(u32 a_low,s32 a_high,u32 b_low,s32 b_high,__i64 *result);    void    (PMAPIP _PM_sub64)(u32 a_low,s32 a_high,u32 b_low,s32 b_high,__i64 *result);    void    (PMAPIP _PM_mul64)(u32 a_low,s32 a_high,u32 b_low,s32 b_high,__i64 *result);    void    (PMAPIP _PM_div64)(u32 a_low,s32 a_high,u32 b_low,s32 b_high,__i64 *result);    void    (PMAPIP _PM_shr64)(u32 a_low,s32 a_high,s32 shift,__i64 *result);    void    (PMAPIP _PM_sar64)(u32 a_low,s32 a_high,s32 shift,__i64 *result);    void    (PMAPIP _PM_shl64)(u32 a_low,s32 a_high,s32 shift,__i64 *result);    void    (PMAPIP _PM_neg64)(u32 a_low,s32 a_high,__i64 *result);    ulong   (PMAPIP PCI_findBARSize)(int bar,PCIDeviceInfo *pci);    void    (PMAPIP PCI_readRegBlock)(PCIDeviceInfo *info,int index,void *dst,int count);    void    (PMAPIP PCI_writeRegBlock)(PCIDeviceInfo *info,int index,void *src,int count);    void    (PMAPIP PM_flushTLB)(void);    void    (PMAPIP PM_useLocalMalloc)(void * (*malloc)(size_t size),void * (*calloc)(size_t nelem,size_t size),void * (*realloc)(void *ptr,size_t size),void (*free)(void *p));    void *  (PMAPIP PM_malloc)(size_t size);    void *  (PMAPIP PM_calloc)(size_t nelem,size_t size);    void *  (PMAPIP PM_realloc)(void *ptr,size_t size);    void    (PMAPIP PM_free)(void *p);    ibool   (PMAPIP PM_getPhysicalAddrRange)(void *p,ulong length,ulong *physAddress);    void *  (PMAPIP PM_allocPage)(ibool locked);    void    (PMAPIP PM_freePage)(void *p);    ulong   (PMAPIP PM_agpInit)(void);    void    (PMAPIP PM_agpExit)(void);    ibool   (PMAPIP PM_agpReservePhysical)(ulong numPages,int type,void **physContext,PM_physAddr *physAddr);    ibool   (PMAPIP PM_agpReleasePhysical)(void *physContext);    ibool   (PMAPIP PM_agpCommitPhysical)(void *physContext,ulong numPages,ulong startOffset,PM_physAddr *physAddr);    ibool   (PMAPIP PM_agpFreePhysical)(void *physContext,ulong numPages,ulong startOffset);    int     (PMAPIP PCI_getNumDevices)(void);    void    (PMAPIP PM_setLocalBPDPath)(const char *path);    void *  (PMAPIP PM_loadDirectDraw)(int device);    void    (PMAPIP PM_unloadDirectDraw)(int device);    PM_HWND (PMAPIP PM_getDirectDrawWindow)(void);    void    (PMAPIP PM_doSuspendApp)(void);    } PM_imports;#pragma pack()/*---------------------------- Global variables ---------------------------*/#ifdef  __cplusplusextern "C" {            /* Use "C" linkage when in C++ mode */#endif#ifdef  __WIN32_VXD__#define VESA_BUF_SIZE 1024extern uchar *_PM_rmBufAddr;#endif/* {secret} Pointer to global exports structure. * Should not be used by application programs. */extern PM_imports _VARAPI _PM_imports;/* {secret} */extern void * (*__PM_malloc)(size_t size);/* {secret} */extern void * (*__PM_calloc)(size_t nelem,size_t size);/* {secret} */extern void * (*__PM_realloc)(void *ptr,size_t size);/* {secret} */extern void (*__PM_free)(void *p);/*--------------------------- Function Prototypes -------------------------*//* Routine to initialise the host side PM library. Note used from DLL's */void    PMAPI PM_init(void);/* Routine to return either PM_realMode, PM_286 or PM_386 */int     PMAPI PM_getModeType(void);/* Routine to return a selector to the BIOS data area at segment 0x40 */void *  PMAPI PM_getBIOSPointer(void);/* Routine to return a linear pointer to the VGA frame buffer memory */void *  PMAPI PM_getA0000Pointer(void);/* Routines to map/free physical memory into the current DS segment. In * some environments (32-bit DOS is one), after the mapping has been * allocated, it cannot be freed. Hence you should only allocate the * mapping once and cache the value for use by other parts of your * application. If the mapping cannot be createed, this function will * return a NULL pointer. * * This routine will also work for memory addresses below 1Mb, but the * mapped address cannot cross the 1Mb boundary. */void *  PMAPI PM_mapPhysicalAddr(ulong base,ulong limit,ibool isCached);void    PMAPI PM_freePhysicalAddr(void *ptr,ulong limit);/* Routine to determine the physical address of a linear address. It is * up to the caller to ensure the entire address range for a linear * block of memory is page aligned if that is required. */ulong   PMAPI PM_getPhysicalAddr(void *p);ibool   PMAPI PM_getPhysicalAddrRange(void *p,ulong length,ulong *physAddress);/* Routines for memory allocation. By default these functions use the regular * C runtime library malloc/free functions, but you can use the * PM_useLocalMalloc function to override the default memory allocator with * your own memory allocator. This will ensure that all memory allocation * used by SciTech products will use your overridden memory allocator * functions. * * Note that BPD files automatically map the C runtime library * malloc/calloc/realloc/free calls from inside the BPD to the PM library * versions by default. */void    PMAPI PM_useLocalMalloc(void * (*malloc)(size_t size),void * (*calloc)(size_t nelem,size_t size),void * (*realloc)(void *ptr,size_t size),void (*free)(void *p));void *  PMAPI PM_malloc(size_t size);void *  PMAPI PM_calloc(size_t nelem,size_t size);void *  PMAPI PM_realloc(void *ptr,size_t size);void    PMAPI PM_free(void *p);/* Routine to allocate a memory block in the global shared region that * is common to all tasks and accessible from ring 0 code. */void *  PMAPI PM_mallocShared(long size);/* Routine to free the allocated shared memory block */void    PMAPI PM_freeShared(void *ptr);/* Attach a previously allocated linear mapping to a new process */void *  PMAPI PM_mapToProcess(void *linear,ulong limit);/* Macros to extract byte, word and long values from a char pointer */#define PM_getByte(p)       *((volatile uchar*)(p))#define PM_getWord(p)       *((volatile ushort*)(p))#define PM_getLong(p)       *((volatile ulong*)(p))#define PM_setByte(p,v)     PM_getByte(p) = (v)#define PM_setWord(p,v)     PM_getWord(p) = (v)#define PM_setLong(p,v)     PM_getLong(p) = (v)/* Routine for accessing a low 1Mb memory block. You dont need to free this * pointer, but in 16 bit protected mode the selector allocated will be * re-used the next time this routine is called. */void *  PMAPI PM_mapRealPointer(uint r_seg,uint r_off);/* Routine to allocate a block of conventional memory below the 1Mb * limit so that it can be accessed from real mode. Ensure that you free * the segment when you are done with it. * * This routine returns a selector and offset to the segment that has been * allocated, and also returns the real mode segment and offset which can * be passed to real mode routines. Will return 0 if memory could not be * allocated. * * Please note that with some DOS extenders, memory allocated with the * following function cannot be freed, hence it will be allocated for the * life of your program. Thus if you need to call a bunch of different * real-mode routines in your program, allocate a single large buffer at * program startup that can be re-used throughout the program execution. */void *  PMAPI PM_allocRealSeg(uint size,uint *r_seg,uint *r_off);void    PMAPI PM_freeRealSeg(void *mem);/* Routine to allocate a block of locked memory, and return both the * linear and physical addresses of the memory. You should always * allocate locked memory blocks in page sized chunks (ie: 4K on IA32). * If the memory is not contiguous, you will need to use the * PM_getPhysicalAddr function to get the physical address of linear * pages within the memory block (the returned physical address will be * for the first address in the memory block only). */void *  PMAPI PM_allocLockedMem(uint size,ulong *physAddr,ibool contiguous,ibool below16Meg);void    PMAPI PM_freeLockedMem(void *p,uint size,ibool contiguous);/* Routine to allocate and free paged sized blocks of shared memory. * Addressable from all processes, but not from a ring 0 context * under OS/2. Note that under OS/2 PM_mapSharedPages must be called * to map the memory blocks into the shared memory address space * of each connecting process. */void *  PMAPI PM_allocPage(ibool locked);void    PMAPI PM_freePage(void *p);#ifdef __OS2__void    PMAPI PM_mapSharedPages(void);#endif/* Routine to return true if we have access to the BIOS on the host OS */ibool   PMAPI PM_haveBIOSAccess(void);/* Routine to call a real mode assembly language procedure. Register * values are passed in and out in the 'regs' and 'sregs' structures. We * do not provide any method of copying data from the protected mode stack * to the real mode stack, so if you need to pass data to real mode, you will * need to write a real mode assembly language hook to recieve the values * in registers, and to pass the data through a real mode block allocated * with the PM_allocRealSeg() routine. */void    PMAPI PM_callRealMode(uint seg,uint off, RMREGS *regs,RMSREGS *sregs);/* Routines to generate real mode interrupts using the same interface that * is used by int86() and int86x() in realmode. This routine is need to * call certain BIOS and DOS functions that are not supported by some * DOS extenders. No translation is done on any of the register values, * so they must be correctly set up and translated by the calling program. * * Normally the DOS extenders will allow you to use the normal int86() * function directly and will pass on unhandled calls to real mode to be * handled by the real mode handler. However calls to int86x() with real * mode segment values to be loaded will cause a GPF if used with the * standard int86x(), so you should use these routines if you know you * want to call a real mode handler. */int     PMAPI PM_int86(int intno, RMREGS *in, RMREGS *out);int     PMAPI PM_int86x(int intno, RMREGS *in, RMREGS *out,RMSREGS *sregs);/* Routine to generate a real mode interrupt. This is identical to the * above function, but takes a DPMI_regs structure for the registers * which has a lot more information. It is only available from 32-bit * protected mode. */void    PMAPI DPMI_int86(int intno, DPMI_regs *regs);/* Function to return the amount of available physical and total memory. * The results of this function are *only* valid before you have made any

⌨️ 快捷键说明

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