📄 tct.s
字号:
;/* */
;/* W. Lamie 07-15-1993 Created initial version 1.0 */
;/* D. Lamie 07-15-1993 Verified version 1.0 */
;/* W. Lamie 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 */
;/* */
;/*************************************************************************/
XDEF _TCT_Control_Interrupts
_TCT_Control_Interrupts:
;INT TCT_Control_Interrupts(new_level)
;{
;
;INT old_level; /* Old interrupt level */
;
; /* For the 68xxx family, do not modify the actual interrupt level
; value inside of ISRs, since it is used to determine if nesting
; has occurred prior to normal nesting detection logic. */
; if (TCD_Interrupt_Count == 0)
; TCD_Interrupt_Level = new_level;
; else
; TCT_Interrupt_Level = new_level;
;
TST.L _TCD_Interrupt_Count ; Called from interrupt thread
BNE _TCT_Interrupt_Thread ; Yes, use interrupt storage
LEA _TCD_Interrupt_Level,A0 ; Point at normal interrupt level
; storage
BRA _TCT_Continue ;
_TCT_Interrupt_Thread:
LEA _TCT_Interrupt_Level,A0 ; Point at interrupt level storage
;
; /* Obtain the current interrupt lockout posture. */
; old_level = TCD_Interrupt_Level;
;
_TCT_Continue:
CLR.L D0 ; Clear return value
ORI.W #LOCKOUT,SR ; Lockout interrupts
MOVE.W 2(A0),D0 ; Pickup previous interrupt level
;
; /* Setup new interrupt lockout posture. */
;
MOVE.W 6(A7),2(A0) ; New interrupt level
MOVE.W SR,D1 ; Pickup status register
AND.W #$F8FF,D1 ; Clear interrupt level
OR.W 6(A7),D1 ; Or-in new interrupt level
MOVE.W D1,SR ; Put new level in SR
;
; /* Return old interrupt lockout level. */
; return(old_level);
RTS ; Return to caller
;}
;
;
;
;/*************************************************************************/
;/* */
;/* FUNCTION */
;/* */
;/* TCT_Local_Control_Interrupts */
;/* */
;/* DESCRIPTION */
;/* */
;/* This function enables and disables interrupts as specified by */
;/* the caller. */
;/* */
;/* AUTHOR */
;/* */
;/* William E. Lamie, Accelerated Technology, Inc. */
;/* */
;/* 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 03-01-1994 Created initial version 1.1 */
;/* D. Lamie 03-18-1994 Verified version 1.1 */
;/* B. Sellew 03-28-1995 Changed #$700 to #$F8FF, */
;/* resulting in version 1.0+2 */
;/* (spr 38) */
;/* */
;/*************************************************************************/
XDEF _TCT_Local_Control_Interrupts
_TCT_Local_Control_Interrupts:
;INT TCT_Local_Control_Interrupts(new_level)
;{
;
;INT old_level; /* Old interrupt level */
;
;
; /* Obtain the current interrupt lockout posture. */
; old_level = SR & 0x700;
;
;
; /* Setup new interrupt lockout posture. */
;
CLR.L D0 ; Clear return level
MOVE.W 6(A7),D1 ; Pickup New interrupt level
MOVE.W SR,D0 ; Pickup status register
AND.W #$F8FF,D0 ; Isolate interrupt level
OR.W D1,D0 ; Build new SR
MOVE.W SR,D1 ; Save old SR
AND.W #$700,D1 ; Isolate interrupt level
MOVE.W D0,SR ; Put new level in SR
MOVE.W D1,D0 ; Save old interrupt level
;
; /* Return old interrupt lockout level. */
; return(old_level);
RTS ; Return to caller
;}
;
;
;
;/*************************************************************************/
;/* */
;/* FUNCTION */
;/* */
;/* TCT_Restore_Interrupts */
;/* */
;/* DESCRIPTION */
;/* */
;/* This function restores interrupts to that specified in the */
;/* global TCD_Interrupt_Level variable. */
;/* */
;/* AUTHOR */
;/* */
;/* William E. Lamie, Accelerated Technology, Inc. */
;/* */
;/* CALLED BY */
;/* */
;/* Application */
;/* */
;/* CALLS */
;/* */
;/* None */
;/* */
;/* INPUTS */
;/* */
;/* None */
;/* */
;/* OUTPUTS */
;/* */
;/* None */
;/* level */
;/* */
;/* HISTORY */
;/* */
;/* NAME DATE REMARKS */
;/* */
;/* W. Lamie 03-01-1994 Created initial version 1.1 */
;/* D. Lamie 03-18-1994 Verified version 1.1 */
;/* */
;/*************************************************************************/
XDEF _TCT_Restore_Interrupts
_TCT_Restore_Interrupts:
;VOID TCT_Restore_Interrupts(VOID)
;{
;
ORI.W #LOCKOUT,SR ; Lockout interrupts
MOVE.W SR,D0 ; Pickup status register
AND.W #$F8FF,D0 ; Clear interrupt level
OR.W _TCD_Interrupt_Level+2,D0 ; Or-in global level
MOVE.W D0,SR ; Put new level in SR
RTS ; 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. */
;/* */
;/* AUTHOR */
;/* */
;/* William E. Lamie, Accelerated Technology, Inc. */
;/* */
;/* 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 */
;/* */
;/* HISTORY */
;/* */
;/* NAME DATE REMARKS */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -