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

📄 tmt.s

📁 nucleus plus ARM9 source code
💻 S
📖 第 1 页 / 共 3 页
字号:
;*      This function returns the current value of the count-down timer. 
;*                                                                       
;* CALLED BY                                                             
;*                                                                       
;*      TMC_Start_Timer                     Start timer function         
;*                                                                       
;* CALLS                                                                 
;*                                                                       
;*      None                                                             
;*                                                                       
;* INPUTS                                                                
;*                                                                       
;*      None                                                             
;*                                                                       
;* OUTPUTS                                                               
;*                                                                       
;*      TMD_Timer                           Value of count-down timer    
;*                                                                       
;* HISTORY                                                               
;*                                                                       
;*         NAME            DATE                    REMARKS               
;*                                                                       
;*      W. Lamie        02-15-1994      Created initial version 1.0      
;*      D. Lamie        02-15-1994      Verified version 1.0             
;*                                                                       
;************************************************************************
;UNSIGNED  TMT_Read_Timer(void)
;{
    .def    $TMT_Read_Timer
$TMT_Read_Timer                             ; Dual-state interworking veneer
    .state16
    BX  r15
    NOP
    .state32
    B   _TMT_Read_Timer

        .def    _TMT_Read_Timer
_TMT_Read_Timer

; Return the current value of the count-down timer.
;    return(TMD_Timer);

        LDR     r0,Timer                    ; Build address to timer
        LDR     r0,[r0,#0]                  ; Pickup timer contents

        BX      r14                         ; Return to caller

;}

;************************************************************************
;*                                                                       
;* FUNCTION                                                              
;*                                                                       
;*      TMT_Enable_Timer                                                 
;*                                                                       
;* DESCRIPTION                                                           
;*                                                                       
;*      This function enables the count-down timer with the specified    
;*      value.                                                           
;*                                                                       
;* CALLED BY                                                             
;*                                                                       
;*      TMC_Start_Timer                     Start timer function         
;*      TMC_Timer_Task                      Timer expiration task        
;*                                                                       
;* CALLS                                                                 
;*                                                                       
;*      None                                                             
;*                                                                       
;* INPUTS                                                                
;*                                                                       
;*      time                                New count-down time          
;*                                                                       
;* 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  TMT_Enable_Timer(UNSIGNED time)
;{
    .def    $TMT_Enable_Timer
$TMT_Enable_Timer                           ; Dual-state interworking veneer
    .state16
    BX  r15
    NOP
    .state32
    B   _TMT_Enable_Timer

        .def    _TMT_Enable_Timer
_TMT_Enable_Timer

; Place the new time value into the count-down timer.
;    TMD_Timer =  time;

        LDR     r1,Timer                    ; Build address of timer
        STR     r0,[r1,#0]                  ; Store new timer value

; Indicate that the timer is active.
;    TMD_Timer_State =  TM_ACTIVE;

        MOV     r0,#0                       ; Build TM_ACTIVE value
        LDR     r1,Timer_State              ; Build address of timer state var
        STR     r0,[r1,#0]                  ; Change the state to active

        BX      r14                         ; Return to caller

;}

;************************************************************************
;*                                                                       
;* FUNCTION                                                              
;*                                                                       
;*      TMT_Adjust_Timer                                                 
;*                                                                       
;* DESCRIPTION                                                           
;*                                                                       
;*      This function adjusts the count-down timer with the specified    
;*      value, if the new value is less than the current.                
;*                                                                       
;* CALLED BY                                                             
;*                                                                       
;*      None                                                             
;*                                                                       
;* CALLS                                                                 
;*                                                                       
;*      None                                                             
;*                                                                       
;* INPUTS                                                                
;*                                                                       
;*      time                                New count-down time.         
;*                                                                       
;* 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             
;*      C. Meredith     08-27-1994      Corrected bug in new timer       
;*                                        adjust routine, resulting in   
;*                                        version 1.1a                   
;*      W. Lamie        08-27-1994      Verified version 1.1a            
;*                                                                       
;************************************************************************
;VOID  TMT_Adjust_Timer(UNSIGNED time)
;{
    .def    $TMT_Adjust_Timer
$TMT_Adjust_Timer                           ; Dual-state interworking veneer
    .state16
    BX  r15
    NOP
    .state32
    B   _TMT_Adjust_Timer

        .def    _TMT_Adjust_Timer
_TMT_Adjust_Timer

; Lockout all interrupts
;    TMD_Timer_State =  TM_NOT_ACTIVE;

        MRS     r3,CPSR                     ; Pickup current CPSR
        ORR     r2,r3,#LOCKOUT              ; Build lockout CPSR
        MSR     CPSR,r2                     ; Setup new CPSR interrupt bits

; Check for the new value is less than the current time value
;    if (time < TMD_Timer)

        LDR     r1,Timer                    ; Build address to timer var
        LDR     r2,[r1,#0]                  ; read value of the timer
        CMP     r2,r0                       ; Do Timer - time > 0, means
        BLT     TMT_No_Adjust               ; time < Timer.

;        Adjust the time 
;        TMD_Timer = time;

        STR     r0,[r1,#0]                  ; load passed in timer value

; Return to caller after restoring interrupts

TMT_No_Adjust:

        MSR     CPSR,r3                     ; Setup new CPSR enable bits

        BX      r14                         ; Return to caller
;}

;************************************************************************
;*                                                                       
;* FUNCTION                                                              
;*                                                                       
;*      TMT_Disable_Timer                                                
;*                                                                       
;* DESCRIPTION                                                           
;*                                                                       
;*      This function disables the count-down timer.                     
;*                                                                       
;* CALLED BY                                                             
;*                                                                       
;*      TMC_Start_Timer                     Start timer function         
;*      TMC_Timer_Task                      Timer expiration task        
;*                                                                       
;* CALLS                                                                 
;*                                                                       
;*      None                                                             
;*                                                                       
;* INPUTS                                                                
;*                                                                       
;*      None                                                             
;*                                                                       
;* 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  TMT_Disable_Timer(void)
;{
    .def    $TMT_Disable_Timer
$TMT_Disable_Timer                          ; Dual-state interworking veneer
    .state16
    BX  r15
    NOP
    .state32
    B   _TMT_Disable_Timer

        .def    _TMT_Disable_Timer

⌨️ 快捷键说明

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