📄 ioce.c
字号:
/* This function performs error checking on the parameters supplied */
/* to the I/O driver request function. */
/* */
/* CALLED BY */
/* */
/* Application */
/* */
/* CALLS */
/* */
/* IOC_Request_Driver Actual request driver routine*/
/* */
/* INPUTS */
/* */
/* driver Driver control block pointer */
/* request User's I/O request */
/* */
/* OUTPUTS */
/* */
/* NU_INVALID_DRIVER Indicates the driver pointer */
/* is invalid */
/* NU_INVALID_POINTER Indicates the request pointer*/
/* is invalid */
/* */
/* HISTORY */
/* */
/* DATE REMARKS */
/* */
/* 03-01-1993 Created initial version 1.0 */
/* 04-19-1993 Verified version 1.0 */
/* 03-01-1994 Changed function interface, */
/* resulting in version 1.1 */
/* */
/* 03-18-1994 Verified version 1.1 */
/* */
/*************************************************************************/
STATUS IOCE_Request_Driver(NU_DRIVER *driver , NU_DRIVER_REQUEST *request)
{
STATUS status; /* Completion status */
/* Determine if driver pointer is invalid. */
if (driver == NU_NULL)
/* Driver pointer is invalid, indicate in completion status. */
status = NU_INVALID_DRIVER;
else if (driver -> nu_driver_id != IO_DRIVER_ID)
/* Driver pointer is invalid, indicate in completion status. */
status = NU_INVALID_DRIVER;
else if (request == NU_NULL)
/* Request pointer is invalid, indicate in completion status. */
status = NU_INVALID_POINTER;
else
/* Parameters are valid, call actual function. */
status = IOC_Request_Driver(driver, request);
/* Return the completion status. */
return(status);
}
/*************************************************************************/
/* */
/* FUNCTION */
/* */
/* IOCE_Resume_Driver */
/* */
/* DESCRIPTION */
/* */
/* This function performs error checking on the parameters supplied */
/* to the I/O driver resume function. */
/* */
/* CALLED BY */
/* */
/* Application */
/* */
/* CALLS */
/* */
/* TCCE_Validate_Resume Validate resume driver */
/* request against actual */
/* status */
/* IOC_Resume_Driver Actual resume driver routine */
/* */
/* INPUTS */
/* */
/* task Pointer of task to resume */
/* */
/* OUTPUTS */
/* */
/* NU_INVALID_TASK Indicates the task pointer */
/* is invalid */
/* NU_INVALID_RESUME Indicates the task is not */
/* suspended */
/* */
/* HISTORY */
/* */
/* DATE REMARKS */
/* */
/* 03-01-1993 Created initial version 1.0 */
/* 04-19-1993 Verified version 1.0 */
/* 03-01-1994 Modified logic that checked task */
/* status without protection of */
/* scheduling structures, */
/* resulting in version 1.0a */
/* 03-01-1994 Verified version 1.0a */
/* 03-01-1994 Changed function interface, */
/* resulting in version 1.1 */
/* */
/* 03-18-1994 Verified version 1.1 */
/* */
/*************************************************************************/
STATUS IOCE_Resume_Driver(NU_TASK *task)
{
STATUS status; /* Completion status */
/* Determine if the task pointer is valid. */
if ((task == NU_NULL) || (((TC_TCB *) task) -> tc_id != TC_TASK_ID))
/* Task pointer is invalid. */
status = NU_INVALID_TASK;
/* Check actual status of task to see if request is valid. */
else if (TCCE_Validate_Resume(NU_DRIVER_SUSPEND, task))
/* Task is not suspended in a driver, return error status. */
status = NU_INVALID_RESUME;
else
/* Call the actual resume service. */
status = IOC_Resume_Driver(task);
/* Return the completion status. */
return(status);
}
/*************************************************************************/
/* */
/* FUNCTION */
/* */
/* IOCE_Suspend_Driver */
/* */
/* DESCRIPTION */
/* */
/* This function performs error checking on the parameters supplied */
/* to the I/O driver suspend function. */
/* */
/* CALLED BY */
/* */
/* Application */
/* */
/* CALLS */
/* */
/* IOC_Suspend_Driver Actual driver suspend routine*/
/* TCCE_Suspend_Error Check for a legal suspension */
/* */
/* INPUTS */
/* */
/* terminate_routine Termination/Timeout cleanup */
/* routine */
/* information Information pointer of the */
/* cleanup routine */
/* timeout Suspension timeout request */
/* */
/* OUTPUTS */
/* */
/* NU_INVALID_SUSPEND Indicates suspension is not */
/* legal */
/* */
/* HISTORY */
/* */
/* DATE REMARKS */
/* */
/* 03-01-1993 Created initial version 1.0 */
/* 04-19-1993 Verified version 1.0 */
/* 03-01-1994 Changed function interface, */
/* resulting in version 1.1 */
/* */
/* 03-18-1994 Verified version 1.1 */
/* */
/*************************************************************************/
STATUS IOCE_Suspend_Driver(VOID (*terminate_routine)(VOID *),
VOID *information, UNSIGNED timeout)
{
STATUS status; /* Completion status */
/* Determine if there is a suspension error. */
if (TCCE_Suspend_Error())
/* Suspension error, not called from a legal thread. */
status = NU_INVALID_SUSPEND;
else
/* Call the actual suspend service. */
status = IOC_Suspend_Driver(terminate_routine, information, timeout);
/* Return the completion status. */
return(status);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -