📄 tmt.s
字号:
;/* 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)
;{
EXPORT TMT_Disable_Timer
TMT_Disable_Timer
;
; /* Disable the count-down timer. */
; TMD_Timer_State = TM_NOT_ACTIVE;
;
MOV a2,#1 ; Build TM_NOT_ACTIVE value
LDR a1,[pc, #Timer_State-.-8] ; Build address to timer state var
STR a2,[a1,#0] ; Change timer state to not active
[ THUMB
BX lr ; Return to caller
|
MOV pc,lr ; Return to caller
]
;}
;
;
;/*************************************************************************/
;/* */
;/* FUNCTION */
;/* */
;/* TMT_Retreive_TS_Timer */
;/* */
;/* DESCRIPTION */
;/* */
;/* This function returns the time-sliced task pointer. */
;/* */
;/* AUTHOR */
;/* */
;/* William E. Lamie, Accelerated Technology, Inc. */
;/* */
;/* CALLED BY */
;/* */
;/* TMC_Timer_HISR Timer HISR */
;/* */
;/* CALLS */
;/* */
;/* None */
;/* */
;/* INPUTS */
;/* */
;/* None */
;/* */
;/* OUTPUTS */
;/* */
;/* TMD_Time_Slice_Task Time sliced task pointer */
;/* */
;/* HISTORY */
;/* */
;/* NAME DATE REMARKS */
;/* */
;/* C. Meredith 03-01-1994 Created initial version 1.1 */
;/* D. Lamie 03-18-1994 Verified version 1.1 */
;/* */
;/*************************************************************************/
;NU_TASK TMT_Retrieve_TS_Task (VOID)
;{
EXPORT TMT_Retrieve_TS_Task
TMT_Retrieve_TS_Task
;
; /* Read the current TMD_Time_Slice_Task variable and load for
; return to caller. */
;
LDR a2,[pc, #Slice_Task-.-8] ; Build address to timer slice var
LDR a1,[a2,#0] ; Get task pointer to be returned
;
; return to caller time slice value back to caller
;
[ THUMB
BX lr ; Return to caller
|
MOV pc,lr ; Return to caller
]
;}
;
;
;/*************************************************************************/
;/* */
;/* FUNCTION */
;/* */
;/* TMT_Timer_Interrupt */
;/* */
;/* DESCRIPTION */
;/* */
;/* This function processes the actual hardware interrupt. */
;/* Processing includes updating the system clock and the count- */
;/* down timer and the time-slice timer. If one or both of the */
;/* timers expire, the timer HISR is activated. */
;/* */
;/* AUTHOR */
;/* */
;/* William E. Lamie, Accelerated Technology, Inc. */
;/* */
;/* CALLED BY */
;/* */
;/* Interrupt Vector */
;/* */
;/* CALLS */
;/* */
;/* TCT_Activate_HISR Activate timer HISR */
;/* TCT_Interrupt_Context_Save Save interrupted context */
;/* TCT_Interrupt_Context_Restore Restore interrupted context */
;/* */
;/* 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_Timer_Interrupt(void)
;{
EXPORT TMT_Timer_Interrupt
TMT_Timer_Interrupt
;
; /* It is assumed that interrupts are locked out by the caller of this
; function. */
;
; /* Increment the system clock. */
; TMD_System_Clock++;
;
LDR a1,[pc, #System_Clock-.-8] ; Pickup system clock address
LDR a2,[a1,#0] ; Pickup system clock contents
ADD a2,a2,#1 ; Increment system clock
STR a2,[a1,#0] ; Store new system clock value
;
; /* Determine if the count-down timer is active. */
; if (TMD_Timer_State == TM_ACTIVE)
; {
;
LDR a2,[pc, #Timer_State-.-8] ; Build address to timer state flag
LDR a1,[a2,#0] ; Pickup timer state
MOV a4,#2 ; Build expired value
CMP a1,#0 ; Is there a timer active?
BNE TMT_No_Timer_Active ; No, skip timer processing
;
; /* Decrement the count-down timer. */
; TMD_Timer--;
;
LDR a1,[pc, #Timer-.-8] ; Build timer address
LDR a3,[a1,#0] ; Pickup the current timer value
SUBS a3,a3,#1 ; Decrement the timer value
STR a3,[a1,#0] ; Store the new timer value
;
; /* Determine if the timer has expired. If so, modify the state
; to indicate that it has expired. */
; if (TMD_Timer == 0)
;
; TMD_Timer_State = TM_EXPIRED;
;
STREQ a4,[a2,#0] ; Change the timer state to
; expired
;
; }
TMT_No_Timer_Active
;
; /* Determine if the time-slice timer is active. Note that the parameters
; for the time-slice are controlled by the Thread Control (TC)
; component. */
; if (TMD_Time_Slice_State == TM_ACTIVE)
; {
LDR a1,[pc, #Slice_State-.-8] ; Build time slice state address
LDR a3,[a1,#0] ; Pickup time slice state
CMP a3,#0 ; Is there a time slice active?
BNE TMT_No_Time_Slice_Active ; No, skip time slice processing
;
; /* Decrement the time slice counter. */
; TMD_Time_Slice--;
;
LDR a3,[pc, #Time_Slice-.-8] ; Build time slice address
LDR a4,[a3,#0] ; Pickup the time slice value
SUBS a4,a4,#1 ; Decrement the time slice
STR a4,[a3,#0] ; Store the new time slice value
;
; /* Determine if the time-slice timer has expired. If so, modify the
; time-slice state to indicate that it has. */
; if (TMD_Time_Slice == 0)
; {
;
BNE TMT_No_Time_Slice_Active ; Has time slice expired?
;
; TMD_Time_Slice_State = TM_EXPIRED;
;
MOV a4,#2 ; Build TM_EXPIRED value
STR a4,[a1,#0] ; Indicate time slice is expired
;
; /* Copy the current thread into the time-slice task pointer. */
; TMD_Time_Slice_Task = TCD_Current_Thread;
;
LDR a3,[pc,#Current_Thread-.-8] ; Pickup current thread pointer adr
LDR a3,[a3,#0] ; Pickup current thread pointer
LDR a4,[pc, #Slice_Task-.-8] ; Pickup time slice task pointer ad
STR a3,[a4,#0] ; Store current thread pointer
;
; ((TC_TCB *) TCD_Current_Thread) -> tc_cur_time_slice = 1;
;
MOV a4,#1 ; For safety, place a minimal time-
STR a4,[a3,#&20]! ; 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. */
; if ((TMD_Timer_State == TM_EXPIRED) ||
; (TMD_Time_Slice_State == TM_EXPIRED))
; {
;
LDR a2,[a2,#0] ; Pickup timer state
CMP a2,#2 ; Does it indicate expiration?
LDRNE a1,[a1,#0] ; Pickup time slice state
CMPNE a1,#2 ; Does it indicate expiration?
[ THUMB
BXNE lr ; Return if no expiration
|
MOVNE pc,lr ; Return if no expiration
]
;
; /* Activate the HISR timer function. */
; TCT_Activate_HISR(&TMD_HISR);
;
STR lr,[sp, #-4]! ; Save lr on the stack
LDR a1,[pc, #HISR-.-8] ; Build address of timer HISR
BL TCT_Activate_HISR ; Activate timer HISR
LDR lr,[sp], #4 ; Recover return address
; }
;
[ THUMB
BX lr ; Return to caller
|
MOV pc,lr ; Return to caller
]
;}
END
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -