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

📄 tcse.c

📁 已移植到TI OMAP1610处理器的Nucleus操作系统源码
💻 C
📖 第 1 页 / 共 3 页
字号:
/*************************************************************************/
/*                                                                       */
/*               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       */
/*                                                                       */
/*      tcse.c                                         Nucleus PLUS 1.14 */
/*                                                                       */
/* COMPONENT                                                             */
/*                                                                       */
/*      TC - Thread Control                                              */
/*                                                                       */
/* DESCRIPTION                                                           */
/*                                                                       */
/*      This file contains error checking routines for the supplemental  */
/*      functions in the Thread Control component.  This permits easy    */
/*      removal of error checking logic when it is not needed.           */
/*                                                                       */
/* DATA STRUCTURES                                                       */
/*                                                                       */
/*      None                                                             */
/*                                                                       */
/* FUNCTIONS                                                             */
/*                                                                       */
/*      TCSE_Change_Priority                Change task's priority       */
/*      TCSE_Change_Preemption              Change task's preemption     */
/*      TCSE_Change_Time_Slice              Change task's time slice     */
/*      TCSE_Control_Signals                Enable and disable signals   */
/*      TCSE_Receive_Signals                Receive current signals      */
/*      TCSE_Register_Signal_Handler        Register a signal handler    */
/*      TCSE_Send_Signals                   Send signals to a task       */
/*      TCSE_Activate_HISR                  Activate an HISR             */
/*                                                                       */
/* DEPENDENCIES                                                          */
/*                                                                       */
/*      tc_extr.h                           Thread Control functions     */
/*                                                                       */
/* HISTORY                                                               */
/*                                                                       */
/*         DATE                    REMARKS                               */
/*                                                                       */
/*      03-01-1994      Created initial version 1.1 from                 */
/*                        routines originally in core                    */
/*                        error checking file                            */
/*                                                                       */
/*      03-18-1994      Verified version 1.1                             */
/*      04-17-1996      updated to version 1.2                           */
/*      03-17-1997      Protected Send Signals service                   */
/*                      from NULL Control Block pointers                 */
/*                      creating 1.2a. (SPR220)                          */
/*      03-24-1998      Released version 1.3.                            */
/*      04-17-2002      Released version 1.13m                           */
/*      11-07-2002      Released version 1.14                            */
/*************************************************************************/
#define         NU_SOURCE_FILE


#include        "tc_extr.h"                 /* Thread control functions  */

/* Define external inner-component global data references.  */

extern TC_TCB          *TCD_Execute_Task;
extern VOID            *TCD_Current_Thread;


/*************************************************************************/
/*                                                                       */
/* FUNCTION                                                              */
/*                                                                       */
/*      TCSE_Change_Priority                                             */
/*                                                                       */
/* DESCRIPTION                                                           */
/*                                                                       */
/*      This function performs error checking for the change priority    */
/*      service.  If an error is detected, this service is ignored and   */
/*      the requested priority is returned.                              */
/*                                                                       */
/* CALLED BY                                                             */
/*                                                                       */
/*      Application                                                      */
/*                                                                       */
/* CALLS                                                                 */
/*                                                                       */
/*      TCS_Change_Priority                 Actual change priority       */
/*                                                                       */
/* INPUTS                                                                */
/*                                                                       */
/*      task_ptr                            Task control block pointer   */
/*      new_priority                        New priority for task        */
/*                                                                       */
/* OUTPUTS                                                               */
/*                                                                       */
/*      old_priority                        Original task priority       */
/*                                                                       */
/* 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                             */
/*                                                                       */
/*************************************************************************/
OPTION   TCSE_Change_Priority(NU_TASK *task_ptr, OPTION new_priority)
{

TC_TCB         *task;                       /* Task control block ptr    */
OPTION          old_priority;               /* Previous priority of task */


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

    /* Determine if the task pointer is valid.  */
    if (task -> tc_id == TC_TASK_ID) 
    
        /* Nothing seems to be wrong, change the priority as specified.  */
        old_priority =  TCS_Change_Priority(task_ptr, new_priority);
        
    else
    
        /* Copy the new priority into the old priority.  */
        old_priority =  new_priority;
    
    /* Return the previous priority.  */
    return(old_priority);
}


/*************************************************************************/
/*                                                                       */
/* FUNCTION                                                              */
/*                                                                       */
/*      TCSE_Change_Preemption                                           */
/*                                                                       */
/* DESCRIPTION                                                           */
/*                                                                       */
/*      This function performs error checking on the change preemption   */
/*      service.  If the current thread is not a task thread, this       */
/*      request is ignored.                                              */
/*                                                                       */
/* CALLED BY                                                             */
/*                                                                       */
/*      Application                                                      */
/*                                                                       */
/* CALLS                                                                 */
/*                                                                       */
/*      TCS_Change_Preemption               Change the preemption posture*/
/*                                            of the calling task        */
/*                                                                       */
/* INPUTS                                                                */
/*                                                                       */
/*      preempt                             Preempt selection parameter  */
/*                                                                       */
/* OUTPUTS                                                               */
/*                                                                       */
/*      old_preempt                         Original preempt value       */
/*                                                                       */
/* HISTORY                                                               */
/*                                                                       */
/*         DATE                    REMARKS                               */
/*                                                                       */
/*      03-01-1993      Created initial version 1.0                      */
/*      04-19-1993      Verified version 1.0                             */

⌨️ 快捷键说明

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