⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ioc.c

📁 test file nucleus source
💻 C
📖 第 1 页 / 共 3 页
字号:
/*      03-01-1994      Changed function interfaces to                   *//*                      match prototype, changed                         *//*                      protection logic, resulting in                   *//*                      version 1.1                                      *//*                                                                       *//*      03-18-1994      Verified version 1.1                             *//*      04-23-1996      Corrected SPR121                                 *//*                                                                       *//*************************************************************************/STATUS  IOC_Resume_Driver(NU_TASK *task){TC_PROTECT     *save_protect;               /* Saved protect pointer     */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_RESUME_DRIVER_ID, (UNSIGNED) task,                                                (UNSIGNED) 0, (UNSIGNED) 0);#endif    /* Pickup current protection. */    save_protect =  TCT_Get_Current_Protect();    /* Protect against system access.  */    TCT_System_Protect();#ifdef INCLUDE_PROVIEW    _RTProf_DumpDriver(RT_PROF_RESUME_DRIVER, 0 , RT_PROF_OK);#endif /*INCLUDE_PROVIEW*/    /* Resume the specified task.  */    if (TCC_Resume_Task(task, NU_DRIVER_SUSPEND))    {        /* Only unprotect if there is protection in place. */        if (save_protect)        {            /* Release protection caller had.  */            TCT_Unprotect_Specific(save_protect);        }        /* Transfer control to the system if the resumed task function           detects a preemption condition.  */        TCT_Control_To_System();    }    else    {        /* Determine if there was protection previously in force.  */        if (save_protect)        {            /* Switch to original protection.  */            TCT_Set_Current_Protect(save_protect);            /* Release system protection.  */            TCT_System_Unprotect();        }        else            /* Release system protection.  */            TCT_Unprotect();    }    /* Return to user mode */    NU_USER_MODE();    /* Return the completion status.  */    return(NU_SUCCESS);}/*************************************************************************//*                                                                       *//* FUNCTION                                                              *//*                                                                       *//*      IOC_Suspend_Driver                                               *//*                                                                       *//* DESCRIPTION                                                           *//*                                                                       *//*      This function suspends a task inside of an I/O driver.  It is    *//*      the responsibility of the I/O driver to keep track of tasks      *//*      waiting inside of an I/O driver.                                 *//*                                                                       *//* CALLED BY                                                             *//*                                                                       *//*      Application                                                      *//*      IOCE_Suspend_Driver                 Error checking shell         *//*                                                                       *//* CALLS                                                                 *//*                                                                       *//*      [HIC_Make_History_Entry]            Make entry in history log    *//*      TCC_Suspend_Task                    Suspend calling task         *//*      TCT_Current_Thread                  Current task thread          *//*      [TCT_Check_Stack]                   Stack checking function      *//*      TCT_Get_Current_Protect             Pickup current protect ptr   *//*      TCT_Set_Suspend_Protect             Setup suspend protect field  *//*      TCT_System_Protect                  Protect against system access*//*      TCT_Unprotect_Specific              Release user protection      *//*                                                                       *//* INPUTS                                                                *//*                                                                       *//*      terminate_routine                   Termination/Timeout cleanup  *//*                                            routine                    *//*      information                         Information pointer of the   *//*                                            cleanup routine            *//*      timeout                             Suspension timeout request   *//*                                                                       *//* OUTPUTS                                                               *//*                                                                       *//*      NU_SUCCESS                          If service is successful     *//*                                                                       *//* HISTORY                                                               *//*                                                                       *//*        DATE                    REMARKS                                *//*                                                                       *//*      03-01-1993      Created initial version 1.0                      *//*      04-19-1993      Verified version 1.0                             *//*      03-01-1994      Changed protection logic,                        *//*                      resulting in version 1.1                         *//*                                                                       *//*      03-18-1994      Verified version 1.1                             *//*      04-23-1996      Corrected SPR121.                                *//*                                                                       *//*************************************************************************/STATUS  IOC_Suspend_Driver(VOID (*terminate_routine)(VOID *),                                        VOID *information, UNSIGNED timeout){TC_PROTECT  *suspend_protect;               /* Current protection        */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_SUSPEND_DRIVER_ID, (UNSIGNED) terminate_routine,                                (UNSIGNED) information, (UNSIGNED) timeout);#endif    /* Pickup current protect.  */    suspend_protect =  TCT_Get_Current_Protect();    /* Setup system protection.  */    TCT_System_Protect();#ifdef INCLUDE_PROVIEW    _RTProf_DumpDriver(RT_PROF_SUSPEND_DRIVER, 0 , RT_PROF_OK);#endif /*INCLUDE_PROVIEW*/    /* If no protection exists, don't unprotect. */    if (suspend_protect)    {        /* Release initial protection.  */        TCT_Unprotect_Specific(suspend_protect);        /* Save suspend protect for timeout and terminate.  */        TCT_Set_Suspend_Protect(suspend_protect);    }    /* Suspend the calling task.  */    TCC_Suspend_Task((NU_TASK *) TCT_Current_Thread(), NU_DRIVER_SUSPEND,                                terminate_routine, information, timeout);    /* Return to user mode */    NU_USER_MODE();    /* Return the completion status.  */    return(NU_SUCCESS);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -