📄 ioc.c
字号:
/*************************************************************************//* *//* Copyright Mentor Graphics Corporation 2002 *//* All Rights Reserved. *//* *//* THIS WORK CONTAINS TRADE SECRET AND PROPRIETARY INFORMATION WHICH IS *//* THE PROPERTY OF MENTOR GRAPHICS CORPORATION OR ITS LICENSORS AND IS *//* SUBJECT TO LICENSE TERMS. *//* *//*************************************************************************//*************************************************************************//* *//* FILE NAME VERSION *//* *//* ioc.c Nucleus PLUS 1.14 *//* *//* COMPONENT *//* *//* IO - Input/Output Driver Management *//* *//* DESCRIPTION *//* *//* This file contains the core routines for the I/O Driver *//* Management component. *//* *//* 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 *//* *//* DATE REMARKS *//* *//* 03-01-1993 Created initial version 1.0 *//* 04-19-1993 Verified version 1.0 *//* 08-09-1993 Corrected pointer retrieval *//* loop, resulting in version 1.0a *//* 08-09-1993 Verified version 1.0a *//* 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 *//* *//* 03-15-1994 Verified version 1.1 *//* 04-17-1996 updated to version 1.2 *//* 04-23-1996 Corrected SPR121. *//* 03-24-1998 Released version 1.3 *//* 03-26-1999 Released 1.11m (new release *//* numbering scheme) *//* 04-07-1999 Release 1.11mA *//* 04-17-2002 Released version 1.13m *//* 11-07-2002 Released version 1.14 *//*************************************************************************/#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 */#include "profiler.h" /* ProView interface *//* 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. *//* *//* 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 *//* *//* DATE REMARKS *//* *//* 03-01-1993 Created initial version 1.0 *//* 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 */NU_SUPERV_USER_VARIABLES /* Switch to supervisor mode */ NU_SUPERVISOR_MODE();#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++;#ifdef INCLUDE_PROVIEW _RTProf_DumpDriver(RT_PROF_CREATE_DRIVER, driver, RT_PROF_OK);#endif /*INCLUDE_PROVIEW*/ /* Release protection against access to the list of created I/O drivers. */ TCT_Unprotect(); /* Return to user mode */ NU_USER_MODE(); /* Return successful completion. */ return(NU_SUCCESS);}/*************************************************************************//* *//* FUNCTION *//* *//* IOC_Delete_Driver *//* */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -