annotate gsm-fw/nucleus/stashaway/tct.S.fiq @ 155:3be2bc80ad38

gsm-fw/bsp/Makefile: abb+spi hooked into the build
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Sun, 17 Nov 2013 06:08:47 +0000
parents ea819b60fe0d
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
144
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1 /*
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2 ************************************************************************
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
3 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
4 * Copyright Mentor Graphics Corporation 2002
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
5 * All Rights Reserved.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
6 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
7 * THIS WORK CONTAINS TRADE SECRET AND PROPRIETARY INFORMATION WHICH IS
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
8 * THE PROPERTY OF MENTOR GRAPHICS CORPORATION OR ITS LICENSORS AND IS
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
9 * SUBJECT TO LICENSE TERMS.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
10 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
11 ************************************************************************
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
12 ************************************************************************
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
13 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
14 * FILE NAME VERSION
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
15 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
16 * tct.s Nucleus PLUS\ARM925\Code Composer 1.14.1
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
17 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
18 * COMPONENT
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
19 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
20 * TC - Thread Control
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
21 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
22 * DESCRIPTION
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
23 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
24 * This file contains the target processor dependent routines for
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
25 * performing target-dependent scheduling functions.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
26 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
27 * FUNCTIONS
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
28 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
29 * TCT_Control_Interrupts Enable / disable interrupts
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
30 * by changing
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
31 * TCD_Interrupt_Level
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
32 * TCT_Local_Control_Interrupts Enable/disable interrupts
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
33 * by not changing
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
34 * TCD_Interrupt_Level
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
35 * TCT_Restore_Interrupts Restores interrupts to the
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
36 * level in TCD_Interrupt_Level
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
37 * TCT_Build_Task_Stack Build initial task stack
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
38 * TCT_Build_HISR_Stack Build initial HISR stack
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
39 * TCT_Build_Signal_Frame Build signal handler frame
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
40 * TCT_Check_Stack Check current stack
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
41 * TCT_Schedule Schedule the next thread
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
42 * TCT_Control_To_Thread Transfer control to a thread
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
43 * TCT_Control_To_System Transfer control from thread
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
44 * TCT_Signal_Exit Exit from signal handler
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
45 * TCT_Current_Thread Returns a pointer to current
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
46 * thread
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
47 * TCT_Set_Execute_Task Sets TCD_Execute_Task under
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
48 * protection from interrupts
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
49 * TCT_Protect Protect critical section
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
50 * TCT_Unprotect Unprotect critical section
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
51 * TCT_Unprotect_Specific Release specific protection
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
52 * TCT_Set_Current_Protect Set the thread's current
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
53 * protection field
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
54 * TCT_Protect_Switch Switch to protected thread
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
55 * TCT_Schedule_Protected Schedule the protected thread
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
56 * TCT_Interrupt_Context_Save Save interrupted context
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
57 * TCT_Interrupt_Context_Restore Restore interrupted context
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
58 * TCT_Activate_HISR Activate a HISR
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
59 * TCT_HISR_Shell HISR execution shell
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
60 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
61 * DEPENDENCIES
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
62 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
63 * cs_extr.h Common Service functions
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
64 * tc_extr.h Thread Control functions
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
65 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
66 * HISTORY
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
67 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
68 * NAME DATE REMARKS
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
69 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
70 * B. Ronquillo 08-28-2002 Released version 1.14.1
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
71 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
72 ************************************************************************
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
73 */
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
74
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
75 #define NU_SOURCE_FILE
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
76
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
77 /*
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
78 ******************************
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
79 * INCLUDE ASSEMBLY CONSTANTS *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
80 ******************************
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
81 * Define constants used in low-level initialization.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
82 */
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
83
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
84 #include "asm_defs.h"
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
85
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
86 .code 32
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
87
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
88 /* a couple of global variables defined in this module */
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
89
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
90 .comm TCT_System_Limit,4,4
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
91 .comm TCT_Special_Nested,4,4
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
92
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
93 .text
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
94
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
95 /*
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
96 **********************************
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
97 * LOCAL VARIABLE DECLARATIONS *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
98 **********************************
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
99 * Define pointers to system variables so their addresses may be obtained in a
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
100 * pc-relative manner.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
101 */
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
102
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
103 System_Limit:
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
104 .word TCT_System_Limit
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
105
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
106 Int_Level:
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
107 .word TCD_Interrupt_Level
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
108
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
109 Task_Shell:
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
110 .word TCC_Task_Shell
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
111
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
112 HISR_Shell:
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
113 .word TCT_HISR_Shell
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
114
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
115 Signal_Shell:
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
116 .word TCC_Signal_Shell
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
117
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
118 Current_Thread:
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
119 .word TCD_Current_Thread
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
120
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
121 Execute_HISR:
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
122 .word TCD_Execute_HISR
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
123
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
124 Execute_Task:
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
125 .word TCD_Execute_Task
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
126
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
127 Time_Slice:
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
128 .word TMD_Time_Slice
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
129
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
130 Slice_State:
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
131 .word TMD_Time_Slice_State
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
132
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
133 System_Stack:
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
134 .word TCD_System_Stack
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
135
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
136 Int_Count:
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
137 .word TCD_Interrupt_Count
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
138
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
139 Special_Nested:
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
140 .word TCT_Special_Nested
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
141
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
142 HISR_Tails:
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
143 .word TCD_Active_HISR_Tails
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
144
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
145 HISR_Heads:
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
146 .word TCD_Active_HISR_Heads
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
147
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
148 /*
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
149 ************************************************************************
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
150 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
151 * FUNCTION
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
152 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
153 * TCT_Control_Interrupts
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
154 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
155 * DESCRIPTION
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
156 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
157 * This function enables and disables interrupts as specified by
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
158 * the caller. Interrupts disabled by this call are left disabled
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
159 * until the another call is made to enable them.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
160 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
161 * CALLED BY
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
162 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
163 * Application
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
164 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
165 * CALLS
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
166 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
167 * None
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
168 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
169 * INPUTS
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
170 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
171 * new_level New interrupt enable level
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
172 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
173 * OUTPUTS
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
174 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
175 * old_level Previous interrupt enable
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
176 * level
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
177 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
178 * HISTORY
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
179 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
180 * NAME DATE REMARKS
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
181 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
182 * W. Lamie 02-15-1994 Created initial version 1.0
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
183 * D. Lamie 02-15-1994 Verified version 1.0
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
184 * C. Meredith 03-01-1994 Lockout interrupts while setting
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
185 * up the new level, resutling in
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
186 * version 1.1
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
187 * D. Lamie 03-18-1994 Verified version 1.1
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
188 * M. Trippi 02-03-1997 Masked the return value to only
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
189 * return the interrupt bits.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
190 * (SPR0252)
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
191 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
192 ************************************************************************
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
193 */
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
194
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
195 @INT TCT_Control_Interrupts (INT new_level)
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
196 @{
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
197
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
198 .globl TCT_Control_Interrupts
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
199 TCT_Control_Interrupts:
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
200
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
201 @INT old_level; Old interrupt level
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
202
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
203 @ lock out all interrupts before any checking or changing
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
204
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
205 @ Obtain the current interrupt lockout posture.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
206 @ old_level = TCD_Interrupt_Level;
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
207
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
208 @ Setup new interrupt lockout posture.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
209 @ TCD_Interrupt_Level = new_level;
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
210
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
211 @ renable interrupts for the specified lockout
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
212
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
213 @ Return old interrupt lockout level.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
214 @ return(old_level);
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
215
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
216 MRS r2,CPSR @ Pickup current CPSR
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
217 ORR r2,r2,#LOCKOUT @ Build lockout CPSR
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
218 MSR CPSR,r2 @ Lockout interrupts temporarily
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
219 LDR r1, Int_Level @ Pickup interrupt level
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
220 LDR r3,[r1, #0] @ Pickup current interrupt lockout
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
221 BIC r2,r2,#LOCK_MSK @ Clear lockout mask
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
222 ORR r2,r2,r0 @ Build new CPSR with appropriate
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
223 @ interrupts locked out
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
224 STR r0,[r1,#0] @ Save current lockout
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
225 MSR CPSR,r2 @ Setup new CPSR lockout bits
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
226 AND r0,r3,#LOCK_MSK @ Return previous lockout (SPR0252)
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
227
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
228 BX r14 @ Return to caller
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
229
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
230 @}
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
231
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
232 /*
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
233 ************************************************************************
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
234 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
235 * FUNCTION
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
236 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
237 * TCT_Local_Control_Interrupts
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
238 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
239 * DESCRIPTION
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
240 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
241 * This function enables and disables interrupts as specified by
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
242 * the caller.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
243 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
244 * CALLED BY
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
245 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
246 * Application
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
247 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
248 * CALLS
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
249 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
250 * None
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
251 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
252 * INPUTS
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
253 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
254 * new_level New interrupt enable level
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
255 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
256 * OUTPUTS
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
257 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
258 * old_level Previous interrupt enable
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
259 * level
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
260 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
261 * HISTORY
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
262 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
263 * NAME DATE REMARKS
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
264 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
265 * C. Meredith 03-01-1994 Created initial version 1.1
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
266 * D. Lamie 03-18-1994 Verified version 1.1
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
267 * M. Trippi 02-03-1997 Masked the return value to only
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
268 * return the interrupt bits.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
269 * (SPR0252)
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
270 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
271 ************************************************************************
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
272 */
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
273
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
274 @INT TCT_Local_Control_Interrupts (INT new_level)
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
275 @{
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
276
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
277 .globl TCT_Local_Control_Interrupts
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
278 TCT_Local_Control_Interrupts:
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
279
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
280 @INT old_level; Old interrupt level
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
281
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
282 @ read in the old level
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
283 @ old_level = current interrupt level of processor;
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
284
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
285 MRS r2,CPSR @ Pickup current CPSR
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
286 MOV r3,r2 @ save the old level
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
287
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
288 @ clear out the old level and set the new level
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
289 @ current interrupt level of processor &= ~LOCKOUT;
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
290 @ current interrupt level of processor |= new_level;
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
291
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
292 BIC r2,r2,#LOCK_MSK @ Clear all current interrupts
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
293 ORR r2,r2,r0 @ Build new CPSR with new
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
294 @ interrupt level
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
295 MSR CPSR,r2 @ Setup new CPSR interrupt bits
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
296
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
297 @ Return old interrupt lockout level.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
298 @ return(old_level);
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
299
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
300 AND r0,r3,#LOCK_MSK @ Return previous lockout (SPR0252)
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
301
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
302 BX r14 @ Return to caller
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
303
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
304 @}
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
305
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
306 /*
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
307 ************************************************************************
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
308 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
309 * FUNCTION
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
310 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
311 * TCT_Restore_Interrupts
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
312 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
313 * DESCRIPTION
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
314 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
315 * This function restores interrupts to that specified in the global
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
316 * TCD_Interrupt_Level variable.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
317 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
318 * CALLED BY
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
319 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
320 * Application
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
321 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
322 * CALLS
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
323 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
324 * None
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
325 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
326 * INPUTS
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
327 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
328 * None.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
329 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
330 * OUTPUTS
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
331 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
332 * None.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
333 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
334 * HISTORY
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
335 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
336 * NAME DATE REMARKS
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
337 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
338 * C. Meredith 03-01-1994 Created initial version 1.1
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
339 * D. Lamie 03-18-1994 Verified version 1.1
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
340 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
341 ************************************************************************
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
342 */
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
343
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
344 @VOID TCT_Restore_Interrupts (VOID)
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
345 @{
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
346
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
347 .globl TCT_Restore_Interrupts
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
348 TCT_Restore_Interrupts:
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
349
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
350 @ Lock out all interrupts before any checking or changing
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
351 @ Obtain the current interrupt lockout posture.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
352 @ Reload the level base on the TCD_Interrupt_Level variable
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
353
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
354 MRS r1,CPSR @ Pickup current CPSR
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
355 MOV r2,r1 @ save the CPSR value
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
356 ORR r1,r1,#LOCKOUT @ Build lockout CPSR
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
357 MSR CPSR,r1 @ Lockout interrupts temporarily
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
358 BIC r2,r2,#LOCK_MSK @ Clear current interrupt levels
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
359 LDR r1,Int_Level @ Load address of TCD_Interrupt_Level
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
360 LDR r0,[r1, #0] @ Pickup current interrupt lockout
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
361 ORR r2,r2,r0 @ Build new CPSR with appropriate
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
362 @ interrupts locked out
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
363 MSR CPSR,r2 @ Setup new CPSR lockout bits
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
364
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
365 BX r14 @ Return to caller
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
366
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
367 @}
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
368
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
369 /*
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
370 ************************************************************************
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
371 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
372 * FUNCTION
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
373 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
374 * TCT_Build_Task_Stack
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
375 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
376 * DESCRIPTION
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
377 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
378 * This function builds an initial stack frame for a task. The
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
379 * initial stack contains information concerning initial values of
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
380 * registers and the task's point of entry. Furthermore, the
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
381 * initial stack frame is in the same form as an interrupt stack
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
382 * frame.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
383 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
384 * CALLED BY
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
385 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
386 * TCC_Create_Task Create a new task
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
387 * TCC_Reset_Task Reset the specified task
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
388 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
389 * CALLS
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
390 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
391 * None
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
392 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
393 * INPUTS
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
394 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
395 * task Task control block pointer
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
396 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
397 * OUTPUTS
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
398 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
399 * None
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
400 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
401 * HISTORY
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
402 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
403 * NAME DATE REMARKS
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
404 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
405 * W. Lamie 02-15-1994 Created initial version 1.0
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
406 * D. Lamie 02-15-1994 Verified version 1.0
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
407 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
408 ************************************************************************
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
409 */
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
410
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
411 @VOID TCT_Build_Task_Stack(TC_TCB *task)
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
412 @{
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
413
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
414 .globl TCT_Build_Task_Stack
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
415 TCT_Build_Task_Stack:
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
416
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
417 @ Pickup the stack base.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
418 @ REG_Stack_Base = (BYTE_PTR) task -> tc_stack_start;
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
419
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
420 LDR r2,[r0,#0x24] @ Pickup the stack starting address
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
421
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
422 @ Pickup the stack size.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
423 @ REG_Stack_Size = task -> tc_stack_size;
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
424
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
425 LDR r1,[r0,#0x30] @ Pickup the stack size in bytes
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
426
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
427 @ Calculate the stack ending address.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
428 @ REG_Stack_End = REG_Stack_Base + REG_Stack_Size - 1;
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
429
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
430 ADD r3,r1,r2 @ Compute the beginning of stack
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
431 BIC r3,r3,#3 @ Insure word alignment
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
432 SUB r3,r3,#4 @ Reserve a word
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
433
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
434 @ Save the stack ending address.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
435 @ task -> tc_stack_end = REG_Stack_End;
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
436
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
437 STR r3,[r0,#0x28] @ Save the stack ending address
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
438
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
439 @ Reference the task shell.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
440 @ REG_Function_Ptr = (VOID *) TCC_Task_Shell;
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
441
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
442 @ Build an initial stack. This initial stack frame facilitates an
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
443 @ interrupt return to the TCC_Task_Shell function, which in turn
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
444 @ invokes the application task. The initial stack frame has the
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
445 @ following format:
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
446
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
447 @ (Lower Address) Stack Top -> 1 (Interrupt stack type)
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
448 @ CPSR Saved CPSR
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
449 @ r0 Saved r0
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
450 @ r1 Saved r1
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
451 @ r2 Saved r2
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
452 @ r3 Saved r3
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
453 @ r4 Saved r4
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
454 @ r5 Saved r5
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
455 @ r6 Saved r6
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
456 @ r7 Saved r7
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
457 @ r8 Saved r8
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
458 @ r9/sb Saved r9/sl
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
459 @ r10/sl Saved r10/sl
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
460 @ fp Saved fp
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
461 @ r12 Saved r12
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
462 @ r13 Saved r13
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
463 @ r14 Saved r14
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
464 @ (Higher Address) Stack Bottom-> r15 Saved r15
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
465
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
466
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
467 LDR r2, Task_Shell @ Pickup address of shell entry
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
468 STR r2,[r3], #-4 @ Store entry address on stack
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
469 MOV r2,#0 @ Clear value for initial registers
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
470 STR r2,[r3], #-4 @ Store initial r14
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
471 ADD r2,r3,#8 @ Compute initial r13
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
472 STR r2,[r3], #-4 @ Store initial r13 (Stack Bottom)
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
473 STR r2,[r3], #-4 @ Store initial r12
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
474 STR r2,[r3], #-4 @ Store initial fp
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
475 LDR r2,[r0,#0x24] @ Pickup the stack starting address
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
476 STR r2,[r3], #-4 @ Store initial r10/sl
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
477 MOV r2,#0 @ Clear value for initial registers
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
478 STR r2,[r3], #-4 @ Store initial r9/sb
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
479 STR r2,[r3], #-4 @ Store initial r8
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
480 STR r2,[r3], #-4 @ Store initial r7
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
481 STR r2,[r3], #-4 @ Store initial r6
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
482 STR r2,[r3], #-4 @ Store initial r5
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
483 STR r2,[r3], #-4 @ Store initial r4
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
484 STR r2,[r3], #-4 @ Store initial r3
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
485 STR r2,[r3], #-4 @ Store initial r2
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
486 STR r2,[r3], #-4 @ Store initial r1
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
487 STR r2,[r3], #-4 @ Store initial r0
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
488 MSR CPSR_f,r2 @ Clear the flags
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
489 MRS r2,CPSR @ Pickup the CPSR
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
490 BIC r2,r2,#LOCK_MSK @ Clear initial interrupt lockout
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
491 STR r2,[r3], #-4 @ Store CPSR on the initial stack
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
492 MOV r2,#1 @ Build interrupt stack type (1)
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
493 STR r2,[r3, #0] @ Store stack type on the top
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
494
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
495 @ Save the minimum amount of remaining stack memory.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
496 @ task -> tc_stack_minimum = REG_Stack_Size - 72;
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
497
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
498 MOV r2,#72 @ Size of interrupt stack frame
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
499 SUB r1,r1,r2 @ Compute minimum available bytes
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
500 STR r1,[r0, #0x34] @ Save in minimum stack area
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
501
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
502 @ Save the new stack pointer into the task's control block.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
503 @ task -> tc_stack_pointer = (VOID *) Stack_Top;
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
504
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
505 STR r3,[r0, #0x2C] @ Save stack pointer
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
506
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
507 BX r14 @ Return to caller
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
508
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
509 @}
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
510
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
511 /*
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
512 ************************************************************************
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
513 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
514 * FUNCTION
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
515 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
516 * TCT_Build_HISR_Stack
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
517 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
518 * DESCRIPTION
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
519 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
520 * This function builds an HISR stack frame that allows quick
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
521 * scheduling of the HISR.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
522 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
523 * CALLED BY
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
524 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
525 * TCC_Create_HISR Create HISR function
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
526 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
527 * CALLS
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
528 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
529 * None
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
530 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
531 * INPUTS
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
532 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
533 * hisr HISR control block pointer
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
534 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
535 * OUTPUTS
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
536 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
537 * None
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
538 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
539 * HISTORY
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
540 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
541 * NAME DATE REMARKS
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
542 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
543 * W. Lamie 02-15-1994 Created initial version 1.0
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
544 * D. Lamie 02-15-1994 Verified version 1.0
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
545 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
546 ************************************************************************
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
547 */
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
548
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
549 @VOID TCT_Build_HISR_Stack(TC_HCB *hisr)
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
550 @{
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
551
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
552 .globl TCT_Build_HISR_Stack
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
553 TCT_Build_HISR_Stack:
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
554
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
555 @ Pickup the stack base.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
556 @ REG_Stack_Base = (BYTE_PTR) hisr -> tc_stack_start;
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
557
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
558 LDR r2,[r0,#0x24] @ Pickup the stack starting address
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
559
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
560 @ Pickup the stack size.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
561 @ REG_Stack_Size = hisr -> tc_stack_size;
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
562
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
563 LDR r1,[r0,#0x30] @ Pickup the stack size in bytes
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
564
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
565 @ Calculate the stack ending address.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
566 @ REG_Stack_End = REG_Stack_Base + REG_Stack_Size;
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
567
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
568 ADD r3,r1,r2 @ Compute the beginning of stack
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
569 BIC r3,r3,#3 @ Insure word alignment
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
570 SUB r3,r3,#4 @ Reserve a word
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
571
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
572 @ Save the stack ending address.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
573 @ hisr -> tc_stack_end = REG_Stack_End;
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
574
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
575 STR r3,[r0,#0x28] @ Save the stack ending address
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
576
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
577 @ Reference the HISR shell.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
578 @ REG_Function_Ptr = (VOID *) TCT_HISR_Shell;
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
579
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
580 @ Build an initial stack. This initial stack frame facilitates an
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
581 @ solicited return to the TCT_HISR_Shell function, which in turn
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
582 @ invokes the appropriate HISR. The initial HISR stack frame has the
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
583 @ following format:
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
584
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
585 @ (Lower Address) Stack Top -> 0 (Solicited stack type)
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
586 @ !!FOR THUMB ONLY!! 0/0x20 Saved state mask
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
587 @ r4 Saved r4
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
588 @ r5 Saved r5
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
589 @ r6 Saved r6
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
590 @ r7 Saved r7
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
591 @ r8 Saved r8
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
592 @ r9/sb Saved r9/sl
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
593 @ r10/sl Saved r10/sl
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
594 @ fp Saved fp
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
595 @ r12 Saved r12
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
596 @ (Higher Address) Stack Bottom-> r15 Saved r15
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
597
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
598
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
599 LDR r2,HISR_Shell @ Pickup address of shell entry
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
600 STR r2,[r3], #-4 @ Store entry address on stack
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
601 ADD r2,r3,#4 @ Compute initial r13
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
602 STR r2,[r3], #-4 @ Store initial r12
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
603 STR r2,[r3], #-4 @ Store initial fp
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
604 LDR r2,[r0,#0x24] @ Pickup the stack starting address
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
605 STR r2,[r3], #-4 @ Store initial r10/sl
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
606 MOV r2,#0 @ Clear value for initial registers
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
607 STR r2,[r3], #-4 @ Store initial r9/sb
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
608 STR r2,[r3], #-4 @ Store initial r8
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
609 STR r2,[r3], #-4 @ Store initial r7
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
610 STR r2,[r3], #-4 @ Store initial r6
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
611 STR r2,[r3], #-4 @ Store initial r5
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
612 STR r2,[r3], #-4 @ Store initial r4
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
613 #if 1 /* was .if THUMB */
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
614 STR r2,[r3], #-4 @ Store initial state mask
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
615 #endif
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
616 STR r2,[r3, #0] @ Store solicited stack type on the
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
617 @ top of the stack
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
618
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
619 @ Save the minimum amount of remaining stack memory.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
620 @ hisr -> tc_stack_minimum = REG_Stack_Size - (ARM)44 or (THUMB)48;
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
621
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
622 #if 1 /* was .if THUMB */
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
623 MOV r2,#48 @ Size of solicited stack frame
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
624 #else
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
625 MOV r2,#44 @ Size of solicited stack frame
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
626 #endif
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
627
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
628 SUB r1,r1,r2 @ Compute minimum available bytes
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
629 STR r1,[r0, #0x34] @ Save in minimum stack area
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
630
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
631 @ Save the new stack pointer into the task's control block.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
632 @ hisr -> tc_stack_pointer = (VOID *) Stack_Top;
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
633
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
634 STR r3,[r0, #0x2C] @ Save stack pointer
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
635
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
636 BX r14 @ Return to caller
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
637
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
638 @}
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
639
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
640 /*
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
641 ************************************************************************
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
642 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
643 * FUNCTION
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
644 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
645 * TCT_Build_Signal_Frame
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
646 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
647 * DESCRIPTION
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
648 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
649 * This function builds a frame on top of the task's stack to
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
650 * cause the task's signal handler to execute the next time
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
651 * the task is executed.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
652 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
653 * CALLED BY
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
654 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
655 * TCC_Send_Signals Send signals to a task
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
656 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
657 * CALLS
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
658 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
659 * None
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
660 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
661 * INPUTS
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
662 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
663 * task Task control block pointer
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
664 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
665 * OUTPUTS
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
666 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
667 * None
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
668 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
669 * HISTORY
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
670 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
671 * NAME DATE REMARKS
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
672 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
673 * W. Lamie 02-15-1994 Created initial version 1.0
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
674 * D. Lamie 02-15-1994 Verified version 1.0
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
675 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
676 ************************************************************************
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
677 */
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
678
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
679 @VOID TCT_Build_Signal_Frame(TC_TCB *task)
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
680 @{
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
681
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
682 .globl TCT_Build_Signal_Frame
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
683 TCT_Build_Signal_Frame:
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
684
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
685 @ Pickup the stack pointer.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
686 @ REG_Stack_Ptr = (BYTE_PTR) task -> tc_stack_pointer;
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
687
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
688 LDR r3,[r0,#0x2c] @ Pickup the current stack pointer
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
689
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
690 @ Reference the Signal shell.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
691 @ REG_Function_Ptr = (VOID *) TCC_Signal_Shell;
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
692
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
693 @ Build a signal stack. This signal stack frame facilitates an
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
694 @ solicited return to the TCC_Signal_Shell function, which in turn
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
695 @ invokes the appropriate signal handler. The initial HISR stack frame
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
696 @ has the following format:
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
697
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
698 @ (Lower Address) Stack Top -> 0 (Solicited stack type)
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
699 @ !!FOR THUMB ONLY!! 0/0x20 Saved state mask
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
700 @ r4 Saved r4
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
701 @ r5 Saved r5
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
702 @ r6 Saved r6
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
703 @ r7 Saved r7
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
704 @ r8 Saved r8
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
705 @ r9/sb Saved r9/sl
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
706 @ r10/sl Saved r10/sl
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
707 @ fp Saved fp
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
708 @ r12 Saved r12
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
709 @ (Higher Address) Stack Bottom-> r15 Saved r15
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
710
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
711
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
712 LDR r2,Signal_Shell @ Pickup address of shell entry
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
713 SUB r3,r3,#4
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
714 STR r2,[r3], #-4 @ Store entry address on stack
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
715 ADD r2,r3,#4 @ Compute initial r13
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
716 STR r2,[r3], #-4 @ Store initial r12
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
717 STR r2,[r3], #-4 @ Store initial fp
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
718 LDR r2,[r0,#0x24] @ Pickup the stack starting address
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
719 STR r2,[r3], #-4 @ Store initial r10/sl
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
720 MOV r2,#0 @ Clear value for initial registers
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
721 STR r2,[r3], #-4 @ Store initial r9/sb
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
722 STR r2,[r3], #-4 @ Store initial r8
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
723 STR r2,[r3], #-4 @ Store initial r7
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
724 STR r2,[r3], #-4 @ Store initial r6
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
725 STR r2,[r3], #-4 @ Store initial r5
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
726 STR r2,[r3], #-4 @ Store initial r4
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
727 #if 0
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
728 MOV r1,#0x20 @ Get initial state mask
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
729 STR r1,[r3], #-4 @ Store initial state mask
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
730 #else
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
731 STR r2,[r3], #-4 @ TCC_Signal_Shell is an ARM proc
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
732 #endif
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
733
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
734 STR r2,[r3, #0] @ Store solicited stack type on the
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
735 @ top of the stack
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
736
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
737 @ Save the new stack pointer into the task's control block.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
738 @ task -> tc_stack_pointer = (VOID *) (REG_Stack_Ptr - REG_Stack_Size);
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
739
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
740 STR r3,[r0, #0x2C] @ Save stack pointer
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
741
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
742 BX r14 @ Return to caller
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
743
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
744 @}
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
745
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
746 /*
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
747 ************************************************************************
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
748 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
749 * FUNCTION
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
750 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
751 * TCT_Check_Stack
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
752 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
753 * DESCRIPTION
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
754 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
755 * This function checks the current stack for overflow conditions.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
756 * Additionally, this function keeps track of the minimum amount
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
757 * of stack space for the calling thread and returns the current
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
758 * available stack space.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
759 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
760 * CALLED BY
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
761 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
762 * TCC_Send_Signals Send signals to a task
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
763 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
764 * CALLS
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
765 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
766 * ERC_System_Error System error handler
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
767 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
768 * INPUTS
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
769 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
770 * None
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
771 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
772 * OUTPUTS
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
773 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
774 * available bytes in stack
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
775 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
776 * HISTORY
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
777 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
778 * NAME DATE REMARKS
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
779 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
780 * W. Lamie 02-15-1994 Created initial version 1.0
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
781 * D. Lamie 02-15-1994 Verified version 1.0
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
782 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
783 ************************************************************************
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
784 */
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
785
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
786 @UNSIGNED TCT_Check_Stack(void)
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
787 @{
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
788
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
789 .globl TCT_Check_Stack
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
790 TCT_Check_Stack:
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
791
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
792 @TC_TCB *thread;
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
793 @UNSIGNED remaining;
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
794
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
795 @ Pickup the current task/HISR pointer.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
796 @ thread = (TC_TCB *) TCD_Current_Thread;
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
797
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
798 LDR r0,Current_Thread @ Pickup address of thread pointer
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
799 LDR r0,[r0,#0] @ Pickup thread pointer
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
800
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
801 @ Determine if there is a current thread.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
802 @ if (thread)
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
803 @ {
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
804
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
805 CMP r0,#0 @ Determine if a thread is active
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
806 MOV r3,#0 @ Default remaining value
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
807 BEQ TCT_Skip_Stack_Check @ If NU_NULL, skip stack checking
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
808
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
809 @ Determine if the stack pointers are out of range.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
810 @ if ((thread -> tc_stack_pointer < thread -> tc_stack_start) ||
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
811 @ (thread -> tc_stack_pointer > thread -> tc_stack_end))
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
812
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
813 LDR r2,[r0,#0x24] @ Pickup start of stack area
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
814 CMP r13,r2 @ Compare with current stack ptr
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
815 BLT TCT_Stack_Range_Error @ If less, stack is out of range
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
816 LDR r1,[r0,#0x28] @ Pickup end of stack area
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
817 CMP r13,r1 @ Compare with current stack ptr
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
818 BLE TCT_Stack_Range_Okay @ If less, stack range is okay
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
819
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
820 @ Stack overflow condition exits.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
821 @ ERC_System_Error(NU_STACK_OVERFLOW);
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
822
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
823 TCT_Stack_Range_Error:
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
824
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
825 STR r14,[r13, #4]! @ Store r14 on the stack
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
826 MOV r0,#3 @ Build NU_STACK_OVERFLOW code
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
827 BL ERC_System_Error @ Call system error handler. Note:
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
828 @ control is not returned!
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
829 @ Examine stack to find return
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
830 @ address of this routine.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
831
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
832 TCT_Stack_Range_Okay:
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
833
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
834 @ Calculate the amount of available space on the stack.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
835 @ remaining = (BYTE_PTR) thread -> tc_stack_pointer -
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
836 @ (BYTE_PTR) thread -> tc_stack_start;
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
837
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
838 SUB r3,r13,r2 @ Calculate remaining stack size
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
839
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
840 @ Determine if there is enough memory on the stack to save all of the
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
841 @ registers.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
842 @ if (remaining < 80)
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
843
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
844 CMP r3,#80 @ Is there enough room for an
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
845 @ interrupt frame?
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
846 BCS TCT_No_Stack_Error @ If so, no stack overflow yet
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
847
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
848 @ Stack overflow condition is about to happen.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
849 @ ERC_System_Error(NU_STACK_OVERFLOW);
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
850
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
851 STR r14,[r13, #4]! @ Store r14 on the stack
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
852 MOV r0,#3 @ Build NU_STACK_OVERFLOW code
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
853 BL ERC_System_Error @ Call system error handler. Note:
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
854 @ control is not returned!
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
855 @ Examine stack to find return
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
856 @ address of this routine.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
857
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
858 TCT_No_Stack_Error:
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
859
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
860 @ Determine if this is a new minimum amount of stack space.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
861 @ if (remaining < thread -> tc_stack_minimum)
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
862
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
863 LDR r2,[r0,#0x34]
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
864 CMP r3,r2
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
865 STRCC r3,[r0,#0x34]
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
866
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
867 @ Save the new stack minimum.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
868 @ thread -> tc_stack_minimum = remaining;
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
869 @ }
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
870 @ else
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
871
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
872 @ Set the remaining bytes to 0.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
873 @ remaining = 0;
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
874
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
875 @ Return the remaining number of bytes on the stack.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
876 @ return(remaining);
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
877
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
878 TCT_Skip_Stack_Check:
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
879 MOV r0,r3 @ Return remaining bytes
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
880
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
881 BX r14 @ Return to caller
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
882
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
883 @}
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
884
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
885 /*
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
886 ************************************************************************
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
887 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
888 * FUNCTION
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
889 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
890 * TCT_Schedule
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
891 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
892 * DESCRIPTION
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
893 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
894 * This function waits for a thread to become ready. Once a thread
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
895 * is ready, this function initiates a transfer of control to that
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
896 * thread.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
897 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
898 * CALLED BY
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
899 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
900 * INC_Initialize Main initialization routine
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
901 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
902 * CALLS
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
903 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
904 * TCT_Control_To_Thread Transfer control to a thread
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
905 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
906 * INPUTS
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
907 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
908 * TCD_Execute_Task Pointer to task to execute
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
909 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
910 * OUTPUTS
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
911 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
912 * None
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
913 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
914 * HISTORY
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
915 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
916 * NAME DATE REMARKS
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
917 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
918 * W. Lamie 02-15-1994 Created initial version 1.0
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
919 * D. Lamie 02-15-1994 Verified version 1.0
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
920 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
921 ************************************************************************
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
922 */
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
923
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
924 @VOID TCT_Schedule(void)
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
925 @{
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
926
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
927 .globl TCT_Schedule
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
928 TCT_Schedule:
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
929
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
930 @ Restore interrupts according to the value contained in
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
931 @ TCD_Interrupt_Level.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
932
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
933 LDR r1,Int_Level @ Build address of interrupt level
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
934 MRS r0,CPSR @ Pickup current CPSR
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
935 LDR r2,[r1, #0] @ Pickup current interrupt lockout
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
936 BIC r0,r0,#LOCK_MSK @ Clear the interrupt lockout bits
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
937 ORR r0,r0,r2 @ Build new interrupt lockout CPSR
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
938 MSR CPSR,r0 @ Setup new CPSR
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
939 LDR r2,Execute_HISR @ Pickup TCD_Execute_HISR address
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
940 LDR r3,Execute_Task @ Pickup TCD_Execute_Task address
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
941
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
942 #ifdef INCLUDE_PROVIEW
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
943 @ Nucleus ProView Hook
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
944 @ We check if upon entering TCT_Schedule we already have a task to excute.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
945 @ if not, we start IDLE.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
946 LDR r0,[r2, #0] @ Pickup highest priority HISR ptr
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
947 CMP r0,#0 @ Is there a HISR active?
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
948 BNE TCT_Schedule_Thread @ Found an HISR
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
949 LDR r0,[r3, #0] @ Pickup highest priority Task ptr
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
950 CMP r0,#0 @ Is there a task active?
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
951 BNE TCT_Schedule_Thread @ If not, start IDLE.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
952 STR r2,[r13, #-4]! @ Save r2 on the stack
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
953 STR r3,[r13, #-4]! @ Save r3 on the stack
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
954 BL _NU_Idle_Hook
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
955 LDR r3,[r13], #4 @ Recover r2
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
956 LDR r2,[r13], #4 @ Recover r3
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
957 #endif
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
958
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
959
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
960 @ Wait until a thread (task or HISR) is available to execute.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
961 @ do
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
962 @ {
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
963 TCT_Schedule_Loop:
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
964
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
965 @ } while ((!TCD_Execute_HISR) && (!TCD_Execute_Task));
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
966
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
967 LDR r0,[r2, #0] @ Pickup highest priority HISR ptr
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
968 CMP r0,#0 @ Is there a HISR active?
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
969 BNE TCT_Schedule_Thread @ Found an HISR
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
970 LDR r0,[r3, #0] @ Pickup highest priority Task ptr
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
971 CMP r0,#0 @ Is there a task active?
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
972 BEQ TCT_Schedule_Loop @ If not, continue the search
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
973
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
974 @ Yes, either a task or an HISR is ready to execute. Lockout
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
975 @ interrupts while the thread is transferred to.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
976
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
977 TCT_Schedule_Thread:
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
978 MRS r1,CPSR @ Pickup CPSR again
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
979 ORR r1,r1,#LOCKOUT @ Build interrupt lockout value
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
980 MSR CPSR,r1 @ Lockout interrupts
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
981
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
982 @ Transfer control to the thread by falling through to the following
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
983 @ routine.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
984 @}
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
985
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
986 /*
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
987 ************************************************************************
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
988 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
989 * FUNCTION
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
990 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
991 * TCT_Control_To_Thread
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
992 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
993 * DESCRIPTION
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
994 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
995 * This function transfers control to the specified thread. Each
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
996 * time control is transferred to a thread, its scheduled counter
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
997 * is incremented. Additionally, time-slicing for task threads is
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
998 * enabled in this routine. The TCD_Current_Thread pointer is
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
999 * setup by this function.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1000 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1001 * CALLED BY
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1002 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1003 * TCT_Schedule Indirectly called
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1004 * TCT_Protect Protection task switch
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1005 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1006 * CALLS
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1007 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1008 * None
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1009 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1010 * INPUTS
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1011 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1012 * thread Thread control block pointer
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1013 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1014 * OUTPUTS
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1015 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1016 * None
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1017 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1018 * HISTORY
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1019 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1020 * NAME DATE REMARKS
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1021 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1022 * W. Lamie 02-15-1994 Created initial version 1.0
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1023 * D. Lamie 02-15-1994 Verified version 1.0
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1024 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1025 ************************************************************************
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1026 */
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1027
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1028 @VOID TCT_Control_To_Thread(TC_TCB *thread)
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1029 @{
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1030 TCT_Control_To_Thread:
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1031
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1032 @ Setup the current thread pointer.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1033 @ TCD_Current_Thread = (VOID *) thread;
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1034
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1035 LDR r1,Current_Thread @ Pickup current thread ptr address
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1036 LDR r2,[r0, #0x1c] @ Pickup scheduled count
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1037 STR r0,[r1, #0] @ Setup current thread pointer
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1038
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1039 @ Increment the thread scheduled counter.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1040 @ thread -> tc_scheduled++;
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1041
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1042 LDR r3,[r0, #0x20] @ Pickup time slice value
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1043 ADD r2,r2,#1 @ Increment the scheduled count
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1044 STR r2,[r0, #0x1c] @ Store new scheduled count
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1045
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1046 @ Check for time slice option.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1047 @ if (thread -> tc_cur_time_slice)
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1048 @ {
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1049 CMP r3,#0 @ Is there a time slice?
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1050 BEQ TCT_No_Start_TS_1 @ If 0, there is no time slice
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1051
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1052 @ Start a time slice.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1053 @ TMD_Time_Slice = thread -> tc_cur_time_slice;
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1054 @ TMD_Time_Slice_State = 0;
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1055
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1056 LDR r2,Time_Slice @ Pickup address of TMD_Time_Slice
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1057 LDR r1,Slice_State @ Pickup address of
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1058 @ TMD_Time_Slice_State
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1059 STR r3,[r2, #0] @ Setup the time slice
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1060 MOV r2,#0 @ Build active state flag
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1061 STR r2,[r1,#0] @ Set the active flag
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1062 @ }
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1063 TCT_No_Start_TS_1:
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1064 #ifdef INCLUDE_PROVIEW
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1065 @ Nucleus ProView Hook
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1066
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1067 STR r0,[r13, #-4]! @ Save r0 on the stack
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1068 BL _NU_Schedule_Task_Hook @ Branch to RTView
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1069 LDR r0,[r13], #4 @ Recover return address
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1070 #endif
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1071
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1072
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1073 @ Pickup the stack pointer and resume the thread.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1074 @ REG_Stack_Ptr = thread -> tc_stack_pointer;
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1075
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1076 LDR r13,[r0, #0x2c] @ Switch to thread's stack pointer
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1077
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1078 @ Pop off the saved information associated with the thread. After we
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1079 @ determine which type of stack is present. A 1 on the top of the
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1080 @ stack indicates an interrupt stack, while a 0 on the top of the
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1081 @ stack indicates a solicited type of stack.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1082
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1083 @ Remember that the interrupt level that is restored must represent
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1084 @ the interrupt level in TCD_Interrupt_Level.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1085
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1086 LDR r1,[r13], #4 @ Pop off the stack type
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1087 CMP r1,#1 @ See if it is an interrupt stack
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1088 BEQ TCT_Interrupt_Resume @ If so, an interrupt resume of
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1089 @ thread is required
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1090 LDR r1, Int_Level @ Pickup address of interrupt
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1091 @ lockout
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1092 MRS r0,CPSR @ Pickup current CPSR
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1093 BIC r0,r0,#LOCK_MSK @ Clear lockout mask
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1094
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1095 BIC r0,r0,#0x80000000
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1096
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1097
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1098 LDR r2,[r1, #0] @ Pickup interrupt lockout mask
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1099 ORR r0,r0,r2 @ Build new interrupt lockout mask
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1100 #if 1 /* was .if THUMB */
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1101 LDR r2,[r13], #4 @ Pop off the state mask
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1102 ORR r0,r0,r2 @ Set appropriate state
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1103 #endif
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1104 MSR SPSR,r0 @ Place it into the SPSR
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1105 LDMIA r13!,{r4-r12,r15}^ @ A solicited return is required.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1106 @ This type of return only
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1107 @ recovers r4-r13 & r15
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1108 TCT_Interrupt_Resume:
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1109 LDR r0,[r13], #4 @ Pop off the CPSR
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1110 LDR r1,Int_Level @ Pickup address of interrupt
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1111 @ lockout
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1112 BIC r0,r0,#LOCK_MSK @ Clear lockout mask
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1113 LDR r2,[r1, #0] @ Pickup interrupt lockout mask
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1114 ORR r0,r0,r2 @ Build new interrupt lockout mask
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1115 MSR SPSR,r0 @ Place it into the SPSR
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1116 LDMIA r13,{r0-r15}^ @ Recover all registers and resume
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1117 @ at point of interrupt
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1118 @}
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1119
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1120 /*
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1121 ************************************************************************
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1122 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1123 * FUNCTION
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1124 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1125 * TCT_Control_To_System
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1126 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1127 * DESCRIPTION
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1128 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1129 * This function returns control from a thread to the system. Note
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1130 * that this service is called in a solicited manner, i.e. it is
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1131 * not called from an interrupt thread. Registers required by the
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1132 * compiler to be preserved across function boundaries are saved by
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1133 * this routine. Note that this is usually a sub-set of the total
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1134 * number of available registers.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1135 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1136 * CALLED BY
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1137 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1138 * Other Components
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1139 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1140 * CALLS
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1141 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1142 * TCT_Schedule Schedule the next thread
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1143 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1144 * INPUTS
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1145 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1146 * None
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1147 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1148 * OUTPUTS
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1149 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1150 * None
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1151 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1152 * HISTORY
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1153 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1154 * NAME DATE REMARKS
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1155 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1156 * W. Lamie 02-15-1994 Created initial version 1.0
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1157 * D. Lamie 02-15-1994 Verified version 1.0
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1158 * C. Meredith 03-01-1994 Corrected problem in time-slice
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1159 * reset logic, resulting in
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1160 * version 1.1
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1161 * D. Lamie 03-18-1994 Verified version 1.1
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1162 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1163 ************************************************************************
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1164 */
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1165
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1166 @VOID TCT_Control_To_System(void)
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1167 @{
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1168
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1169 .globl TCT_Control_To_System
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1170 TCT_Control_To_System:
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1171
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1172 @ Lockout interrupts.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1173
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1174 MRS r0,CPSR @ Pickup current CPSR
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1175 ORR r0,r0,#LOCKOUT @ Build interrupt lockout value
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1176 MSR CPSR,r0 @ Lockout interrupts
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1177
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1178 @ Save a minimal context of the thread.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1179
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1180 STMDB r13!,{r4-r12,r14} @ Save minimal context of thread on
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1181 @ the current stack
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1182 #if 1 /* was .if THUMB */
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1183 MOV r2,r14 @ Determine what state the caller
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1184 MOV r2,r2,LSL #31 @ was in and build an
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1185 MOV r2,r2,LSR #26 @ appropriate state mask
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1186 STR r2,[r13, #-4]! @ Place it on the stack
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1187 #endif
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1188
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1189 MOV r2,#0 @ Build solicited stack type value
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1190 @ and NU_NULL value
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1191 STR r2,[r13, #-4]! @ Place it on the top of the stack
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1192
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1193 @ Setup a pointer to the thread control block.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1194 @ REG_Thread_Ptr = (TC_TCB *) TCD_Current_Thread;
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1195
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1196 LDR r1,Current_Thread @ Pickup current thread ptr address
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1197 LDR r0,[r1, #0] @ Pickup current thread pointer
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1198
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1199 @ Clear the current thread control block pointer.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1200 @ TCD_Current_Thread = NU_NULL;
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1201
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1202 LDR r3,Slice_State @ Pickup time slice state address
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1203 STR r2,[r1, #0] @ Set current thread pointer to
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1204 @ NU_NULL
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1205
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1206 @ Check to see if a time slice is active. If so, copy the original time
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1207 @ slice into the current time slice field of the task's control block.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1208 @ if (TMD_Time_Slice_State == 0)
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1209 @ {
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1210 LDR r1,[r3, #0] @ Pickup time slice state flag
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1211 CMP r1,#0 @ Compare with active value
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1212 BNE TCT_No_Stop_TS_1 @ If non-active, don't disable
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1213
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1214
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1215 @ Insure that the next time the task runs it gets a fresh time
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1216 @ slice.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1217 @ REG_Thread_Ptr -> tc_cur_time_slice = REG_Thread_Ptr -> tc_time_slice;
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1218
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1219 LDR r1,[r0, #0x40] @ Pickup original time slice
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1220
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1221 @ Clear any active time slice by setting the state to NOT_ACTIVE.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1222 @ TMD_Time_Slice_State = 1;
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1223
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1224 MOV r2,#1 @ Build disable value
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1225 STR r2,[r3, #0] @ Disable time slice
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1226 STR r1,[r0, #0x20] @ Reset current time slice
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1227 @ }
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1228 TCT_No_Stop_TS_1:
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1229
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1230 @ Save off the current stack pointer in the control block.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1231 @ REG_Thread_Ptr -> tc_stack_pointer = (VOID *) REG_Stack_Ptr;
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1232
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1233 STR r13,[r0, #0x2c] @ Save the thread's stack pointer
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1234
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1235 @ Clear the task's current protection.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1236 @ (REG_Thread_Ptr -> tc_current_protect) -> tc_tcb_pointer = NU_NULL;
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1237 @ REG_Thread_Ptr -> tc_current_protect = NU_NULL;
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1238
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1239 LDR r1,[r0, #0x38] @ Pickup current thread pointer
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1240 MOV r2,#0 @ Build NU_NULL value
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1241 STR r2,[r0, #0x38] @ Clear the protect pointer field
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1242 STR r2,[r1, #0] @ Release the actual protection
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1243
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1244 @ Switch to the system stack.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1245 @ REG_Stack_Ptr = TCD_System_Stack;
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1246
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1247 LDR r1, System_Stack @ Pickup address of stack pointer
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1248 LDR r2, System_Limit @ Pickup address of stack limit ptr
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1249 LDR r13,[r1, #0] @ Switch to system stack
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1250 LDR r10,[r2, #0] @ Setup system stack limit
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1251
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1252 @ Finished, return to the scheduling loop.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1253
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1254 B TCT_Schedule @ Return to scheduling loop
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1255 @}
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1256
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1257 /*
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1258 ************************************************************************
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1259 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1260 * FUNCTION
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1261 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1262 * TCT_Signal_Exit
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1263 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1264 * DESCRIPTION
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1265 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1266 * This function exits from a signal handler. The primary purpose
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1267 * of this function is to clear the scheduler protection and switch
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1268 * the stack pointer back to the normal task's stack pointer.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1269 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1270 * CALLED BY
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1271 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1272 * TCC_Signal_Shell Signal handling shell func
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1273 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1274 * CALLS
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1275 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1276 * TCT_Schedule Scheduler
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1277 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1278 * INPUTS
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1279 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1280 * None
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1281 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1282 * OUTPUTS
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1283 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1284 * None
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1285 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1286 * HISTORY
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1287 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1288 * NAME DATE REMARKS
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1289 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1290 * W. Lamie 02-15-1994 Created initial version 1.0
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1291 * D. Lamie 02-15-1994 Verified version 1.0
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1292 * C. Meredith 03-01-1994 Corrected problem in time-slice
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1293 * reset logic, resulting in
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1294 * version 1.1
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1295 * D. Lamie 03-18-1994 Verified version 1.1
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1296 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1297 ************************************************************************
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1298 */
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1299
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1300 @VOID TCT_Signal_Exit(void)
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1301 @{
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1302
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1303 .globl TCT_Signal_Exit
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1304 TCT_Signal_Exit:
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1305
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1306 @ Lockout interrupts.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1307
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1308 MRS r3,CPSR @ Pickup current CPSR
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1309 ORR r3,r3,#LOCKOUT @ Build lockout value
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1310 MSR CPSR,r3 @ Lockout interrupts
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1311
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1312 @ Setup a pointer to the thread control block.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1313 @ REG_Thread_Ptr = (TC_TCB *) TCD_Current_Thread;
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1314
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1315 LDR r1,Current_Thread @ Pickup address of thread pointer
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1316 MOV r2,#0 @ Build NU_NULL value
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1317 LDR r0,[r1,#0] @ Pickup current thread pointer
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1318
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1319 @ Clear the current thread control block.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1320 @ TCD_Current_Thread = NU_NULL;
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1321
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1322 LDR r3,Slice_State @ Pickup time slice state address
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1323 STR r2,[r1, #0] @ Clear current thread pointer
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1324
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1325 @ Check to see if a time slice is active. If so, copy the original time
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1326 @ slice into the current time slice field of the task's control block.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1327 @ if (TMD_Time_Slice_State == 0)
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1328 @ {
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1329
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1330 LDR r1,[r3, #0] @ Pickup time slice state flag
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1331 CMP r1,#0 @ Compare with active value
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1332 BNE TCT_No_Stop_TS_2 @ If non-active, don't disable
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1333
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1334 @ Insure that the next time the task runs it gets a fresh time
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1335 @ slice.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1336 @ REG_Thread_Ptr -> tc_cur_time_slice = REG_Thread_Ptr -> tc_time_slice;
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1337
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1338 LDR r1,[r0, #0x40] @ Pickup original time slice
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1339
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1340 @ Clear any active time slice by setting the state to NOT_ACTIVE.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1341 @ TMD_Time_Slice_State = 1;
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1342
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1343 MOV r2,#1 @ Build disable value
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1344 STR r2,[r3, #0] @ Disable time slice
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1345 STR r1,[r0, #0x20] @ Reset current time slice
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1346 @ }
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1347 TCT_No_Stop_TS_2:
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1348
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1349 @ Switch back to the saved stack. The saved stack pointer was saved
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1350 @ before the signal frame was built.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1351 @ REG_Thread_Ptr -> tc_stack_pointer =
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1352 @ REG_Thread_Ptr -> tc_saved_stack_ptr;
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1353
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1354 LDR r1,[r0, #0x3c] @ Pickup saved stack pointer
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1355 STR r1,[r0, #0x2c] @ Place in current stack pointer
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1356
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1357 @ Clear the task's current protection.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1358 @ (REG_Thread_Ptr -> tc_current_protect) -> tc_tcb_pointer = NU_NULL;
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1359 @ REG_Thread_Ptr -> tc_current_protect = NU_NULL;
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1360
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1361 LDR r1,[r0, #0x38] @ Pickup current thread pointer
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1362 MOV r2,#0 @ Build NU_NULL value
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1363 STR r2,[r0, #0x38] @ Clear the protect pointer field
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1364 STR r2,[r1, #0] @ Release the actual protection
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1365
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1366 @ Switch to the system stack.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1367 @ REG_Stack_Ptr = (BYTE_PTR) TCD_System_Stack;
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1368
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1369 LDR r1, System_Stack @ Pickup address of stack pointer
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1370 LDR r2, System_Limit @ Pickup address of stack limit ptr
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1371 LDR r13,[r1, #0] @ Switch to system stack
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1372 LDR r10,[r2, #0] @ Setup system stack limit
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1373
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1374 @ Finished, return to the scheduling loop.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1375
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1376 B TCT_Schedule @ Return to scheduling loop
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1377 @}
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1378
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1379 /*
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1380 ************************************************************************
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1381 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1382 * FUNCTION
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1383 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1384 * TCT_Current_Thread
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1385 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1386 * DESCRIPTION
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1387 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1388 * This function returns the current thread pointer.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1389 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1390 * CALLED BY
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1391 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1392 * Application
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1393 * System Components
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1394 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1395 * CALLS
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1396 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1397 * None
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1398 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1399 * INPUTS
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1400 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1401 * None
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1402 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1403 * OUTPUTS
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1404 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1405 * Pointer to current thread
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1406 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1407 * HISTORY
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1408 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1409 * NAME DATE REMARKS
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1410 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1411 * W. Lamie 02-15-1994 Created initial version 1.0
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1412 * D. Lamie 02-15-1994 Verified version 1.0
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1413 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1414 ************************************************************************
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1415 */
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1416
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1417 @VOID *TCT_Current_Thread(void)
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1418 @{
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1419
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1420 .globl TCT_Current_Thread
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1421 TCT_Current_Thread:
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1422
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1423 @ Return the current thread pointer.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1424 @ return(TCD_Current_Thread);
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1425
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1426 LDR r0, Current_Thread @ Pickup address of thread pointer
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1427 LDR r0,[r0, #0] @ Pickup current thread pointer
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1428
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1429 BX r14 @ Return to caller
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1430
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1431 @}
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1432
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1433 /*
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1434 ************************************************************************
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1435 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1436 * FUNCTION
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1437 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1438 * TCT_Set_Execute_Task
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1439 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1440 * DESCRIPTION
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1441 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1442 * This function sets the current task to execute variable under
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1443 * protection against interrupts.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1444 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1445 * CALLED BY
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1446 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1447 * TCC Scheduling Routines
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1448 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1449 * CALLS
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1450 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1451 * None
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1452 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1453 * INPUTS
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1454 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1455 * task Pointer to task control block
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1456 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1457 * OUTPUTS
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1458 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1459 * TCD_Execute_Task Modified variable
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1460 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1461 * HISTORY
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1462 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1463 * NAME DATE REMARKS
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1464 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1465 * W. Lamie 02-15-1994 Created initial version 1.0
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1466 * D. Lamie 02-15-1994 Verified version 1.0
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1467 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1468 ************************************************************************
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1469 */
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1470
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1471 @VOID TCT_Set_Execute_Task(TC_TCB *task)
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1472 @{
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1473
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1474 .globl TCT_Set_Execute_Task
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1475 TCT_Set_Execute_Task:
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1476
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1477 @ Now setup the TCD_Execute_Task pointer.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1478 @ TCD_Execute_Task = task;
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1479
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1480 LDR r1, Execute_Task @ Pickup execute task ptr address
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1481 STR r0,[r1,#0] @ Setup new task to execute
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1482
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1483 BX r14 @ Return to caller
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1484
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1485 @}
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1486
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1487 /*
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1488 ************************************************************************
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1489 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1490 * FUNCTION
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1491 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1492 * TCT_Protect
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1493 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1494 * DESCRIPTION
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1495 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1496 * This function protects against multiple thread access.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1497 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1498 * CALLED BY
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1499 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1500 * Application
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1501 * System Components
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1502 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1503 * CALLS
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1504 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1505 * None
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1506 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1507 * INPUTS
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1508 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1509 * protect Pointer to protection block
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1510 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1511 * OUTPUTS
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1512 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1513 * None
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1514 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1515 * HISTORY
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1516 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1517 * NAME DATE REMARKS
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1518 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1519 * W. Lamie 02-15-1994 Created initial version 1.0
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1520 * D. Lamie 02-15-1994 Verified version 1.0
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1521 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1522 ************************************************************************
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1523 */
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1524
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1525 @VOID TCT_Protect(TC_PROTECT *protect)
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1526 @{
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1527
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1528 .globl TCT_Protect
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1529 TCT_Protect:
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1530
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1531 @ Determine if the caller is in a task or HISR thread.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1532 @ if (TCD_Current_Thread)
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1533 @ {
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1534
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1535 LDR r1,Current_Thread @ Pickup current thread ptr address
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1536 LDR r3,[r1, #0] @ Pickup current thread pointer
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1537 CMP r3,#0 @ Check to see if it is non-NULL
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1538 BEQ TCT_Skip_Protect @ If NULL, skip protection
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1539
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1540 @ Lockout interrupts.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1541
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1542 MRS r1,CPSR @ Pickup current CPSR
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1543 ORR r1,r1,#LOCKOUT @ Place lockout value in
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1544 MSR CPSR,r1 @ Lockout interrupts
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1545
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1546 @ Wait until the protect structure is available.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1547 @ while (protect -> tc_tcb_pointer != NU_NULL)
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1548 @ {
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1549
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1550 TCT_Protect_Loop:
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1551 LDR r1,[r0, #0] @ Pickup protection owner field
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1552 CMP r1,#0 @ Is there any protection?
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1553 BEQ TCT_Protect_Available @ If NU_NULL, no current protection
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1554
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1555 @ Protection structure is not available.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1556
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1557 @ Indicate that another thread is waiting.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1558 @ protect -> tc_thread_waiting = 1;
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1559
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1560 MOV r2,#1 @ Build thread waiting flag
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1561 STR r2,[r0, #4] @ Set waiting field
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1562
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1563 @ Directly schedule the thread waiting.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1564 @ TCT_Schedule_Protected(protect -> tc_tcb_pointer);
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1565
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1566 STR r0,[r13, #-4]! @ Save r0 on the stack
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1567 STR r14,[r13, #-4]! @ Save r14 on the stack
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1568 MOV r0,r3 @ Place current thread into r0
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1569 BL TCT_Schedule_Protected @ Call routine to schedule the
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1570 @ owner of the thread
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1571
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1572 LDR r14,[r13], #4 @ Recover saved r14
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1573 LDR r0,[r13], #4 @ Recover saved r0
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1574
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1575 @ Lockout interrupts.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1576
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1577 LDR r1,Current_Thread @ Pickup current thread ptr address
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1578 LDR r3,[r1, #0] @ Pickup current thread pointer
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1579 MRS r1,CPSR @ Pickup current CPSR
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1580 ORR r1,r1,#LOCKOUT @ Place lockout value in
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1581 MSR CPSR,r1 @ Lockout interrupts
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1582 B TCT_Protect_Loop @ Examine protect flags again
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1583 @ }
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1584 TCT_Protect_Available:
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1585
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1586 @ Protection structure is available.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1587
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1588 @ Indicate that this thread owns the protection.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1589 @ protect -> tc_tcb_pointer = TCD_Current_Thread;
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1590
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1591 STR r3,[r0, #0] @ Indicate calling thread owns this
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1592 @ protection
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1593
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1594 @ Clear the thread waiting flag.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1595 @ protect -> tc_thread_waiting = 0;
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1596
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1597 MOV r2,#0 @ Clear value
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1598 STR r2,[r0, #4] @ Clear the thread waiting flag
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1599
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1600 @ Save the protection pointer in the thread's control block. Note
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1601 @ that both task and HISR threads share the same control block
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1602 @ format.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1603 @ REG_Thread_Ptr = (TC_TCB *) TCD_Current_Thread;
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1604 @ REG_Thread_Ptr -> tc_current_protect = protect;
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1605
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1606 STR r0,[r3, #0x38] @ Setup current protection
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1607
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1608 @ Restore interrupts.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1609
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1610 LDR r2,Int_Level @ Pickup address of interrupt level
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1611 MRS r1,CPSR @ Pickup current CPSR
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1612 LDR r3,[r2, #0] @ Pickup interrupt lockout level
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1613 BIC r1,r1,#LOCK_MSK @ Clear lockout bits
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1614 ORR r1,r1,r3 @ Build new interrupt lockout
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1615 MSR CPSR,r1 @ Setup CPSR appropriately
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1616 @ }
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1617
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1618 TCT_Skip_Protect:
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1619
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1620 BX r14 @ Return to caller
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1621
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1622 @}
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1623
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1624 /*
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1625 ************************************************************************
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1626 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1627 * FUNCTION
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1628 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1629 * TCT_Unprotect
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1630 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1631 * DESCRIPTION
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1632 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1633 * This function releases protection of the currently active
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1634 * thread. If the caller is not an active thread, then this
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1635 * request is ignored.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1636 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1637 * CALLED BY
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1638 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1639 * Application
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1640 * System Components
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1641 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1642 * CALLS
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1643 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1644 * None
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1645 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1646 * INPUTS
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1647 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1648 * None
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1649 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1650 * OUTPUTS
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1651 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1652 * None
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1653 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1654 * HISTORY
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1655 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1656 * NAME DATE REMARKS
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1657 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1658 * W. Lamie 02-15-1994 Created initial version 1.0
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1659 * D. Lamie 02-15-1994 Verified version 1.0
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1660 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1661 ************************************************************************
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1662 */
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1663
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1664 @VOID TCT_Unprotect(void)
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1665 @{
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1666
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1667 .globl TCT_Unprotect
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1668 TCT_Unprotect:
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1669
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1670
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1671 @ Determine if the caller is in a task or HISR thread.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1672 @ if (TCD_Current_Thread)
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1673 @ {
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1674
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1675 LDR r1,Current_Thread @ Pickup current thread ptr address
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1676 LDR r3,[r1, #0] @ Pickup current thread pointer
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1677 CMP r3,#0 @ Check to see if it is non-NULL
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1678 BEQ TCT_Skip_Unprotect @ If NULL, skip unprotection
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1679
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1680 @ Setup a thread control block pointer.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1681 @ REG_Thread_Ptr = (TC_TCB *) TCD_Current_Thread;
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1682
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1683 @ Determine if there is a currently active protection.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1684 @ if (REG_Thread_Ptr -> tc_current_protect)
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1685 @ {
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1686
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1687 LDR r0,[r3, #0x38] @ Pickup current protect field
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1688 CMP r0,#0 @ Is there a protection in force?
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1689 BEQ TCT_Skip_Unprotect @ If not, nothing is protected
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1690
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1691 @ Lockout interrupts.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1692
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1693 MRS r1,CPSR @ Pickup current CPSR
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1694 ORR r1,r1,#LOCKOUT @ Place lockout value in
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1695 MSR CPSR,r1 @ Lockout interrupts
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1696
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1697 @ Yes, this thread still has this protection structure.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1698 @ REG_Protect_Ptr = REG_Thread_Ptr -> tc_current_protect;
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1699
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1700 @ Is there a higher priority thread waiting for the protection
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1701 @ structure?
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1702 @ if (REG_Protect_Ptr -> tc_thread_waiting)
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1703
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1704 LDR r2,[r0, #4] @ Pickup thread waiting flag
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1705 CMP r2,#0 @ Are there any threads waiting?
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1706 BEQ TCT_Not_Waiting_Unpr @ If not, just release protection
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1707
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1708 @ Transfer control to the system. Note that this
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1709 @ automatically clears the current protection and it returns
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1710 @ to the caller of this routine instead of this routine.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1711 @ TCT_Control_To_System();
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1712
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1713 B TCT_Control_To_System @ Return control to the system
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1714
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1715 @ else
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1716 @ {
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1717 TCT_Not_Waiting_Unpr:
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1718
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1719 @ Clear the protection.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1720 @ REG_Thread_Ptr -> tc_current_protect = NU_NULL;
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1721 @ REG_Protect_Ptr -> tc_tcb_pointer = NU_NULL;
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1722
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1723 MOV r2,#0 @ Build NU_NULL value
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1724 STR r2,[r0, #0] @ Release the protection
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1725 STR r2,[r3, #0x38] @ Clear protection pointer in the
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1726 @ control block
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1727
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1728 @ }
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1729
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1730 TCT_Not_Protected:
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1731 @ Restore interrupts again.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1732
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1733 LDR r2,Int_Level @ Pickup address of interrupt level
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1734 MRS r1,CPSR @ Pickup current CPSR
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1735 LDR r3,[r2, #0] @ Pickup interrupt lockout level
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1736 BIC r1,r1,#LOCK_MSK @ Clear lockout bits
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1737 ORR r1,r1,r3 @ Build new interrupt lockout
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1738 MSR CPSR,r1 @ Setup CPSR appropriately
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1739
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1740 @ }
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1741 @ }
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1742 TCT_Skip_Unprotect:
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1743
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1744 BX r14 @ Return to caller
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1745
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1746 @}
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1747
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1748 /*
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1749 ************************************************************************
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1750 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1751 * FUNCTION
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1752 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1753 * TCT_Unprotect_Specific
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1754 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1755 * DESCRIPTION
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1756 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1757 * This function releases a specific protection structure.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1758 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1759 * CALLED BY
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1760 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1761 * Application
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1762 * System Components
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1763 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1764 * CALLS
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1765 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1766 * None
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1767 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1768 * INPUTS
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1769 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1770 * protect Pointer to protection block
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1771 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1772 * OUTPUTS
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1773 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1774 * None
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1775 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1776 * HISTORY
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1777 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1778 * NAME DATE REMARKS
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1779 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1780 * W. Lamie 02-15-1994 Created initial version 1.0
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1781 * D. Lamie 02-15-1994 Verified version 1.0
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1782 * C. Meredith 03-01-1994 Corrected problem in time-slice
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1783 * reset logic, corrected bug
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1784 * using protect ptr, resulting
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1785 * in version 1.1
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1786 * D. Lamie 03-18-1994 Verified version 1.1
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1787 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1788 ************************************************************************
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1789 */
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1790
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1791 @VOID Specific(TC_PROTECT *protect)
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1792 @{
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1793
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1794 .globl TCT_Unprotect_Specific
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1795 TCT_Unprotect_Specific:
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1796
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1797 @ Determine if the caller is in a task or HISR thread.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1798 @ if (TCD_Current_Thread)
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1799 @ {
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1800
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1801 LDR r1,Current_Thread @ Pickup current thread ptr address
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1802 LDR r3,[r1, #0] @ Pickup current thread pointer
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1803 CMP r3,#0 @ Check to see if it is non-NULL
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1804 BEQ TCT_Skip_Unprot_Spec @ If NULL, skip unprotect specific
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1805
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1806 @ Lockout interrupts.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1807
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1808 MRS r1,CPSR @ Pickup current CPSR
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1809 ORR r1,r1,#LOCKOUT @ Place lockout value in
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1810 MSR CPSR,r1 @ Lockout interrupts
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1811
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1812 @ Clear the protection pointer.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1813 @ protect -> tc_tcb_pointer = NU_NULL;
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1814
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1815 MOV r2,#0 @ Build NU_NULL value
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1816 STR r2,[r0, #0] @ Clear protection ownership
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1817
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1818 @ Determine if a thread is waiting.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1819 @ if (protect -> tc_thread_waiting)
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1820 @ {
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1821
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1822 LDR r1,[r0, #4] @ Pickup the waiting field
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1823 CMP r1,#0 @ Is there another thread waiting?
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1824 BEQ TCT_Not_Waiting_Unspec @ No, restore interrupts and return
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1825
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1826 @ A higher-priority thread is waiting.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1827
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1828 @ Save a minimal context of the thread.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1829
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1830 STMDB r13!,{r4-r12,r14} @ Save minimal context of thread on
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1831 @ the current stack
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1832
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1833 #if 1 /* was .if THUMB */
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1834 MOV r2,r14 @ Determine what state the caller
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1835 MOV r2,r2,LSL #31 @ was in and build an
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1836 MOV r2,r2,LSR #26 @ appropriate state mask
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1837 STR r2,[r13, #-4]! @ Place it on the stack
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1838 #endif
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1839
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1840 MOV r2,#0 @ Build solicited stack type value
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1841 @ and NU_NULL value
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1842 STR r2,[r13, #-4]! @ Place it on the top of the stack
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1843
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1844 @ Setup a pointer to the thread control block.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1845 @ REG_Thread_Ptr = (TC_TCB *) TCD_Current_Thread;
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1846
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1847 LDR r1,Current_Thread @ Pickup current thread ptr address
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1848 LDR r0,[r1, #0] @ Pickup current thread pointer
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1849
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1850 @ Clear the current thread control block pointer.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1851 @ TCD_Current_Thread = NU_NULL;
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1852
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1853 LDR r3,Slice_State @ Pickup time slice state address
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1854 STR r2,[r1, #0] @ Set current thread pointer to
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1855 @ NU_NULL
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1856
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1857 @ Check to see if a time slice is active. If so, copy the
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1858 @ original time slice into the current time slice field of the
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1859 @ thread's control block.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1860 @ if (TMD_Time_Slice_State == 0)
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1861 @ {
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1862
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1863 LDR r1,[r3, #0] @ Pickup time slice state flag
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1864 CMP r1,#0 @ Compare with active value
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1865 BNE TCT_No_Stop_TS_3 @ If non-active, don't disable
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1866
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1867 @ Insure that the next time the task runs it gets a fresh time
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1868 @ slice.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1869 @ REG_Thread_Ptr -> tc_cur_time_slice =
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1870 @ REG_Thread_Ptr -> tc_time_slice;
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1871
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1872 LDR r1,[r0, #0x40] @ Pickup original time slice
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1873
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1874 @ Clear any active time slice by setting the state to
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1875 @ NOT_ACTIVE.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1876 @ TMD_Time_Slice_State = 1;
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1877
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1878 MOV r2,#1 @ Build disable value
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1879 STR r2,[r3, #0] @ Disable time slice
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1880 STR r1,[r0, #0x20] @ Reset current time slice
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1881 @ }
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1882
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1883 TCT_No_Stop_TS_3:
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1884
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1885 @ Save off the current stack pointer in the control block.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1886 @ REG_Thread_Ptr -> tc_stack_pointer = (VOID *) REG_Stack_Ptr;
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1887
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1888 STR r13,[r0, #0x2c] @ Save the thread's stack pointer
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1889
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1890 @ Switch to the system stack.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1891 @ REG_Stack_Ptr = TCD_System_Stack;
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1892
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1893 LDR r1,System_Stack @ Pickup address of stack pointer
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1894 LDR r2,System_Limit @ Pickup address of stack limit ptr
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1895 LDR r13,[r1, #0] @ Switch to system stack
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1896 LDR r10,[r2, #0] @ Setup system stack limit
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1897
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1898 @ Finished, return to the scheduling loop.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1899
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1900 B TCT_Schedule @ Return to scheduling loop
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1901
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1902 @ }
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1903 @ else
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1904 @ {
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1905 TCT_Not_Waiting_Unspec:
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1906
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1907 @ No higher-priority thread is waiting.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1908
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1909 @ Restore interrupts.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1910
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1911 LDR r2,Int_Level @ Pickup address of interrupt level
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1912 MRS r1,CPSR @ Pickup current CPSR
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1913 LDR r3,[r2, #0] @ Pickup interrupt lockout level
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1914 BIC r1,r1,#LOCK_MSK @ Clear lockout bits
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1915 ORR r1,r1,r3 @ Build new interrupt lockout
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1916 MSR CPSR,r1 @ Setup CPSR appropriately
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1917
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1918 @ }
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1919 @ }
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1920
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1921 TCT_Skip_Unprot_Spec:
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1922
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1923 BX r14 @ Return to caller
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1924
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1925 @}
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1926
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1927 /*
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1928 ************************************************************************
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1929 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1930 * FUNCTION
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1931 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1932 * TCT_Set_Current_Protect
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1933 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1934 * DESCRIPTION
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1935 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1936 * This function sets the current protection field of the current
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1937 * thread's control block to the specified protection pointer.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1938 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1939 * CALLED BY
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1940 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1941 * TCC_Resume_Task Resume task function
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1942 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1943 * CALLS
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1944 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1945 * None
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1946 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1947 * INPUTS
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1948 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1949 * protect Pointer to protection block
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1950 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1951 * OUTPUTS
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1952 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1953 * None
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1954 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1955 * HISTORY
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1956 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1957 * NAME DATE REMARKS
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1958 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1959 * W. Lamie 02-15-1994 Created initial version 1.0
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1960 * D. Lamie 02-15-1994 Verified version 1.0
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1961 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1962 ************************************************************************
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1963 */
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1964
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1965 @VOID TCT_Set_Current_Protect(TC_PROTECT *protect)
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1966 @{
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1967
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1968 .globl TCT_Set_Current_Protect
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1969 TCT_Set_Current_Protect:
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1970
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1971 @ Determine if the caller is in a task or HISR thread.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1972 @ if (TCD_Current_Thread)
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1973 @ {
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1974
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1975 LDR r1,Current_Thread @ Pickup current thread ptr address
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1976 LDR r3,[r1, #0] @ Pickup current thread pointer
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1977 CMP r3,#0 @ Check to see if a thread is
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1978 @ active
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1979
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1980 @ Point at the current thread control block.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1981 @ REG_Thread_Ptr = (TC_TCB *) TCD_Current_Thread;
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1982
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1983 @ Modify the current protection.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1984 @ REG_Thread_Ptr -> tc_current_protect = protect;
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1985
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1986 STRNE r0,[r3, #0x38] @ Setup new protection
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1987 @ }
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1988
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1989
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1990 BX r14 @ Return to caller
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1991
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1992 @}
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1993
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1994 /*
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1995 ************************************************************************
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1996 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1997 * FUNCTION
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1998 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1999 * TCT_Protect_Switch
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2000 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2001 * DESCRIPTION
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2002 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2003 * This function waits until a specific task no longer has any
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2004 * protection associated with it. This is necessary since task's
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2005 * cannot be suspended or terminated unless they have released all
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2006 * of their protection.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2007 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2008 * CALLED BY
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2009 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2010 * System Components
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2011 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2012 * CALLS
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2013 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2014 * None
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2015 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2016 * INPUTS
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2017 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2018 * thread Pointer to thread control blk
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2019 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2020 * OUTPUTS
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2021 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2022 * None
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2023 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2024 * HISTORY
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2025 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2026 * NAME DATE REMARKS
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2027 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2028 * W. Lamie 02-15-1994 Created initial version 1.0
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2029 * D. Lamie 02-15-1994 Verified version 1.0
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2030 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2031 ************************************************************************
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2032 */
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2033
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2034 @VOID TCT_Protect_Switch(VOID *thread)
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2035 @{
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2036
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2037 .globl TCT_Protect_Switch
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2038 TCT_Protect_Switch:
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2039
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2040 @ Lockout interrupts.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2041
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2042 MRS r1,CPSR @ Pickup current CPSR
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2043 ORR r1,r1,#LOCKOUT @ Place lockout value in
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2044 MSR CPSR,r1 @ Lockout interrupts
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2045
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2046 @ REG_Thread_Ptr = (TC_TCB *) thread;
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2047
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2048 @ Wait until the specified task has no protection associated with it.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2049 @ while (REG_Thread_Ptr -> tc_current_protect)
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2050 @ {
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2051
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2052 LDR r1,[r0, #0x38] @ Pickup protection of specified
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2053 @ thread
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2054 CMP r1,#0 @ Does the specified thread have
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2055 @ an active protection?
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2056 BEQ TCT_Switch_Done @ If not, protect switch is done
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2057
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2058 @ Let the task run again in an attempt to clear its protection.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2059
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2060 @ Indicate that a higher priority thread is waiting.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2061 @ (REG_Thread_Ptr -> tc_current_protect) -> tc_thread_waiting = 1;
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2062
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2063 MOV r2,#1 @ Build waiting flag value
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2064 STR r2,[r1, #4] @ Set waiting flag of the
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2065 @ protection owned by the other
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2066 @ thread
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2067
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2068 @ Directly schedule the thread waiting.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2069 @ TCT_Schedule_Protected((REG_Thread_Ptr -> tc_current_protect)
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2070 @ -> tc_tcb_pointer);
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2071
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2072 LDR r2,Current_Thread @ Pickup current thread ptr address
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2073 STR r0,[r13, #-4]! @ Save r0 on the stack
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2074 STR r14,[r13, #-4]! @ Save r14 on the stack
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2075 MOV r1,r0 @ Move new thread into r1
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2076 LDR r0,[r2, #0] @ Pickup current thread pointer
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2077 BL TCT_Schedule_Protected @ Call routine to schedule the
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2078 @ owner of the thread
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2079
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2080 LDR r14,[r13], #4 @ Recover saved r14
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2081 LDR r0,[r13], #4 @ Recover saved r0
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2082
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2083 @ Lockout interrupts.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2084
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2085 B TCT_Protect_Switch @ Branch to top of routine and
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2086 @ start over
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2087 @ }
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2088 TCT_Switch_Done:
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2089
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2090 @ Restore interrupts.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2091
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2092 LDR r2,Int_Level @ Pickup address of interrupt level
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2093 MRS r1,CPSR @ Pickup current CPSR
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2094 LDR r3,[r2, #0] @ Pickup interrupt lockout level
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2095 BIC r1,r1,#LOCK_MSK @ Clear lockout bits
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2096 ORR r1,r1,r3 @ Build new interrupt lockout
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2097 MSR CPSR,r1 @ Setup CPSR appropriately
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2098
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2099
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2100 BX r14 @ Return to caller
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2101
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2102 @}
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2103
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2104 /*
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2105 ************************************************************************
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2106 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2107 * FUNCTION
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2108 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2109 * TCT_Schedule_Protected
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2110 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2111 * DESCRIPTION
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2112 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2113 * This function saves the minimal context of the thread and then
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2114 * directly schedules the thread that has protection over the
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2115 * the thread that called this routine.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2116 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2117 * CALLED BY
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2118 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2119 * TCT_Protect
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2120 * TCT_Protect_Switch
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2121 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2122 * CALLS
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2123 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2124 * TCT_Control_To_Thread Transfer control to protected
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2125 * thread
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2126 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2127 * INPUTS
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2128 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2129 * None
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2130 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2131 * OUTPUTS
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2132 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2133 * None
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2134 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2135 * HISTORY
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2136 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2137 * NAME DATE REMARKS
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2138 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2139 * W. Lamie 02-15-1994 Created initial version 1.0
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2140 * D. Lamie 02-15-1994 Verified version 1.0
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2141 * C. Meredith 03-01-1994 Corrected problem in time-slice
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2142 * reset logic, resulting in
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2143 * version 1.1
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2144 * D. Lamie 03-18-1994 Verified version 1.1
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2145 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2146 ************************************************************************
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2147 */
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2148
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2149 @VOID TCT_Schedule_Protected(VOID *thread)
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2150 @{
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2151
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2152 .globl TCT_Schedule_Protected
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2153 TCT_Schedule_Protected:
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2154
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2155 @ Interrupts are already locked out by the caller.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2156
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2157 @ Save minimal context required by the system.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2158
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2159 STMDB r13!,{r4-r12,r14} @ Save minimal context of thread on
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2160 @ the current stack
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2161
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2162 #if 1 /* was .if THUMB */
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2163 MOV r2,r14 @ Determine what state the caller
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2164 MOV r2,r2,LSL #31 @ was in and build an
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2165 MOV r2,r2,LSR #26 @ appropriate state mask
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2166 STR r2,[r13, #-4]! @ Place it on the stack
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2167 #endif
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2168
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2169 MOV r2,#0 @ Build solicited stack type value
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2170 @ and NU_NULL value
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2171 STR r2,[r13, #-4]! @ Place it on the top of the stack
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2172 MOV r4,r1 @ Save thread to schedule
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2173
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2174 @ Setup a pointer to the thread control block.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2175 @ REG_Thread_Ptr = (TC_TCB *) TCD_Current_Thread;
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2176
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2177 LDR r1,Current_Thread @ Pickup current thread ptr address
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2178
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2179 @ Clear the current thread control block.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2180 @ TCD_Current_Thread = NU_NULL;
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2181
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2182 LDR r3,Slice_State @ Pickup time slice state address
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2183 STR r2,[r1, #0] @ Set current thread pointer to
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2184 @ NU_NULL
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2185
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2186 @ Check to see if a time slice is active. If so, copy the original time
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2187 @ slice into the current time slice field of the task's control block.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2188 @ if (TMD_Time_Slice_State == 0)
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2189 @ {
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2190
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2191 LDR r1,[r3, #0] @ Pickup time slice state flag
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2192 CMP r1,#0 @ Compare with active value
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2193 BNE TCT_No_Stop_TS_4 @ If non-active, don't disable
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2194
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2195 @ Insure that the next time the task runs it gets a fresh time
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2196 @ slice.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2197 @ REG_Thread_Ptr -> tc_cur_time_slice = REG_Thread_Ptr -> tc_time_slice;
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2198
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2199 LDR r1,[r0, #0x40] @ Pickup original time slice
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2200
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2201 @ Clear any active time slice by setting the state to NOT_ACTIVE.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2202 @ TMD_Time_Slice_State = 1;
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2203
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2204 MOV r2,#1 @ Build disable value
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2205 STR r2,[r3, #0] @ Disable time slice
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2206 STR r1,[r0, #0x20] @ Reset current time slice
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2207
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2208 @ }
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2209 TCT_No_Stop_TS_4:
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2210
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2211 @ Save off the current stack pointer in the control block.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2212 @ REG_Thread_Ptr -> tc_stack_pointer = (VOID *) REG_Stack_Ptr;
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2213
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2214 STR r13,[r0, #0x2c] @ Save the thread's stack pointer
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2215
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2216 @ Switch to the system stack.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2217 @ TCD_System_Stack = (VOID *) REG_Stack_Ptr;
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2218
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2219 LDR r1,System_Stack @ Pickup address of stack pointer
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2220 LDR r2,System_Limit @ Pickup address of stack limit ptr
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2221 LDR r13,[r1, #0] @ Switch to system stack
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2222 LDR r10,[r2, #0] @ Setup system stack limit
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2223
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2224 @ Transfer control to the specified thread directly.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2225 @ TCT_Control_To_Thread(thread);
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2226
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2227 LDR r2,Int_Level @ Pickup address of interrupt level
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2228 MRS r1,CPSR @ Pickup current CPSR
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2229 LDR r3,[r2, #0] @ Pickup interrupt lockout level
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2230 BIC r1,r1,#LOCK_MSK @ Clear lockout bits
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2231 ORR r1,r1,r3 @ Build new interrupt lockout
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2232 MOV r0,r4 @ Indicate thread to schedule
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2233 MSR CPSR,r1 @ Setup CPSR appropriately
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2234 ORR r1,r1,#LOCKOUT @ Build lockout value again
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2235 MSR CPSR,r1 @ Lockout interrupts again
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2236 B TCT_Control_To_Thread @ Schedule the thread indirectly
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2237 @}
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2238
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2239 /*
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2240 ************************************************************************
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2241 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2242 * FUNCTION
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2243 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2244 * TCT_Interrupt_Context_Save
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2245 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2246 * DESCRIPTION
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2247 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2248 * This function saves the interrupted thread's context. Nested
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2249 * interrupts are also supported. If a task or HISR thread was
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2250 * interrupted, the stack pointer is switched to the system stack
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2251 * after the context is saved.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2252 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2253 * CALLED BY
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2254 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2255 * Application ISRs Assembly language ISRs
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2256 * INT_Interrupt_Shell Interrupt handler shell
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2257 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2258 * CALLS
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2259 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2260 * None
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2261 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2262 * INPUTS
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2263 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2264 * vector Interrupt's vector number
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2265 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2266 * OUTPUTS
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2267 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2268 * None
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2269 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2270 * HISTORY
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2271 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2272 * NAME DATE REMARKS
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2273 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2274 * W. Lamie 02-15-1994 Created initial version 1.0
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2275 * D. Lamie 02-15-1994 Verified version 1.0
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2276 * D. Driscoll 01-04-2002 Released version 1.13.3.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2277 * Updated to handle nested /
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2278 * prioritized IRQs
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2279 ************************************************************************
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2280 */
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2281
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2282 @VOID TCT_Interrupt_Context_Save(INT vector)
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2283 @{
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2284
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2285 .globl TCT_Interrupt_Context_Save
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2286 TCT_Interrupt_Context_Save:
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2287 @ Determine if this is a nested interrupt.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2288 LDR r1,Int_Count @ Pickup address of interrupt count
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2289 LDR r2,[r1, #0] @ Pickup interrupt counter
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2290 ADD r2,r2,#1 @ Add 1 to interrupt counter
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2291 STR r2,[r1, #0] @ Store new interrupt counter value
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2292 CMP r2,#1 @ Is it nested?
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2293 BEQ TCT_Not_Nested_Save @ No
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2294
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2295 @ Nested interrupt. Save complete context on the current stack.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2296 TCT_Nested_Save:
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2297
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2298 /* No longer needed in the FreeCalypso version, as we can use r0 instead. */
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2299 #if 0
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2300 @ 1. Save another register on the exception stack so we have enough to work with
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2301 STMDB r13!,{r5}
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2302 #endif
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2303
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2304 @ 2. Save the necessary exception registers into r1-r3
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2305 MOV r1,r13 @ Put the exception r13 into r1
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2306 MOV r2,r14 @ Move the return address for the caller
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2307 @ of this function into r2
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2308 MRS r3,spsr @ Put the exception spsr into r3
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2309
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2310 @ 3. Adjust the exception stack pointer for future exceptions
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2311 ADD r13,r13,#20 @ r13 reset to pre-interrupt value
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2312
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2313 @ 4. Switch CPU modes to save context on system stack
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2314 MRS r0,CPSR @ Pickup the current CPSR
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2315 BIC r0,r0,#MODE_MASK @ Clear the mode bits
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2316
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2317 ORR r0,r0,#SUP_MODE @ Change to supervisor mode (SVD)
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2318
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2319 MSR CPSR,r0 @ Switch modes (IRQ->SVC)
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2320
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2321 @ 5. Store the SVC r13 into r5 so the r13 can be saved as is.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2322 @ FreeCalyspo: using r0 instead
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2323 MOV r0,r13
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2324
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2325 @ 6. Save the exception return address on the stack (r15).
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2326 STMDB r0!,{r4}
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2327
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2328 @ 7. Save r5-r14 on stack (used to be r6-r14)
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2329 STMDB r0!,{r5-r14}
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2330
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2331 @ 8. Switch back to using r13 now that the original r13 has been saved.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2332 MOV r13,r0
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2333
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2334 /* no longer relevant */
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2335 #if 0
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2336 @ 9. Get r5 and exception enable registers off of exception stack and
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2337 @ save r5 (stored in r4) back to the system stack.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2338 LDMIA r1!,{r4-r5}
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2339 STMDB r13!,{r4}
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2340 MOV r4,r5 @ Put exception enable value into r4
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2341 #endif
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2342
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2343 @ 10. Get the rest of the registers off the exception stack and
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2344 @ save them onto the system stack.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2345 LDMIA r1!,{r5-r8,r11} @ Get r0-r4 off exception stack
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2346 STMDB r13!,{r5-r8,r11} @ Put r0-r4 on system stack
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2347
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2348 /* no longer relevant */
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2349 #if 0
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2350 @ 11. Store the exception enable value back on the exception stack.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2351 STMDB r1,{r4}
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2352 #endif
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2353
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2354 @ 12. Save the SPSR on the system stack (CPSR)
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2355 STMDB r13!,{r3}
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2356
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2357 /* TI's approach to interrupt handling does not support re-enabling here */
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2358 #if 0
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2359 @ 13. Re-enable interrupts
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2360 MRS r1,CPSR
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2361 BIC r1,r1,#(IRQ_BIT_OR_FIQ_BIT)
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2362 MSR CPSR,r1
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2363 #endif
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2364
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2365 BX r2 @ Return to calling ISR
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2366 @ }
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2367 @ else
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2368 @ {
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2369 TCT_Not_Nested_Save:
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2370
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2371 @ Determine if a thread was interrupted.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2372 @ if (TCD_Current_Thread)
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2373 @ {
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2374
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2375 LDR r1,Current_Thread @ Pickup current thread ptr address
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2376 LDR r1,[r1, #0] @ Pickup the current thread pointer
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2377 CMP r1,#0 @ Is it NU_NULL?
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2378 BEQ TCT_Idle_Context_Save @ If no, no real save is necessary
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2379
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2380
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2381 @ Yes, a thread was interrupted. Save complete context on the
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2382 @ thread's stack.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2383
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2384 /* No longer needed in the FreeCalypso version, as we can use r0 instead. */
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2385 #if 0
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2386 @ 1. Save another register on the exception stack so we have enough to work with
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2387 STMDB r13!,{r5}
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2388 #endif
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2389
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2390 @ 2. Save the necessary exception registers into r1-r3
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2391 MOV r1,r13 @ Put the exception r13 into r1
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2392 MOV r2,r14 @ Move the return address for the caller
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2393 @ of this function into r2
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2394 MRS r3,spsr @ Put the exception spsr into r3
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2395
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2396 @ 3. Adjust the exception stack pointer for future exceptions
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2397 ADD r13,r13,#20 @ r13 reset to pre-interrupt value
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2398
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2399 @ 4. Switch CPU modes to save context on system stack
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2400 MRS r0,CPSR @ Pickup the current CPSR
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2401 BIC r0,r0,#MODE_MASK @ Clear the mode bits
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2402
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2403 ORR r0,r0,#SUP_MODE @ Change to supervisor mode (SVD)
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2404
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2405 MSR CPSR,r0 @ Switch modes (IRQ->SVC)
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2406
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2407 @ 5. Store the SVC r13 into r5 so the r13 can be saved as is.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2408 @ FreeCalyspo: using r0 instead
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2409 MOV r0,r13
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2410
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2411 @ 6. Save the exception return address on the stack (r15).
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2412 STMDB r0!,{r4}
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2413
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2414 @ 7. Save r5-r14 on stack (used to be r6-r14)
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2415 STMDB r0!,{r5-r14}
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2416
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2417 @ 8. Switch back to using r13 now that the original r13 has been saved.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2418 MOV r13,r0
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2419
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2420 /* no longer relevant */
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2421 #if 0
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2422 @ 9. Get r5 and exception enable registers off of exception stack and
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2423 @ save r5 (stored in r4) back to the system stack.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2424 LDMIA r1!,{r4-r5}
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2425 STMDB r13!,{r4}
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2426 MOV r4,r5 @ Put exception enable value into r4
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2427 #endif
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2428
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2429 @ 10. Get the rest of the registers off the exception stack and
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2430 @ save them onto the system stack.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2431 LDMIA r1!,{r5-r8,r11} @ Get r0-r4 off exception stack
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2432 STMDB r13!,{r5-r8,r11} @ Put r0-r4 on system stack
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2433
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2434 /* no longer relevant */
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2435 #if 0
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2436 @ 11. Store the exception enable value back on the exception stack.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2437 STMDB r1,{r4}
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2438 #endif
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2439
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2440 @ 12. Save the SPSR on the system stack (CPSR)
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2441 STMDB r13!,{r3}
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2442
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2443 @ 13. Save stack type to the task stack (1=interrupt stack)
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2444 MOV r1,#1 @ Interrupt stack type
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2445 STMDB r13!,{r1}
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2446
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2447 @ Save the thread's stack pointer in the control block.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2448 @ REG_Thread_Ptr = (TC_TCB *) TCD_Current_Thread
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2449 @ REG_Thread_Ptr -> tc_stack_pointer = (VOID *) REG_Stack_Ptr
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2450
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2451 LDR r1,Current_Thread @ Pickup current thread ptr address
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2452 LDR r3,[r1, #0] @ Pickup current thread pointer
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2453 STR r13,[r3, #TC_STACK_POINTER] @ Save stack pointer
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2454
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2455 @ Switch to the system stack.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2456 @ REG_Stack_Ptr = TCD_System_Stack
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2457
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2458 LDR r1,System_Stack @ Pickup address of stack pointer
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2459 LDR r3,System_Limit @ Pickup address of stack limit ptr
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2460 LDR r13,[r1, #0] @ Switch to system stack
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2461 LDR r10,[r3, #0] @ Setup system stack limit
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2462
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2463 /* TI's approach to interrupt handling does not support re-enabling here */
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2464 #if 0
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2465 @ Re-enable interrupts
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2466 MRS r1,CPSR
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2467 BIC r1,r1,#(IRQ_BIT_OR_FIQ_BIT)
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2468 MSR CPSR,r1
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2469 #endif
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2470
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2471 @ Return to caller ISR.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2472
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2473 BX r2 @ Return to caller ISR
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2474
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2475 @ }
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2476
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2477 TCT_Idle_Context_Save:
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2478
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2479 MOV r2,r14 @ Save r14 in r2
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2480 @ LDR r3,[r13] @ Get exception enable value from stack
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2481 ADD r13,r13,#20 @ Adjust exception r13 for future interrupts
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2482 @ STR r3,[r13] @ Put exception enable value back on stack
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2483
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2484 MRS r1,CPSR @ Pickup current CPSR
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2485 BIC r1,r1,#MODE_MASK @ Clear the current mode
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2486 @ BIC r1,r1,#(IRQ_BIT_OR_FIQ_BIT) @ Re-enable interrupts
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2487
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2488 ORR r1,r1,#SUP_MODE @ Prepare to switch to supervisor
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2489 @ mode (SVC)
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2490 MSR CPSR,r1 @ Switch to supervisor mode (SVC)
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2491
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2492 BX r2 @ Return to caller ISR
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2493
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2494 @ }
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2495 @}
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2496
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2497 /*
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2498 ************************************************************************
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2499 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2500 * FUNCTION
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2501 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2502 * TCT_Interrupt_Context_Restore
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2503 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2504 * DESCRIPTION
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2505 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2506 * This function restores the interrupt context if a nested
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2507 * interrupt condition is present. Otherwise, this routine
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2508 * transfers control to the scheduling function.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2509 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2510 * CALLED BY
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2511 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2512 * Application ISRs Assembly language ISRs
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2513 * INT_Interrupt_Shell Interrupt handler shell
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2514 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2515 * CALLS
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2516 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2517 * TCT_Schedule Thread scheduling function
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2518 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2519 * INPUTS
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2520 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2521 * None
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2522 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2523 * OUTPUTS
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2524 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2525 * None
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2526 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2527 * HISTORY
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2528 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2529 * NAME DATE REMARKS
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2530 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2531 * W. Lamie 02-15-1994 Created initial version 1.0
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2532 * D. Lamie 02-15-1994 Verified version 1.0
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2533 * D. Driscoll 01-04-2002 Released version 1.13.3.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2534 * Updated to handle nested /
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2535 * prioritized IRQs
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2536 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2537 ************************************************************************
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2538 */
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2539
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2540 @VOID TCT_Interrupt_Context_Restore(void)
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2541 @{
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2542
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2543 .globl TCT_Interrupt_Context_Restore
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2544 TCT_Interrupt_Context_Restore:
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2545 @ It is assumed that anything pushed on the stack by ISRs has been
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2546 @ removed upon entry into this routine.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2547
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2548 @ Decrement and check for nested interrupt conditions.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2549 @ if (--TCD_Interrupt_Count)
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2550 @ {
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2551
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2552 LDR r1,Int_Count @ Pickup address of interrupt count
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2553 LDR r2,[r1, #0] @ Pickup interrupt counter
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2554 SUB r2,r2,#1 @ Decrement interrupt counter
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2555 STR r2,[r1, #0] @ Store interrupt counter
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2556 CMP r2,#0
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2557 BEQ TCT_Not_Nested_Restore
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2558
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2559 @ Restore previous context.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2560
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2561 LDR r1,[r13], #4 @ Pickup the saved CPSR
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2562
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2563 MSR SPSR,r1 @ Place into saved SPSR
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2564 LDMIA r13,{r0-r15}^ @ Return to the point of interrupt
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2565
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2566 @ }
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2567 @ else
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2568 @ {
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2569
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2570 TCT_Not_Nested_Restore:
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2571
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2572 @ Determine if a thread is active.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2573 @ if (TCD_Current_Thread)
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2574 @ {
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2575
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2576 LDR r1,Current_Thread @ Pickup current thread ptr address
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2577 LDR r0,[r1, #0] @ Pickup current thread pointer
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2578 CMP r0,#0 @ Determine if a thread is active
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2579 BEQ TCT_Idle_Context_Restore @ If not, idle system restore
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2580
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2581 @ Clear the current thread pointer.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2582 @ TCD_Current_Thread = NU_NULL
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2583
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2584 MOV r2,#0 @ Build NU_NULL value
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2585 STR r2,[r1, #0] @ Set current thread ptr to NU_NULL
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2586
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2587 @ Determine if a time slice is active. If so, the remaining
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2588 @ time left on the time slice must be saved in the task's
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2589 @ control block.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2590 @ if (TMD_Time_Slice_State == 0)
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2591 @ {
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2592
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2593 LDR r3,Slice_State @ Pickup time slice state address
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2594 LDR r1,[r3, #0] @ Pickup time slice state
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2595 CMP r1,#0 @ Determine if time slice active
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2596 BNE TCT_Idle_Context_Restore @ If not, skip time slice reset
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2597
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2598 @ Pickup the remaining portion of the time slice and save it
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2599 @ in the task's control block.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2600 @ REG_Thread_Ptr -> tc_cur_time_slice = TMD_Time_Slice
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2601 @ TMD_Time_Slice_State = 1
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2602
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2603 LDR r2,Time_Slice @ Pickup address of time slice left
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2604 MOV r1,#1 @ Build disable time slice value
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2605 LDR r2,[r2, #0] @ Pickup remaining time slice
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2606 STR r1,[r3, #0] @ Disable time slice
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2607 STR r2,[r0, #TC_CUR_TIME_SLICE] @ Store remaining time slice
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2608
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2609 @ }
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2610 @ }
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2611 TCT_Idle_Context_Restore:
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2612
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2613 @ Reset the system stack pointer.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2614 LDR r1,System_Stack @ Pickup address of stack pointer
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2615 LDR r2,System_Limit @ Pickup address of stack limit ptr
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2616 LDR r13,[r1, #0] @ Switch to system stack
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2617 LDR r10,[r2, #0] @ Setup system stack limit
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2618
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2619 @ Return to scheduler.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2620
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2621 B TCT_Schedule @ Return to scheduling loop
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2622
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2623 @ }
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2624 @}
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2625
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2626 /*
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2627 ************************************************************************
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2628 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2629 * FUNCTION
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2630 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2631 * TCT_Activate_HISR
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2632 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2633 * DESCRIPTION
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2634 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2635 * This function activates the specified HISR. If the HISR is
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2636 * already activated, the HISR's activation count is simply
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2637 * incremented. Otherwise, the HISR is placed on the appropriate
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2638 * HISR priority list in preparation for execution.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2639 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2640 * CALLED BY
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2641 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2642 * Application LISRs
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2643 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2644 * CALLS
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2645 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2646 * None
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2647 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2648 * INPUTS
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2649 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2650 * hisr Pointer to HISR to activate
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2651 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2652 * OUTPUTS
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2653 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2654 * NU_SUCCESS Successful completion
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2655 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2656 * HISTORY
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2657 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2658 * NAME DATE REMARKS
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2659 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2660 * W. Lamie 02-15-1994 Created initial version 1.0
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2661 * D. Lamie 02-15-1994 Verified version 1.0
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2662 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2663 ************************************************************************
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2664 */
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2665
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2666 @STATUS TCT_Activate_HISR(TC_HCB *hisr)
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2667 @{
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2668
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2669 .globl TCT_Activate_HISR
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2670 TCT_Activate_HISR:
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2671
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2672 @INT priority;
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2673
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2674
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2675 @ Lockout interrupts.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2676
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2677 STR r4,[r13, #-4]! @ Save r4
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2678 MRS r4,CPSR @ Pickup current CPSR
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2679 ORR r1,r4,#LOCKOUT @ Build interrupt lockout value
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2680 MSR CPSR,r1 @ Lockout interrupts
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2681
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2682 @ Determine if the HISR is already active.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2683 @ if (hisr -> tc_activation_count)
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2684 @ {
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2685
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2686 LDR r1,[r0,#0x40] @ Pickup current activation count
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2687 CMP r1,#0 @ Is it the first activation?
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2688 BEQ TCT_First_Activate @ Yes, place it on the correct list
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2689
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2690 @ Increment the activation count. Make sure that it does not go
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2691 @ to zero.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2692 @ hisr -> tc_activation_count++;
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2693
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2694 ADDS r1,r1,#1 @ Increment the activation count
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2695 STR r1,[r0,#0x40] @ Store new activation count
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2696
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2697 @ if (hisr -> tc_activation_count == 0)
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2698
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2699 @ hisr -> tc_activation_count = 0xFFFFFFFFUL;
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2700
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2701 MVNEQ r1,#0 @ If counter rolled-over reset
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2702 STREQ r1,[r0,#0x40] @ Store all ones count
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2703 B TCT_Activate_Done @ Finished with activation
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2704 @ }
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2705 @ else
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2706 @ {
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2707 TCT_First_Activate:
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2708
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2709
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2710 @ Set the activation count to 1.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2711 @ hisr -> tc_activation_count = 1;
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2712
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2713 MOV r1,#1 @ Initial activation count
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2714 STR r1,[r0,#0x40] @ Store initial activation count
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2715
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2716 @ Pickup the HISR's priority.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2717 @ priority = hisr -> tc_priority;
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2718
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2719 @ Determine if there is something in the given priority list.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2720 @ if (TCD_Active_HISR_Tails[priority])
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2721 @ {
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2722
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2723 LDRB r1,[r0,#0x1a] @ Pickup priority of HISR
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2724 LDR r2,HISR_Tails @ Pickup tail pointer base
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2725 LDR r3,[r2,r1,LSL #2] @ Pickup tail pointer for priority
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2726 CMP r3,#0 @ Is this first HISR at priority?
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2727 BEQ TCT_First_HISR @ No, append to end of HISR list
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2728
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2729 @ Something is already on this list. Add after the tail.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2730 @ (TCD_Active_HISR_Tails[priority]) -> tc_active_next = hisr;
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2731 @ TCD_Active_HISR_Tails[priority] = hisr;
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2732
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2733 STR r0,[r3,#0x3c] @ Setup the active next pointer
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2734 STR r0,[r2,r1,LSL #2] @ Setup the tail pointer
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2735 B TCT_Activate_Done @ Finished with activate processing
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2736 @ }
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2737 @ else
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2738 @ {
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2739 TCT_First_HISR:
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2740
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2741 @ Nothing is on this list.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2742 @ TCD_Active_HISR_Heads[priority] = hisr;
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2743 @ TCD_Active_HISR_Tails[priority] = hisr;
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2744
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2745 LDR r3,HISR_Heads @ Pickup address of head pointers
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2746 STR r0,[r2,r1,LSL #2] @ Set tail pointer to this HISR
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2747 STR r0,[r3,r1,LSL #2] @ Set head pointer to this HISR
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2748
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2749 @ Determine the highest priority HISR.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2750 @ if (TCD_Active_HISR_Heads[0])
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2751 @ TCD_Execute_HISR = TCD_Active_HISR_Heads[0];
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2752 @ else if (TCD_Active_HISR_Heads[1])
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2753 @ TCD_Execute_HISR = TCD_Active_HISR_Heads[1];
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2754 @ else
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2755 @ TCD_Execute_HISR = TCD_Active_HISR_Heads[2];
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2756
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2757 LDR r1,[r3,#0] @ Pickup priority 0 head pointer
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2758 LDR r0,Execute_HISR @ Build address to execute HISR ptr
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2759 CMP r1,#0 @ Is priority 0 active?
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2760 LDREQ r1,[r3,#4] @ If not, pickup priority 1 head
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2761 CMPEQ r1,#0 @ Is priority 1 active?
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2762 LDREQ r1,[r3,#8] @ Else, must be priority 2 active
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2763 STR r1,[r0,#0] @ Store which ever priority is the
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2764 @ active one
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2765 @ }
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2766 @ }
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2767 TCT_Activate_Done:
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2768
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2769 MSR CPSR,r4 @ Restore interrupt lockout
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2770 LDR r4,[r13], #4 @ Restore corrupted r4
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2771
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2772 @ return(NU_SUCCESS);
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2773
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2774 MOV r0,#0 @ Always return NU_SUCCESS
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2775
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2776 BX r14 @ Return to caller
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2777
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2778 @}
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2779
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2780 /*
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2781 ************************************************************************
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2782 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2783 * FUNCTION
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2784 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2785 * TCT_HISR_Shell
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2786 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2787 * DESCRIPTION
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2788 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2789 * This function is the execution shell of each and every HISR. If
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2790 * the HISR has completed its processing, this shell routine exits
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2791 * back to the system. Otherwise, it sequentially calls the HISR
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2792 * routine until the activation count goes to zero.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2793 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2794 * CALLED BY
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2795 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2796 * HISR Scheduling
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2797 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2798 * CALLS
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2799 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2800 * hisr -> tc_entry Actual entry function of HISR
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2801 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2802 * INPUTS
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2803 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2804 * None
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2805 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2806 * OUTPUTS
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2807 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2808 * None
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2809 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2810 * HISTORY
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2811 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2812 * NAME DATE REMARKS
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2813 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2814 * W. Lamie 02-15-1994 Created initial version 1.0
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2815 * D. Lamie 02-15-1994 Verified version 1.0
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2816 *
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2817 ************************************************************************
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2818 */
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2819
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2820 @VOID TCT_HISR_Shell(void)
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2821 @{
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2822 .globl TCT_HISR_Shell
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2823 TCT_HISR_Shell:
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2824
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2825 @ Point at the HISR.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2826 @ REG_HISR_Ptr = (TC_HCB *) TCD_Current_Thread;
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2827
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2828 LDR r0,Current_Thread @ Build address of thread pointer
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2829 LDR r5,[r0, #0] @ Pickup control block pointer
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2830
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2831 @ do
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2832 @ {
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2833 TCT_HISR_Loop:
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2834
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2835 @ Call the HISR's entry routine.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2836 @ (*(REG_HISR_Ptr -> tc_entry)) ();
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2837
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2838 /* old TMS470 code:
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2839
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2840 .if THUMB = 0
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2841
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2842 MOV r14,r15 ; Setup return value
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2843 LDR r15,[r5,#44h] ; Call HISR entry function
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2844 .else
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2845 LDR r4,[r5,#44h] ; Get HISR entry function
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2846 TST r4,#1 ; See if calling Thumb or ARM
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2847 BNE Thumbsec
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2848 MOV r14,r15 ; Setup return value
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2849 BX r4
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2850 B ARMCODE
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2851 Thumbsec:
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2852 ADD r14, r15, #1
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2853 BX r4
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2854 .state16
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2855 ThumbAfterHisr
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2856 MOV r1, r15
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2857 BX r1
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2858 .state32
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2859 .endif
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2860 */
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2861
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2862 /* new code for the GNU style of ARM/Thumb interworking */
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2863 ldr r4, [r5, #TC_HISR_ENTRY]
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2864 mov lr, pc
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2865 bx r4
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2866
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2867 @ Lockout interrupts.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2868
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2869 MRS r1,CPSR @ Pickup current CPSR
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2870 ORR r1,r1,#LOCKOUT @ Build interrupt lockout
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2871 MSR CPSR,r1 @ Lockout interrupts
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2872
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2873 @ On return, decrement the activation count and check to see if
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2874 @ it is 0. Once it reaches 0, the HISR should be made inactive.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2875 @ REG_HISR_Ptr -> tc_activation_count--;
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2876
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2877
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2878 LDR r0,[r5, #0x40] @ Pickup current activation count
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2879 SUBS r0,r0,#1 @ Subtract and set condition codes
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2880 STR r0,[r5, #0x40] @ Store new activation count
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2881 BEQ TCT_HISR_Finished @ Finished processing HISR
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2882
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2883 @ Restore interrupts.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2884
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2885 LDR r2,Int_Level @ Pickup address of interrupt level
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2886 MRS r1,CPSR @ Pickup current CPSR
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2887 LDR r3,[r2, #0] @ Pickup interrupt lockout level
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2888 BIC r1,r1,#LOCK_MSK @ Clear lockout bits
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2889 ORR r1,r1,r3 @ Build new interrupt lockout
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2890 MSR CPSR,r1 @ Setup CPSR appropriately
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2891 B TCT_HISR_Loop @ Return to HISR loop
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2892 @ }
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2893 @ while (REG_HISR_Ptr -> tc_activation_count);
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2894
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2895 TCT_HISR_Finished:
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2896
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2897 @ At this point, the HISR needs to be made inactive.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2898
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2899 @ Determine if this is the only HISR on the given priority list.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2900 @ if (REG_HISR_Ptr == TCD_Active_HISR_Tails[REG_HISR_Ptr -> tc_priority])
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2901 @ {
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2902
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2903 LDR r14,HISR_Tails @ Pickup tail pointers address
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2904 LDRB r3,[r5,#0x1a] @ Pickup priority
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2905 LDR r6,[r14,r3,LSL #2] @ Pickup this priority tail pointer
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2906 LDR r2,Execute_HISR @ Build address to execute HISR ptr
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2907 MOV r12,#0 @ Clear r12
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2908 LDR r1,HISR_Heads @ Pickup head pointers address
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2909 CMP r6,r5 @ Is this priority tail the same as
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2910 @ the current HISR?
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2911 BNE TCT_More_HISRs @ If not, more HISRs at this
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2912 @ priority
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2913
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2914 @ The only HISR on the list. Clean up the list and check for the
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2915 @ highest priority HISR.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2916 @ TCD_Active_HISR_Heads[REG_HISR_Ptr -> tc_priority] = NU_NULL;
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2917 @ TCD_Active_HISR_Tails[REG_HISR_Ptr -> tc_priority] = NU_NULL;
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2918
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2919 STR r12,[r1,r3,LSL #2] @ Set head pointer to NU_NULL
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2920 STR r12,[r14,r3,LSL #2] @ Set tail pointer to NU_NULL
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2921
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2922 @ Determine the highest priority HISR.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2923 @ if (TCD_Active_HISR_Heads[0])
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2924 @ TCD_Execute_HISR = TCD_Active_HISR_Heads[0];
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2925 @ else if (TCD_Active_HISR_Heads[1])
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2926 @ TCD_Execute_HISR = TCD_Active_HISR_Heads[1];
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2927 @ else
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2928 @ TCD_Execute_HISR = TCD_Active_HISR_Heads[2];
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2929
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2930 LDR r3,[r1,#0] @ Pickup priority 0 head pointer
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2931 CMP r3,#0 @ Is there an HISR active?
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2932 LDREQ r3,[r1,#4] @ If not, pickup priority 1 pointer
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2933 CMPEQ r3,#0 @ Is there an HISR active?
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2934 LDREQ r3,[r1,#8] @ If not, pickup priority 2 pointer
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2935 STR r3,[r2,#0] @ Setup execute HISR pointer
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2936 B TCT_HISR_Exit @ Exit HISR processing
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2937 @ }
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2938 @ else
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2939 @ {
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2940
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2941 TCT_More_HISRs:
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2942
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2943 @ Move the head pointer to the next HISR in the list.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2944 @ TCD_Active_HISR_Heads[REG_HISR_Ptr -> tc_priority] =
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2945 @ REG_HISR_Ptr -> tc_active_next;
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2946
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2947 @ Also set the TCD_Execute_HISR pointer.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2948 @ TCD_Execute_HISR = REG_HISR_Ptr -> tc_active_next;
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2949
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2950 LDR r14,[r5,#0x3c] @ Pickup next HISR to activate
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2951 STR r14,[r1,r3,LSL #2] @ Setup new head pointer
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2952 STR r14,[r2, #0] @ Setup execute HISR pointer
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2953 @ }
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2954
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2955 TCT_HISR_Exit:
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2956
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2957 @ Build fake return to the top of this loop. The next time the HISR
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2958 @ is activated, it will return to the top of this function.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2959
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2960 LDR r14,HISR_Shell @ Pickup address of shell entry
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2961 STMDB r13!,{r4-r12,r14} @ Save minimal context of thread on
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2962 @ the current stack
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2963 MOV r2,#0 @ Build solicited stack type value
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2964 @ and NU_NULL value
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2965 #if 1 /* was .if THUMB */
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2966 STR r2,[r13, #-4]! @ Save state mask
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2967 #endif
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2968 STR r2,[r13, #-4]! @ Place it on the top of the stack
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2969
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2970 @ Clear the current thread control block.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2971 @ TCD_Current_Thread = NU_NULL;
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2972
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2973 LDR r1,Current_Thread @ Pickup current thread ptr address
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2974 STR r2,[r1, #0] @ Set current thread pointer to
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2975 @ NU_NULL
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2976
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2977 @ Save off the current stack pointer in the control block.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2978 @ REG_HISR_Ptr -> tc_stack_pointer = (VOID *) REG_Stack_Ptr;
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2979
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2980
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2981 STR r13,[r5, #0x2c] @ Save the thread's stack pointer
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2982
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2983
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2984 @ Switch to the system stack.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2985 @ REG_Stack_Ptr = (BYTE_PTR) TCD_System_Stack;
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2986
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2987 LDR r1,System_Stack @ Pickup address of stack pointer
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2988 LDR r2,System_Limit @ Pickup address of stack limit ptr
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2989 LDR r13,[r1, #0] @ Switch to system stack
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2990 LDR r10,[r2, #0] @ Setup system stack limit
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2991
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2992 @ Transfer control to the main scheduling loop.
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2993
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2994 B TCT_Schedule @ Return to main scheduling loop
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2995 @}
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2996
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2997 /* FreeCalypso addition, used by riviera/rvf/rvf_task.c: */
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2998 .globl INT_Check_IRQ_Mask
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2999 INT_Check_IRQ_Mask:
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
3000 MRS r0,CPSR
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
3001 BX lr
ea819b60fe0d gsm-fw/nucleus/tc[di].c: minor cleanup
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
3002