📄 tct.s
字号:
#/*************************************************************************/
#/* */
#/* Copyright (c) 1993-1995 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/MPC860/D 1.3 */
#/* */
#/* 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 */
#/* */
#/* DEPENDENCIES */
#/* */
#/* cs_extr.h Common Service functions */
#/* tc_extr.h Thread Control functions */
#/* */
#/* HISTORY */
#/* */
#/* NAME DATE REMARKS */
#/* */
#/* Barry Sellew 06-24-1996 Created initial version 1.0 */
#/* Barry Sellew 06-16-1997 Created and verified ver. 1.1 */
#/* Barry Sellew 08-10-1997 Modified TCT_Interrupt_Context */
#/* _Restore, resulting in */
#/* version 1.2 */
#/* Barry Sellew 09-10-1997 Verified version 1.2 */
#/* Barry Sellew 02-02-1998 Created and verified ver. 1.3 */
#/* */
#/*************************************************************************/
.file "tct.s"
##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;
#
#
#/* Define external function references. */
#VOID TCC_Task_Shell(VOID);
#VOID TCC_Signal_Shell(VOID);
#VOID TCT_HISR_Shell(VOID);
#VOID ERC_System_Error(INT error);
#
.globl TCT_Control_Interrupts, TCT_Local_Control_Interrupts
.globl TCT_Restore_Interrupts, TCT_Build_Task_Stack
.globl TCT_Build_HISR_Stack, TCT_Build_Signal_Frame
.globl TCT_Check_Stack, TCT_Schedule, TCT_Control_To_Thread
.globl TCT_Control_To_System, TCT_Signal_Exit, TCT_Current_Thread
.globl _TCT_Set_Execute_Task, TCT_Protect, TCT_Unprotect
.globl TCT_Unprotect_Specific, TCT_Set_Current_Protect
.globl TCT_Protect_Switch, TCT_Schedule_Protected
.globl TCT_Interrupt_Context_Save, TCT_Interrupt_Context_Restore
.globl TCT_Activate_HISR, TCT_HISR_Shell
#
#/* Define internal function references. */
#VOID TCT_Schedule_Protected(VOID *thread);
#
# /* define the local variable for the nested interrupt stuff */
#
.lcomm TCT_Nested,4
#
# /* Define a variable for saving the system stack limit in. This value is
# intialized in INT.S and is in effect whenever the system stack is in
# use. */
#
#VOID *TCT_System_Limit;
#
.comm TCT_System_Limit,4
#
.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 (argument in r3) New interrupt enable level */
#/* */
#/* OUTPUTS */
#/* */
#/* old_level (return in r3) Previous interrupt enable */
#/* level */
#/* */
#/* HISTORY */
#/* */
#/* NAME DATE REMARKS */
#/* */
#/* Barry Sellew 06-24-1996 Created initial version 1.0 */
#/* */
#/*************************************************************************/
#INT TCT_Control_Interrupts(INT new_level)
#{
#
#INT old_level; #/* Old interrupt level */
.text
.align 2
TCT_Control_Interrupts:
#
# /* lockout interrupts */
#
mfmsr r11 # get current MSR value
rlwinm r11,r11,0,17,15 # mask off MSR[EE] bit
mtmsr r11 # write current interrupt status
#
# /* Obtain the current interrupt lockout posture. */
# old_level = TCD_Interrupt_Level;
#
addis r12,0,TCD_Interrupt_Level@ha
lwz r4,TCD_Interrupt_Level@l(r12)
#
# /* Setup new interrupt lockout posture. */
# TCD_Interrupt_Level = new_level;
#
stw r3,TCD_Interrupt_Level@l(r12)
#
# /* load the new interrupt level */
#
or r11,r11,r3 # or in new interrupt
mtmsr r11
#
# /* Return old interrupt lockout level. */
# return(old_level);
#
li r3,0
ori r3,r4,0
blr
#
#}
#
#/*************************************************************************/
#/* */
#/* FUNCTION */
#/* */
#/* TCT_Local_Control_Interrupts */
#/* */
#/* DESCRIPTION */
#/* */
#/* This function enables and disables interrupts as specified by */
#/* the caller. */
#/* */
#/* AUTHOR */
#/* */
#/* Barry Sellew, Accelerated Technology, Inc. */
#/* */
#/* CALLED BY */
#/* */
#/* Application */
#/* */
#/* CALLS */
#/* */
#/* None */
#/* */
#/* INPUTS */
#/* */
#/* new_level (argument in r3) New interrupt enable level */
#/* */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -