⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tct.s

📁 mcf5307实验源代码
💻 S
📖 第 1 页 / 共 5 页
字号:
_TCT_Continue:
        CLR.L   D0                          ; Clear return value
	MOVE.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.L	#$0000F8FF,D1               ; Clear interrupt level
	OR.L	4(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                                                                */
;/*                                                                       */
;/*      Barry Sellew, 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               */
;/*                                                                       */
;/*      B. Sellew       02-21-1997      Created and verified version 1.0 */                                               */
;/*                                                                       */
;/*************************************************************************/
        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.L	#$0000F8FF,D0               ; Isolate interrupt level
	OR.L	D1,D0                       ; Build new SR
	MOVE.W	SR,D1			    ; Save old SR
	AND.L	#$00000700,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                                                                */
;/*                                                                       */
;/*      Barry Sellew, Accelerated Technology, Inc.                       */
;/*                                                                       */
;/* CALLED BY                                                             */
;/*                                                                       */
;/*      Application                                                      */
;/*                                                                       */
;/* CALLS                                                                 */
;/*                                                                       */
;/*      None                                                             */
;/*                                                                       */
;/* INPUTS                                                                */
;/*                                                                       */
;/*      None                                                             */
;/*                                                                       */
;/* OUTPUTS                                                               */
;/*                                                                       */
;/*      None                                                             */
;/*                                            level                      */
;/*                                                                       */
;/* HISTORY                                                               */
;/*                                                                       */
;/*         NAME            DATE                    REMARKS               */
;/*                                                                       */
;/*      B. Sellew       02-21-1997      Created and verified version 1.0 */                                               */
;/*                                                                       */
;/*************************************************************************/
        XDEF    _TCT_Restore_Interrupts
_TCT_Restore_Interrupts:
;VOID  TCT_Restore_Interrupts(VOID)
;{
;
	MOVE.W	#LOCKOUT,SR                 ; Lockout interrupts
        MOVE.W  SR,D0                       ; Pickup status register
	AND.L	#$0000F8FF,D0               ; Clear interrupt level
	OR.L	_TCD_Interrupt_Level,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                                                                */
;/*                                                                       */
;/*      Barry Sellew, 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               */
;/*                                                                       */
;/*      B. Sellew       02-21-1997      Created and verified version 1.0 */                                               */
;/*                                                                       */
;/*************************************************************************/
        XDEF    _TCT_Build_Task_Stack
_TCT_Build_Task_Stack:
;VOID  TCT_Build_Task_Stack(TC_TCB *task)
;{
;
        MOVEA.L 4(A7),A1                    ; Pickup task pointer in A1
;
;    /* Pickup the stack base.  */
;    REG_Stack_Base =  (BYTE_PTR) task -> tc_stack_start;
;
        MOVE.L  36(A1),D0                   ; Pickup start of stack area
;    
;    /* Pickup the stack size.  */
;    REG_Stack_Size =  task -> tc_stack_size;
;    
        MOVE.L  48(A1),D1                   ; Pickup size of stack area
;
;    /* Calculate the stack ending address.  */
;    REG_Stack_End =  REG_Stack_Base + REG_Stack_Size;
;    
        ADD.L   D1,D0                       ; Compute bottom of stack
        AND.L   #$FFFFFFFC,D0               ; Insure long word alignment
        SUBQ.L  #4,D0                       ; Backup the stack
        MOVEA.L D0,A0                       ; Put stack pointer into A0
;
;    /* Save the end of the stack area in the control block.  */
;    task -> tc_stack_end =  (VOID *) REG_Stack_End;
;
        MOVE.L  D0,40(A1)                   ; Save end of stack area
;
;    /* Save the minimum amount of remaining stack memory.  */
;    task -> tc_stack_minimum =  REG_Stack_Size - 80;
;
        SUB.L   #80,D1                      ; Requires this many bytes
        MOVE.L  D1,52(A1)                   ; Save minimum in control block
;    
;    /* Build an initial stack.  */
;
        CLR.L   D0                          ; Clear D0
        MOVE.L  D0,-(A0)                    ; Put NULL return address on the 
                                            ;   stack.  This is primarily for
                                            ;   source level debuggers
        MOVE.L  #_TCC_Task_Shell,D0         ; All tasks have same entry point

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -