📄 ioce.c
字号:
/*************************************************************************/
/* */
/* Copyright (c) 1993-2001 Accelerated Technology, Inc. */
/* */
/* PROPRIETARY RIGHTS of Accelerated Technology are involved in the */
/* subject matter of this material. All manufacturing, reproduction, */
/* use, and sales rights pertaining to this subject matter are governed */
/* by the license agreement. The recipient of this software implicitly */
/* accepts the terms of the license. */
/* */
/*************************************************************************/
/*************************************************************************/
/* */
/* FILE NAME VERSION */
/* */
/* ioce.c PLUS 1.13 */
/* */
/* COMPONENT */
/* */
/* IO - Input/Output Driver Management */
/* */
/* DESCRIPTION */
/* */
/* This file contains the error checking routines for the functions */
/* in the Input/Output Driver component. This permits easy removal */
/* of error checking logic when it is not needed. */
/* */
/* AUTHOR */
/* */
/* Accelerated Technology, Inc. */
/* */
/* DATA STRUCTURES */
/* */
/* None */
/* */
/* FUNCTIONS */
/* */
/* IOCE_Create_Driver Create an I/O driver */
/* IOCE_Delete_Driver Delete an I/O driver */
/* IOCE_Request_Driver Make an I/O driver request */
/* IOCE_Resume_Driver Resume a task suspended in */
/* an I/O driver */
/* IOCE_Suspend_Driver Suspend a task inside an I/O */
/* driver */
/* */
/* DEPENDENCIES */
/* */
/* cs_extr.h Common Service functions */
/* tc_extr.h Thread Control functions */
/* io_extr.h I/O driver functions */
/* hi_extr.h History functions */
/* */
/* 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 name original error */
/* checking file and changed */
/* function interfaces, resulting */
/* in version 1.1 */
/* */
/* 03-18-1994 Verified version 1.1 */
/* 04-17-1996 updated to version 1.2 */
/* 03-24-1998 Released version 1.3 */
/* */
/*************************************************************************/
#define NU_SOURCE_FILE
#include "cs_extr.h" /* Common service functions */
#include "tc_extr.h" /* Thread control functions */
#include "io_extr.h" /* I/O driver functions */
#include "hi_extr.h" /* History functions */
/*************************************************************************/
/* */
/* FUNCTION */
/* */
/* IOCE_Create_Driver */
/* */
/* DESCRIPTION */
/* */
/* This function performs error checking on the parameters supplied */
/* to the I/O driver create function. */
/* */
/* AUTHOR */
/* */
/* Accelerated Technology, Inc. */
/* */
/* CALLED BY */
/* */
/* Application */
/* */
/* CALLS */
/* */
/* IOC_Create_Driver Actual create driver routine */
/* */
/* INPUTS */
/* */
/* driver Driver control block pointer */
/* name Driver's logical name */
/* driver_entry Driver's point of entry */
/* */
/* OUTPUTS */
/* */
/* NU_INVALID_DRIVER Indicates driver pointer is */
/* NULL or is already in use */
/* NU_INVALID_POINTER Indicates the driver's entry */
/* pointer is NULL */
/* */
/* 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_Create_Driver(NU_DRIVER *driver, CHAR *name,
VOID (*driver_entry)(NU_DRIVER *, NU_DRIVER_REQUEST *))
{
STATUS status; /* Completion status */
/* Check for an invalid driver pointer. */
if ((driver == NU_NULL) || (driver -> nu_driver_id == IO_DRIVER_ID))
/* Indicate that the driver pointer is invalid. */
status = NU_INVALID_DRIVER;
else if (driver_entry == NU_NULL)
/* Indicate that the driver entry point is invalid. */
status = NU_INVALID_POINTER;
else
/* Parameters are okay, call actual function to create an I/O
driver. */
status = IOC_Create_Driver(driver, name, driver_entry);
/* Return completion status. */
return(status);
}
/*************************************************************************/
/* */
/* FUNCTION */
/* */
/* IOCE_Delete_Driver */
/* */
/* DESCRIPTION */
/* */
/* This function performs error checking on the parameters supplied */
/* to the I/O driver delete function. */
/* */
/* AUTHOR */
/* */
/* Accelerated Technology, Inc. */
/* */
/* CALLED BY */
/* */
/* Application */
/* */
/* CALLS */
/* */
/* IOC_Delete_Driver Actual delete driver routine */
/* */
/* INPUTS */
/* */
/* driver Driver control block pointer */
/* */
/* OUTPUTS */
/* */
/* NU_INVALID_DRIVER Indicates the driver 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_Delete_Driver(NU_DRIVER *driver)
{
STATUS status; /* Completion status */
/* Determine if the driver pointer is valid. */
if ((driver) && (driver -> nu_driver_id == IO_DRIVER_ID))
/* Driver pointer is valid, call function to delete it. */
status = IOC_Delete_Driver(driver);
else
/* Driver pointer is invalid, indicate in completion status. */
status = NU_INVALID_DRIVER;
/* Return completion status. */
return(status);
}
/*************************************************************************/
/* */
/* FUNCTION */
/* */
/* IOCE_Request_Driver */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -