📄 tmt.s
字号:
;/* */
;/* OUTPUTS */
;/* */
;/* TMD_System_Clock Value of system clock */
;/* */
;/* 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_Retrieve_Clock(void)
;{
EXPORT TMT_Retrieve_Clock
TMT_Retrieve_Clock
;
; /* Return the current value of the system clock. */
; return(TMD_System_Clock);
;
LDR r0,System_Clock ; Build address to system clock
LDR r0,[r0,#0] ; Pickup system clock contents
BX lr ; Return to caller
;}
;
;
;
;/*************************************************************************/
;/* */
;/* FUNCTION */
;/* */
;/* TMT_Read_Timer */
;/* */
;/* DESCRIPTION */
;/* */
;/* 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)
;{
EXPORT 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 lr ; 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)
;{
EXPORT 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 lr ; 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)
;{
EXPORT TMT_Adjust_Timer
TMT_Adjust_Timer
;
; /* Lockout all interrupts */
; TMD_Timer_State = TM_NOT_ACTIVE;
;
MRS r2,CPSR ; Pickup current CPSR
MOV r3,r2
ORR r2,r2,#LOCKOUT ; Build lockout CPSR
MSR CPSR_cxsf,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
LDR r1,Int_Level ; Build address to interrupt level
LDR r1,[r1,#0] ; read the interrupt level
MRS r2,CPSR ; Pickup current CPSR
BIC r2,r2,#LOCK_MSK ; Clear lockout mask
ORR r2,r2,r1 ; Build new CPSR with appropriate
; interrupts enabled
MSR CPSR_cxsf,r3 ; Setup new CPSR enable bits
BX lr ; 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 */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -