📄 tct.s
字号:
;************************************************************************
;*
;* Copyright Mentor Graphics Corporation 2002
;* All Rights Reserved.
;*
;* THIS WORK CONTAINS TRADE SECRET AND PROPRIETARY INFORMATION WHICH IS
;* THE PROPERTY OF MENTOR GRAPHICS CORPORATION OR ITS LICENSORS AND IS
;* SUBJECT TO LICENSE TERMS.
;*
;************************************************************************
;************************************************************************
;*
;* FILE NAME VERSION
;*
;* tct.s Nucleus PLUS\ARM925\Code Composer 1.14.1
;*
;* COMPONENT
;*
;* TC - Thread Control
;*
;* DESCRIPTION
;*
;* This file contains the target processor dependent routines for
;* performing target-dependent scheduling functions.
;*
;* 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
;*
;* B. Ronquillo 08-28-2002 Released version 1.14.1
;*
;************************************************************************
;#define NU_SOURCE_FILE
;******************************
;* INCLUDE ASSEMBLY CONSTANTS *
;******************************
;Define constants used in low-level initialization.
.include "D:\XWproject\Nucleus\source\Plus\Demo\asm_defs.inc"
.state32
.bss
;VOID *TCT_System_Limit;
; Auto set the variable THUMB to 1 or 0 depending on whether the
; batch files are being used with the "plus thumb" or not.
; .if $$isdefed("ASMTHUMB")
THUMB .equ 1
; .else
;THUMB .equ 0
; .endif
;**********************************
;* EXTERNAL VARIABLE DECLARATIONS *
;**********************************
;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;
.ref _TCD_Execute_Task
.ref _TCD_Execute_HISR
.ref _TCD_Current_Thread
.ref _TCD_System_Stack
.ref _TCD_Interrupt_Count
.ref _TCD_Active_HISR_Heads
.ref _TCD_Active_HISR_Tails
.ref _TCD_Interrupt_Level
.ref _TMD_Time_Slice
.ref _TMD_Time_Slice_State
.if $$isdefed("INCLUDE_PROVIEW")
.ref __NU_Schedule_Task_Hook
.ref __NU_Idle_Hook
.endif
;**********************************
;* EXTERNAL FUNCTION DECLARATIONS *
;**********************************
; 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);
.ref $TCC_Task_Shell
.ref $TCC_Signal_Shell
.ref $ERC_System_Error
.text
;**********************************
;* LOCAL VARIABLE DECLARATIONS *
;**********************************
; Define pointers to system variables so their addresses may be obtained in a
; pc-relative manner.
.def _TCT_System_Limit
_TCT_System_Limit
.word 00000000h
System_Limit
.word _TCT_System_Limit
Int_Level
.word _TCD_Interrupt_Level
Task_Shell
.word $TCC_Task_Shell
HISR_Shell
.word _TCT_HISR_Shell
Signal_Shell
.word $TCC_Signal_Shell
Current_Thread
.word _TCD_Current_Thread
Execute_HISR
.word _TCD_Execute_HISR
Execute_Task
.word _TCD_Execute_Task
Time_Slice
.word _TMD_Time_Slice
Slice_State
.word _TMD_Time_Slice_State
System_Stack
.word _TCD_System_Stack
Int_Count
.word _TCD_Interrupt_Count
HISR_Tails
.word _TCD_Active_HISR_Tails
HISR_Heads
.word _TCD_Active_HISR_Heads
System_Error
.word $ERC_System_Error+1
;************************************************************************
;*
;* 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.
;*
;* 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 02-15-1994 Created initial version 1.0
;* D. Lamie 02-15-1994 Verified version 1.0
;* C. Meredith 03-01-1994 Lockout interrupts while setting
;* up the new level, resutling in
;* version 1.1
;* D. Lamie 03-18-1994 Verified version 1.1
;* M. Trippi 02-03-1997 Masked the return value to only
;* return the interrupt bits.
;* (SPR0252)
;*
;************************************************************************
;INT TCT_Control_Interrupts (INT new_level)
;{
.def $TCT_Control_Interrupts
$TCT_Control_Interrupts ; Dual-state interworking veneer
.state16
BX r15
NOP
.state32
B _TCT_Control_Interrupts
.def _TCT_Control_Interrupts
_TCT_Control_Interrupts
;INT old_level; Old interrupt level
; lock out all interrupts before any checking or changing
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -