📄 ioc.c
字号:
/*************************************************************************/
/* */
/* Copyright (c) 1993-1996 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 */
/* */
/* ioc.c PLUS 1.2 */
/* */
/* COMPONENT */
/* */
/* IO - Input/Output Driver Management */
/* */
/* DESCRIPTION */
/* */
/* This file contains the core routines for the I/O Driver */
/* Management component. */
/* */
/* AUTHOR */
/* */
/* William E. Lamie, Accelerated Technology, Inc. */
/* */
/* DATA STRUCTURES */
/* */
/* None */
/* */
/* FUNCTIONS */
/* */
/* IOC_Create_Driver Create an I/O driver */
/* IOC_Delete_Driver Delete an I/O driver */
/* IOC_Request_Driver Make an I/O driver request */
/* IOC_Resume_Driver Resume a task suspended in */
/* an I/O driver */
/* IOC_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 */
/* */
/* NAME DATE REMARKS */
/* */
/* W. Lamie 03-01-1993 Created initial version 1.0 */
/* D. Lamie 04-19-1993 Verified version 1.0 */
/* W. Lamie 08-09-1993 Corrected pointer retrieval */
/* loop, resulting in version 1.0a */
/* D. Lamie 08-09-1993 Verified version 1.0a */
/* W. Lamie 03-01-1994 Moved non-core functions into */
/* supplemental files, changed */
/* function interfaces to match */
/* those in prototype, changed */
/* protection logic to reduce */
/* overhead, resulting in */
/* version 1.1 */
/* R. Pfaff - */
/* D. Lamie 03-15-1994 Verified version 1.1 */
/* M.Q. Qian 04-17-1996 updated to version 1.2 */
/* */
/*************************************************************************/
#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 */
/* Define external inner-component global data references. */
extern CS_NODE *IOD_Created_Drivers_List;
extern UNSIGNED IOD_Total_Drivers;
extern TC_PROTECT IOD_List_Protect;
/*************************************************************************/
/* */
/* FUNCTION */
/* */
/* IOC_Create_Driver */
/* */
/* DESCRIPTION */
/* */
/* This function creates an I/O driver and places it on the list of */
/* created I/O drivers. Note that this function does not actually */
/* invoke the driver. */
/* */
/* AUTHOR */
/* */
/* William E. Lamie, Accelerated Technology, Inc. */
/* */
/* CALLED BY */
/* */
/* Application */
/* IOCE_Create_Driver Error checking shell */
/* */
/* CALLS */
/* */
/* CSC_Place_On_List Add node to linked-list */
/* [HIC_Make_History_Entry] Make entry in history log */
/* [TCT_Check_Stack] Stack checking function */
/* TCT_Protect Data structure protect */
/* TCT_Unprotect Un-protect data structure */
/* */
/* INPUTS */
/* */
/* driver Driver control block pointer */
/* name Driver's logical name */
/* driver_entry Driver's point of entry */
/* */
/* OUTPUTS */
/* */
/* NU_SUCCESS */
/* */
/* HISTORY */
/* */
/* NAME DATE REMARKS */
/* */
/* W. Lamie 03-01-1993 Created initial version 1.0 */
/* D. Lamie 04-19-1993 Verified version 1.0 */
/* */
/*************************************************************************/
STATUS IOC_Create_Driver(NU_DRIVER *driver, CHAR *name,
VOID (*driver_entry)(NU_DRIVER *, NU_DRIVER_REQUEST *))
{
INT i; /* Working index variable */
#ifdef NU_ENABLE_STACK_CHECK
/* Call stack checking function to check for an overflow condition. */
TCT_Check_Stack();
#endif
#ifdef NU_ENABLE_HISTORY
/* Make an entry that corresponds to this function in the system history
log. */
HIC_Make_History_Entry(NU_CREATE_DRIVER_ID, (UNSIGNED) driver,
(UNSIGNED) name, (UNSIGNED) driver_entry);
#endif
/* First, clear the driver ID just in case it is an old Driver
Control Block. */
driver -> nu_driver_id = 0;
/* Fill in the driver's name. */
for (i = 0; i < NU_MAX_NAME; i++)
driver -> nu_driver_name[i] = name[i];
/* Save the driver's entry function in the control block. */
driver -> nu_driver_entry = driver_entry;
/* Protect against access to the list of created drivers. */
TCT_Protect(&IOD_List_Protect);
/* At this point the driver is completely built. The ID can now be
set and it can be linked into the created driver list. */
driver -> nu_driver_id = IO_DRIVER_ID;
/* Link the driver into the list of created I/O drivers and increment the
total number of drivers in the system. */
CSC_Place_On_List(&IOD_Created_Drivers_List, (CS_NODE *) driver);
IOD_Total_Drivers++;
/* Release protection against access to the list of created I/O drivers. */
TCT_Unprotect();
/* Return successful completion. */
return(NU_SUCCESS);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -