📄 tct.s
字号:
;/*************************************************************************/
;/* */
;/* Copyright (c) 1993-1999 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 ARM 6/7/9 1.11.18 */
;/* */
;/* 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 */
;/* by changing */
;/* TCD_Interrupt_Level */
;/* TCT_Local_Control_Interrupts Enable/disable interrupts */
;/* by not changing */
;/* TCD_Interrupt_Level */
;/* TCT_Restore_Interrupts Restores interrupts to the */
;/* level in TCD_Interrupt_Level */
;/* 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 02-15-1994 Created initial version 1.0 */
;/* D. Lamie 02-15-1994 Verified version 1.0 */
;/* C. Meredith 03-01-1994 Fixed time-slice problem, fixed */
;/* a problem in interrupt control */
;/* function, fixed ARM bug in */
;/* TCT_Unprotect_Specific, and */
;/* and added two new interrupt */
;/* control services, resulting in */
;/* version 1.1 */
;/* D. Lamie 03-18-1994 Verified version 1.1 */
;/* M. Trippi 07-11-1996 New NUCLEUS.H and TMT.S created */
;/* version 1.2 */
;/* M. Trippi 02-03-1997 TCT_Control_Interrupts and */
;/* TCT_Local_Control_Interrupts */
;/* returned the entire Status */
;/* Register instead of just the */
;/* Interrupt mask. (SPR0252) */
;/* M. Trippi 02-18-1997 Released version 1.3 */
;/* M. Manning 03-04-1997 Released version 1.4 */
;/* J. Bolton 08-26-1997 Released version 1.5 */
;/* J. Bolton 10-08-1997 Released version 1.6 */
;/* M. Kyle Craig 02-05-1999 Revised version 1.11.17 */
;/* George Clark 02-05-1999 Verified and Released 1.11.17 */
;/* B. Whatley 08-12-1999 Released version 1.11.18 */
;/* */
;/*************************************************************************/
;#define NU_SOURCE_FILE
;
;#include "cs_extr.h" /* Common service functions */
;#include "tc_extr.h" /* Thread control functions */
;
;/* Define constants used in low-level initialization. */
;
;
LOCKOUT EQU &C0 ; Interrupt lockout value
LOCK_MSK EQU &C0 ; Interrupt lockout mask value
MODE_MASK EQU &1F ; Processor Mode Mask
SUP_MODE EQU &13 ; Supervisor Mode (SVC)
IRQ_MODE EQU &12 ; Interrupt Mode (IRQ)
FIQ_MODE EQU &11 ; Fast Interrupt Mode (FIQ)
IRQ_BIT EQU &80 ; Interrupt bit of CPSR and SPSR;
;
AREA |C$$data|,DATA
|x$dataseg|
;
;/* 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;
;
;/* Define internal variables so the C compiler can provide meaningful
; code with offsets into data structures. Typically, this section is
; removed after this file is compiled down to assembly language. */
;
;BYTE_PTR REG_Stack_Base;
;BYTE_PTR REG_Stack_End;
;BYTE_PTR REG_Stack_Ptr;
;UNSIGNED REG_Stack_Size;
;TC_TCB *REG_Thread_Ptr;
;TC_HCB *REG_HISR_Ptr;
;TC_PROTECT *REG_Protect_Ptr;
;VOID *REG_Function_Ptr;
;
EXPORT TCT_System_Limit
TCT_System_Limit
DCD &00000000
;
;
; If assembled with TASM the variable {CONFIG} will be set to 16
; II assembled with ARMASM the variable {CONFIG} will be set to 32
; Set the variable THUMB to TRUE or false depending on whether the
; file is being assembled with TASM or ARMASM.
GBLL THUMB
GBLL ARM
[ {CONFIG} = 16
THUMB SETL {TRUE}
ARM SETL {FALSE}
; If assembling with TASM go into 32 bit mode as the Armulator will
; start up the program in ARM state.
CODE32
|
THUMB SETL {FALSE}
ARM SETL {TRUE}
]
;
[ THUMB
AREA |C$$code|, CODE, READONLY,INTERWORK
|x$codeseg|
|
AREA |C$$code|, CODE, READONLY
|x$codeseg|
]
;/* 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;
;
IMPORT TCD_Execute_Task
IMPORT TCD_Execute_HISR
IMPORT TCD_Current_Thread
IMPORT TCD_System_Stack
IMPORT TCD_Interrupt_Count
IMPORT TCD_Active_HISR_Heads
IMPORT TCD_Active_HISR_Tails
IMPORT TCD_Interrupt_Level
IMPORT TMD_Time_Slice
IMPORT 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);
;
IMPORT TCC_Task_Shell
IMPORT TCC_Signal_Shell
IMPORT ERC_System_Error
;
;/* Define internal function references. */
;VOID TCT_Schedule_Protected(VOID *thread);
;
EXPORT TCT_Schedule_Protected
;
;/* Define pointers to system variables so their addresses may be obtained in a
; pc-relative manner. */
;
System_Limit
DCD TCT_System_Limit
;
Int_Level
DCD TCD_Interrupt_Level
;
Task_Shell
DCD TCC_Task_Shell
;
HISR_Shell
DCD TCT_HISR_Shell
;
Signal_Shell
DCD TCC_Signal_Shell
;
Current_Thread
DCD TCD_Current_Thread
;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -