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

📄 tmt.s

📁 MMI层OBJ不能完全编译
💻 S
📖 第 1 页 / 共 2 页
字号:

    ; Restore interrupts to entry level

    MSR     CPSR,r3

    ; Return to caller

    BX      lr


;************************************************************************
;*
;*  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
;*
;*  REGISTERS MODIFIED
;*
;*      r0, r1
;*
;*  HISTORY
;*
;*      NAME            DATE            REMARKS
;*
;*      S. Nguyen       03/28/2005      Released version 1.15.1
;*
;************************************************************************
;VOID  TMT_Disable_Timer(void)

    .def    _TMT_Disable_Timer
_TMT_Disable_Timer

    ; Disable the count-down timer.

    MOV     r1,#1                           ; Build TM_NOT_ACTIVE value
    LDR     r0,TMT_Timer_State              ; Build address to timer state var
    STR     r1,[r0]                         ; Change timer state to not active

    ; Return to caller

    BX      lr


;************************************************************************
;*
;*  FUNCTION
;*
;*      TMT_Retrieve_TS_Task
;*
;*  DESCRIPTION
;*
;*      This function returns the time-sliced task pointer.
;*
;*  CALLED BY
;*
;*      TMC_Timer_HISR                  Timer HISR
;*
;*  CALLS
;*
;*      None
;*
;*  INPUTS
;*
;*      None
;*
;*  OUTPUTS
;*
;*      r0 -    Time sliced task pointer
;*
;*  REGISTERS MODIFIED
;*
;*      r0, r1
;*
;*  HISTORY
;*
;*      NAME            DATE            REMARKS
;*
;*      S. Nguyen       03/28/2005      Released version 1.15.1
;*
;************************************************************************
;NU_TASK  *_TMT_Retrieve_TS_Task(VOID)

    .def    _TMT_Retrieve_TS_Task
_TMT_Retrieve_TS_Task

    ; Read the current TMD_Time_Slice_Task in r0 (return register)

    LDR     r1,TMT_Slice_Task               ; Build address to timer slice var
    LDR     r0,[r1]                         ; Get task pointer to be returned

    ; Return to caller

    BX      lr                              ; Return to caller


;************************************************************************
;*
;*  FUNCTION
;*
;*      TMT_Timer_Interrupt
;*
;*  DESCRIPTION
;*
;*      This function processes the actual hardware interrupt.
;*      Processing includes updating the system clock, the count-
;*      down timer and the time-slice timer.  If one or both of the
;*      timers expire, the timer HISR is activated.
;*
;*  CALLED BY
;*
;*      INT_Timer_Interrupt
;*
;*  CALLS
;*
;*      TCT_Interrupt_Context_Save      Save interrupted context
;*      TCT_Activate_HISR               Activate timer HISR
;*      TCT_Interrupt_Context_Restore   Restore interrupted context
;*
;*  INPUTS
;*
;*      None
;*
;*  OUTPUTS
;*
;*      None
;*
;*  REGISTERS MODIFIED
;*
;*      r0, r1, r2, r3, r4, Interrupt stack SP (IRQ/FIQ)
;*
;*  HISTORY
;*
;*      NAME            DATE            REMARKS
;*
;*      S. Nguyen       03/28/2005      Released version 1.15.1
;*
;************************************************************************
;VOID  TMT_Timer_Interrupt(void)

    .def    _TMT_Timer_Interrupt
_TMT_Timer_Interrupt

    ; Increment the system clock.

    LDR     r0,TMT_System_Clock             ; Pickup system clock address
    LDR     r1,[r0]                         ; Pickup system clock value
    ADD     r1,r1,#1                        ; Increment system clock
    STR     r1,[r0]                         ; Store new system clock value

    ; Determine if the count-down timer is active.

    LDR     r1,TMT_Timer_State              ; Build address to timer state flag
    LDR     r0,[r1]                         ; Pickup timer state
    CMP     r0,#0                           ; Is there a timer active?
    BNE     TMT_No_Timer_Active             ; No, skip timer processing

    ; Pickup the value of the timer.

    LDR     r0,TMT_Timer                    ; Build timer address
    LDR     r2,[r0]                         ; Pickup the current timer value

    ; Test if the Timer is at 0 and if so skip the decrement

    CMP     r2,#0
    BEQ     TMT_Expired

    ; Decrement the count-down timer.

    SUBS    r2,r2,#1                        ; Decrement the timer value
    STR     r2,[r0]                         ; Store the new timer value

    BNE     TMT_No_Timer_Active             ; Skip over the Set Timer State

TMT_Expired

    ; If the timer has expired, modify the state to indicate that
    ; it has expired.

    MOV     r3,#2                           ; Build expired value
    STR     r3,[r1]                         ; Change the timer state to expired

TMT_No_Timer_Active

    ; Determine if the time-slice timer is active.

    LDR     r0,TMT_Slice_State              ; Build time slice state address
    LDR     r2,[r0]                         ; Pickup time slice state
    CMP     r2,#0                           ; Is there a time slice active?
    BNE     TMT_No_Time_Slice_Active        ; No, skip time slice processing

    ; Get the time-slice timer value

    LDR     r2,TMT_Time_Slice               ; Build time slice address
    LDR     r3,[r2]                         ; Pickup the time slice value

    ; Ensure the timer is not 0 before decrementing

    CMP     r3,#0
    BEQ     TMT_Time_Slice_Expire

    ; Decrement the time-slice timer and save it

    SUBS    r3,r3,#1                        ; Decrement the time slice
    STR     r3,[r2]                         ; Store the new time slice value

    ; Has time slice expired?

    BNE     TMT_No_Time_Slice_Active

TMT_Time_Slice_Expire

    ; If the time-slice timer has expired modify the
    ; time-slice state to indicate that it has.

    MOV     r3,#2                           ; Build TM_EXPIRED value
    STR     r3,[r0]                         ; Indicate time slice is expired

    ; Copy the current thread into the time-slice task pointer.

    LDR     r2,TMT_Current_Thread           ; Pickup current thread pointer adr
    LDR     r2,[r2]                         ; Pickup current thread pointer
    LDR     r3,TMT_Slice_Task               ; Pickup time slice task pointer ad
    STR     r2,[r3]                         ; Store current thread pointer

    ; Place a minimal time slice into the task's control block.

    MOV     r3,#1                           ; For safety, place a minimal time-
    STR     r3,[r2,#TC_CUR_TIME_SLICE]      ; slice into the task's control
                                            ; block

TMT_No_Time_Slice_Active

    ; Determine if either of the basic timers have expired.  If so,
    ; activate the timer HISR.

    LDR     r1,[r1]                         ; Pickup timer state
    CMP     r1,#2                           ; Does it indicate expiration?
    LDRNE   r0,[r0]                         ; Pickup time slice state
    CMPNE   r0,#2                           ; Does it indicate expiration?
 ;;   BNE     TMT_Interrupt_Exit              ; If not expired, return to point of interrupt
    BXNE     lr                              ; If not expired, return to caller

    ; Put interrupt return address in r4

 ;;   MOV     r4,lr

    ; Do a complete context save.

 ;;   BL      _TCT_Interrupt_Context_Save

    ; Activate the HISR timer function.
    STR     lr,[sp, #-4]!                      ; Save lr on the stack
    LDR     r0,TMT_HISR                     ; Build address of timer HISR
    BL      _TCT_Activate_HISR              ; Activate timer HISR
    LDR     lr,[sp], #4                 ; Recover return address
    BX      lr                          ; Return to caller



    ; Execute macro to unmask interrupts masked during nesting process
;VENKAT: UNNESTING is not needed already taken care.
;;    UNNEST_INTERRUPT    TIMER_INTERRUPT_MODE

    ; Restore context and return to scheduler (control doesn't return here)

 ;;   B       _TCT_Interrupt_Context_Restore

;TMT_Interrupt_Exit

    ; Unnest / restore the minimal context
;VENKAT: UNNESTING is not needed already taken care.
;;    UNNEST_MIN_INTERRUPT

    ; Put return address on stack

;    STMDB   sp!,{lr}

    ; Return to point of interrupt

;    LDMIA   sp!,{pc}^



;**************************************
; Veneer for thumb mode
;**************************************
    .if NU_THUMB_SUPPORT

;**********************************
;* TMT_Set_Clock Veneer for THUMB *
;**********************************
    .def    $TMT_Set_Clock
$TMT_Set_Clock

    .state16
    BX      pc
    NOP

    .state32
    B       _TMT_Set_Clock


;********************************
;* TMT_Retrieve_Clock for THUMB *
;********************************
    .def    $TMT_Retrieve_Clock
$TMT_Retrieve_Clock

    .state16
    BX      pc
    NOP

    .state32
    B       _TMT_Retrieve_Clock


;***********************************
;* TMT_Read_Timer Veneer for THUMB *
;***********************************
    .def    $TMT_Read_Timer
$TMT_Read_Timer

    .state16
    BX      pc
    NOP

    .state32
    B       _TMT_Read_Timer


;*************************************
;* TMT_Enable_Timer Veneer for THUMB *
;*************************************
    .def    $TMT_Enable_Timer
$TMT_Enable_Timer

    .state16
    BX      pc
    NOP

    .state32
    B       _TMT_Enable_Timer

;*************************************
;* TMT_Adjust_Timer Veneer for THUMB *
;*************************************
    .def    $TMT_Adjust_Timer
$TMT_Adjust_Timer

    .state16
    BX      pc
    NOP

    .state32
    B       _TMT_Adjust_Timer

;**************************************
;* TMT_Disable_Timer Veneer for THUMB *
;**************************************
    .def    $TMT_Disable_Timer
$TMT_Disable_Timer

    .state16
    BX      pc
    NOP

    .state32
    B       _TMT_Disable_Timer

;******************************************
;* TMT_Retrieve_TS_Task Veneer for THUMB *
;******************************************
    .def    $TMT_Retrieve_TS_Task
$TMT_Retrieve_TS_Task

    .state16
    BX      pc
    NOP

    .state32
    B       _TMT_Retrieve_TS_Task

    .endif



    .end


⌨️ 快捷键说明

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