📄 ramdisk.c
字号:
UCOUNT *mem_address;
/* Nucleus */
if( NU_Alloc_Partition(NUF_RAMDISK_PARTITION,
(unsigned int **) &mem_address,
NU_NO_TIMEOUT) == NU_SUCCESS )
return ((UTINY FAR *) mem_address);
else
return((UTINY FAR *)0);
#endif /* PLUS */
}
/*************************************************************************/
/* */
/* FUNCTION rd_free_page */
/* */
/* DESCRIPTION */
/* */
/* This function deallocates one page of memory from a Nucleus */
/* fixed partition. */
/* */
/* AUTHOR */
/* */
/* Peter Van Oudenaren */
/* */
/* CALLED BY */
/* */
/* pc_rd_open */
/* pc_rd_close */
/* */
/* CALLS */
/* */
/* NU_Deallocate_Partition (PLUS) */
/* NU_Change_Preemption (PLUS) */
/* free */
/* NU_Dealloc_Partition (RTX) */
/* */
/* INPUTS */
/* */
/* page - pointer to memory to be deallocated */
/* */
/* OUTPUTS */
/* */
/* none */
/* */
/* HISTORY */
/* */
/* NAME DATE REMARKS */
/* */
/* P. Van Oudenaren Initial Version */
/* N. Henderson 02/18/94 Cleanup */
/*************************************************************************/
VOID rd_free_page(UTINY FAR *page) /* __fn__ */
{
#if (PLUS)
#if (RAMDISK_FROMPOOL)
/* If the input parameter is valid, deallocate. */
if (page)
NU_Deallocate_Partition((VOID *)page);
#else
/* Using free() instead of dealloc */
OPTION preempt_status;
/* Don't let anyone interfere with the malloc. Anticpating DOS non-
reentrancy. */
preempt_status = NU_Change_Preemption(NU_NO_PREEMPT);
/* If the input is valid, deallocate the page. */
if (page)
free(page);
/* Others can take over now since the malloc is complete. */
NU_Change_Preemption(preempt_status);
#endif
#else /* RTX */
/* If the input is valid, deallocate the page. */
if (page)
NU_Dealloc_Partition((unsigned *)page);
#endif
}
/*************************************************************************/
/* */
/* FUNCTION pc_rd_ioctl */
/* */
/* DESCRIPTION */
/* */
/* This function doesn't do anything for the RAM Disk. It is */
/* included for devtable consistency. */
/* */
/* AUTHOR */
/* */
/* Peter Van Oudenaren */
/* */
/* CALLED BY */
/* */
/* none */
/* */
/* CALLS */
/* */
/* none */
/* */
/* INPUTS */
/* */
/* none */
/* */
/* OUTPUTS */
/* */
/* none */
/* */
/* HISTORY */
/* */
/* NAME DATE REMARKS */
/* */
/* P. Van Oudenaren Initial Version */
/* N. Henderson 02/18/94 Cleanup */
/*************************************************************************/
BOOL pc_rd_ioctl(UCOUNT driveno, UCOUNT command, VOID *buffer) /*__fn__*/
{
driveno = driveno;
command = command;
buffer = buffer;
return(NO);
}
/*************************************************************************/
/* */
/* FUNCTION pc_rd_raw_open */
/* */
/* DESCRIPTION */
/* */
/* This function doesn't do anything for the RAM Disk. It is */
/* included for devtable consistency. */
/* */
/* AUTHOR */
/* */
/* Peter Van Oudenaren */
/* */
/* CALLED BY */
/* */
/* none */
/* */
/* CALLS */
/* */
/* none */
/* */
/* INPUTS */
/* */
/* none */
/* */
/* OUTPUTS */
/* */
/* none */
/* */
/* HISTORY */
/* */
/* NAME DATE REMARKS */
/* */
/* P. Van Oudenaren Initial Version */
/* N. Henderson 02/18/94 Cleanup */
/*************************************************************************/
BOOL pc_rd_raw_open(UCOUNT driveno) /*__fn__*/
{
driveno = driveno;
return(NO);
}
/*************************************************************************/
/* */
/* FUNCTION pc_rd_open */
/* */
/* DESCRIPTION */
/* */
/* This function prepares the RAM Disk for usage by allocating the */
/* pages necessary for usage. */
/* */
/* AUTHOR */
/* */
/* Peter Van Oudenaren */
/* */
/* CALLED BY */
/* */
/* Nucleus FILE */
/* */
/* CALLS */
/* */
/* rd_alloc_page */
/* rd_free_page */
/* */
/* INPUTS */
/* */
/* driveno - the number assigned to the RAM Disk (not used) */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -