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

📄 tcse.c

📁 nuclues 内核源代码已经在arm7-9 上作了移植
💻 C
📖 第 1 页 / 共 3 页
字号:
/*      TCS_Receive_Signals                 Actual receive signals func  */
/*                                                                       */
/* INPUTS                                                                */
/*                                                                       */
/*      None                                                             */
/*                                                                       */
/* OUTPUTS                                                               */
/*                                                                       */
/*      Current signals                                                  */
/*                                                                       */
/* HISTORY                                                               */
/*                                                                       */
/*         DATE                    REMARKS                               */
/*                                                                       */
/*      03-01-1993      Created initial version 1.0                      */
/*      04-19-1993      Verified version 1.0                             */
/*                                                                       */
/*************************************************************************/
UNSIGNED  TCSE_Receive_Signals(VOID)
{

TC_TCB          *task;                      /* Task pointer              */
UNSIGNED        signals;                    /* Current signals           */

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

    /* Determine if the call is valid.  */
    if (task -> tc_id == TC_TASK_ID)
    
        /* Valid request- call actual routine to receive signals.  */
        signals =  TCS_Receive_Signals();
    else
    
        /* Return cleared signals.  */
        signals =  0;        
        
    /* Return the signals to the caller.  */
    return(signals);
}


/*************************************************************************/
/*                                                                       */
/* FUNCTION                                                              */
/*                                                                       */
/*      TCSE_Register_Signal_Handler                                     */
/*                                                                       */
/* DESCRIPTION                                                           */
/*                                                                       */
/*      This function determines whether or not the caller is a task.    */
/*      If the caller is not a task and/or if the supplied signal        */
/*      handling function pointer is NULL, an appropriate error status   */
/*      is returned.                                                     */
/*                                                                       */
/* AUTHOR                                                                */
/*                                                                       */
/*      Accelerated Technology, Inc.                                     */
/*                                                                       */
/* CALLED BY                                                             */
/*                                                                       */
/*      Application                                                      */
/*                                                                       */
/* CALLS                                                                 */
/*                                                                       */
/*      TCS_Register_Signal_Handler         Actual function to register  */
/*                                            the signal handler         */
/*                                                                       */
/* INPUTS                                                                */
/*                                                                       */
/*      signal_handler                      Signal execution shell       */
/*                                                                       */
/* OUTPUTS                                                               */
/*                                                                       */
/*      NU_INVALID_TASK                     Not called from task thread  */
/*      NU_INVALID_POINTER                  Signal handler pointer NULL  */
/*                                                                       */
/* HISTORY                                                               */
/*                                                                       */
/*         DATE                    REMARKS                               */
/*                                                                       */
/*      03-01-1993      Created initial version 1.0                      */
/*      04-19-1993      Verified version 1.0                             */
/*                                                                       */
/*************************************************************************/
STATUS  TCSE_Register_Signal_Handler(VOID (*signal_handler)(UNSIGNED))
{

STATUS           status;                    /* Return status             */
TC_TCB          *task;                      /* Task pointer              */

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

    /* Determine if the caller is a task.  */
    if (task -> tc_id != TC_TASK_ID)
    
        /* Indicate that the caller is invalid.  */
        status =  NU_INVALID_TASK;
        
    else if (signal_handler == NU_NULL)
    
        /* Indicate that the signal handler is invalid.  */
        status =  NU_INVALID_POINTER;

    else
    
        /* Everything is fine, call the actual function.  */
        status =  TCS_Register_Signal_Handler(signal_handler);
        
    /* Return completion status.  */
    return(status);
}


/*************************************************************************/
/*                                                                       */
/* FUNCTION                                                              */
/*                                                                       */
/*      TCSE_Send_Signals                                                */
/*                                                                       */
/* DESCRIPTION                                                           */
/*                                                                       */
/*      This function checks for an invalid task.  If an invalid task    */
/*      is selected and error is returned.                               */
/*                                                                       */
/* AUTHOR                                                                */
/*                                                                       */
/*      Accelerated Technology, Inc.                                     */
/*                                                                       */
/* CALLED BY                                                             */
/*                                                                       */
/*      Application                                                      */
/*                                                                       */
/* CALLS                                                                 */
/*                                                                       */
/*      TCS_Send_Signals                    Actual send signal function  */
/*                                                                       */
/* INPUTS                                                                */
/*                                                                       */
/*      task_ptr                            Task pointer                 */
/*      signals                             Signals to send to the task  */
/*                                                                       */
/* OUTPUTS                                                               */
/*                                                                       */
/*      NU_INVALID_TASK                     Task 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                             */
/*      03-17-1997      Corrected SPR220.                                */
/*                                                                       */
/*************************************************************************/
STATUS  TCSE_Send_Signals(NU_TASK *task_ptr, UNSIGNED signals)
{

TC_TCB         *task;                       /* Task control block ptr    */
STATUS          status;                     /* Completion status         */


    /* Move input task pointer into internal pointer.  */
    task =  (TC_TCB *) task_ptr;

    /* Determine if the task pointer is valid.  */
    if ((task != NU_NULL)  && (task -> tc_id == TC_TASK_ID))
    
        /* Task pointer is valid, call the actual function.  */
        status =  TCS_Send_Signals(task_ptr, signals);
    else
    
        /* Task pointer is invalid, return an error status.  */
        status =  NU_INVALID_TASK;
        
    /* Return the completion status.  */
    return(status);
}

⌨️ 快捷键说明

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