📄 tct.s
字号:
;/*************************************************************************/;/* */;/* 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_InterruptsTCT_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 a3,CPSR ; Pickup current CPSR ORR a3,a3,#LOCKOUT ; Build lockout CPSR MSR CPSR_cxsf,a3 ; Lockout interrupts temporarily LDR a2,Int_Level ; Pickup interrupt level LDR a4,[a2, #0] ; Pickup current interrupt lockout BIC a3,a3,#LOCK_MSK ; Clear lockout mask ORR a3,a3,a1 ; Build new CPSR with appropriate ; interrupts locked out STR a1,[a2,#0] ; Save current lockout MSR CPSR_cxsf,a3 ; Setup new CPSR lockout bits AND a1,a4,#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_InterruptsTCT_Local_Control_Interrupts;INT old_level; /* Old interrupt level */; /* read in the old level */; old_level = current interrupt level of processor MRS a3,CPSR ; Pickup current CPSR MOV a4,a3 ; 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 a3,a3,#LOCK_MSK ; Clear all current interrupts ORR a3,a3,a1 ; Build new CPSR with new ; interrupt level MSR CPSR_cxsf,a3 ; Setup new CPSR interrupt bits; /* Return old interrupt lockout level. */; return(old_level) AND a1,a4,#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_InterruptsTCT_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 a2,CPSR ; Pickup current CPSR MOV a3,a2 ; save the CPSR value ORR a2,a2,#LOCKOUT ; Build lockout CPSR MSR CPSR_cxsf,a2 ; Lockout interrupts temporarily BIC a3,a3,#LOCK_MSK ; Clear current interrupt levels LDR a2,Int_Level ; Load address of TCD_Interrupt_Level LDR a1,[a2, #0] ; Pickup current interrupt lockout ORR a3,a3,a1 ; Build new CPSR with appropriate ; interrupts locked out MSR CPSR_cxsf,a3 ; Setup new CPSR lockout bits BX lr ; Return to caller;} ;/*************************************************************************/;/* */;/* FUNCTION */;/* */;/* TCT_Build_Task_Stack */;/* */;/* DESCRIPTION */;/* */;/* This function builds an initial stack frame for a task. The */;/* initial stack contains information concerning initial values of */;/* registers and the task's point of entry. Furthermore, the */;/* initial stack frame is in the same form as an interrupt stack */;/* frame. */;/* */;/* CALLED BY */;/* */;/* TCC_Create_Task Create a new task */;/* TCC_Reset_Task Reset the specified task */;/* */;/* CALLS */;/* */;/* None */;/* */;/* INPUTS */;/* */;/* task Task control block pointer */;/* */;/* OUTPUTS */;/* */;/* None */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -