annotate src/nucleus/gcc/tmt.S @ 152:d3668a47b969

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