pm.c
来自「适合KS8695X」· C语言 代码 · 共 702 行 · 第 1/2 页
C
702 行
switch (port) {
case 0: return 0x3BC;
case 1: return 0x378;
case 2: return 0x278;
}
return 0;
}
/****************************************************************************
REMARKS:
Allocate a block of (unnamed) shared memory.
****************************************************************************/
void * PMAPI PM_mallocShared(
long size)
{
return PM_malloc(size);
}
/****************************************************************************
REMARKS:
Free a block of shared memory.
****************************************************************************/
void PMAPI PM_freeShared(
void *ptr)
{
PM_free(ptr);
}
/****************************************************************************
REMARKS:
Map a linear memory address to the calling process address space. The
address will have been allocated in another process using the
PM_mapPhysicalAddr function.
****************************************************************************/
void * PMAPI PM_mapToProcess(
void *base,
ulong limit)
{
return base;
}
/****************************************************************************
REMARKS:
Map a real mode pointer to a protected mode pointer.
****************************************************************************/
void * PMAPI PM_mapRealPointer(
uint r_seg,
uint r_off)
{
/* Not used for RTTarget-32 */
return NULL;
}
/****************************************************************************
REMARKS:
Allocate a block of real mode memory
****************************************************************************/
void * PMAPI PM_allocRealSeg(
uint size,
uint *r_seg,
uint *r_off)
{
/* Not used for RTTarget-32 */
return NULL;
}
/****************************************************************************
REMARKS:
Free a block of real mode memory.
****************************************************************************/
void PMAPI PM_freeRealSeg(
void *mem)
{
/* Not used for RTTarget-32 */
}
/****************************************************************************
REMARKS:
Issue a real mode interrupt (parameters in DPMI compatible structure)
****************************************************************************/
void PMAPI DPMI_int86(
int intno,
DPMI_regs *regs)
{
/* Not used for RTTarget-32 */
}
/****************************************************************************
REMARKS:
Issue a real mode interrupt.
****************************************************************************/
int PMAPI PM_int86(
int intno,
RMREGS *in,
RMREGS *out)
{
/* Not used for RTTarget-32 */
return 0;
}
/****************************************************************************
REMARKS:
Issue a real mode interrupt.
****************************************************************************/
int PMAPI PM_int86x(
int intno,
RMREGS *in,
RMREGS *out,
RMSREGS *sregs)
{
/* Not used for RTTarget-32 */
return 0;
}
/****************************************************************************
REMARKS:
Call a real mode far function.
****************************************************************************/
void PMAPI PM_callRealMode(
uint seg,
uint off,
RMREGS *in,
RMSREGS *sregs)
{
/* Not used for RTTarget-32 */
}
/****************************************************************************
REMARKS:
Return the amount of available memory.
****************************************************************************/
void PMAPI PM_availableMemory(
ulong *physical,
ulong *total)
{
/* TODO: Figure out how to determine the available memory. Not entirely */
/* critical so returning 0 is OK. */
*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, phsyically contigous memory for DMA */
return 0;
}
/****************************************************************************
REMARKS:
Free a block of locked physical memory.
****************************************************************************/
void PMAPI PM_freeLockedMem(
void *p,
uint size,
ibool contiguous)
{
/* TODO: Free a locked memory buffer */
}
/****************************************************************************
REMARKS:
Call the VBE/Core software interrupt to change display banks.
****************************************************************************/
void PMAPI PM_setBankA(
int bank)
{
/* Not used for RTTarget-32 */
}
/****************************************************************************
REMARKS:
Call the VBE/Core software interrupt to change display banks.
****************************************************************************/
void PMAPI PM_setBankAB(
int bank)
{
/* Not used for RTTarget-32 */
}
/****************************************************************************
REMARKS:
Call the VBE/Core software interrupt to change display start address.
****************************************************************************/
void PMAPI PM_setCRTStart(
int x,
int y,
int waitVRT)
{
/* Not used for RTTarget-32 */
}
/****************************************************************************
REMARKS:
Execute the POST on the secondary BIOS for a controller.
****************************************************************************/
ibool PMAPI PM_doBIOSPOST(
ushort axVal,
ulong BIOSPhysAddr,
void *mappedBIOS)
{
/* Not used for RTTarget-32 */
return false;
}
PM_MODULE PMAPI PM_loadLibrary(
const char *szDLLName)
{
/* TODO: Implement this to load shared libraries! */
(void)szDLLName;
return NULL;
}
void * PMAPI PM_getProcAddress(
PM_MODULE hModule,
const char *szProcName)
{
/* TODO: Implement this! */
(void)hModule;
(void)szProcName;
return NULL;
}
void PMAPI PM_freeLibrary(
PM_MODULE hModule)
{
/* TODO: Implement this! */
(void)hModule;
}
/****************************************************************************
REMARKS:
Function to find the first file matching a search criteria in a directory.
****************************************************************************/
ulong 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(
ulong 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(
ulong 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 this
function will return false for anything except a value of 3 (considered
the root drive, and equivalent to C: for non-Unix systems). The drive
numbering 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 regardless
of 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 + =
减小字号Ctrl + -
显示快捷键?