?? tmt.s
字號:
;/*************************************************************************/
;/* */
;/* Copyright (c) 1993-1994 Accelerated Technology, Inc. */
;/* */
;/* PROPRIETARY RIGHTS of Accelerated Technology are involved in the */
;/* subject matter of this material. All manufacturing, reproduction, */
;/* use, and sales rights pertaining to this subject matter are governed */
;/* by the license agreement. The recipient of this software implicitly */
;/* accepts the terms of the license. */
;/* */
;/*************************************************************************/
;
;/*************************************************************************/
;/* */
;/* FILE NAME VERSION */
;/* */
;/* tmt.s PLUS/68HC11/I 1.2 */
;/* */
;/* COMPONENT */
;/* */
;/* TM - Timer Management */
;/* */
;/* DESCRIPTION */
;/* */
;/* This file contains the target dependent routines of the timer */
;/* management component. */
;/* */
;/* AUTHOR */
;/* */
;/* William E. Lamie, Accelerated Technology, Inc. */
;/* */
;/* DATA STRUCTURES */
;/* */
;/* None */
;/* */
;/* FUNCTIONS */
;/* */
;/* TMT_Set_Clock Set system clock */
;/* TMT_Retrieve_Clock Retrieve system clock */
;/* TMT_Read_Timer Read count-down timer */
;/* TMT_Enable_Timer Enable count-down timer */
;/* TMT_Adjust_Timer Adjust count-down timer */
;/* TMT_Disable_Timer Disable count-down timer */
;/* TMT_Retrieve_TS_Task Retrieve time-sliced task ptr*/
;/* TMT_Timer_Interrupt Process timer interrupt */
;/* */
;/* DEPENDENCIES */
;/* */
;/* tc_extr.h Thread Control functions */
;/* tm_extr.h Timer functions */
;/* */
;/* HISTORY */
;/* */
;/* NAME DATE REMARKS */
;/* */
;/* W. Lamie 06-01-1993 Created initial version 1.0 */
;/* D. Lamie 06-01-1993 Verified version 1.0 */
;/* W. Lamie 08-09-1993 Add logic to insure that time- */
;/* slice expirations are not lost,*/
;/* resulting in version 1.0a */
;/* D. Lamie 08-09-1993 Verified version 1.0a */
;/* K. Homer 03-01-1994 Added routine to adjust count- */
;/* down timer if less than the */
;/* current value, added function */
;/* to retrieve time-sliced task, */
;/* modified interrupt lockout */
;/* over timer variable access, */
;/* resulting in version 1.1 */
;/* D. Lamie 03-18-1994 Verified version 1.1 */
;/* K. Homer 10-20-1994 Fixed TMT_Retrieve_TS_Task */
;/* resulting in version 1.1a */
;/* D. Lamie 10-25-1994 Verified version 1.1a */
;/* M. Trippi 06-12-1996 New NUCLEUS.H created version 1.2*/
;/* */
;/*************************************************************************/
;#define NU_SOURCE_FILE
;
;
;#include "tc_extr.h" /* Thread control functions */
;#include "tm_extr.h" /* Timer functions */
;
;
;/* Define external inner-component global data references. */
;
;extern VOID *TCD_Current_Thread;
;extern INT TCD_Interrupt_Level;
;extern UNSIGNED TMD_System_Clock;
;extern UNSIGNED TMD_Timer;
;extern INT TMD_Timer_State;
;extern UNSIGNED TMD_Time_Slice;
;extern TC_TCB *TMD_Time_Slice_Task;
;extern INT TMD_Time_Slice_State;
;extern TC_HCB TMD_HISR;
;extern TC_TCB TMD_Task;
.external _TMD_HISR
.external _TMD_Time_Slice_State
.external _TMD_Time_Slice_Task
.external _TMD_Time_Slice
.external _TMD_Timer_State
.external _TMD_Timer
.external _TMD_System_Clock
.external _TCD_Interrupt_Level
.external _TCD_Current_Thread
;
;
;/* Define external function references. */
;
;VOID TCT_Interrupt_Context_Save(INT vector);
;VOID TCT_Interrupt_Context_Restore(VOID);
;STATUS TCT_Activate_HISR(TC_HCB *hisr);
.external _TCT_Interrupt_Context_Restore
.external _TCT_Interrupt_Context_Save
.external _TCT_Activate_HISR
;
;
;
.psect _text
;/*************************************************************************/
;/* */
;/* FUNCTION */
;/* */
;/* TMT_Set_Clock */
;/* */
;/* DESCRIPTION */
;/* */
;/* This function sets the system clock to the specified value. */
;/* */
;/* AUTHOR */
;/* */
;/* William E. Lamie, Accelerated Technology, Inc. */
;/* */
;/* CALLED BY */
;/* */
;/* Application */
;/* */
;/* CALLS */
;/* */
;/* None */
;/* */
;/* INPUTS */
;/* */
;/* new_value New value for the clock */
;/* */
;/* OUTPUTS */
;/* */
;/* None */
;/* */
;/* HISTORY */
;/* */
;/* NAME DATE REMARKS */
;/* */
;/* W. Lamie 06-01-1993 Created initial version 1.0 */
;/* D. Lamie 06-01-1993 Verified version 1.0 */
;/* K. Homer 03-01-1994 Modified interrupt lockout code, */
;/* resulting in version 1.1 */
;/* D. Lamie 03-18-1994 Verified version 1.1 */
;/* */
;/*************************************************************************/
;VOID TMT_Set_Clock(UNSIGNED new_value)
;{
.public _TMT_Set_Clock
_TMT_Set_Clock:
;
; /* Set the system clock to the specified value. */
; TMD_System_Clock = new_value;
tsy ; Pickup stack pointer
sei ; Lockout interrupts since this
; counter is manipulated in
; an interrupt thread
;
ldd 2,y ; Pickup MSW of new_value
std _TMD_System_Clock ; Store it in variable
ldd 4,y ; Pickup LSW of new_value
std _TMD_System_Clock+2 ; Store it in variable
ldd _TCD_Interrupt_Level ; Pickup current interrupt lockout
; See if interrupts are to be
; enabled or disabled
bne _TMT_Set_Done ; If non-zero, leave interrupts
; disabled
cli ; Otherwise, enable interrupts
_TMT_Set_Done:
;
rts ; Return to caller
;}
;
;
;
;/*************************************************************************/
;/* */
;/* FUNCTION */
;/* */
;/* TMT_Retrieve_Clock */
;/* */
;/* DESCRIPTION */
;/* */
;/* This function returns the current value of the system clock. */
;/* */
;/* AUTHOR */
;/* */
;/* William E. Lamie, Accelerated Technology, Inc. */
;/* */
;/* CALLED BY */
;/* */
;/* Application */
;/* */
;/* CALLS */
;/* */
;/* None */
;/* */
;/* INPUTS */
;/* */
;/* None */
;/* */
;/* OUTPUTS */
;/* */
;/* TMD_System_Clock Value of system clock */
;/* */
;/* HISTORY */
;/* */
;/* NAME DATE REMARKS */
;/* */
;/* W. Lamie 06-01-1993 Created initial version 1.0 */
;/* D. Lamie 06-01-1993 Verified version 1.0 */
;/* K. Homer 03-01-1994 Modified interrupt lockout code, */
;/* resulting in version 1.1 */
;/* D. Lamie 03-18-1994 Verified version 1.1 */
;/* */
;/*************************************************************************/
;UNSIGNED TMT_Retrieve_Clock(void)
;{
.public _TMT_Retrieve_Clock
_TMT_Retrieve_Clock:
;
; /* Return the current value of the system clock. */
; return(TMD_System_Clock);
;
pshx ; Save IX on the stack
sei ; Lockout interrupts
ldy _TMD_System_Clock ; Pickup MSW of system clock
ldx _TMD_System_Clock+2 ; Pickup LSW of system clock
ldd _TCD_Interrupt_Level ; Pickup current interrupt lockout
; See if interrupts are to be
; enabled or disabled
bne _TMT_Retrieve_Done ; If non-zero, leave interrupts
; disabled
cli ; Otherwise, enable interrupts
_TMT_Retrieve_Done:
xgdx ; Move the LSW into D for return
pulx ; Recover IX from the stack
rts ; Return to caller
;}
;
;
;
;/*************************************************************************/
;/* */
;/* FUNCTION */
;/* */
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -