annotate src/nucleus/tms470/tmt.s @ 172:a0f935d68377

targets: gtm900 added
author Mychaela Falconia <falcon@freecalypso.org>
date Wed, 19 Jun 2019 04:38:43 +0000
parents 614668bbbc4f
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
40
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 ;************************************************************************
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 ;* Copyright Mentor Graphics Corporation 2002
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4 ;* All Rights Reserved.
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 ;* THIS WORK CONTAINS TRADE SECRET AND PROPRIETARY INFORMATION WHICH IS
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 ;* THE PROPERTY OF MENTOR GRAPHICS CORPORATION OR ITS LICENSORS AND IS
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 ;* SUBJECT TO LICENSE TERMS.
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 ;************************************************************************
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11 ;************************************************************************
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13 ;* FILE NAME VERSION
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15 ;* tmt.s Nucleus PLUS\ARM925\Code Composer 1.14.1
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17 ;* COMPONENT
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 ;* TM - Timer Management
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21 ;* DESCRIPTION
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23 ;* This file contains the target dependent routines of the timer
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 ;* management component.
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 ;* FUNCTIONS
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28 ;* TMT_Set_Clock Set system clock
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29 ;* TMT_Retrieve_Clock Retrieve system clock
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30 ;* TMT_Read_Timer Read count-down timer
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
31 ;* TMT_Enable_Timer Enable count-down timer
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
32 ;* TMT_Adjust_Timer Adjust count-down timer
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
33 ;* TMT_Disable_Timer Disable count-down timer
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
34 ;* TMT_Retrieve_TS_Task Retrieve time-sliced task ptr
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
35 ;* TMT_Timer_Interrupt Process timer interrupt
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
36 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
37 ;* DEPENDENCIES
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
38 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
39 ;* tc_extr.h Thread Control functions
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
40 ;* tm_extr.h Timer functions
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
41 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
42 ;* HISTORY
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
43 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
44 ;* NAME DATE REMARKS
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
45 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
46 ;* B. Ronquillo 08-28-2002 Released version 1.14.1
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
47 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
48 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
49 ;************************************************************************
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
50 ;#define NU_SOURCE_FILE
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
51 ;******************************
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
52 ;* INCLUDE ASSEMBLY CONSTANTS *
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
53 ;******************************
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
54 ; Define constants used in low-level initialization.
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
55 LOCKOUT .equ 00C0h ; Interrupt lockout value
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
56
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
57 .state32
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
58
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
59 ;**********************************
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
60 ;* EXTERNAL VARIABLE DECLARATIONS *
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
61 ;**********************************
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
62 ; Define external inner-component global data references.
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
63 ;extern VOID *TCD_Current_Thread;
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
64 ;extern UNSIGNED TMD_System_Clock;
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
65 ;extern UNSIGNED TMD_Timer;
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
66 ;extern INT TMD_Timer_State;
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
67 ;extern UNSIGNED TMD_Time_Slice;
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
68 ;extern TC_TCB *TMD_Time_Slice_Task;
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
69 ;extern INT TMD_Time_Slice_State;
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
70 ;extern TC_HCB TMD_HISR;
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
71
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
72 .ref _TCD_Current_Thread
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
73 .ref _TMD_System_Clock
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
74 .ref _TMD_Timer
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
75 .ref _TMD_Timer_State
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
76 .ref _TMD_Time_Slice
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
77 .ref _TMD_Time_Slice_Task
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
78 .ref _TMD_Time_Slice_State
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
79 .ref _TMD_HISR
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
80 .ref _TCD_Interrupt_Level
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
81
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
82 ; Define activate HISR function.
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
83 ;STATUS TCT_Activate_HISR(TC_HCB *hisr);
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
84
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
85 .ref _TCT_Activate_HISR
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
86
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
87 .text
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
88 ;**********************************
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
89 ;* LOCAL VARIABLE DECLARATIONS *
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
90 ;**********************************
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
91 ; Define various data structure pointers so their addresses
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
92 ; can be obtained in a PC-relative manner.
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
93
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
94 System_Clock
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
95 .word _TMD_System_Clock
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
96
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
97 Timer
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
98 .word _TMD_Timer
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
99
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
100 Timer_State
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
101 .word _TMD_Timer_State
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
102
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
103 Slice_State
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
104 .word _TMD_Time_Slice_State
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
105
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
106 Time_Slice
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
107 .word _TMD_Time_Slice
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
108
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
109 Current_Thread
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
110 .word _TCD_Current_Thread
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
111
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
112 Slice_Task
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
113 .word _TMD_Time_Slice_Task
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
114
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
115 HISR
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
116 .word _TMD_HISR
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
117
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
118 Int_Level
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
119 .word _TCD_Interrupt_Level
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
120
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
121 ;************************************************************************
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
122 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
123 ;* FUNCTION
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
124 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
125 ;* TMT_Set_Clock
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
126 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
127 ;* DESCRIPTION
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
128 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
129 ;* This function sets the system clock to the specified value.
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
130 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
131 ;* CALLED BY
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
132 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
133 ;* Application
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
134 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
135 ;* CALLS
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
136 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
137 ;* None
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
138 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
139 ;* INPUTS
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
140 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
141 ;* new_value New value for the clock
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
142 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
143 ;* OUTPUTS
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
144 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
145 ;* None
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
146 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
147 ;* HISTORY
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
148 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
149 ;* NAME DATE REMARKS
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
150 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
151 ;* W. Lamie 02-15-1994 Created initial version 1.0
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
152 ;* D. Lamie 02-15-1994 Verified version 1.0
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
153 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
154 ;************************************************************************
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
155 ;VOID TMT_Set_Clock(UNSIGNED new_value)
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
156 ;{
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
157 .def $TMT_Set_Clock
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
158 $TMT_Set_Clock ; Dual-state interworking veneer
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
159 .state16
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
160 BX r15
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
161 NOP
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
162 .state32
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
163 B _TMT_Set_Clock
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
164
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
165 .def _TMT_Set_Clock
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
166 _TMT_Set_Clock
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
167
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
168 ; Set the system clock to the specified value.
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
169 ; TMD_System_Clock = new_value;
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
170
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
171 LDR r1,System_Clock ; Build address of system clock
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
172 STR r0,[r1,#0] ; Store new system clock value
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
173
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
174 BX r14 ; Return to caller
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
175
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
176 ;}
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
177
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
178 ;************************************************************************
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
179 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
180 ;* FUNCTION
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
181 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
182 ;* TMT_Retrieve_Clock
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
183 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
184 ;* DESCRIPTION
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
185 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
186 ;* This function returns the current value of the system clock.
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
187 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
188 ;* CALLED BY
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
189 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
190 ;* Application
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
191 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
192 ;* CALLS
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
193 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
194 ;* None
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
195 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
196 ;* INPUTS
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
197 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
198 ;* None
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
199 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
200 ;* OUTPUTS
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
201 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
202 ;* TMD_System_Clock Value of system clock
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
203 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
204 ;* HISTORY
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
205 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
206 ;* NAME DATE REMARKS
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
207 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
208 ;* W. Lamie 02-15-1994 Created initial version 1.0
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
209 ;* D. Lamie 02-15-1994 Verified version 1.0
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
210 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
211 ;************************************************************************
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
212 ;UNSIGNED TMT_Retrieve_Clock(void)
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
213 ;{
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
214 .def $TMT_Retrieve_Clock
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
215 $TMT_Retrieve_Clock ; Dual-state interworking veneer
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
216 .state16
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
217 BX r15
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
218 NOP
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
219 .state32
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
220 B _TMT_Retrieve_Clock
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
221
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
222 .def _TMT_Retrieve_Clock
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
223 _TMT_Retrieve_Clock
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
224
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
225 ; Return the current value of the system clock.
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
226 ; return(TMD_System_Clock);
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
227
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
228 LDR r0,System_Clock ; Build address to system clock
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
229 LDR r0,[r0,#0] ; Pickup system clock contents
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
230
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
231 BX r14 ; Return to caller
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
232
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
233 ;}
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
234
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
235 ;************************************************************************
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
236 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
237 ;* FUNCTION
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
238 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
239 ;* TMT_Read_Timer
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
240 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
241 ;* DESCRIPTION
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
242 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
243 ;* This function returns the current value of the count-down timer.
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
244 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
245 ;* CALLED BY
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
246 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
247 ;* TMC_Start_Timer Start timer function
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
248 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
249 ;* CALLS
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
250 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
251 ;* None
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
252 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
253 ;* INPUTS
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
254 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
255 ;* None
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
256 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
257 ;* OUTPUTS
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
258 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
259 ;* TMD_Timer Value of count-down timer
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
260 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
261 ;* HISTORY
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
262 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
263 ;* NAME DATE REMARKS
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
264 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
265 ;* W. Lamie 02-15-1994 Created initial version 1.0
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
266 ;* D. Lamie 02-15-1994 Verified version 1.0
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
267 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
268 ;************************************************************************
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
269 ;UNSIGNED TMT_Read_Timer(void)
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
270 ;{
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
271 .def $TMT_Read_Timer
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
272 $TMT_Read_Timer ; Dual-state interworking veneer
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
273 .state16
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
274 BX r15
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
275 NOP
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
276 .state32
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
277 B _TMT_Read_Timer
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
278
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
279 .def _TMT_Read_Timer
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
280 _TMT_Read_Timer
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
281
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
282 ; Return the current value of the count-down timer.
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
283 ; return(TMD_Timer);
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
284
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
285 LDR r0,Timer ; Build address to timer
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
286 LDR r0,[r0,#0] ; Pickup timer contents
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
287
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
288 BX r14 ; Return to caller
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
289
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
290 ;}
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
291
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
292 ;************************************************************************
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
293 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
294 ;* FUNCTION
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
295 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
296 ;* TMT_Enable_Timer
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
297 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
298 ;* DESCRIPTION
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
299 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
300 ;* This function enables the count-down timer with the specified
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
301 ;* value.
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
302 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
303 ;* CALLED BY
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
304 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
305 ;* TMC_Start_Timer Start timer function
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
306 ;* TMC_Timer_Task Timer expiration task
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
307 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
308 ;* CALLS
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
309 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
310 ;* None
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
311 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
312 ;* INPUTS
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
313 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
314 ;* time New count-down time
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
315 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
316 ;* OUTPUTS
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
317 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
318 ;* None
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
319 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
320 ;* HISTORY
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
321 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
322 ;* NAME DATE REMARKS
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
323 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
324 ;* W. Lamie 02-15-1994 Created initial version 1.0
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
325 ;* D. Lamie 02-15-1994 Verified version 1.0
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
326 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
327 ;************************************************************************
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
328 ;VOID TMT_Enable_Timer(UNSIGNED time)
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
329 ;{
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
330 .def $TMT_Enable_Timer
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
331 $TMT_Enable_Timer ; Dual-state interworking veneer
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
332 .state16
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
333 BX r15
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
334 NOP
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
335 .state32
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
336 B _TMT_Enable_Timer
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
337
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
338 .def _TMT_Enable_Timer
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
339 _TMT_Enable_Timer
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
340
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
341 ; Place the new time value into the count-down timer.
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
342 ; TMD_Timer = time;
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
343
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
344 LDR r1,Timer ; Build address of timer
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
345 STR r0,[r1,#0] ; Store new timer value
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
346
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
347 ; Indicate that the timer is active.
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
348 ; TMD_Timer_State = TM_ACTIVE;
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
349
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
350 MOV r0,#0 ; Build TM_ACTIVE value
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
351 LDR r1,Timer_State ; Build address of timer state var
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
352 STR r0,[r1,#0] ; Change the state to active
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
353
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
354 BX r14 ; Return to caller
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
355
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
356 ;}
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
357
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
358 ;************************************************************************
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
359 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
360 ;* FUNCTION
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
361 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
362 ;* TMT_Adjust_Timer
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
363 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
364 ;* DESCRIPTION
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
365 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
366 ;* This function adjusts the count-down timer with the specified
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
367 ;* value, if the new value is less than the current.
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
368 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
369 ;* CALLED BY
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
370 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
371 ;* None
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
372 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
373 ;* CALLS
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
374 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
375 ;* None
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
376 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
377 ;* INPUTS
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
378 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
379 ;* time New count-down time.
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
380 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
381 ;* OUTPUTS
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
382 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
383 ;* None
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
384 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
385 ;* HISTORY
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
386 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
387 ;* NAME DATE REMARKS
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
388 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
389 ;* C. Meredith 03-01-1994 Created initial version 1.1
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
390 ;* D. Lamie 03-18-1994 Verified version 1.1
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
391 ;* C. Meredith 08-27-1994 Corrected bug in new timer
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
392 ;* adjust routine, resulting in
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
393 ;* version 1.1a
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
394 ;* W. Lamie 08-27-1994 Verified version 1.1a
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
395 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
396 ;************************************************************************
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
397 ;VOID TMT_Adjust_Timer(UNSIGNED time)
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
398 ;{
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
399 .def $TMT_Adjust_Timer
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
400 $TMT_Adjust_Timer ; Dual-state interworking veneer
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
401 .state16
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
402 BX r15
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
403 NOP
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
404 .state32
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
405 B _TMT_Adjust_Timer
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
406
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
407 .def _TMT_Adjust_Timer
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
408 _TMT_Adjust_Timer
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
409
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
410 ; Lockout all interrupts
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
411 ; TMD_Timer_State = TM_NOT_ACTIVE;
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
412
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
413 MRS r3,CPSR ; Pickup current CPSR
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
414 ORR r2,r3,#LOCKOUT ; Build lockout CPSR
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
415 MSR CPSR,r2 ; Setup new CPSR interrupt bits
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
416
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
417 ; Check for the new value is less than the current time value
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
418 ; if (time < TMD_Timer)
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
419
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
420 LDR r1,Timer ; Build address to timer var
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
421 LDR r2,[r1,#0] ; read value of the timer
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
422 CMP r2,r0 ; Do Timer - time > 0, means
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
423 BLT TMT_No_Adjust ; time < Timer.
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
424
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
425 ; Adjust the time
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
426 ; TMD_Timer = time;
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
427
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
428 STR r0,[r1,#0] ; load passed in timer value
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
429
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
430 ; Return to caller after restoring interrupts
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
431
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
432 TMT_No_Adjust:
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
433
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
434 MSR CPSR,r3 ; Setup new CPSR enable bits
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
435
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
436 BX r14 ; Return to caller
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
437 ;}
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
438
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
439 ;************************************************************************
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
440 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
441 ;* FUNCTION
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
442 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
443 ;* TMT_Disable_Timer
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
444 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
445 ;* DESCRIPTION
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
446 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
447 ;* This function disables the count-down timer.
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
448 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
449 ;* CALLED BY
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
450 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
451 ;* TMC_Start_Timer Start timer function
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
452 ;* TMC_Timer_Task Timer expiration task
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
453 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
454 ;* CALLS
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
455 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
456 ;* None
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
457 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
458 ;* INPUTS
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
459 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
460 ;* None
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
461 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
462 ;* OUTPUTS
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
463 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
464 ;* None
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
465 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
466 ;* HISTORY
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
467 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
468 ;* NAME DATE REMARKS
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
469 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
470 ;* W. Lamie 02-15-1994 Created initial version 1.0
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
471 ;* D. Lamie 02-15-1994 Verified version 1.0
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
472 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
473 ;************************************************************************
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
474 ;VOID TMT_Disable_Timer(void)
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
475 ;{
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
476 .def $TMT_Disable_Timer
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
477 $TMT_Disable_Timer ; Dual-state interworking veneer
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
478 .state16
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
479 BX r15
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
480 NOP
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
481 .state32
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
482 B _TMT_Disable_Timer
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
483
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
484 .def _TMT_Disable_Timer
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
485 _TMT_Disable_Timer
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
486
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
487 ; Disable the count-down timer.
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
488 ; TMD_Timer_State = TM_NOT_ACTIVE;
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
489
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
490 MOV r1,#1 ; Build TM_NOT_ACTIVE value
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
491 LDR r0,Timer_State ; Build address to timer state var
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
492 STR r1,[r0,#0] ; Change timer state to not active
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
493
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
494 BX r14 ; Return to caller
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
495 ;}
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
496
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
497 ;************************************************************************
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
498 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
499 ;* FUNCTION
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
500 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
501 ;* TMT_Retreive_TS_Timer
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
502 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
503 ;* DESCRIPTION
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
504 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
505 ;* This function returns the time-sliced task pointer.
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
506 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
507 ;* CALLED BY
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
508 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
509 ;* TMC_Timer_HISR Timer HISR
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
510 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
511 ;* CALLS
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
512 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
513 ;* None
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
514 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
515 ;* INPUTS
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
516 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
517 ;* None
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
518 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
519 ;* OUTPUTS
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
520 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
521 ;* TMD_Time_Slice_Task Time sliced task pointer
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
522 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
523 ;* HISTORY
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
524 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
525 ;* NAME DATE REMARKS
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
526 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
527 ;* C. Meredith 03-01-1994 Created initial version 1.1
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
528 ;* D. Lamie 03-18-1994 Verified version 1.1
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
529 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
530 ;************************************************************************
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
531 ;NU_TASK TMT_Retrieve_TS_Task (VOID)
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
532 ;{
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
533 .def $TMT_Retrieve_TS_Task
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
534 $TMT_Retrieve_TS_Task ; Dual-state interworking veneer
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
535 .state16
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
536 BX r15
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
537 NOP
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
538 .state32
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
539 B _TMT_Retrieve_TS_Task
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
540
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
541 .def _TMT_Retrieve_TS_Task
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
542 _TMT_Retrieve_TS_Task
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
543
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
544 ; Read the current TMD_Time_Slice_Task variable and load for
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
545 ; return to caller.
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
546
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
547 LDR r1,Slice_Task ; Build address to timer slice var
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
548 LDR r0,[r1,#0] ; Get task pointer to be returned
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
549
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
550 ; Return to caller time slice value back to caller
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
551
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
552 BX r14 ; Return to caller
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
553
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
554 ;}
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
555
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
556 ;************************************************************************
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
557 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
558 ;* FUNCTION
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
559 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
560 ;* TMT_Timer_Interrupt
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
561 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
562 ;* DESCRIPTION
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
563 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
564 ;* This function processes the actual hardware interrupt.
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
565 ;* Processing includes updating the system clock and the count-
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
566 ;* down timer and the time-slice timer. If one or both of the
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
567 ;* timers expire, the timer HISR is activated.
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
568 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
569 ;* CALLED BY
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
570 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
571 ;* Interrupt Vector
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
572 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
573 ;* CALLS
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
574 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
575 ;* TCT_Activate_HISR Activate timer HISR
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
576 ;* TCT_Interrupt_Context_Save Save interrupted context
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
577 ;* TCT_Interrupt_Context_Restore Restore interrupted context
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
578 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
579 ;* INPUTS
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
580 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
581 ;* None
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
582 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
583 ;* OUTPUTS
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
584 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
585 ;* None
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
586 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
587 ;* HISTORY
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
588 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
589 ;* NAME DATE REMARKS
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
590 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
591 ;* W. Lamie 02-15-1994 Created initial version 1.0
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
592 ;* D. Lamie 02-15-1994 Verified version 1.0
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
593 ;*
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
594 ;************************************************************************
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
595 ;VOID TMT_Timer_Interrupt(void)
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
596 ;{
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
597 .def _TMT_Timer_Interrupt
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
598 _TMT_Timer_Interrupt
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
599
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
600 MRS r1,CPSR ; Pickup current CPSR
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
601 ORR r1,r1,#LOCKOUT ; Set the interrupt lockout bits
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
602 MSR CPSR,r1 ; Lockout interrupts
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
603
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
604 ; Increment the system clock.
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
605 ; TMD_System_Clock++;
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
606
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
607 LDR r0,System_Clock ; Pickup system clock address
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
608 LDR r1,[r0,#0] ; Pickup system clock contents
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
609 ADD r1,r1,#1 ; Increment system clock
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
610 STR r1,[r0,#0] ; Store new system clock value
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
611
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
612 ; Determine if the count-down timer is active.
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
613 ; if (TMD_Timer_State == TM_ACTIVE)
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
614 ; {
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
615
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
616 LDR r1,Timer_State ; Build address to timer state flag
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
617 LDR r0,[r1,#0] ; Pickup timer state
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
618 MOV r3,#2 ; Build expired value
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
619 CMP r0,#0 ; Is there a timer active?
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
620 BNE TMT_No_Timer_Active ; No, skip timer processing
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
621
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
622 ; Decrement the count-down timer.
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
623 ; TMD_Timer--;
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
624
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
625 LDR r0,Timer ; Build timer address
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
626 LDR r2,[r0,#0] ; Pickup the current timer value
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
627
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
628 ; Test if the Timer is at 0 and if so skip the decrement
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
629 cmp r2,#1
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
630 beq EXPIRED
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
631
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
632 SUBS r2,r2,#1 ; Decrement the timer value
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
633 STR r2,[r0,#0] ; Store the new timer value
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
634
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
635 bne TMT_No_Timer_Active ; Skip over the Set Timer State
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
636
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
637 ; Determine if the timer has expired. If so, modify the state
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
638 ; to indicate that it has expired.
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
639 ; if (TMD_Timer == 0)
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
640
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
641 ; TMD_Timer_State = TM_EXPIRED;
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
642
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
643 EXPIRED:
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
644 STREQ r3,[r1,#0] ; Change the timer state to
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
645 ; expired
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
646
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
647 ; }
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
648 TMT_No_Timer_Active:
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
649
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
650 ; Determine if the time-slice timer is active. Note that the parameters
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
651 ; for the time-slice are controlled by the Thread Control (TC)
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
652 ; component.
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
653 ; if (TMD_Time_Slice_State == TM_ACTIVE)
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
654 ; {
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
655 LDR r0,Slice_State ; Build time slice state address
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
656 LDR r2,[r0,#0] ; Pickup time slice state
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
657 CMP r2,#0 ; Is there a time slice active?
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
658 BNE TMT_No_Time_Slice_Active ; No, skip time slice processing
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
659
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
660 ; Decrement the time slice counter.
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
661 ; TMD_Time_Slice--;
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
662
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
663 LDR r2,Time_Slice ; Build time slice address
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
664 LDR r3,[r2,#0] ; Pickup the time slice value
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
665 SUBS r3,r3,#1 ; Decrement the time slice
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
666 STR r3,[r2,#0] ; Store the new time slice value
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
667
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
668 ; Determine if the time-slice timer has expired. If so, modify the
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
669 ; time-slice state to indicate that it has.
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
670 ; if (TMD_Time_Slice == 0)
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
671 ; {
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
672
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
673 BNE TMT_No_Time_Slice_Active ; Has time slice expired?
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
674
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
675 ; TMD_Time_Slice_State = TM_EXPIRED;
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
676
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
677 MOV r3,#2 ; Build TM_EXPIRED value
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
678 STR r3,[r0,#0] ; Indicate time slice is expired
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
679
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
680 ; Copy the current thread into the time-slice task pointer.
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
681 ; TMD_Time_Slice_Task = TCD_Current_Thread;
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
682
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
683 LDR r2,Current_Thread ; Pickup current thread pointer adr
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
684 LDR r2,[r2,#0] ; Pickup current thread pointer
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
685 LDR r3,Slice_Task ; Pickup time slice task pointer ad
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
686 STR r2,[r3,#0] ; Store current thread pointer
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
687
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
688 ; ((TC_TCB *) TCD_Current_Thread) -> tc_cur_time_slice = 1;
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
689
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
690 MOV r3,#1 ; For safety, place a minimal time-
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
691 STR a4,[a3,#20h]! ; slice into the task's control
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
692 ; block
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
693
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
694 ; }
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
695 ; }
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
696 TMT_No_Time_Slice_Active:
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
697
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
698 ; Determine if either of the basic timers have expired. If so,
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
699 ; activate the timer HISR.
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
700 ; if ((TMD_Timer_State == TM_EXPIRED) ||
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
701 ; (TMD_Time_Slice_State == TM_EXPIRED))
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
702 ; {
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
703
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
704 LDR r1,[r1,#0] ; Pickup timer state
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
705 CMP r1,#2 ; Does it indicate expiration?
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
706 LDRNE r0,[r0,#0] ; Pickup time slice state
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
707 CMPNE r0,#2 ; Does it indicate expiration?
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
708
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
709 BXNE r14 ; Return if no expiration
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
710
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
711 ; Activate the HISR timer function.
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
712 ; TCT_Activate_HISR(&TMD_HISR);
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
713
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
714 STR r14,[r13, #-4]! ; Save r14 on the stack
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
715 LDR r0,HISR ; Build address of timer HISR
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
716 BL _TCT_Activate_HISR ; Activate timer HISR
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
717 LDR r14,[r13], #4 ; Recover return address
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
718 ; }
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
719
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
720 BX r14 ; Return to caller
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
721
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
722 ;}
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
723 .end
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
724
614668bbbc4f Nucleus: tmt.s ported over from FreeNucleus by XVilka
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
725