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

📄 tct.s

📁 nuclues plus 源代码程序
💻 S
📖 第 1 页 / 共 5 页
字号:
;/*************************************************************************/
;/*                                                                       */
;/*         Copyright (c) 1993-1994 Accelerated Technology, Inc.          */
;/*                                                                       */
;/* PROPRIETARY RIGHTS of Accelerated Technology are involved in the      */
;/* subject matter of this material.  All manufacturing, reproduction,    */
;/* use, and sales rights pertaining to this subject matter are governed  */
;/* by the license agreement.  The recipient of this software implicitly  */
;/* accepts the terms of the license.                                     */
;/*                                                                       */
;/*************************************************************************/
;
;/*************************************************************************/
;/*                                                                       */
;/* FILE NAME                                            VERSION          */
;/*                                                                       */
;/*      tct.s                                       PLUS/68HC11/I 1.2    */
;/*                                                                       */
;/* COMPONENT                                                             */
;/*                                                                       */
;/*      TC - Thread Control                                              */
;/*                                                                       */
;/* DESCRIPTION                                                           */
;/*                                                                       */
;/*      This file contains the target processor dependent routines for   */
;/*      performing target-dependent scheduling functions.                */
;/*                                                                       */
;/* AUTHOR                                                                */
;/*                                                                       */
;/*      William E. Lamie, Accelerated Technology, Inc.                   */
;/*                                                                       */
;/* DATA STRUCTURES                                                       */
;/*                                                                       */
;/*      None                                                             */
;/*                                                                       */
;/* FUNCTIONS                                                             */
;/*                                                                       */
;/*      TCT_Control_Interrupts              Enable / disable interrupts  */
;/*      TCT_Local_Control_Interrupts        Local enable / disable ints  */
;/*      TCT_Restore_Interrupts              Restore global interrupts    */
;/*      TCT_Build_Task_Stack                Build initial task stack     */
;/*      TCT_Build_HISR_Stack                Build initial HISR stack     */
;/*      TCT_Build_Signal_Frame              Build signal handler frame   */
;/*      TCT_Check_Stack                     Check current stack          */
;/*      TCT_Schedule                        Schedule the next thread     */
;/*      TCT_Control_To_Thread               Transfer control to a thread */
;/*      TCT_Control_To_System               Transfer control from thread */
;/*      TCT_Signal_Exit                     Exit from signal handler     */
;/*      TCT_Current_Thread                  Returns a pointer to current */
;/*                                            thread                     */
;/*      TCT_Set_Execute_Task                Sets TCD_Execute_Task under  */
;/*                                            protection from interrupts */
;/*      TCT_Protect                         Protect critical section     */
;/*      TCT_Unprotect                       Unprotect critical section   */
;/*      TCT_Unprotect_Specific              Release specific protection  */
;/*      TCT_Set_Current_Protect             Set the thread's current     */
;/*                                            protection field           */
;/*      TCT_Protect_Switch                  Switch to protected thread   */
;/*      TCT_Schedule_Protected              Schedule the protected thread*/
;/*      TCT_Interrupt_Context_Save          Save interrupted context     */
;/*      TCT_Interrupt_Context_Restore       Restore interrupted context  */
;/*      TCT_Activate_HISR                   Activate a HISR              */
;/*      TCT_HISR_Shell                      HISR execution shell         */
;/*                                                                       */
;/* DEPENDENCIES                                                          */
;/*                                                                       */
;/*      cs_extr.h                           Common Service functions     */
;/*      tc_extr.h                           Thread Control functions     */
;/*                                                                       */
;/* HISTORY                                                               */
;/*                                                                       */
;/*         NAME            DATE                    REMARKS               */
;/*                                                                       */
;/*      W. Lamie        06-01-1993      Created initial version 1.0      */
;/*      D. Lamie        06-01-1993      Verified version 1.0             */
;/*      W. Lamie        08-09-1993      Corrected several comments,      */
;/*                                        deactivated the time-slice     */
;/*                                        timer after context save,      */
;/*                                        resulting in version 1.0a      */
;/*      D. Lamie        08-09-1993      Verified version 1.0a            */
;/*      W. Lamie        09-19-1993      Added logic to prevent           */
;/*                                        de-referencing a NULL pointer  */
;/*                                        during initialization,         */
;/*                                        resulting in version 1.0b      */
;/*      D. Lamie        09-19-1993      Verified version 1.0b            */
;/*      K. Homer        03-01-1994      Corrected a problem that caused  */
;/*                                        HISR time-slicing, fixed       */
;/*                                        control interrupts problem,    */
;/*                                        added two new interrupt        */
;/*                                        control functions,             */
;/*                                        resulting in version 1.1       */
;/*      D. Lamie        03-18-1994      Verified version 1.1             */
;/*      M. Trippi       06-12-1996      New NUCLEUS.H created version 1.2*/
;/*                                                                       */
;/*************************************************************************/
;#define         NU_SOURCE_FILE
;
;#include        "cs_extr.h"                 /* Common service functions  */
;#include        "tc_extr.h"                 /* Thread control functions  */
;
;
;/* Define external inner-component global data references.  */
;
;extern TC_TCB          *TCD_Execute_Task;
;extern TC_HCB          *TCD_Execute_HISR;
;extern VOID            *TCD_Current_Thread;
;extern VOID            *TCD_System_Stack;
;extern INT              TCD_Interrupt_Count;
;extern TC_HCB          *TCD_Active_HISR_Heads[TC_HISR_PRIORITIES];
;extern TC_HCB          *TCD_Active_HISR_Tails[TC_HISR_PRIORITIES];
;extern INT              TCD_Interrupt_Level;
;extern UNSIGNED         TMD_Time_Slice;
;extern INT              TMD_Time_Slice_State;
;
        .external       _TMD_Time_Slice_State
        .external       _TMD_Time_Slice
        .external       _TCD_Interrupt_Level
        .external       _TCD_Active_HISR_Tails
        .external       _TCD_Active_HISR_Heads
        .external       _TCD_Interrupt_Count
        .external       _TCD_System_Stack
        .external       _TCD_Current_Thread
        .external       _TCD_Execute_HISR
        .external       _TCD_Execute_Task
;
;
;/* Define external function references.  */
;VOID    TCC_Task_Shell(VOID);
;VOID    TCC_Signal_Shell(VOID);
;VOID    ERC_System_Error(INT error);
;
        .external       _ERC_System_Error
        .external       _TCC_Signal_Shell
        .external       _TCC_Task_Shell
;
;
;/* Define internal function references.  */
;VOID  TCT_Schedule_Protected(VOID *thread);
;
;
        .psect  _bss
;/* Define the variable for saving the return address in.  */
;
;VOID    *TCT_Save_Ret_Addr;
;
        .public _TCT_Save_Ret_Addr
_TCT_Save_Ret_Addr:
        .byte   [2]
;
;
;/* Define constants of this file.  */
;
        .define INIT_CCR =  0000H
;
;       
        .psect  _text
;/*************************************************************************/
;/*                                                                       */
;/* FUNCTION                                                              */
;/*                                                                       */
;/*      TCT_Control_Interrupts                                           */
;/*                                                                       */
;/* DESCRIPTION                                                           */
;/*                                                                       */
;/*      This function enables and disables interrupts as specified by    */
;/*      the caller.  Interrupts disabled by this call are left disabled  */
;/*      until the another call is made to enable them.                   */
;/*                                                                       */
;/* AUTHOR                                                                */
;/*                                                                       */
;/*      William E. Lamie, Accelerated Technology, Inc.                   */
;/*                                                                       */
;/* CALLED BY                                                             */
;/*                                                                       */
;/*      Application                                                      */
;/*                                                                       */
;/* CALLS                                                                 */
;/*                                                                       */
;/*      None                                                             */
;/*                                                                       */
;/* INPUTS                                                                */
;/*                                                                       */
;/*      new_level                           New interrupt enable level   */
;/*                                                                       */
;/* OUTPUTS                                                               */
;/*                                                                       */
;/*      old_level                           Previous interrupt enable    */
;/*                                            level                      */
;/*                                                                       */
;/* HISTORY                                                               */
;/*                                                                       */
;/*         NAME            DATE                    REMARKS               */
;/*                                                                       */
;/*      W. Lamie        06-01-1993      Created initial version 1.0      */
;/*      D. Lamie        06-01-1993      Verified version 1.0             */
;/*      K. Homer        03-01-1994      Added interrupt lockout prior to */
;/*                                        manipulation of global         */
;/*                                        interrupt variable, resulting  */
;/*                                        in version 1.1                 */
;/*      D. Lamie        03-18-1994      Verified version 1.1             */
;/*                                                                       */
;/*************************************************************************/
;INT  TCT_Control_Interrupts(INT new_level)
;{
        .public _TCT_Control_Interrupts
_TCT_Control_Interrupts:
;
;INT     old_level;                          /* Old interrupt level       */
;
;
;    /* Obtain the current interrupt lockout posture.  */
;    old_level =  TCD_Interrupt_Level;
;
;    /* Setup new interrupt lockout posture.  */
;    TCD_Interrupt_Level =  new_level;
;        
;    /* Return old interrupt lockout level.  */
;    return(old_level);
;
        sei                                 ; Disable interrupts 
        ldy     _TCD_Interrupt_Level        ; Pickup current interrupt lockout
        std     _TCD_Interrupt_Level        ; Store new interrupt lockout
        tstb                                ; See if interrupts are to be 
                                            ;   enabled or disabled
        bne     _TCT_Int_Control_Done       ; If non-zero, leave interrupts 
                                            ;   disabled

⌨️ 快捷键说明

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