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

📄 tcce.c

📁 nuclues plus 源代码程序
💻 C
📖 第 1 页 / 共 5 页
字号:
    task =  (TC_TCB *) TCD_Current_Thread;
     
    /* Determine if the current thread is a task.  If so, call the actual
       task sleep routine.  Otherwise, ignore the request.  */
    if ((task) && (task -> tc_id == TC_TASK_ID))
    
        /* Valid request, call the sleep function.  */
        TCC_Task_Sleep(ticks);
}


/*************************************************************************/
/*                                                                       */
/* FUNCTION                                                              */
/*                                                                       */
/*      TCCE_Suspend_Error                                               */
/*                                                                       */
/* DESCRIPTION                                                           */
/*                                                                       */
/*      This function checks for a suspend request error.  Suspension    */
/*      requests are only allowed from task threads.  A suspend request  */
/*      from any other thread is an error.                               */
/*                                                                       */
/* AUTHOR                                                                */
/*                                                                       */
/*      William E. Lamie, Accelerated Technology, Inc.                   */
/*                                                                       */
/* CALLED BY                                                             */
/*                                                                       */
/*      Other Components                                                 */
/*                                                                       */
/* CALLS                                                                 */
/*                                                                       */
/*      None                                                             */
/*                                                                       */
/* INPUTS                                                                */
/*                                                                       */
/*      None                                                             */
/*                                                                       */
/* OUTPUTS                                                               */
/*                                                                       */
/*      NU_TRUE                             If an error is detected      */
/*      NU_FALSE                            If no error is detected      */
/*                                                                       */
/* HISTORY                                                               */
/*                                                                       */
/*         NAME            DATE                    REMARKS               */
/*                                                                       */
/*      W. Lamie        03-01-1993      Created initial version 1.0      */
/*      D. Lamie        04-19-1993      Verified version 1.0             */
/*                                                                       */
/*************************************************************************/
INT   TCCE_Suspend_Error(VOID)
{

TC_TCB          *task;                      /* Task pointer              */
INT              status =  NU_FALSE;        /* Initialize to no error    */


    /* Setup the task pointer.  */
    task =  (TC_TCB *) TCD_Current_Thread;

    /* Check for suspension errors.  */
    if (task == NU_NULL)
    
        /* Error, suspend request probably from initialization.  */
        status =  NU_TRUE;
        
    else if (task -> tc_id != TC_TASK_ID)

        /* Control block is probably an HISR not a task.  */
        status =  NU_TRUE;

    else if (task -> tc_signal_active)
    
        /* Called from a signal handler.  */
        status =  NU_TRUE;
        
    /* Return status to caller.  */
    return(status);
}


/*************************************************************************/
/*                                                                       */
/* FUNCTION                                                              */
/*                                                                       */
/*      TCCE_Activate_HISR                                               */
/*                                                                       */
/* DESCRIPTION                                                           */
/*                                                                       */
/*      This function performs error checking on the parameters supplied */
/*      to the activate HISR function.                                   */
/*                                                                       */
/* AUTHOR                                                                */
/*                                                                       */
/*      William E. Lamie, Accelerated Technology, Inc.                   */
/*                                                                       */
/* CALLED BY                                                             */
/*                                                                       */
/*      Application                                                      */
/*                                                                       */
/* CALLS                                                                 */
/*                                                                       */
/*      TCT_Activate_HISR                   Actual HISR activate call    */
/*                                                                       */
/* INPUTS                                                                */
/*                                                                       */
/*      hisr_ptr                            HISR control block pointer   */
/*                                                                       */
/* OUTPUTS                                                               */
/*                                                                       */
/*      NU_INVALID_HISR                     Invalid HISR pointer         */
/*                                                                       */
/* 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        03-01-1994      Modified function interface,     */
/*                                        added register optimizations,  */
/*                                        resulting in version 1.1       */
/*      R. Pfaff -                                                       */
/*      D. Lamie        03-18-1994      Verified version 1.1             */
/*                                                                       */
/*************************************************************************/
STATUS  TCCE_Activate_HISR(NU_HISR *hisr_ptr)
{

TC_HCB         *hisr;                       /* HISR control block ptr    */
STATUS          status;                     /* Completion status         */



    /* Move input HISR control block pointer into internal pointer.  */
    hisr =  (TC_HCB *) hisr_ptr;

    /* Check each parameter.  */
    if (hisr == NU_NULL)
    
        /* Invalid HISR control block pointer.  */
        status =  NU_INVALID_HISR;

    else if (hisr -> tc_id != TC_HISR_ID)
    
        /* Invalid HISR control block pointer.  */
        status =  NU_INVALID_HISR;
        
    else
    
        /* Call the routine to activate the HISR.  */
        status =  TCT_Activate_HISR(hisr_ptr);
        
    /* Return completion status.  */
    return(status);
}


/*************************************************************************/
/*                                                                       */
/* FUNCTION                                                              */
/*                                                                       */
/*      TCCE_Validate_Resume                                             */
/*                                                                       */
/* DESCRIPTION                                                           */
/*                                                                       */
/*      This function validates the resume service and resume driver     */
/*      calls with scheduling protection around the examination of the   */
/*      task status.                                                     */
/*                                                                       */
/* AUTHOR                                                                */
/*                                                                       */
/*      William E. Lamie, Accelerated Technology, Inc.                   */
/*                                                                       */
/* CALLED BY                                                             */
/*                                                                       */
/*      IOCE_Resume_Driver                  Driver error checking funct. */
/*      TCCE_Resume_Service                 Error checking function      */
/*                                                                       */
/* CALLS                                                                 */
/*                                                                       */
/*      TCT_Set_Current_Protect             Setup current protect pointer*/
/*      TCT_System_Protect                  Protect from system access   */
/*      TCT_System_Unprotect                Release system protection    */
/*      TCT_Unprotect                       Release current protection   */
/*                                                                       */
/* INPUTS                                                                */
/*                                                                       */
/*      resume_type                         Type of resume request       */
/*      task_ptr                            Task control block pointer   */
/*                                                                       */
/* OUTPUTS                                                               */
/*                                                                       */
/*      NU_TRUE                             Invalid resume               */
/*      NU_FALSE                            Valid resume                 */
/*                                                                       */
/* HISTORY                                                               */
/*                                                                       */
/*         NAME            DATE                    REMARKS               */
/*                                                                       */
/*      W. Lamie        03-01-1994      Created initial version of       */
/*                                        function for version 1.0g      */
/*      D. Lamie        03-01-1994      Verified version 1.0g            */
/*      W. Lamie        03-01-1994      Modified function interface,     */
/*                                        added register optimizations,  */
/*                                        added system protection logic, */
/*                                        moved to TCCE since it is an   */
/*                                        error interface function,      */
/*                                        resulting in version 1.1       */
/*      R. Pfaff -                                                       */
/*      D. Lamie        03-18-1994      Verified version 1.1             */
/*                                                                       */
/*************************************************************************/
STATUS  TCCE_Validate_Resume(OPTION resume_type, NU_TASK *task_ptr)
{

R1 TC_TCB      *task;  

⌨️ 快捷键说明

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