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

📄 tct.s

📁 已移植到TI OMAP1610处理器的Nucleus操作系统源码
💻 S
📖 第 1 页 / 共 5 页
字号:
;    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,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,r2                     ; Setup new CPSR lockout bits
        AND     r0,r3,#LOCK_MSK             ; Return previous lockout (SPR0252)
      
        BX      r14                         ; 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)
;{
    .def    $TCT_Local_Control_Interrupts
$TCT_Local_Control_Interrupts               ; Dual-state interworking veneer
    .state16
    BX  r15
    NOP
    .state32
    B   _TCT_Local_Control_Interrupts

        .def    _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,r2                     ; Setup new CPSR interrupt bits

;    Return old interrupt lockout level. 
;    return(old_level);

        AND     r0,r3,#LOCK_MSK             ; Return previous lockout (SPR0252)
       
        BX      r14                         ; 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)
;{
    .def    $TCT_Restore_Interrupts
$TCT_Restore_Interrupts                     ; Dual-state interworking veneer
    .state16
    BX  r15
    NOP
    .state32
    B   _TCT_Restore_Interrupts

        .def    _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,r1                     ; Lockout interrupts temporarily
        BIC     r2,r2,#LOCK_MSK             ; Clear current interrupt levels
        LDR     r1,Int_Level                ; Load address of TCD_Interrupt_Level
        LDR     r0,[r1, #0]                 ; Pickup current interrupt lockout
        ORR     r2,r2,r0                    ; Build new CPSR with appropriate
                                            ; interrupts locked out
        MSR     CPSR,r2                     ; Setup new CPSR lockout bits

        BX      r14                         ; 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                                                             
;*                                                                       
;* HISTORY                                                               
;*                                                                       
;*         NAME            DATE                    REMARKS               
;*                                                                       
;*      W. Lamie        02-15-1994      Created initial version 1.0      
;*      D. Lamie        02-15-1994      Verified version 1.0             
;*                                                                       
;************************************************************************
;VOID  TCT_Build_Task_Stack(TC_TCB *task)
;{
    .def    $TCT_Build_Task_Stack
$TCT_Build_Task_Stack                       ; Dual-state interworking veneer
    .state16
    BX  r15
    NOP
    .state32
    B   _TCT_Build_Task_Stack

        .def    _TCT_Build_Task_Stack
_TCT_Build_Task_Stack

    ; Pickup the stack base. 
;    REG_Stack_Base =  (BYTE_PTR) task -> tc_stack_start;

        LDR     r2,[r0,#24h]                ; Pickup the stack starting address

    ; Pickup the stack size. 
;    REG_Stack_Size =  task -> tc_stack_size;

        LDR     r1,[r0,#30h]                ; Pickup the stack size in bytes

    ; Calculate the stack ending address. 
;    REG_Stack_End =  REG_Stack_Base + REG_Stack_Size - 1;

        ADD     r3,r1,r2                    ; Compute the beginning of stack
        BIC     r3,r3,#3                    ; Insure word alignment
        SUB     r3,r3,#4                    ; Reserve a word

    ; Save the stack ending address. 
;    task -> tc_stack_end =  REG_Stack_End;

        STR     r3,[r0,#28h]                ; Save the stack ending address

    ; Reference the task shell. 
;    REG_Function_Ptr =  (VOID *) TCC_Task_Shell;

; Build an initial stack.  This initial stack frame facilitates an 
; interrupt return to the TCC_Task_Shell function, which in turn 
; invokes the application task.  The initial stack frame has the 
; following format:

⌨️ 快捷键说明

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