📄 tct.s
字号:
;/*************************************************************************/
;/* */
;/* 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/68xxx/X 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 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 */
;/* */
;/* W. Lamie 07-15-1993 Created initial version 1.0 */
;/* D. Lamie 07-15-1993 Verified version 1.0 */
;/* W. Lamie 08-09-1993 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 check to avoid using a */
;/* NULL pointer during system */
;/* initialization, resulting in */
;/* version 1.0b */
;/* D. Lamie 09-19-1993 Verified version 1.0b */
;/* W. Lamie 03-01-1994 Fixed time-slice problem, fixed */
;/* a problem in interrupt control */
;/* function, and added two new */
;/* interrupt control services, */
;/* resulting in version 1.1 */
;/* D. Lamie 03-18-1994 Verified version 1.1 */
;/* U. Pollock 03-25-1996 Added PCSI Fix, fixes an */
;/* interrupt problem where */
;/* TCD_Interrupt_Level is read and */
;/* an interrupt occurs that changes */
;/* it before it is written back with*/
;/* the correct value. */
;/* B. Sellew 03-28-1996 TCT_Local_Control_Interrupts was */
;/* modified, resulting in version */
;/* 1.0+2 (spr 38) */
;/* M.Q Qian 04-24-1996 Updated to 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 ram
;
;/* 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.L 1
;
;
;/* Define the saved interrupt posture for use during interrupt processing. */
;
;UNSIGNED TCT_Interrupt_Level;
;
XDEF _TCT_Interrupt_Level
_TCT_Interrupt_Level DS.L 1
;
;
;/* Define internal interrupt lockout constant. This value must lockout any
; interrupt that interfaces with Nucleus. */
;
LOCKOUT EQU $0700
;
;/* 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 $0700
;
;
;/* Define initial SR value for tasks and HISRs. */
;
INIT_SR EQU $2000
;
;
SECTION code
;/*************************************************************************/
;/* */
;/* 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 */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -