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

📄 tct.s

📁 mcf5307实验源代码
💻 S
📖 第 1 页 / 共 5 页
字号:
;/*************************************************************************/
;/*                                                                       */
;/*        Copyright (c) 1993-1996 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/MCF5204_06/D 1.2  */
;/*                                                                       */
;/* COMPONENT                                                             */
;/*                                                                       */
;/*      TC - Thread Control                                              */
;/*                                                                       */
;/* DESCRIPTION                                                           */
;/*                                                                       */
;/*      This file contains the target processor dependent routines for   */
;/*      performing target-dependent scheduling functions.                */
;/*                                                                       */
;/* AUTHOR                                                                */
;/*                                                                       */
;/*      Barry Sellew, 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 interrupt lck */
;/*      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         */
;/*      TCT_Check_For_Preemption            Check for preemption         */
;/*                                                                       */
;/* DEPENDENCIES                                                          */
;/*                                                                       */
;/*      cs_extr.h                           Common Service functions     */
;/*      tc_extr.h                           Thread Control functions     */
;/*                                                                       */
;/* HISTORY                                                               */
;/*                                                                       */
;/*         NAME            DATE                    REMARKS               */
;/*                                                                       */
;/*      B. Sellew       02-21-1997      Created and verified version 1.0 */                                               */
;/*      B. Sellew       07-30-1997      Created and verified version 1.1 */                                               */
;/*      B. Sellew       11-06-1997      Created and verified 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;
;
        XREF    _TCD_Interrupt_Level
        XREF    _TCD_Current_Thread
        XREF    _TCD_Execute_HISR
        XREF    _TCD_Execute_Task
        XREF    _TMD_Time_Slice
        XREF    _TMD_Time_Slice_State
        XREF    _TCD_System_Stack
        XREF    _TCD_Interrupt_Count
        XREF    _TCD_Active_HISR_Tails
        XREF    _TCD_Active_HISR_Heads
;
;
;/* Define external function references.  */
;VOID    TCC_Task_Shell(VOID);
;VOID    TCC_Signal_Shell(VOID);
;VOID    ERC_System_Error(INT error);
;
        XREF    _TCC_Task_Shell
        XREF    _TCC_Signal_Shell
        XREF    _ERC_System_Error
;
;
;/* Define internal function references.  */
;VOID  TCT_Schedule_Protected(VOID *thread);
;
;
        SECTION .bss
;
;/* Define the flag that determines if a nested condition is present 
;   before the actual interrupt counter can be incremented.  */
;
;UNSIGNED    TCT_Nested;
;
        XDEF    _TCT_Nested
_TCT_Nested     DS.B    4
;
;
;/* Define the saved interrupt posture for use during interrupt processing.  */
;
;UNSIGNED    TCT_Interrupt_Level;
;
        XDEF    _TCT_Interrupt_Level
_TCT_Interrupt_Level    DS.B    4
;
;
;/* Define internal interrupt lockout constant.  This value must lockout any
;   interrupt that interfaces with Nucleus.  */
;
LOCKOUT         EQU     $2700
;
;/* Define the interrupt lockout that protects the HISR activation lists.  This
;   allows the user to make a HISR active from a high-priority non-managed 
;   ISR.  This value must lockout all interrupts that are locked out by
;   the LOCKOUT equate, defined previously.  */
;
HISRLOCK        EQU     $2700
;
;
;/* Define initial SR value for tasks and HISRs.  */
;
INIT_SR         EQU     $2000
;
;
        SECTION .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                                                                */
;/*                                                                       */
;/*      Barry Sellew, 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               */
;/*                                                                       */
;/*      B. Sellew       02-21-1997      Created and verified version 1.0 */                                               */
;/*                                                                       */
;/*************************************************************************/
        XDEF    _TCT_Control_Interrupts
_TCT_Control_Interrupts:
;INT  TCT_Control_Interrupts(new_level)
;{
;
;INT     old_level;                          /* Old interrupt level       */
;
;    /* For the 52xx family, do not modify the actual interrupt level 
;       value inside of ISRs, since it is used to determine if nesting
;       has occurred prior to normal nesting detection logic.  */
;    if (TCD_Interrupt_Count == 0)
;        TCD_Interrupt_Level =  new_level;
;    else
;        TCT_Interrupt_Level =  new_level;
;
        TST.L   _TCD_Interrupt_Count        ; Called from interrupt thread
        BNE     _TCT_Interrupt_Thread       ; Yes, use interrupt storage
        LEA     _TCD_Interrupt_Level,A0     ; Point at normal interrupt level
                                            ;   storage
        BRA     _TCT_Continue               ; 
_TCT_Interrupt_Thread:
        LEA     _TCT_Interrupt_Level,A0     ; Point at interrupt level storage
;
;    /* Obtain the current interrupt lockout posture.  */
;    old_level =  TCD_Interrupt_Level;
;

⌨️ 快捷键说明

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