📄 tmt.s
字号:
;/*************************************************************************/
;/* */
;/* Copyright (c) 1994 - 1999 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 ARM 6/7/9 1.11.18 */
;/* */
;/* 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 02-15-1994 Created initial version 1.0 */
;/* D. Lamie 02-15-1994 Verified version 1.0 */
;/* C. Meredith 03-01-1994 Added two new functions, */
;/* resulting in 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 */
;/* U. Pollock 03-29-1996 Modified TMT_Adjust_Timer */
;/* resulting in ver 1.1a+1(spr79) */
;/* M. Trippi 07-11-1996 Released version 1.2 */
;/* M. Trippi 02-18-1997 Released version 1.3 */
;/* M. Manning 03-04-1997 Released version 1.4 */
;/* J. Bolton 08-26-1997 Released version 1.5 */
;/* J. Bolton 10-08-1997 Released version 1.6 */
;/* M. Kyle Craig 02-05-1999 Revised version 1.17 */
;/* George Clark 02-05-1999 Released version 1.11.17 */
;/* B. Whatley 08-12-1999 Released version 1.11.18 */
;/* */
;/*************************************************************************/
;#define NU_SOURCE_FILE
;
;
;#include "tc_extr.h" /* Thread control functions */
;#include "tm_extr.h" /* Timer functions */
;
;
;/* Define constants used in low-level initialization. */
;
LOCKOUT EQU &C0 ; Interrupt lockout value
LOCK_MSK EQU &C0 ; Interrupt lockout mask value
INT_CNTRL_BASE EQU &0A000000 ; Define base of all interrupt
; controller registers
TIMER_BASE EQU &0A800000 ; Define base for all timer
; registers
IRQStatus EQU &00
; If assembled with TASM the variable {CONFIG} will be set to 16
; II assembled with ARMASM the variable {CONFIG} will be set to 32
; Set the variable THUMB to TRUE or false depending on whether the
; file is being assembled with TASM or ARMASM.
GBLL THUMB
GBLL ARM
[ {CONFIG} = 16
THUMB SETL {TRUE}
ARM SETL {FALSE}
; If assembling with TASM go into 32 bit mode as the Armulator will
; start up the program in ARM state.
CODE32
|
THUMB SETL {FALSE}
ARM SETL {TRUE}
]
;
[ THUMB
AREA |C$$code|, CODE, READONLY,INTERWORK
|x$codeseg|
|
AREA |C$$code|, CODE, READONLY
|x$codeseg|
]
;
;/* Define external inner-component global data references. */
;
;extern VOID *TCD_Current_Thread;
;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;
;
IMPORT TCD_Current_Thread
IMPORT TMD_System_Clock
IMPORT TMD_Timer
IMPORT TMD_Timer_State
IMPORT TMD_Time_Slice
IMPORT TMD_Time_Slice_Task
IMPORT TMD_Time_Slice_State
IMPORT TMD_HISR
IMPORT TCD_Interrupt_Level
;
;
;/* Define activate HISR function. */
;STATUS TCT_Activate_HISR(TC_HCB *hisr);
;
IMPORT TCT_Activate_HISR
;
;
;/* Define various data structure pointers so their addresses can be obtained
; in a PC-relative manner. */
;
System_Clock
DCD TMD_System_Clock
;
Timer
DCD TMD_Timer
;
Timer_State
DCD TMD_Timer_State
;
Slice_State
DCD TMD_Time_Slice_State
;
Time_Slice
DCD TMD_Time_Slice
;
Current_Thread
DCD TCD_Current_Thread
;
Slice_Task
DCD TMD_Time_Slice_Task
;
HISR
DCD TMD_HISR
;
Int_Level
DCD TCD_Interrupt_Level
;
;
;/*************************************************************************/
;/* */
;/* 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 02-15-1994 Created initial version 1.0 */
;/* D. Lamie 02-15-1994 Verified version 1.0 */
;/* */
;/*************************************************************************/
;VOID TMT_Set_Clock(UNSIGNED new_value)
;{
EXPORT TMT_Set_Clock
TMT_Set_Clock
;
; /* Set the system clock to the specified value. */
; TMD_System_Clock = new_value;
;
LDR a2,[pc, #System_Clock-.-8] ; Build address of system clock
STR a1,[a2,#0] ; Store new system clock value
[ THUMB
BX lr ; Return to caller
|
MOV pc,lr ; 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 */
;/* */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -