📄 tct.s
字号:
Signal_Shell
DCD TCC_Signal_Shell
;
Current_Thread
DCD TCD_Current_Thread
;
Execute_HISR
DCD TCD_Execute_HISR
;
Execute_Task
DCD TCD_Execute_Task
;
Time_Slice
DCD TMD_Time_Slice
;
Slice_State
DCD TMD_Time_Slice_State
;
System_Stack
DCD TCD_System_Stack
;
Int_Count
DCD TCD_Interrupt_Count
;
HISR_Tails
DCD TCD_Active_HISR_Tails
;
HISR_Heads
DCD TCD_Active_HISR_Heads
;
;
;/*************************************************************************/
;/* */
;/* 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)
;{
EXPORT TCT_Control_Interrupts
TCT_Control_Interrupts
;
;INT old_level; /* Old interrupt level */
;
; /* lock out all interrupts before any checking or changing */
;
; /* Obtain the current interrupt lockout posture. */
; old_level = TCD_Interrupt_Level;
;
; /* Setup new interrupt lockout posture. */
; TCD_Interrupt_Level = new_level;
;
; /* renable interrupts for the specified lockout */
;
; /* Return old interrupt lockout level. */
; return(old_level);
;
MRS r2,CPSR ; Pickup current CPSR
ORR r2,r2,#LOCKOUT ; Build lockout CPSR
MSR CPSR_cxsf,r2 ; Lockout interrupts temporarily
LDR r1,Int_Level ; Pickup interrupt level
LDR r3,[r1, #0] ; Pickup current interrupt lockout
BIC r2,r2,#LOCK_MSK ; Clear lockout mask
ORR r2,r2,r0 ; Build new CPSR with appropriate
; interrupts locked out
STR r0,[r1,#0] ; Save current lockout
MSR CPSR_cxsf,r2 ; Setup new CPSR lockout bits
AND r0,r3,#LOCK_MSK ; Return previous lockout (SPR0252)
BX lr ; Return to caller
;}
;
;
;
;/*************************************************************************/
;/* */
;/* FUNCTION */
;/* */
;/* TCT_Local_Control_Interrupts */
;/* */
;/* DESCRIPTION */
;/* */
;/* This function enables and disables interrupts as specified by */
;/* the caller. */
;/* */
;/* CALLED BY */
;/* */
;/* Application */
;/* */
;/* CALLS */
;/* */
;/* None */
;/* */
;/* INPUTS */
;/* */
;/* new_level New interrupt enable level */
;/* */
;/* OUTPUTS */
;/* */
;/* old_level Previous interrupt enable */
;/* level */
;/* */
;/* HISTORY */
;/* */
;/* NAME DATE REMARKS */
;/* */
;/* C. Meredith 03-01-1994 Created initial 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_Local_Control_Interrupts (INT new_level)
;{
EXPORT TCT_Local_Control_Interrupts
TCT_Local_Control_Interrupts
;
;INT old_level; /* Old interrupt level */
;
; /* read in the old level */
; old_level = current interrupt level of processor;
;
MRS r2,CPSR ; Pickup current CPSR
MOV r3,r2 ; save the old level
;
; /* clear out the old level and set the new level */
; current interrupt level of processor &= ~LOCKOUT;
; current interrupt level of processor |= new_level;
;
BIC r2,r2,#LOCK_MSK ; Clear all current interrupts
ORR r2,r2,r0 ; Build new CPSR with new
; interrupt level
MSR CPSR_cxsf,r2 ; Setup new CPSR interrupt bits
;
; /* Return old interrupt lockout level. */
; return(old_level);
;
AND r0,r3,#LOCK_MSK ; Return previous lockout (SPR0252)
BX lr ; Return to caller
;}
;
;
;
;/*************************************************************************/
;/* */
;/* FUNCTION */
;/* */
;/* TCT_Restore_Interrupts */
;/* */
;/* DESCRIPTION */
;/* */
;/* This function restores interrupts to that specified in the global*/
;/* TCD_Interrupt_Level variable. */
;/* */
;/* CALLED BY */
;/* */
;/* Application */
;/* */
;/* CALLS */
;/* */
;/* None */
;/* */
;/* INPUTS */
;/* */
;/* None. */
;/* */
;/* OUTPUTS */
;/* */
;/* None. */
;/* */
;/* HISTORY */
;/* */
;/* NAME DATE REMARKS */
;/* */
;/* C. Meredith 03-01-1994 Created initial version 1.1 */
;/* D. Lamie 03-18-1994 Verified version 1.1 */
;/* */
;/*************************************************************************/
;VOID TCT_Restore_Interrupts (VOID)
;{
EXPORT TCT_Restore_Interrupts
TCT_Restore_Interrupts
;
; /* lock out all interrupts before any checking or changing */
;
; /* Obtain the current interrupt lockout posture. */
;
; /* reload the level base on the TCD_Interrupt_Level variable */
;
;
MRS r1,CPSR ; Pickup current CPSR
MOV r2,r1 ; save the CPSR value
ORR r1,r1,#LOCKOUT ; Build lockout CPSR
MSR CPSR_cxsf,r1 ; Lockout interrupts temporarily
BIC r2,r2,#LOCK_MSK ; Clear current interrupt levels
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -