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

📄 pm.c

📁 gumstiz u-boot loader in linux
💻 C
📖 第 1 页 / 共 3 页
字号:
    /* TODO: This function calls a real mode far function with a far call. */    /*       If you do not support BIOS access, this function should be */    /*       empty. */}/****************************************************************************REMARKS:Return the amount of available memory.****************************************************************************/void PMAPI PM_availableMemory(    ulong *physical,    ulong *total){    /* TODO: Report the amount of available memory, both the amount of */    /*       physical memory left and the amount of virtual memory left. */    /*       If the OS does not provide these services, report 0's. */    *physical = *total = 0;}/****************************************************************************REMARKS:Allocate a block of locked, physical memory for DMA operations.****************************************************************************/void * PMAPI PM_allocLockedMem(    uint size,    ulong *physAddr,    ibool contiguous,    ibool below16M){    /* TODO: Allocate a block of locked, physical memory of the specified */    /*       size. This is used for bus master operations. If this is not */    /*       supported by the OS, return NULL and bus mastering will not */    /*       be used. */    return NULL;}/****************************************************************************REMARKS:Free a block of locked physical memory.****************************************************************************/void PMAPI PM_freeLockedMem(    void *p,    uint size,    ibool contiguous){    /* TODO: Free a memory block allocated with PM_allocLockedMem. */}/****************************************************************************REMARKS:Call the VBE/Core software interrupt to change display banks.****************************************************************************/void PMAPI PM_setBankA(    int bank){    RMREGS  regs;    /* TODO: This does a bank switch function by calling the real mode */    /*       VESA BIOS. If you do not support BIOS access, this function should */    /*       be empty. */    regs.x.ax = 0x4F05;    regs.x.bx = 0x0000;    regs.x.dx = bank;    PM_int86(0x10,&regs,&regs);}/****************************************************************************REMARKS:Call the VBE/Core software interrupt to change display banks.****************************************************************************/void PMAPI PM_setBankAB(    int bank){    RMREGS  regs;    /* TODO: This does a bank switch function by calling the real mode */    /*       VESA BIOS. If you do not support BIOS access, this function should */    /*       be empty. */    regs.x.ax = 0x4F05;    regs.x.bx = 0x0000;    regs.x.dx = bank;    PM_int86(0x10,&regs,&regs);    regs.x.ax = 0x4F05;    regs.x.bx = 0x0001;    regs.x.dx = bank;    PM_int86(0x10,&regs,&regs);}/****************************************************************************REMARKS:Call the VBE/Core software interrupt to change display start address.****************************************************************************/void PMAPI PM_setCRTStart(    int x,    int y,    int waitVRT){    RMREGS  regs;    /* TODO: This changes the display start address by calling the real mode */    /*       VESA BIOS. If you do not support BIOS access, this function */    /*       should be empty. */    regs.x.ax = 0x4F07;    regs.x.bx = waitVRT;    regs.x.cx = x;    regs.x.dx = y;    PM_int86(0x10,&regs,&regs);}/****************************************************************************REMARKS:Enable write combining for the memory region.****************************************************************************/ibool PMAPI PM_enableWriteCombine(    ulong base,    ulong length,    uint type){    /* TODO: This function should enable Pentium Pro and Pentium II MTRR */    /*       write combining for the passed in physical memory base address */    /*       and length. Normally this is done via calls to an OS specific */    /*       device driver as this can only be done at ring 0. */    /* */    /* NOTE: This is a *very* important function to implement! If you do */    /*       not implement, graphics performance on the latest Intel chips */    /*       will be severly impaired. For sample code that can be used */    /*       directly in a ring 0 device driver, see the MSDOS implementation */    /*       which includes assembler code to do this directly (if the */    /*       program is running at ring 0). */    return false;}/****************************************************************************REMARKS:Execute the POST on the secondary BIOS for a controller.****************************************************************************/ibool PMAPI PM_doBIOSPOST(    ushort axVal,    ulong BIOSPhysAddr,    void *mappedBIOS){    /* TODO: This function is used to run the BIOS POST code on a secondary */    /*       controller to initialise it for use. This is not necessary */    /*       for multi-controller operation, but it will make it a lot */    /*       more convenicent for end users (otherwise they have to boot */    /*       the system once with the secondary controller as primary, and */    /*       then boot with both controllers installed). */    /* */    /*       Even if you don't support full BIOS access, it would be */    /*       adviseable to be able to POST the secondary controllers in the */    /*       system using this function as a minimum requirement. Some */    /*       graphics hardware has registers that contain values that only */    /*       the BIOS knows about, which makes bring up a card from cold */    /*       reset difficult if the BIOS has not POST'ed it. */    return false;}/****************************************************************************REMARKS:Load an OS specific shared library or DLL. If the OS does not supportshared libraries, simply return NULL.****************************************************************************/PM_MODULE PMAPI PM_loadLibrary(    const char *szDLLName){    /* TODO: This function should load a native shared library from disk */    /*       given the path to the library. */    (void)szDLLName;    return NULL;}/****************************************************************************REMARKS:Get the address of a named procedure from a shared library.****************************************************************************/void * PMAPI PM_getProcAddress(    PM_MODULE hModule,    const char *szProcName){    /* TODO: This function should return the address of a named procedure */    /*       from a native shared library. */    (void)hModule;    (void)szProcName;    return NULL;}/****************************************************************************REMARKS:Unload a shared library.****************************************************************************/void PMAPI PM_freeLibrary(    PM_MODULE hModule){    /* TODO: This function free a previously loaded native shared library. */    (void)hModule;}/****************************************************************************REMARKS:Enable requested I/O privledge level (usually only to set to a value of3, and then restore it back again). If the OS is protected this functionmust be implemented in order to enable I/O port access for ring 3applications. The function should return the IOPL level active beforethe switch occurred so it can be properly restored.****************************************************************************/int PMAPI PM_setIOPL(    int level){    /* TODO: This function should enable IOPL for the task (if IOPL is */    /*       not always enabled for the app through some other means). */    return level;}/****************************************************************************REMARKS:Function to find the first file matching a search criteria in a directory.****************************************************************************/void *PMAPI PM_findFirstFile(    const char *filename,    PM_findData *findData){    /* TODO: This function should start a directory enumeration search */    /*       given the filename (with wildcards). The data should be */    /*       converted and returned in the findData standard form. */    (void)filename;    (void)findData;    return PM_FILE_INVALID;}/****************************************************************************REMARKS:Function to find the next file matching a search criteria in a directory.****************************************************************************/ibool PMAPI PM_findNextFile(    void *handle,    PM_findData *findData){    /* TODO: This function should find the next file in directory enumeration */    /*       search given the search criteria defined in the call to */    /*       PM_findFirstFile. The data should be converted and returned */    /*       in the findData standard form. */    (void)handle;    (void)findData;    return false;}/****************************************************************************REMARKS:Function to close the find process****************************************************************************/void PMAPI PM_findClose(    void *handle){    /* TODO: This function should close the find process. This may do */    /*       nothing for some OS'es. */    (void)handle;}/****************************************************************************REMARKS:Function to determine if a drive is a valid drive or not. Under Unix thisfunction will return false for anything except a value of 3 (consideredthe root drive, and equivalent to C: for non-Unix systems). The drivenumbering is:    1   - Drive A:    2   - Drive B:    3   - Drive C:    etc****************************************************************************/ibool PMAPI PM_driveValid(    char drive){    if (drive == 3)	return true;    return false;}/****************************************************************************REMARKS:Function to get the current working directory for the specififed drive.Under Unix this will always return the current working directory regardlessof what the value of 'drive' is.****************************************************************************/void PMAPI PM_getdcwd(    int drive,    char *dir,    int len){    (void)drive;    getcwd(dir,len);}/****************************************************************************REMARKS:Function to change the file attributes for a specific file.****************************************************************************/void PMAPI PM_setFileAttr(    const char *filename,    uint attrib){    /* TODO: Set the file attributes for a file */    (void)filename;    (void)attrib;}/****************************************************************************REMARKS:Function to create a directory.****************************************************************************/ibool PMAPI PM_mkdir(    const char *filename){    return mkdir(filename) == 0;}/****************************************************************************REMARKS:Function to remove a directory.****************************************************************************/ibool PMAPI PM_rmdir(    const char *filename){    return rmdir(filename) == 0;}

⌨️ 快捷键说明

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