annotate gsm-fw/nucleus/debug-chases/tct.S.dbg @ 305:4dccc9d3305f

gsm-fw: checking in DAR from Leonardo source
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Sun, 16 Mar 2014 05:48:58 +0000
parents afceeeb2cba1
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
138
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1 /*
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2 ************************************************************************
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
3 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
4 * Copyright Mentor Graphics Corporation 2002
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
5 * All Rights Reserved.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
6 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
7 * THIS WORK CONTAINS TRADE SECRET AND PROPRIETARY INFORMATION WHICH IS
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
8 * THE PROPERTY OF MENTOR GRAPHICS CORPORATION OR ITS LICENSORS AND IS
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
9 * SUBJECT TO LICENSE TERMS.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
10 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
11 ************************************************************************
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
12 ************************************************************************
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
13 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
14 * FILE NAME VERSION
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
15 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
16 * tct.s Nucleus PLUS\ARM925\Code Composer 1.14.1
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
17 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
18 * COMPONENT
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
19 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
20 * TC - Thread Control
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
21 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
22 * DESCRIPTION
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
23 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
24 * This file contains the target processor dependent routines for
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
25 * performing target-dependent scheduling functions.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
26 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
27 * FUNCTIONS
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
28 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
29 * TCT_Control_Interrupts Enable / disable interrupts
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
30 * by changing
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
31 * TCD_Interrupt_Level
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
32 * TCT_Local_Control_Interrupts Enable/disable interrupts
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
33 * by not changing
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
34 * TCD_Interrupt_Level
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
35 * TCT_Restore_Interrupts Restores interrupts to the
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
36 * level in TCD_Interrupt_Level
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
37 * TCT_Build_Task_Stack Build initial task stack
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
38 * TCT_Build_HISR_Stack Build initial HISR stack
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
39 * TCT_Build_Signal_Frame Build signal handler frame
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
40 * TCT_Check_Stack Check current stack
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
41 * TCT_Schedule Schedule the next thread
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
42 * TCT_Control_To_Thread Transfer control to a thread
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
43 * TCT_Control_To_System Transfer control from thread
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
44 * TCT_Signal_Exit Exit from signal handler
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
45 * TCT_Current_Thread Returns a pointer to current
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
46 * thread
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
47 * TCT_Set_Execute_Task Sets TCD_Execute_Task under
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
48 * protection from interrupts
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
49 * TCT_Protect Protect critical section
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
50 * TCT_Unprotect Unprotect critical section
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
51 * TCT_Unprotect_Specific Release specific protection
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
52 * TCT_Set_Current_Protect Set the thread's current
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
53 * protection field
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
54 * TCT_Protect_Switch Switch to protected thread
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
55 * TCT_Schedule_Protected Schedule the protected thread
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
56 * TCT_Interrupt_Context_Save Save interrupted context
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
57 * TCT_Interrupt_Context_Restore Restore interrupted context
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
58 * TCT_Activate_HISR Activate a HISR
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
59 * TCT_HISR_Shell HISR execution shell
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
60 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
61 * DEPENDENCIES
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
62 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
63 * cs_extr.h Common Service functions
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
64 * tc_extr.h Thread Control functions
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
65 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
66 * HISTORY
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
67 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
68 * NAME DATE REMARKS
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
69 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
70 * B. Ronquillo 08-28-2002 Released version 1.14.1
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
71 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
72 ************************************************************************
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
73 */
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
74
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
75 #define NU_SOURCE_FILE
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
76
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
77 /*
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
78 ******************************
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
79 * INCLUDE ASSEMBLY CONSTANTS *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
80 ******************************
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
81 * Define constants used in low-level initialization.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
82 */
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
83
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
84 #include "asm_defs.h"
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
85
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
86 .code 32
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
87
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
88 /* TCT_System_Limit is a global variable defined in this module */
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
89
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
90 .comm TCT_System_Limit,4,4
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
91
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
92 .text
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
93
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
94 /*
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
95 **********************************
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
96 * LOCAL VARIABLE DECLARATIONS *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
97 **********************************
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
98 * Define pointers to system variables so their addresses may be obtained in a
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
99 * pc-relative manner.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
100 */
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
101
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
102 System_Limit:
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
103 .word TCT_System_Limit
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
104
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
105 Int_Level:
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
106 .word TCD_Interrupt_Level
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
107
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
108 Task_Shell:
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
109 .word TCC_Task_Shell
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
110
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
111 HISR_Shell:
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
112 .word TCT_HISR_Shell
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
113
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
114 Signal_Shell:
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
115 .word TCC_Signal_Shell
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
116
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
117 Current_Thread:
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
118 .word TCD_Current_Thread
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
119
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
120 Execute_HISR:
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
121 .word TCD_Execute_HISR
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
122
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
123 Execute_Task:
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
124 .word TCD_Execute_Task
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
125
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
126 Time_Slice:
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
127 .word TMD_Time_Slice
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
128
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
129 Slice_State:
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
130 .word TMD_Time_Slice_State
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
131
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
132 System_Stack:
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
133 .word TCD_System_Stack
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
134
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
135 Int_Count:
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
136 .word TCD_Interrupt_Count
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
137
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
138 HISR_Tails:
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
139 .word TCD_Active_HISR_Tails
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
140
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
141 HISR_Heads:
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
142 .word TCD_Active_HISR_Heads
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
143
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
144 /*
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
145 ************************************************************************
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
146 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
147 * FUNCTION
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
148 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
149 * TCT_Control_Interrupts
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
150 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
151 * DESCRIPTION
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
152 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
153 * This function enables and disables interrupts as specified by
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
154 * the caller. Interrupts disabled by this call are left disabled
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
155 * until the another call is made to enable them.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
156 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
157 * CALLED BY
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
158 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
159 * Application
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
160 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
161 * CALLS
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
162 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
163 * None
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
164 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
165 * INPUTS
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
166 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
167 * new_level New interrupt enable level
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
168 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
169 * OUTPUTS
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
170 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
171 * old_level Previous interrupt enable
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
172 * level
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
173 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
174 * HISTORY
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
175 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
176 * NAME DATE REMARKS
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
177 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
178 * W. Lamie 02-15-1994 Created initial version 1.0
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
179 * D. Lamie 02-15-1994 Verified version 1.0
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
180 * C. Meredith 03-01-1994 Lockout interrupts while setting
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
181 * up the new level, resutling in
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
182 * version 1.1
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
183 * D. Lamie 03-18-1994 Verified version 1.1
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
184 * M. Trippi 02-03-1997 Masked the return value to only
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
185 * return the interrupt bits.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
186 * (SPR0252)
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
187 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
188 ************************************************************************
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
189 */
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
190
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
191 @INT TCT_Control_Interrupts (INT new_level)
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
192 @{
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
193
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
194 .globl TCT_Control_Interrupts
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
195 TCT_Control_Interrupts:
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
196
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
197 @INT old_level; Old interrupt level
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
198
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
199 @ lock out all interrupts before any checking or changing
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
200
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
201 @ Obtain the current interrupt lockout posture.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
202 @ old_level = TCD_Interrupt_Level;
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
203
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
204 @ Setup new interrupt lockout posture.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
205 @ TCD_Interrupt_Level = new_level;
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
206
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
207 @ renable interrupts for the specified lockout
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
208
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
209 @ Return old interrupt lockout level.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
210 @ return(old_level);
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
211
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
212 MRS r2,CPSR @ Pickup current CPSR
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
213 ORR r2,r2,#LOCKOUT @ Build lockout CPSR
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
214 MSR CPSR,r2 @ Lockout interrupts temporarily
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
215 LDR r1, Int_Level @ Pickup interrupt level
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
216 LDR r3,[r1, #0] @ Pickup current interrupt lockout
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
217 BIC r2,r2,#LOCK_MSK @ Clear lockout mask
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
218 ORR r2,r2,r0 @ Build new CPSR with appropriate
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
219 @ interrupts locked out
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
220 STR r0,[r1,#0] @ Save current lockout
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
221 MSR CPSR,r2 @ Setup new CPSR lockout bits
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
222 AND r0,r3,#LOCK_MSK @ Return previous lockout (SPR0252)
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
223
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
224 BX r14 @ Return to caller
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
225
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
226 @}
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
227
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
228 /*
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
229 ************************************************************************
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
230 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
231 * FUNCTION
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
232 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
233 * TCT_Local_Control_Interrupts
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
234 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
235 * DESCRIPTION
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
236 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
237 * This function enables and disables interrupts as specified by
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
238 * the caller.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
239 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
240 * CALLED BY
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
241 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
242 * Application
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
243 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
244 * CALLS
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
245 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
246 * None
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
247 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
248 * INPUTS
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
249 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
250 * new_level New interrupt enable level
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
251 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
252 * OUTPUTS
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
253 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
254 * old_level Previous interrupt enable
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
255 * level
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
256 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
257 * HISTORY
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
258 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
259 * NAME DATE REMARKS
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
260 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
261 * C. Meredith 03-01-1994 Created initial version 1.1
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
262 * D. Lamie 03-18-1994 Verified version 1.1
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
263 * M. Trippi 02-03-1997 Masked the return value to only
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
264 * return the interrupt bits.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
265 * (SPR0252)
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
266 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
267 ************************************************************************
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
268 */
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
269
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
270 @INT TCT_Local_Control_Interrupts (INT new_level)
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
271 @{
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
272
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
273 .globl TCT_Local_Control_Interrupts
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
274 TCT_Local_Control_Interrupts:
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
275
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
276 @INT old_level; Old interrupt level
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
277
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
278 @ read in the old level
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
279 @ old_level = current interrupt level of processor;
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
280
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
281 MRS r2,CPSR @ Pickup current CPSR
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
282 MOV r3,r2 @ save the old level
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
283
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
284 @ clear out the old level and set the new level
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
285 @ current interrupt level of processor &= ~LOCKOUT;
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
286 @ current interrupt level of processor |= new_level;
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
287
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
288 BIC r2,r2,#LOCK_MSK @ Clear all current interrupts
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
289 ORR r2,r2,r0 @ Build new CPSR with new
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
290 @ interrupt level
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
291 MSR CPSR,r2 @ Setup new CPSR interrupt bits
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
292
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
293 @ Return old interrupt lockout level.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
294 @ return(old_level);
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
295
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
296 AND r0,r3,#LOCK_MSK @ Return previous lockout (SPR0252)
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
297
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
298 BX r14 @ Return to caller
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
299
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
300 @}
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
301
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
302 /*
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
303 ************************************************************************
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
304 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
305 * FUNCTION
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
306 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
307 * TCT_Restore_Interrupts
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
308 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
309 * DESCRIPTION
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
310 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
311 * This function restores interrupts to that specified in the global
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
312 * TCD_Interrupt_Level variable.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
313 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
314 * CALLED BY
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
315 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
316 * Application
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
317 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
318 * CALLS
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
319 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
320 * None
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
321 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
322 * INPUTS
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
323 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
324 * None.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
325 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
326 * OUTPUTS
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
327 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
328 * None.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
329 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
330 * HISTORY
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
331 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
332 * NAME DATE REMARKS
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
333 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
334 * C. Meredith 03-01-1994 Created initial version 1.1
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
335 * D. Lamie 03-18-1994 Verified version 1.1
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
336 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
337 ************************************************************************
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
338 */
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
339
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
340 @VOID TCT_Restore_Interrupts (VOID)
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
341 @{
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
342
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
343 .globl TCT_Restore_Interrupts
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
344 TCT_Restore_Interrupts:
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
345
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
346 @ Lock out all interrupts before any checking or changing
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
347 @ Obtain the current interrupt lockout posture.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
348 @ Reload the level base on the TCD_Interrupt_Level variable
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
349
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
350 MRS r1,CPSR @ Pickup current CPSR
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
351 MOV r2,r1 @ save the CPSR value
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
352 ORR r1,r1,#LOCKOUT @ Build lockout CPSR
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
353 MSR CPSR,r1 @ Lockout interrupts temporarily
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
354 BIC r2,r2,#LOCK_MSK @ Clear current interrupt levels
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
355 LDR r1,Int_Level @ Load address of TCD_Interrupt_Level
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
356 LDR r0,[r1, #0] @ Pickup current interrupt lockout
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
357 ORR r2,r2,r0 @ Build new CPSR with appropriate
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
358 @ interrupts locked out
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
359 MSR CPSR,r2 @ Setup new CPSR lockout bits
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
360
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
361 BX r14 @ Return to caller
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
362
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
363 @}
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
364
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
365 /*
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
366 ************************************************************************
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
367 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
368 * FUNCTION
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
369 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
370 * TCT_Build_Task_Stack
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
371 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
372 * DESCRIPTION
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
373 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
374 * This function builds an initial stack frame for a task. The
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
375 * initial stack contains information concerning initial values of
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
376 * registers and the task's point of entry. Furthermore, the
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
377 * initial stack frame is in the same form as an interrupt stack
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
378 * frame.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
379 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
380 * CALLED BY
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
381 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
382 * TCC_Create_Task Create a new task
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
383 * TCC_Reset_Task Reset the specified task
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
384 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
385 * CALLS
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
386 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
387 * None
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
388 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
389 * INPUTS
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
390 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
391 * task Task control block pointer
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
392 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
393 * OUTPUTS
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
394 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
395 * None
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
396 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
397 * HISTORY
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
398 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
399 * NAME DATE REMARKS
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
400 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
401 * W. Lamie 02-15-1994 Created initial version 1.0
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
402 * D. Lamie 02-15-1994 Verified version 1.0
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
403 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
404 ************************************************************************
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
405 */
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
406
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
407 @VOID TCT_Build_Task_Stack(TC_TCB *task)
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
408 @{
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
409
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
410 .globl TCT_Build_Task_Stack
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
411 TCT_Build_Task_Stack:
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
412
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
413 @ Pickup the stack base.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
414 @ REG_Stack_Base = (BYTE_PTR) task -> tc_stack_start;
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
415
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
416 LDR r2,[r0,#0x24] @ Pickup the stack starting address
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
417
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
418 @ Pickup the stack size.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
419 @ REG_Stack_Size = task -> tc_stack_size;
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
420
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
421 LDR r1,[r0,#0x30] @ Pickup the stack size in bytes
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
422
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
423 @ Calculate the stack ending address.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
424 @ REG_Stack_End = REG_Stack_Base + REG_Stack_Size - 1;
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
425
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
426 ADD r3,r1,r2 @ Compute the beginning of stack
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
427 BIC r3,r3,#3 @ Insure word alignment
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
428 SUB r3,r3,#4 @ Reserve a word
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
429
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
430 @ Save the stack ending address.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
431 @ task -> tc_stack_end = REG_Stack_End;
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
432
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
433 STR r3,[r0,#0x28] @ Save the stack ending address
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
434
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
435 @ Reference the task shell.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
436 @ REG_Function_Ptr = (VOID *) TCC_Task_Shell;
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
437
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
438 @ Build an initial stack. This initial stack frame facilitates an
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
439 @ interrupt return to the TCC_Task_Shell function, which in turn
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
440 @ invokes the application task. The initial stack frame has the
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
441 @ following format:
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
442
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
443 @ (Lower Address) Stack Top -> 1 (Interrupt stack type)
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
444 @ CPSR Saved CPSR
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
445 @ r0 Saved r0
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
446 @ r1 Saved r1
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
447 @ r2 Saved r2
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
448 @ r3 Saved r3
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
449 @ r4 Saved r4
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
450 @ r5 Saved r5
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
451 @ r6 Saved r6
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
452 @ r7 Saved r7
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
453 @ r8 Saved r8
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
454 @ r9/sb Saved r9/sl
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
455 @ r10/sl Saved r10/sl
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
456 @ fp Saved fp
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
457 @ r12 Saved r12
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
458 @ r13 Saved r13
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
459 @ r14 Saved r14
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
460 @ (Higher Address) Stack Bottom-> r15 Saved r15
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
461
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
462
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
463 LDR r2, Task_Shell @ Pickup address of shell entry
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
464 STR r2,[r3], #-4 @ Store entry address on stack
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
465 MOV r2,#0 @ Clear value for initial registers
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
466 STR r2,[r3], #-4 @ Store initial r14
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
467 ADD r2,r3,#8 @ Compute initial r13
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
468 STR r2,[r3], #-4 @ Store initial r13 (Stack Bottom)
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
469 STR r2,[r3], #-4 @ Store initial r12
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
470 STR r2,[r3], #-4 @ Store initial fp
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
471 LDR r2,[r0,#0x24] @ Pickup the stack starting address
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
472 STR r2,[r3], #-4 @ Store initial r10/sl
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
473 MOV r2,#0 @ Clear value for initial registers
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
474 STR r2,[r3], #-4 @ Store initial r9/sb
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
475 STR r2,[r3], #-4 @ Store initial r8
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
476 STR r2,[r3], #-4 @ Store initial r7
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
477 STR r2,[r3], #-4 @ Store initial r6
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
478 STR r2,[r3], #-4 @ Store initial r5
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
479 STR r2,[r3], #-4 @ Store initial r4
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
480 STR r2,[r3], #-4 @ Store initial r3
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
481 STR r2,[r3], #-4 @ Store initial r2
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
482 STR r2,[r3], #-4 @ Store initial r1
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
483 STR r2,[r3], #-4 @ Store initial r0
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
484 MSR CPSR_f,r2 @ Clear the flags
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
485 MRS r2,CPSR @ Pickup the CPSR
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
486 BIC r2,r2,#LOCK_MSK @ Clear initial interrupt lockout
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
487 STR r2,[r3], #-4 @ Store CPSR on the initial stack
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
488 MOV r2,#1 @ Build interrupt stack type (1)
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
489 STR r2,[r3, #0] @ Store stack type on the top
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
490
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
491 @ Save the minimum amount of remaining stack memory.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
492 @ task -> tc_stack_minimum = REG_Stack_Size - 72;
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
493
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
494 MOV r2,#72 @ Size of interrupt stack frame
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
495 SUB r1,r1,r2 @ Compute minimum available bytes
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
496 STR r1,[r0, #0x34] @ Save in minimum stack area
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
497
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
498 @ Save the new stack pointer into the task's control block.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
499 @ task -> tc_stack_pointer = (VOID *) Stack_Top;
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
500
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
501 STR r3,[r0, #0x2C] @ Save stack pointer
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
502
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
503 BX r14 @ Return to caller
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
504
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
505 @}
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
506
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
507 /*
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
508 ************************************************************************
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
509 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
510 * FUNCTION
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
511 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
512 * TCT_Build_HISR_Stack
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
513 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
514 * DESCRIPTION
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
515 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
516 * This function builds an HISR stack frame that allows quick
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
517 * scheduling of the HISR.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
518 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
519 * CALLED BY
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
520 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
521 * TCC_Create_HISR Create HISR function
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
522 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
523 * CALLS
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
524 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
525 * None
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
526 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
527 * INPUTS
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
528 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
529 * hisr HISR control block pointer
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
530 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
531 * OUTPUTS
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
532 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
533 * None
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
534 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
535 * HISTORY
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
536 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
537 * NAME DATE REMARKS
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
538 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
539 * W. Lamie 02-15-1994 Created initial version 1.0
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
540 * D. Lamie 02-15-1994 Verified version 1.0
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
541 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
542 ************************************************************************
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
543 */
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
544
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
545 @VOID TCT_Build_HISR_Stack(TC_HCB *hisr)
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
546 @{
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
547
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
548 .globl TCT_Build_HISR_Stack
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
549 TCT_Build_HISR_Stack:
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
550
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
551 @ Pickup the stack base.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
552 @ REG_Stack_Base = (BYTE_PTR) hisr -> tc_stack_start;
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
553
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
554 LDR r2,[r0,#0x24] @ Pickup the stack starting address
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
555
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
556 @ Pickup the stack size.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
557 @ REG_Stack_Size = hisr -> tc_stack_size;
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
558
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
559 LDR r1,[r0,#0x30] @ Pickup the stack size in bytes
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
560
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
561 @ Calculate the stack ending address.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
562 @ REG_Stack_End = REG_Stack_Base + REG_Stack_Size;
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
563
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
564 ADD r3,r1,r2 @ Compute the beginning of stack
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
565 BIC r3,r3,#3 @ Insure word alignment
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
566 SUB r3,r3,#4 @ Reserve a word
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
567
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
568 @ Save the stack ending address.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
569 @ hisr -> tc_stack_end = REG_Stack_End;
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
570
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
571 STR r3,[r0,#0x28] @ Save the stack ending address
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
572
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
573 @ Reference the HISR shell.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
574 @ REG_Function_Ptr = (VOID *) TCT_HISR_Shell;
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
575
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
576 @ Build an initial stack. This initial stack frame facilitates an
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
577 @ solicited return to the TCT_HISR_Shell function, which in turn
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
578 @ invokes the appropriate HISR. The initial HISR stack frame has the
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
579 @ following format:
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
580
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
581 @ (Lower Address) Stack Top -> 0 (Solicited stack type)
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
582 @ !!FOR THUMB ONLY!! 0/0x20 Saved state mask
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
583 @ r4 Saved r4
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
584 @ r5 Saved r5
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
585 @ r6 Saved r6
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
586 @ r7 Saved r7
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
587 @ r8 Saved r8
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
588 @ r9/sb Saved r9/sl
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
589 @ r10/sl Saved r10/sl
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
590 @ fp Saved fp
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
591 @ r12 Saved r12
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
592 @ (Higher Address) Stack Bottom-> r15 Saved r15
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
593
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
594
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
595 LDR r2,HISR_Shell @ Pickup address of shell entry
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
596 STR r2,[r3], #-4 @ Store entry address on stack
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
597 ADD r2,r3,#4 @ Compute initial r13
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
598 STR r2,[r3], #-4 @ Store initial r12
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
599 STR r2,[r3], #-4 @ Store initial fp
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
600 LDR r2,[r0,#0x24] @ Pickup the stack starting address
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
601 STR r2,[r3], #-4 @ Store initial r10/sl
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
602 MOV r2,#0 @ Clear value for initial registers
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
603 STR r2,[r3], #-4 @ Store initial r9/sb
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
604 STR r2,[r3], #-4 @ Store initial r8
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
605 STR r2,[r3], #-4 @ Store initial r7
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
606 STR r2,[r3], #-4 @ Store initial r6
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
607 STR r2,[r3], #-4 @ Store initial r5
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
608 STR r2,[r3], #-4 @ Store initial r4
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
609 #if 1 /* was .if THUMB */
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
610 STR r2,[r3], #-4 @ Store initial state mask
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
611 #endif
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
612 STR r2,[r3, #0] @ Store solicited stack type on the
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
613 @ top of the stack
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
614
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
615 @ Save the minimum amount of remaining stack memory.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
616 @ hisr -> tc_stack_minimum = REG_Stack_Size - (ARM)44 or (THUMB)48;
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
617
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
618 #if 1 /* was .if THUMB */
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
619 MOV r2,#48 @ Size of solicited stack frame
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
620 #else
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
621 MOV r2,#44 @ Size of solicited stack frame
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
622 #endif
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
623
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
624 SUB r1,r1,r2 @ Compute minimum available bytes
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
625 STR r1,[r0, #0x34] @ Save in minimum stack area
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
626
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
627 @ Save the new stack pointer into the task's control block.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
628 @ hisr -> tc_stack_pointer = (VOID *) Stack_Top;
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
629
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
630 STR r3,[r0, #0x2C] @ Save stack pointer
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
631
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
632 BX r14 @ Return to caller
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
633
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
634 @}
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
635
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
636 /*
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
637 ************************************************************************
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
638 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
639 * FUNCTION
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
640 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
641 * TCT_Build_Signal_Frame
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
642 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
643 * DESCRIPTION
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
644 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
645 * This function builds a frame on top of the task's stack to
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
646 * cause the task's signal handler to execute the next time
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
647 * the task is executed.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
648 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
649 * CALLED BY
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
650 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
651 * TCC_Send_Signals Send signals to a task
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
652 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
653 * CALLS
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
654 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
655 * None
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
656 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
657 * INPUTS
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
658 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
659 * task Task control block pointer
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
660 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
661 * OUTPUTS
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
662 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
663 * None
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
664 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
665 * HISTORY
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
666 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
667 * NAME DATE REMARKS
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
668 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
669 * W. Lamie 02-15-1994 Created initial version 1.0
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
670 * D. Lamie 02-15-1994 Verified version 1.0
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
671 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
672 ************************************************************************
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
673 */
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
674
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
675 @VOID TCT_Build_Signal_Frame(TC_TCB *task)
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
676 @{
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
677
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
678 .globl TCT_Build_Signal_Frame
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
679 TCT_Build_Signal_Frame:
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
680
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
681 @ Pickup the stack pointer.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
682 @ REG_Stack_Ptr = (BYTE_PTR) task -> tc_stack_pointer;
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
683
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
684 LDR r3,[r0,#0x2c] @ Pickup the current stack pointer
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
685
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
686 @ Reference the Signal shell.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
687 @ REG_Function_Ptr = (VOID *) TCC_Signal_Shell;
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
688
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
689 @ Build a signal stack. This signal stack frame facilitates an
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
690 @ solicited return to the TCC_Signal_Shell function, which in turn
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
691 @ invokes the appropriate signal handler. The initial HISR stack frame
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
692 @ has the following format:
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
693
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
694 @ (Lower Address) Stack Top -> 0 (Solicited stack type)
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
695 @ !!FOR THUMB ONLY!! 0/0x20 Saved state mask
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
696 @ r4 Saved r4
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
697 @ r5 Saved r5
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
698 @ r6 Saved r6
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
699 @ r7 Saved r7
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
700 @ r8 Saved r8
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
701 @ r9/sb Saved r9/sl
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
702 @ r10/sl Saved r10/sl
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
703 @ fp Saved fp
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
704 @ r12 Saved r12
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
705 @ (Higher Address) Stack Bottom-> r15 Saved r15
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
706
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
707
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
708 LDR r2,Signal_Shell @ Pickup address of shell entry
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
709 SUB r3,r3,#4
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
710 STR r2,[r3], #-4 @ Store entry address on stack
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
711 ADD r2,r3,#4 @ Compute initial r13
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
712 STR r2,[r3], #-4 @ Store initial r12
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
713 STR r2,[r3], #-4 @ Store initial fp
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
714 LDR r2,[r0,#0x24] @ Pickup the stack starting address
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
715 STR r2,[r3], #-4 @ Store initial r10/sl
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
716 MOV r2,#0 @ Clear value for initial registers
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
717 STR r2,[r3], #-4 @ Store initial r9/sb
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
718 STR r2,[r3], #-4 @ Store initial r8
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
719 STR r2,[r3], #-4 @ Store initial r7
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
720 STR r2,[r3], #-4 @ Store initial r6
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
721 STR r2,[r3], #-4 @ Store initial r5
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
722 STR r2,[r3], #-4 @ Store initial r4
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
723 #if 0
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
724 MOV r1,#0x20 @ Get initial state mask
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
725 STR r1,[r3], #-4 @ Store initial state mask
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
726 #else
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
727 STR r2,[r3], #-4 @ TCC_Signal_Shell is an ARM proc
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
728 #endif
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
729
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
730 STR r2,[r3, #0] @ Store solicited stack type on the
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
731 @ top of the stack
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
732
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
733 @ Save the new stack pointer into the task's control block.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
734 @ task -> tc_stack_pointer = (VOID *) (REG_Stack_Ptr - REG_Stack_Size);
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
735
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
736 STR r3,[r0, #0x2C] @ Save stack pointer
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
737
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
738 BX r14 @ Return to caller
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
739
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
740 @}
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
741
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
742 /*
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
743 ************************************************************************
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
744 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
745 * FUNCTION
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
746 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
747 * TCT_Check_Stack
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
748 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
749 * DESCRIPTION
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
750 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
751 * This function checks the current stack for overflow conditions.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
752 * Additionally, this function keeps track of the minimum amount
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
753 * of stack space for the calling thread and returns the current
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
754 * available stack space.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
755 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
756 * CALLED BY
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
757 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
758 * TCC_Send_Signals Send signals to a task
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
759 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
760 * CALLS
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
761 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
762 * ERC_System_Error System error handler
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
763 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
764 * INPUTS
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
765 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
766 * None
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
767 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
768 * OUTPUTS
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
769 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
770 * available bytes in stack
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
771 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
772 * HISTORY
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
773 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
774 * NAME DATE REMARKS
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
775 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
776 * W. Lamie 02-15-1994 Created initial version 1.0
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
777 * D. Lamie 02-15-1994 Verified version 1.0
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
778 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
779 ************************************************************************
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
780 */
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
781
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
782 @UNSIGNED TCT_Check_Stack(void)
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
783 @{
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
784
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
785 .globl TCT_Check_Stack
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
786 TCT_Check_Stack:
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
787
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
788 @TC_TCB *thread;
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
789 @UNSIGNED remaining;
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
790
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
791 @ Pickup the current task/HISR pointer.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
792 @ thread = (TC_TCB *) TCD_Current_Thread;
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
793
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
794 LDR r0,Current_Thread @ Pickup address of thread pointer
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
795 LDR r0,[r0,#0] @ Pickup thread pointer
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
796
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
797 @ Determine if there is a current thread.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
798 @ if (thread)
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
799 @ {
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
800
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
801 CMP r0,#0 @ Determine if a thread is active
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
802 MOV r3,#0 @ Default remaining value
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
803 BEQ TCT_Skip_Stack_Check @ If NU_NULL, skip stack checking
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
804
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
805 @ Determine if the stack pointers are out of range.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
806 @ if ((thread -> tc_stack_pointer < thread -> tc_stack_start) ||
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
807 @ (thread -> tc_stack_pointer > thread -> tc_stack_end))
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
808
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
809 LDR r2,[r0,#0x24] @ Pickup start of stack area
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
810 CMP r13,r2 @ Compare with current stack ptr
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
811 BLT TCT_Stack_Range_Error @ If less, stack is out of range
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
812 LDR r1,[r0,#0x28] @ Pickup end of stack area
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
813 CMP r13,r1 @ Compare with current stack ptr
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
814 BLE TCT_Stack_Range_Okay @ If less, stack range is okay
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
815
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
816 @ Stack overflow condition exits.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
817 @ ERC_System_Error(NU_STACK_OVERFLOW);
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
818
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
819 TCT_Stack_Range_Error:
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
820
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
821 STR r14,[r13, #4]! @ Store r14 on the stack
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
822 MOV r0,#3 @ Build NU_STACK_OVERFLOW code
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
823 BL ERC_System_Error @ Call system error handler. Note:
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
824 @ control is not returned!
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
825 @ Examine stack to find return
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
826 @ address of this routine.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
827
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
828 TCT_Stack_Range_Okay:
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
829
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
830 @ Calculate the amount of available space on the stack.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
831 @ remaining = (BYTE_PTR) thread -> tc_stack_pointer -
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
832 @ (BYTE_PTR) thread -> tc_stack_start;
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
833
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
834 SUB r3,r13,r2 @ Calculate remaining stack size
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
835
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
836 @ Determine if there is enough memory on the stack to save all of the
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
837 @ registers.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
838 @ if (remaining < 80)
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
839
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
840 CMP r3,#80 @ Is there enough room for an
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
841 @ interrupt frame?
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
842 BCS TCT_No_Stack_Error @ If so, no stack overflow yet
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
843
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
844 @ Stack overflow condition is about to happen.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
845 @ ERC_System_Error(NU_STACK_OVERFLOW);
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
846
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
847 STR r14,[r13, #4]! @ Store r14 on the stack
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
848 MOV r0,#3 @ Build NU_STACK_OVERFLOW code
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
849 BL ERC_System_Error @ Call system error handler. Note:
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
850 @ control is not returned!
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
851 @ Examine stack to find return
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
852 @ address of this routine.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
853
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
854 TCT_No_Stack_Error:
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
855
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
856 @ Determine if this is a new minimum amount of stack space.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
857 @ if (remaining < thread -> tc_stack_minimum)
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
858
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
859 LDR r2,[r0,#0x34]
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
860 CMP r3,r2
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
861 STRCC r3,[r0,#0x34]
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
862
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
863 @ Save the new stack minimum.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
864 @ thread -> tc_stack_minimum = remaining;
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
865 @ }
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
866 @ else
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
867
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
868 @ Set the remaining bytes to 0.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
869 @ remaining = 0;
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
870
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
871 @ Return the remaining number of bytes on the stack.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
872 @ return(remaining);
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
873
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
874 TCT_Skip_Stack_Check:
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
875 MOV r0,r3 @ Return remaining bytes
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
876
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
877 BX r14 @ Return to caller
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
878
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
879 @}
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
880
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
881 /*
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
882 ************************************************************************
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
883 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
884 * FUNCTION
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
885 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
886 * TCT_Schedule
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
887 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
888 * DESCRIPTION
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
889 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
890 * This function waits for a thread to become ready. Once a thread
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
891 * is ready, this function initiates a transfer of control to that
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
892 * thread.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
893 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
894 * CALLED BY
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
895 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
896 * INC_Initialize Main initialization routine
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
897 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
898 * CALLS
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
899 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
900 * TCT_Control_To_Thread Transfer control to a thread
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
901 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
902 * INPUTS
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
903 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
904 * TCD_Execute_Task Pointer to task to execute
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
905 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
906 * OUTPUTS
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
907 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
908 * None
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
909 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
910 * HISTORY
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
911 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
912 * NAME DATE REMARKS
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
913 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
914 * W. Lamie 02-15-1994 Created initial version 1.0
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
915 * D. Lamie 02-15-1994 Verified version 1.0
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
916 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
917 ************************************************************************
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
918 */
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
919
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
920 @VOID TCT_Schedule(void)
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
921 @{
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
922
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
923 .globl TCT_Schedule
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
924 TCT_Schedule:
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
925
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
926 @ Restore interrupts according to the value contained in
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
927 @ TCD_Interrupt_Level.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
928
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
929 LDR r1,Int_Level @ Build address of interrupt level
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
930 MRS r0,CPSR @ Pickup current CPSR
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
931 LDR r2,[r1, #0] @ Pickup current interrupt lockout
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
932 BIC r0,r0,#LOCK_MSK @ Clear the interrupt lockout bits
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
933 ORR r0,r0,r2 @ Build new interrupt lockout CPSR
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
934 MSR CPSR,r0 @ Setup new CPSR
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
935 LDR r2,Execute_HISR @ Pickup TCD_Execute_HISR address
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
936 LDR r3,Execute_Task @ Pickup TCD_Execute_Task address
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
937
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
938 #ifdef INCLUDE_PROVIEW
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
939 @ Nucleus ProView Hook
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
940 @ We check if upon entering TCT_Schedule we already have a task to excute.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
941 @ if not, we start IDLE.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
942 LDR r0,[r2, #0] @ Pickup highest priority HISR ptr
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
943 CMP r0,#0 @ Is there a HISR active?
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
944 BNE TCT_Schedule_Thread @ Found an HISR
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
945 LDR r0,[r3, #0] @ Pickup highest priority Task ptr
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
946 CMP r0,#0 @ Is there a task active?
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
947 BNE TCT_Schedule_Thread @ If not, start IDLE.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
948 STR r2,[r13, #-4]! @ Save r2 on the stack
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
949 STR r3,[r13, #-4]! @ Save r3 on the stack
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
950 BL _NU_Idle_Hook
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
951 LDR r3,[r13], #4 @ Recover r2
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
952 LDR r2,[r13], #4 @ Recover r3
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
953 #endif
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
954
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
955
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
956 @ Wait until a thread (task or HISR) is available to execute.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
957 @ do
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
958 @ {
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
959 TCT_Schedule_Loop:
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
960
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
961 @ } while ((!TCD_Execute_HISR) && (!TCD_Execute_Task));
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
962
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
963 LDR r0,[r2, #0] @ Pickup highest priority HISR ptr
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
964 CMP r0,#0 @ Is there a HISR active?
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
965 BNE TCT_Schedule_Thread @ Found an HISR
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
966 LDR r0,[r3, #0] @ Pickup highest priority Task ptr
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
967 CMP r0,#0 @ Is there a task active?
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
968 BNE TCT_Schedule_Thread
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
969 @ stmfd r13!,{r2-r3}
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
970 @ BL freecalypso_nucidle_dbghook
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
971 @ ldmfd r13!,{r2-r3}
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
972 B TCT_Schedule_Loop
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
973
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
974 @ Yes, either a task or an HISR is ready to execute. Lockout
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
975 @ interrupts while the thread is transferred to.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
976
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
977 TCT_Schedule_Thread:
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
978 MRS r1,CPSR @ Pickup CPSR again
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
979 ORR r1,r1,#LOCKOUT @ Build interrupt lockout value
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
980 MSR CPSR,r1 @ Lockout interrupts
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
981
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
982 @ Transfer control to the thread by falling through to the following
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
983 @ routine.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
984 @}
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
985
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
986 /*
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
987 ************************************************************************
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
988 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
989 * FUNCTION
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
990 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
991 * TCT_Control_To_Thread
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
992 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
993 * DESCRIPTION
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
994 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
995 * This function transfers control to the specified thread. Each
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
996 * time control is transferred to a thread, its scheduled counter
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
997 * is incremented. Additionally, time-slicing for task threads is
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
998 * enabled in this routine. The TCD_Current_Thread pointer is
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
999 * setup by this function.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1000 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1001 * CALLED BY
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1002 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1003 * TCT_Schedule Indirectly called
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1004 * TCT_Protect Protection task switch
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1005 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1006 * CALLS
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1007 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1008 * None
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1009 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1010 * INPUTS
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1011 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1012 * thread Thread control block pointer
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1013 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1014 * OUTPUTS
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1015 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1016 * None
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1017 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1018 * HISTORY
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1019 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1020 * NAME DATE REMARKS
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1021 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1022 * W. Lamie 02-15-1994 Created initial version 1.0
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1023 * D. Lamie 02-15-1994 Verified version 1.0
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1024 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1025 ************************************************************************
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1026 */
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1027
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1028 @VOID TCT_Control_To_Thread(TC_TCB *thread)
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1029 @{
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1030 TCT_Control_To_Thread:
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1031
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1032 @ Setup the current thread pointer.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1033 @ TCD_Current_Thread = (VOID *) thread;
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1034
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1035 LDR r1,Current_Thread @ Pickup current thread ptr address
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1036 LDR r2,[r0, #0x1c] @ Pickup scheduled count
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1037 STR r0,[r1, #0] @ Setup current thread pointer
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1038
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1039 @ Increment the thread scheduled counter.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1040 @ thread -> tc_scheduled++;
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1041
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1042 LDR r3,[r0, #0x20] @ Pickup time slice value
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1043 ADD r2,r2,#1 @ Increment the scheduled count
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1044 STR r2,[r0, #0x1c] @ Store new scheduled count
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1045
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1046 @ Check for time slice option.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1047 @ if (thread -> tc_cur_time_slice)
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1048 @ {
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1049 CMP r3,#0 @ Is there a time slice?
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1050 BEQ TCT_No_Start_TS_1 @ If 0, there is no time slice
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1051
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1052 @ Start a time slice.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1053 @ TMD_Time_Slice = thread -> tc_cur_time_slice;
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1054 @ TMD_Time_Slice_State = 0;
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1055
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1056 LDR r2,Time_Slice @ Pickup address of TMD_Time_Slice
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1057 LDR r1,Slice_State @ Pickup address of
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1058 @ TMD_Time_Slice_State
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1059 STR r3,[r2, #0] @ Setup the time slice
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1060 MOV r2,#0 @ Build active state flag
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1061 STR r2,[r1,#0] @ Set the active flag
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1062 @ }
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1063 TCT_No_Start_TS_1:
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1064 #ifdef INCLUDE_PROVIEW
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1065 @ Nucleus ProView Hook
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1066
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1067 STR r0,[r13, #-4]! @ Save r0 on the stack
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1068 BL _NU_Schedule_Task_Hook @ Branch to RTView
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1069 LDR r0,[r13], #4 @ Recover return address
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1070 #endif
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1071
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1072
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1073 @ Pickup the stack pointer and resume the thread.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1074 @ REG_Stack_Ptr = thread -> tc_stack_pointer;
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1075
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1076 LDR r13,[r0, #0x2c] @ Switch to thread's stack pointer
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1077
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1078 @ Pop off the saved information associated with the thread. After we
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1079 @ determine which type of stack is present. A 1 on the top of the
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1080 @ stack indicates an interrupt stack, while a 0 on the top of the
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1081 @ stack indicates a solicited type of stack.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1082
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1083 @ Remember that the interrupt level that is restored must represent
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1084 @ the interrupt level in TCD_Interrupt_Level.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1085
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1086 LDR r1,[r13], #4 @ Pop off the stack type
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1087 CMP r1,#1 @ See if it is an interrupt stack
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1088 BEQ TCT_Interrupt_Resume @ If so, an interrupt resume of
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1089 @ thread is required
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1090 LDR r1, Int_Level @ Pickup address of interrupt
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1091 @ lockout
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1092 MRS r0,CPSR @ Pickup current CPSR
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1093 BIC r0,r0,#LOCK_MSK @ Clear lockout mask
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1094
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1095 BIC r0,r0,#0x80000000
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1096
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1097
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1098 LDR r2,[r1, #0] @ Pickup interrupt lockout mask
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1099 ORR r0,r0,r2 @ Build new interrupt lockout mask
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1100 #if 1 /* was .if THUMB */
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1101 LDR r2,[r13], #4 @ Pop off the state mask
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1102 ORR r0,r0,r2 @ Set appropriate state
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1103 #endif
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1104 MSR SPSR,r0 @ Place it into the SPSR
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1105 LDMIA r13!,{r4-r12,r15}^ @ A solicited return is required.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1106 @ This type of return only
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1107 @ recovers r4-r13 & r15
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1108 TCT_Interrupt_Resume:
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1109 LDR r0,[r13], #4 @ Pop off the CPSR
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1110 LDR r1,Int_Level @ Pickup address of interrupt
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1111 @ lockout
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1112 BIC r0,r0,#LOCK_MSK @ Clear lockout mask
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1113 LDR r2,[r1, #0] @ Pickup interrupt lockout mask
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1114 ORR r0,r0,r2 @ Build new interrupt lockout mask
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1115 MSR SPSR,r0 @ Place it into the SPSR
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1116 LDMIA r13,{r0-r15}^ @ Recover all registers and resume
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1117 @ at point of interrupt
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1118 @}
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1119
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1120 /*
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1121 ************************************************************************
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1122 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1123 * FUNCTION
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1124 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1125 * TCT_Control_To_System
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1126 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1127 * DESCRIPTION
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1128 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1129 * This function returns control from a thread to the system. Note
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1130 * that this service is called in a solicited manner, i.e. it is
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1131 * not called from an interrupt thread. Registers required by the
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1132 * compiler to be preserved across function boundaries are saved by
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1133 * this routine. Note that this is usually a sub-set of the total
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1134 * number of available registers.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1135 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1136 * CALLED BY
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1137 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1138 * Other Components
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1139 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1140 * CALLS
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1141 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1142 * TCT_Schedule Schedule the next thread
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1143 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1144 * INPUTS
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1145 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1146 * None
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1147 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1148 * OUTPUTS
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1149 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1150 * None
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1151 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1152 * HISTORY
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1153 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1154 * NAME DATE REMARKS
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1155 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1156 * W. Lamie 02-15-1994 Created initial version 1.0
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1157 * D. Lamie 02-15-1994 Verified version 1.0
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1158 * C. Meredith 03-01-1994 Corrected problem in time-slice
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1159 * reset logic, resulting in
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1160 * version 1.1
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1161 * D. Lamie 03-18-1994 Verified version 1.1
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1162 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1163 ************************************************************************
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1164 */
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1165
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1166 @VOID TCT_Control_To_System(void)
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1167 @{
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1168
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1169 .globl TCT_Control_To_System
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1170 TCT_Control_To_System:
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1171
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1172 @ Lockout interrupts.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1173
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1174 MRS r0,CPSR @ Pickup current CPSR
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1175 ORR r0,r0,#LOCKOUT @ Build interrupt lockout value
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1176 MSR CPSR,r0 @ Lockout interrupts
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1177
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1178 @ Save a minimal context of the thread.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1179
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1180 STMDB r13!,{r4-r12,r14} @ Save minimal context of thread on
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1181 @ the current stack
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1182 #if 1 /* was .if THUMB */
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1183 MOV r2,r14 @ Determine what state the caller
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1184 MOV r2,r2,LSL #31 @ was in and build an
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1185 MOV r2,r2,LSR #26 @ appropriate state mask
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1186 STR r2,[r13, #-4]! @ Place it on the stack
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1187 #endif
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1188
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1189 MOV r2,#0 @ Build solicited stack type value
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1190 @ and NU_NULL value
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1191 STR r2,[r13, #-4]! @ Place it on the top of the stack
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1192
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1193 @ Setup a pointer to the thread control block.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1194 @ REG_Thread_Ptr = (TC_TCB *) TCD_Current_Thread;
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1195
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1196 LDR r1,Current_Thread @ Pickup current thread ptr address
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1197 LDR r0,[r1, #0] @ Pickup current thread pointer
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1198
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1199 @ Clear the current thread control block pointer.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1200 @ TCD_Current_Thread = NU_NULL;
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1201
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1202 LDR r3,Slice_State @ Pickup time slice state address
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1203 STR r2,[r1, #0] @ Set current thread pointer to
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1204 @ NU_NULL
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1205
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
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
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1207 @ slice into the current time slice field of the task's control block.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1208 @ if (TMD_Time_Slice_State == 0)
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1209 @ {
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1210 LDR r1,[r3, #0] @ Pickup time slice state flag
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1211 CMP r1,#0 @ Compare with active value
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1212 BNE TCT_No_Stop_TS_1 @ If non-active, don't disable
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1213
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1214
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1215 @ Insure that the next time the task runs it gets a fresh time
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1216 @ slice.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1217 @ REG_Thread_Ptr -> tc_cur_time_slice = REG_Thread_Ptr -> tc_time_slice;
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1218
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1219 LDR r1,[r0, #0x40] @ Pickup original time slice
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1220
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1221 @ Clear any active time slice by setting the state to NOT_ACTIVE.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1222 @ TMD_Time_Slice_State = 1;
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1223
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1224 MOV r2,#1 @ Build disable value
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1225 STR r2,[r3, #0] @ Disable time slice
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1226 STR r1,[r0, #0x20] @ Reset current time slice
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1227 @ }
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1228 TCT_No_Stop_TS_1:
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1229
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1230 @ Save off the current stack pointer in the control block.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1231 @ REG_Thread_Ptr -> tc_stack_pointer = (VOID *) REG_Stack_Ptr;
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1232
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1233 STR r13,[r0, #0x2c] @ Save the thread's stack pointer
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1234
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1235 @ Clear the task's current protection.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1236 @ (REG_Thread_Ptr -> tc_current_protect) -> tc_tcb_pointer = NU_NULL;
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1237 @ REG_Thread_Ptr -> tc_current_protect = NU_NULL;
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1238
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1239 LDR r1,[r0, #0x38] @ Pickup current thread pointer
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1240 MOV r2,#0 @ Build NU_NULL value
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1241 STR r2,[r0, #0x38] @ Clear the protect pointer field
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1242 STR r2,[r1, #0] @ Release the actual protection
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1243
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1244 @ Switch to the system stack.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1245 @ REG_Stack_Ptr = TCD_System_Stack;
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1246
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1247 LDR r1, System_Stack @ Pickup address of stack pointer
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1248 LDR r2, System_Limit @ Pickup address of stack limit ptr
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1249 LDR r13,[r1, #0] @ Switch to system stack
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1250 LDR r10,[r2, #0] @ Setup system stack limit
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1251
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1252 @ Finished, return to the scheduling loop.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1253
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1254 B TCT_Schedule @ Return to scheduling loop
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1255 @}
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1256
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1257 /*
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1258 ************************************************************************
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1259 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1260 * FUNCTION
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1261 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1262 * TCT_Signal_Exit
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1263 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1264 * DESCRIPTION
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1265 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1266 * This function exits from a signal handler. The primary purpose
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1267 * of this function is to clear the scheduler protection and switch
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1268 * the stack pointer back to the normal task's stack pointer.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1269 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1270 * CALLED BY
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1271 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1272 * TCC_Signal_Shell Signal handling shell func
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1273 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1274 * CALLS
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1275 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1276 * TCT_Schedule Scheduler
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1277 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1278 * INPUTS
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1279 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1280 * None
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1281 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1282 * OUTPUTS
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1283 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1284 * None
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1285 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1286 * HISTORY
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1287 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1288 * NAME DATE REMARKS
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1289 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1290 * W. Lamie 02-15-1994 Created initial version 1.0
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1291 * D. Lamie 02-15-1994 Verified version 1.0
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1292 * C. Meredith 03-01-1994 Corrected problem in time-slice
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1293 * reset logic, resulting in
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1294 * version 1.1
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1295 * D. Lamie 03-18-1994 Verified version 1.1
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1296 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1297 ************************************************************************
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1298 */
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1299
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1300 @VOID TCT_Signal_Exit(void)
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1301 @{
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1302
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1303 .globl TCT_Signal_Exit
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1304 TCT_Signal_Exit:
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1305
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1306 @ Lockout interrupts.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1307
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1308 MRS r3,CPSR @ Pickup current CPSR
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1309 ORR r3,r3,#LOCKOUT @ Build lockout value
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1310 MSR CPSR,r3 @ Lockout interrupts
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1311
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1312 @ Setup a pointer to the thread control block.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1313 @ REG_Thread_Ptr = (TC_TCB *) TCD_Current_Thread;
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1314
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1315 LDR r1,Current_Thread @ Pickup address of thread pointer
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1316 MOV r2,#0 @ Build NU_NULL value
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1317 LDR r0,[r1,#0] @ Pickup current thread pointer
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1318
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1319 @ Clear the current thread control block.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1320 @ TCD_Current_Thread = NU_NULL;
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1321
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1322 LDR r3,Slice_State @ Pickup time slice state address
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1323 STR r2,[r1, #0] @ Clear current thread pointer
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1324
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
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
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1326 @ slice into the current time slice field of the task's control block.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1327 @ if (TMD_Time_Slice_State == 0)
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1328 @ {
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1329
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1330 LDR r1,[r3, #0] @ Pickup time slice state flag
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1331 CMP r1,#0 @ Compare with active value
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1332 BNE TCT_No_Stop_TS_2 @ If non-active, don't disable
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1333
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1334 @ Insure that the next time the task runs it gets a fresh time
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1335 @ slice.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1336 @ REG_Thread_Ptr -> tc_cur_time_slice = REG_Thread_Ptr -> tc_time_slice;
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1337
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1338 LDR r1,[r0, #0x40] @ Pickup original time slice
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1339
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1340 @ Clear any active time slice by setting the state to NOT_ACTIVE.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1341 @ TMD_Time_Slice_State = 1;
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1342
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1343 MOV r2,#1 @ Build disable value
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1344 STR r2,[r3, #0] @ Disable time slice
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1345 STR r1,[r0, #0x20] @ Reset current time slice
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1346 @ }
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1347 TCT_No_Stop_TS_2:
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1348
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1349 @ Switch back to the saved stack. The saved stack pointer was saved
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1350 @ before the signal frame was built.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1351 @ REG_Thread_Ptr -> tc_stack_pointer =
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1352 @ REG_Thread_Ptr -> tc_saved_stack_ptr;
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1353
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1354 LDR r1,[r0, #0x3c] @ Pickup saved stack pointer
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1355 STR r1,[r0, #0x2c] @ Place in current stack pointer
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1356
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1357 @ Clear the task's current protection.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1358 @ (REG_Thread_Ptr -> tc_current_protect) -> tc_tcb_pointer = NU_NULL;
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1359 @ REG_Thread_Ptr -> tc_current_protect = NU_NULL;
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1360
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1361 LDR r1,[r0, #0x38] @ Pickup current thread pointer
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1362 MOV r2,#0 @ Build NU_NULL value
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1363 STR r2,[r0, #0x38] @ Clear the protect pointer field
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1364 STR r2,[r1, #0] @ Release the actual protection
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1365
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1366 @ Switch to the system stack.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1367 @ REG_Stack_Ptr = (BYTE_PTR) TCD_System_Stack;
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1368
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1369 LDR r1, System_Stack @ Pickup address of stack pointer
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1370 LDR r2, System_Limit @ Pickup address of stack limit ptr
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1371 LDR r13,[r1, #0] @ Switch to system stack
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1372 LDR r10,[r2, #0] @ Setup system stack limit
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1373
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1374 @ Finished, return to the scheduling loop.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1375
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1376 B TCT_Schedule @ Return to scheduling loop
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1377 @}
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1378
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1379 /*
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1380 ************************************************************************
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1381 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1382 * FUNCTION
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1383 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1384 * TCT_Current_Thread
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1385 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1386 * DESCRIPTION
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1387 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1388 * This function returns the current thread pointer.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1389 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1390 * CALLED BY
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1391 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1392 * Application
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1393 * System Components
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1394 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1395 * CALLS
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1396 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1397 * None
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1398 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1399 * INPUTS
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1400 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1401 * None
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1402 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1403 * OUTPUTS
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1404 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1405 * Pointer to current thread
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1406 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1407 * HISTORY
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1408 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1409 * NAME DATE REMARKS
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1410 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1411 * W. Lamie 02-15-1994 Created initial version 1.0
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1412 * D. Lamie 02-15-1994 Verified version 1.0
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1413 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1414 ************************************************************************
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1415 */
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1416
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1417 @VOID *TCT_Current_Thread(void)
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1418 @{
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1419
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1420 .globl TCT_Current_Thread
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1421 TCT_Current_Thread:
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1422
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1423 @ Return the current thread pointer.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1424 @ return(TCD_Current_Thread);
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1425
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1426 LDR r0, Current_Thread @ Pickup address of thread pointer
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1427 LDR r0,[r0, #0] @ Pickup current thread pointer
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1428
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1429 BX r14 @ Return to caller
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1430
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1431 @}
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1432
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1433 /*
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1434 ************************************************************************
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1435 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1436 * FUNCTION
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1437 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1438 * TCT_Set_Execute_Task
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1439 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1440 * DESCRIPTION
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1441 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1442 * This function sets the current task to execute variable under
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1443 * protection against interrupts.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1444 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1445 * CALLED BY
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1446 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1447 * TCC Scheduling Routines
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1448 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1449 * CALLS
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1450 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1451 * None
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1452 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1453 * INPUTS
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1454 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1455 * task Pointer to task control block
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1456 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1457 * OUTPUTS
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1458 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1459 * TCD_Execute_Task Modified variable
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1460 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1461 * HISTORY
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1462 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1463 * NAME DATE REMARKS
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1464 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1465 * W. Lamie 02-15-1994 Created initial version 1.0
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1466 * D. Lamie 02-15-1994 Verified version 1.0
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1467 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1468 ************************************************************************
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1469 */
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1470
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1471 @VOID TCT_Set_Execute_Task(TC_TCB *task)
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1472 @{
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1473
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1474 .globl TCT_Set_Execute_Task
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1475 TCT_Set_Execute_Task:
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1476
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1477 @ Now setup the TCD_Execute_Task pointer.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1478 @ TCD_Execute_Task = task;
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1479
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1480 LDR r1, Execute_Task @ Pickup execute task ptr address
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1481 STR r0,[r1,#0] @ Setup new task to execute
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1482
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1483 BX r14 @ Return to caller
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1484
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1485 @}
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1486
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1487 /*
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1488 ************************************************************************
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1489 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1490 * FUNCTION
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1491 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1492 * TCT_Protect
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1493 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1494 * DESCRIPTION
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1495 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1496 * This function protects against multiple thread access.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1497 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1498 * CALLED BY
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1499 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1500 * Application
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1501 * System Components
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1502 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1503 * CALLS
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1504 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1505 * None
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1506 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1507 * INPUTS
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1508 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1509 * protect Pointer to protection block
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1510 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1511 * OUTPUTS
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1512 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1513 * None
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1514 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1515 * HISTORY
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1516 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1517 * NAME DATE REMARKS
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1518 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1519 * W. Lamie 02-15-1994 Created initial version 1.0
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1520 * D. Lamie 02-15-1994 Verified version 1.0
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1521 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1522 ************************************************************************
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1523 */
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1524
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1525 @VOID TCT_Protect(TC_PROTECT *protect)
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1526 @{
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1527
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1528 .globl TCT_Protect
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1529 TCT_Protect:
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1530
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1531 @ Determine if the caller is in a task or HISR thread.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1532 @ if (TCD_Current_Thread)
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1533 @ {
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1534
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1535 LDR r1,Current_Thread @ Pickup current thread ptr address
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1536 LDR r3,[r1, #0] @ Pickup current thread pointer
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1537 CMP r3,#0 @ Check to see if it is non-NULL
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1538 BEQ TCT_Skip_Protect @ If NULL, skip protection
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1539
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1540 @ Lockout interrupts.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1541
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1542 MRS r1,CPSR @ Pickup current CPSR
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1543 ORR r1,r1,#LOCKOUT @ Place lockout value in
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1544 MSR CPSR,r1 @ Lockout interrupts
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1545
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1546 @ Wait until the protect structure is available.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1547 @ while (protect -> tc_tcb_pointer != NU_NULL)
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1548 @ {
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1549
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1550 TCT_Protect_Loop:
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1551 LDR r1,[r0, #0] @ Pickup protection owner field
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1552 CMP r1,#0 @ Is there any protection?
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1553 BEQ TCT_Protect_Available @ If NU_NULL, no current protection
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1554
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1555 @ Protection structure is not available.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1556
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1557 @ Indicate that another thread is waiting.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1558 @ protect -> tc_thread_waiting = 1;
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1559
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1560 MOV r2,#1 @ Build thread waiting flag
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1561 STR r2,[r0, #4] @ Set waiting field
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1562
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1563 @ Directly schedule the thread waiting.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1564 @ TCT_Schedule_Protected(protect -> tc_tcb_pointer);
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1565
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1566 STR r0,[r13, #-4]! @ Save r0 on the stack
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1567 STR r14,[r13, #-4]! @ Save r14 on the stack
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1568 MOV r0,r3 @ Place current thread into r0
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1569 BL TCT_Schedule_Protected @ Call routine to schedule the
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1570 @ owner of the thread
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1571
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1572 LDR r14,[r13], #4 @ Recover saved r14
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1573 LDR r0,[r13], #4 @ Recover saved r0
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1574
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1575 @ Lockout interrupts.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1576
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1577 LDR r1,Current_Thread @ Pickup current thread ptr address
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1578 LDR r3,[r1, #0] @ Pickup current thread pointer
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1579 MRS r1,CPSR @ Pickup current CPSR
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1580 ORR r1,r1,#LOCKOUT @ Place lockout value in
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1581 MSR CPSR,r1 @ Lockout interrupts
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1582 B TCT_Protect_Loop @ Examine protect flags again
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1583 @ }
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1584 TCT_Protect_Available:
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1585
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1586 @ Protection structure is available.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1587
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1588 @ Indicate that this thread owns the protection.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1589 @ protect -> tc_tcb_pointer = TCD_Current_Thread;
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1590
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1591 STR r3,[r0, #0] @ Indicate calling thread owns this
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1592 @ protection
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1593
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1594 @ Clear the thread waiting flag.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1595 @ protect -> tc_thread_waiting = 0;
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1596
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1597 MOV r2,#0 @ Clear value
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1598 STR r2,[r0, #4] @ Clear the thread waiting flag
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1599
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1600 @ Save the protection pointer in the thread's control block. Note
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1601 @ that both task and HISR threads share the same control block
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1602 @ format.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1603 @ REG_Thread_Ptr = (TC_TCB *) TCD_Current_Thread;
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1604 @ REG_Thread_Ptr -> tc_current_protect = protect;
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1605
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1606 STR r0,[r3, #0x38] @ Setup current protection
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1607
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1608 @ Restore interrupts.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1609
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1610 LDR r2,Int_Level @ Pickup address of interrupt level
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1611 MRS r1,CPSR @ Pickup current CPSR
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1612 LDR r3,[r2, #0] @ Pickup interrupt lockout level
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1613 BIC r1,r1,#LOCK_MSK @ Clear lockout bits
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1614 ORR r1,r1,r3 @ Build new interrupt lockout
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1615 MSR CPSR,r1 @ Setup CPSR appropriately
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1616 @ }
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1617
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1618 TCT_Skip_Protect:
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1619
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1620 BX r14 @ Return to caller
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1621
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1622 @}
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1623
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1624 /*
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1625 ************************************************************************
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1626 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1627 * FUNCTION
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1628 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1629 * TCT_Unprotect
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1630 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1631 * DESCRIPTION
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1632 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1633 * This function releases protection of the currently active
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1634 * thread. If the caller is not an active thread, then this
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1635 * request is ignored.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1636 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1637 * CALLED BY
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1638 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1639 * Application
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1640 * System Components
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1641 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1642 * CALLS
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1643 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1644 * None
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1645 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1646 * INPUTS
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1647 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1648 * None
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1649 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1650 * OUTPUTS
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1651 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1652 * None
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1653 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1654 * HISTORY
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1655 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1656 * NAME DATE REMARKS
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1657 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1658 * W. Lamie 02-15-1994 Created initial version 1.0
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1659 * D. Lamie 02-15-1994 Verified version 1.0
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1660 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1661 ************************************************************************
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1662 */
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1663
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1664 @VOID TCT_Unprotect(void)
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1665 @{
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1666
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1667 .globl TCT_Unprotect
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1668 TCT_Unprotect:
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1669
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1670
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1671 @ Determine if the caller is in a task or HISR thread.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1672 @ if (TCD_Current_Thread)
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1673 @ {
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1674
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1675 LDR r1,Current_Thread @ Pickup current thread ptr address
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1676 LDR r3,[r1, #0] @ Pickup current thread pointer
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1677 CMP r3,#0 @ Check to see if it is non-NULL
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1678 BEQ TCT_Skip_Unprotect @ If NULL, skip unprotection
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1679
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1680 @ Setup a thread control block pointer.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1681 @ REG_Thread_Ptr = (TC_TCB *) TCD_Current_Thread;
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1682
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1683 @ Determine if there is a currently active protection.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1684 @ if (REG_Thread_Ptr -> tc_current_protect)
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1685 @ {
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1686
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1687 LDR r0,[r3, #0x38] @ Pickup current protect field
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1688 CMP r0,#0 @ Is there a protection in force?
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1689 BEQ TCT_Skip_Unprotect @ If not, nothing is protected
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1690
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1691 @ Lockout interrupts.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1692
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1693 MRS r1,CPSR @ Pickup current CPSR
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1694 ORR r1,r1,#LOCKOUT @ Place lockout value in
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1695 MSR CPSR,r1 @ Lockout interrupts
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1696
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1697 @ Yes, this thread still has this protection structure.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1698 @ REG_Protect_Ptr = REG_Thread_Ptr -> tc_current_protect;
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1699
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1700 @ Is there a higher priority thread waiting for the protection
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1701 @ structure?
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1702 @ if (REG_Protect_Ptr -> tc_thread_waiting)
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1703
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1704 LDR r2,[r0, #4] @ Pickup thread waiting flag
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1705 CMP r2,#0 @ Are there any threads waiting?
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1706 BEQ TCT_Not_Waiting_Unpr @ If not, just release protection
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1707
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1708 @ Transfer control to the system. Note that this
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1709 @ automatically clears the current protection and it returns
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1710 @ to the caller of this routine instead of this routine.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1711 @ TCT_Control_To_System();
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1712
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1713 B TCT_Control_To_System @ Return control to the system
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1714
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1715 @ else
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1716 @ {
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1717 TCT_Not_Waiting_Unpr:
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1718
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1719 @ Clear the protection.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1720 @ REG_Thread_Ptr -> tc_current_protect = NU_NULL;
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1721 @ REG_Protect_Ptr -> tc_tcb_pointer = NU_NULL;
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1722
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1723 MOV r2,#0 @ Build NU_NULL value
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1724 STR r2,[r0, #0] @ Release the protection
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1725 STR r2,[r3, #0x38] @ Clear protection pointer in the
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1726 @ control block
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1727
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1728 @ }
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1729
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1730 TCT_Not_Protected:
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1731 @ Restore interrupts again.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1732
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1733 LDR r2,Int_Level @ Pickup address of interrupt level
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1734 MRS r1,CPSR @ Pickup current CPSR
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1735 LDR r3,[r2, #0] @ Pickup interrupt lockout level
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1736 BIC r1,r1,#LOCK_MSK @ Clear lockout bits
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1737 ORR r1,r1,r3 @ Build new interrupt lockout
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1738 MSR CPSR,r1 @ Setup CPSR appropriately
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1739
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1740 @ }
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1741 @ }
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1742 TCT_Skip_Unprotect:
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1743
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1744 BX r14 @ Return to caller
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1745
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1746 @}
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1747
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1748 /*
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1749 ************************************************************************
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1750 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1751 * FUNCTION
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1752 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1753 * TCT_Unprotect_Specific
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1754 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1755 * DESCRIPTION
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1756 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1757 * This function releases a specific protection structure.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1758 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1759 * CALLED BY
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1760 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1761 * Application
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1762 * System Components
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1763 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1764 * CALLS
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1765 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1766 * None
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1767 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1768 * INPUTS
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1769 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1770 * protect Pointer to protection block
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1771 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1772 * OUTPUTS
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1773 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1774 * None
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1775 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1776 * HISTORY
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1777 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1778 * NAME DATE REMARKS
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1779 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1780 * W. Lamie 02-15-1994 Created initial version 1.0
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1781 * D. Lamie 02-15-1994 Verified version 1.0
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1782 * C. Meredith 03-01-1994 Corrected problem in time-slice
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1783 * reset logic, corrected bug
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1784 * using protect ptr, resulting
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1785 * in version 1.1
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1786 * D. Lamie 03-18-1994 Verified version 1.1
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1787 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1788 ************************************************************************
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1789 */
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1790
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1791 @VOID Specific(TC_PROTECT *protect)
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1792 @{
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1793
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1794 .globl TCT_Unprotect_Specific
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1795 TCT_Unprotect_Specific:
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1796
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1797 @ Determine if the caller is in a task or HISR thread.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1798 @ if (TCD_Current_Thread)
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1799 @ {
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1800
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1801 LDR r1,Current_Thread @ Pickup current thread ptr address
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1802 LDR r3,[r1, #0] @ Pickup current thread pointer
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1803 CMP r3,#0 @ Check to see if it is non-NULL
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1804 BEQ TCT_Skip_Unprot_Spec @ If NULL, skip unprotect specific
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1805
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1806 @ Lockout interrupts.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1807
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1808 MRS r1,CPSR @ Pickup current CPSR
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1809 ORR r1,r1,#LOCKOUT @ Place lockout value in
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1810 MSR CPSR,r1 @ Lockout interrupts
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1811
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1812 @ Clear the protection pointer.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1813 @ protect -> tc_tcb_pointer = NU_NULL;
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1814
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1815 MOV r2,#0 @ Build NU_NULL value
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1816 STR r2,[r0, #0] @ Clear protection ownership
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1817
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1818 @ Determine if a thread is waiting.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1819 @ if (protect -> tc_thread_waiting)
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1820 @ {
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1821
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1822 LDR r1,[r0, #4] @ Pickup the waiting field
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1823 CMP r1,#0 @ Is there another thread waiting?
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1824 BEQ TCT_Not_Waiting_Unspec @ No, restore interrupts and return
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1825
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1826 @ A higher-priority thread is waiting.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1827
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1828 @ Save a minimal context of the thread.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1829
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1830 STMDB r13!,{r4-r12,r14} @ Save minimal context of thread on
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1831 @ the current stack
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1832
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1833 #if 1 /* was .if THUMB */
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1834 MOV r2,r14 @ Determine what state the caller
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1835 MOV r2,r2,LSL #31 @ was in and build an
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1836 MOV r2,r2,LSR #26 @ appropriate state mask
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1837 STR r2,[r13, #-4]! @ Place it on the stack
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1838 #endif
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1839
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1840 MOV r2,#0 @ Build solicited stack type value
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1841 @ and NU_NULL value
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1842 STR r2,[r13, #-4]! @ Place it on the top of the stack
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1843
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1844 @ Setup a pointer to the thread control block.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1845 @ REG_Thread_Ptr = (TC_TCB *) TCD_Current_Thread;
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1846
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1847 LDR r1,Current_Thread @ Pickup current thread ptr address
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1848 LDR r0,[r1, #0] @ Pickup current thread pointer
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1849
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1850 @ Clear the current thread control block pointer.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1851 @ TCD_Current_Thread = NU_NULL;
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1852
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1853 LDR r3,Slice_State @ Pickup time slice state address
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1854 STR r2,[r1, #0] @ Set current thread pointer to
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1855 @ NU_NULL
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1856
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1857 @ Check to see if a time slice is active. If so, copy the
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1858 @ original time slice into the current time slice field of the
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1859 @ thread's control block.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1860 @ if (TMD_Time_Slice_State == 0)
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1861 @ {
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1862
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1863 LDR r1,[r3, #0] @ Pickup time slice state flag
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1864 CMP r1,#0 @ Compare with active value
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1865 BNE TCT_No_Stop_TS_3 @ If non-active, don't disable
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1866
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1867 @ Insure that the next time the task runs it gets a fresh time
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1868 @ slice.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1869 @ REG_Thread_Ptr -> tc_cur_time_slice =
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1870 @ REG_Thread_Ptr -> tc_time_slice;
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1871
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1872 LDR r1,[r0, #0x40] @ Pickup original time slice
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1873
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1874 @ Clear any active time slice by setting the state to
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1875 @ NOT_ACTIVE.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1876 @ TMD_Time_Slice_State = 1;
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1877
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1878 MOV r2,#1 @ Build disable value
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1879 STR r2,[r3, #0] @ Disable time slice
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1880 STR r1,[r0, #0x20] @ Reset current time slice
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1881 @ }
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1882
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1883 TCT_No_Stop_TS_3:
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1884
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1885 @ Save off the current stack pointer in the control block.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1886 @ REG_Thread_Ptr -> tc_stack_pointer = (VOID *) REG_Stack_Ptr;
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1887
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1888 STR r13,[r0, #0x2c] @ Save the thread's stack pointer
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1889
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1890 @ Switch to the system stack.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1891 @ REG_Stack_Ptr = TCD_System_Stack;
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1892
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1893 LDR r1,System_Stack @ Pickup address of stack pointer
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1894 LDR r2,System_Limit @ Pickup address of stack limit ptr
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1895 LDR r13,[r1, #0] @ Switch to system stack
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1896 LDR r10,[r2, #0] @ Setup system stack limit
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1897
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1898 @ Finished, return to the scheduling loop.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1899
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1900 B TCT_Schedule @ Return to scheduling loop
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1901
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1902 @ }
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1903 @ else
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1904 @ {
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1905 TCT_Not_Waiting_Unspec:
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1906
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1907 @ No higher-priority thread is waiting.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1908
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1909 @ Restore interrupts.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1910
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1911 LDR r2,Int_Level @ Pickup address of interrupt level
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1912 MRS r1,CPSR @ Pickup current CPSR
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1913 LDR r3,[r2, #0] @ Pickup interrupt lockout level
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1914 BIC r1,r1,#LOCK_MSK @ Clear lockout bits
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1915 ORR r1,r1,r3 @ Build new interrupt lockout
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1916 MSR CPSR,r1 @ Setup CPSR appropriately
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1917
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1918 @ }
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1919 @ }
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1920
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1921 TCT_Skip_Unprot_Spec:
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1922
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1923 BX r14 @ Return to caller
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1924
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1925 @}
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1926
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1927 /*
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1928 ************************************************************************
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1929 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1930 * FUNCTION
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1931 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1932 * TCT_Set_Current_Protect
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1933 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1934 * DESCRIPTION
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1935 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1936 * This function sets the current protection field of the current
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1937 * thread's control block to the specified protection pointer.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1938 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1939 * CALLED BY
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1940 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1941 * TCC_Resume_Task Resume task function
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1942 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1943 * CALLS
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1944 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1945 * None
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1946 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1947 * INPUTS
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1948 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1949 * protect Pointer to protection block
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1950 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1951 * OUTPUTS
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1952 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1953 * None
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1954 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1955 * HISTORY
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1956 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1957 * NAME DATE REMARKS
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1958 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1959 * W. Lamie 02-15-1994 Created initial version 1.0
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1960 * D. Lamie 02-15-1994 Verified version 1.0
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1961 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1962 ************************************************************************
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1963 */
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1964
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1965 @VOID TCT_Set_Current_Protect(TC_PROTECT *protect)
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1966 @{
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1967
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1968 .globl TCT_Set_Current_Protect
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1969 TCT_Set_Current_Protect:
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1970
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1971 @ Determine if the caller is in a task or HISR thread.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1972 @ if (TCD_Current_Thread)
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1973 @ {
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1974
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1975 LDR r1,Current_Thread @ Pickup current thread ptr address
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1976 LDR r3,[r1, #0] @ Pickup current thread pointer
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1977 CMP r3,#0 @ Check to see if a thread is
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1978 @ active
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1979
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1980 @ Point at the current thread control block.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1981 @ REG_Thread_Ptr = (TC_TCB *) TCD_Current_Thread;
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1982
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1983 @ Modify the current protection.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1984 @ REG_Thread_Ptr -> tc_current_protect = protect;
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1985
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1986 STRNE r0,[r3, #0x38] @ Setup new protection
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1987 @ }
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1988
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1989
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1990 BX r14 @ Return to caller
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1991
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1992 @}
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1993
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1994 /*
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1995 ************************************************************************
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1996 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1997 * FUNCTION
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1998 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1999 * TCT_Protect_Switch
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2000 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2001 * DESCRIPTION
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2002 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2003 * This function waits until a specific task no longer has any
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2004 * protection associated with it. This is necessary since task's
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2005 * cannot be suspended or terminated unless they have released all
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2006 * of their protection.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2007 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2008 * CALLED BY
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2009 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2010 * System Components
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2011 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2012 * CALLS
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2013 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2014 * None
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2015 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2016 * INPUTS
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2017 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2018 * thread Pointer to thread control blk
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2019 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2020 * OUTPUTS
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2021 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2022 * None
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2023 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2024 * HISTORY
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2025 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2026 * NAME DATE REMARKS
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2027 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2028 * W. Lamie 02-15-1994 Created initial version 1.0
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2029 * D. Lamie 02-15-1994 Verified version 1.0
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2030 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2031 ************************************************************************
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2032 */
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2033
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2034 @VOID TCT_Protect_Switch(VOID *thread)
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2035 @{
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2036
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2037 .globl TCT_Protect_Switch
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2038 TCT_Protect_Switch:
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2039
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2040 @ Lockout interrupts.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2041
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2042 MRS r1,CPSR @ Pickup current CPSR
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2043 ORR r1,r1,#LOCKOUT @ Place lockout value in
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2044 MSR CPSR,r1 @ Lockout interrupts
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2045
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2046 @ REG_Thread_Ptr = (TC_TCB *) thread;
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2047
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2048 @ Wait until the specified task has no protection associated with it.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2049 @ while (REG_Thread_Ptr -> tc_current_protect)
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2050 @ {
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2051
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2052 LDR r1,[r0, #0x38] @ Pickup protection of specified
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2053 @ thread
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2054 CMP r1,#0 @ Does the specified thread have
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2055 @ an active protection?
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2056 BEQ TCT_Switch_Done @ If not, protect switch is done
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2057
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2058 @ Let the task run again in an attempt to clear its protection.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2059
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2060 @ Indicate that a higher priority thread is waiting.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2061 @ (REG_Thread_Ptr -> tc_current_protect) -> tc_thread_waiting = 1;
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2062
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2063 MOV r2,#1 @ Build waiting flag value
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2064 STR r2,[r1, #4] @ Set waiting flag of the
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2065 @ protection owned by the other
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2066 @ thread
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2067
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2068 @ Directly schedule the thread waiting.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2069 @ TCT_Schedule_Protected((REG_Thread_Ptr -> tc_current_protect)
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2070 @ -> tc_tcb_pointer);
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2071
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2072 LDR r2,Current_Thread @ Pickup current thread ptr address
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2073 STR r0,[r13, #-4]! @ Save r0 on the stack
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2074 STR r14,[r13, #-4]! @ Save r14 on the stack
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2075 MOV r1,r0 @ Move new thread into r1
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2076 LDR r0,[r2, #0] @ Pickup current thread pointer
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2077 BL TCT_Schedule_Protected @ Call routine to schedule the
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2078 @ owner of the thread
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2079
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2080 LDR r14,[r13], #4 @ Recover saved r14
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2081 LDR r0,[r13], #4 @ Recover saved r0
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2082
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2083 @ Lockout interrupts.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2084
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2085 B TCT_Protect_Switch @ Branch to top of routine and
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2086 @ start over
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2087 @ }
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2088 TCT_Switch_Done:
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2089
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2090 @ Restore interrupts.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2091
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2092 LDR r2,Int_Level @ Pickup address of interrupt level
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2093 MRS r1,CPSR @ Pickup current CPSR
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2094 LDR r3,[r2, #0] @ Pickup interrupt lockout level
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2095 BIC r1,r1,#LOCK_MSK @ Clear lockout bits
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2096 ORR r1,r1,r3 @ Build new interrupt lockout
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2097 MSR CPSR,r1 @ Setup CPSR appropriately
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2098
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2099
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2100 BX r14 @ Return to caller
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2101
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2102 @}
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2103
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2104 /*
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2105 ************************************************************************
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2106 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2107 * FUNCTION
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2108 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2109 * TCT_Schedule_Protected
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2110 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2111 * DESCRIPTION
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2112 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2113 * This function saves the minimal context of the thread and then
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2114 * directly schedules the thread that has protection over the
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2115 * the thread that called this routine.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2116 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2117 * CALLED BY
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2118 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2119 * TCT_Protect
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2120 * TCT_Protect_Switch
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2121 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2122 * CALLS
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2123 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2124 * TCT_Control_To_Thread Transfer control to protected
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2125 * thread
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2126 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2127 * INPUTS
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2128 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2129 * None
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2130 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2131 * OUTPUTS
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2132 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2133 * None
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2134 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2135 * HISTORY
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2136 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2137 * NAME DATE REMARKS
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2138 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2139 * W. Lamie 02-15-1994 Created initial version 1.0
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2140 * D. Lamie 02-15-1994 Verified version 1.0
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2141 * C. Meredith 03-01-1994 Corrected problem in time-slice
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2142 * reset logic, resulting in
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2143 * version 1.1
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2144 * D. Lamie 03-18-1994 Verified version 1.1
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2145 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2146 ************************************************************************
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2147 */
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2148
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2149 @VOID TCT_Schedule_Protected(VOID *thread)
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2150 @{
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2151
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2152 .globl TCT_Schedule_Protected
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2153 TCT_Schedule_Protected:
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2154
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2155 @ Interrupts are already locked out by the caller.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2156
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2157 @ Save minimal context required by the system.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2158
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2159 STMDB r13!,{r4-r12,r14} @ Save minimal context of thread on
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2160 @ the current stack
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2161
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2162 #if 1 /* was .if THUMB */
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2163 MOV r2,r14 @ Determine what state the caller
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2164 MOV r2,r2,LSL #31 @ was in and build an
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2165 MOV r2,r2,LSR #26 @ appropriate state mask
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2166 STR r2,[r13, #-4]! @ Place it on the stack
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2167 #endif
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2168
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2169 MOV r2,#0 @ Build solicited stack type value
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2170 @ and NU_NULL value
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2171 STR r2,[r13, #-4]! @ Place it on the top of the stack
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2172 MOV r4,r1 @ Save thread to schedule
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2173
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2174 @ Setup a pointer to the thread control block.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2175 @ REG_Thread_Ptr = (TC_TCB *) TCD_Current_Thread;
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2176
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2177 LDR r1,Current_Thread @ Pickup current thread ptr address
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2178
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2179 @ Clear the current thread control block.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2180 @ TCD_Current_Thread = NU_NULL;
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2181
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2182 LDR r3,Slice_State @ Pickup time slice state address
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2183 STR r2,[r1, #0] @ Set current thread pointer to
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2184 @ NU_NULL
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2185
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
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
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2187 @ slice into the current time slice field of the task's control block.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2188 @ if (TMD_Time_Slice_State == 0)
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2189 @ {
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2190
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2191 LDR r1,[r3, #0] @ Pickup time slice state flag
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2192 CMP r1,#0 @ Compare with active value
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2193 BNE TCT_No_Stop_TS_4 @ If non-active, don't disable
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2194
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2195 @ Insure that the next time the task runs it gets a fresh time
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2196 @ slice.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2197 @ REG_Thread_Ptr -> tc_cur_time_slice = REG_Thread_Ptr -> tc_time_slice;
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2198
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2199 LDR r1,[r0, #0x40] @ Pickup original time slice
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2200
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2201 @ Clear any active time slice by setting the state to NOT_ACTIVE.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2202 @ TMD_Time_Slice_State = 1;
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2203
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2204 MOV r2,#1 @ Build disable value
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2205 STR r2,[r3, #0] @ Disable time slice
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2206 STR r1,[r0, #0x20] @ Reset current time slice
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2207
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2208 @ }
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2209 TCT_No_Stop_TS_4:
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2210
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2211 @ Save off the current stack pointer in the control block.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2212 @ REG_Thread_Ptr -> tc_stack_pointer = (VOID *) REG_Stack_Ptr;
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2213
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2214 STR r13,[r0, #0x2c] @ Save the thread's stack pointer
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2215
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2216 @ Switch to the system stack.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2217 @ TCD_System_Stack = (VOID *) REG_Stack_Ptr;
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2218
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2219 LDR r1,System_Stack @ Pickup address of stack pointer
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2220 LDR r2,System_Limit @ Pickup address of stack limit ptr
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2221 LDR r13,[r1, #0] @ Switch to system stack
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2222 LDR r10,[r2, #0] @ Setup system stack limit
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2223
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2224 @ Transfer control to the specified thread directly.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2225 @ TCT_Control_To_Thread(thread);
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2226
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2227 LDR r2,Int_Level @ Pickup address of interrupt level
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2228 MRS r1,CPSR @ Pickup current CPSR
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2229 LDR r3,[r2, #0] @ Pickup interrupt lockout level
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2230 BIC r1,r1,#LOCK_MSK @ Clear lockout bits
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2231 ORR r1,r1,r3 @ Build new interrupt lockout
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2232 MOV r0,r4 @ Indicate thread to schedule
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2233 MSR CPSR,r1 @ Setup CPSR appropriately
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2234 ORR r1,r1,#LOCKOUT @ Build lockout value again
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2235 MSR CPSR,r1 @ Lockout interrupts again
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2236 B TCT_Control_To_Thread @ Schedule the thread indirectly
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2237 @}
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2238
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2239 /*
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2240 ************************************************************************
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2241 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2242 * FUNCTION
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2243 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2244 * TCT_Interrupt_Context_Save
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2245 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2246 * DESCRIPTION
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2247 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2248 * This function saves the interrupted thread's context. Nested
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2249 * interrupts are also supported. If a task or HISR thread was
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2250 * interrupted, the stack pointer is switched to the system stack
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2251 * after the context is saved.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2252 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2253 * CALLED BY
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2254 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2255 * Application ISRs Assembly language ISRs
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2256 * INT_Interrupt_Shell Interrupt handler shell
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2257 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2258 * CALLS
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2259 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2260 * None
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2261 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2262 * INPUTS
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2263 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2264 * vector Interrupt's vector number
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2265 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2266 * OUTPUTS
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2267 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2268 * None
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2269 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2270 * HISTORY
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2271 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2272 * NAME DATE REMARKS
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2273 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2274 * W. Lamie 02-15-1994 Created initial version 1.0
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2275 * D. Lamie 02-15-1994 Verified version 1.0
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2276 * D. Driscoll 01-04-2002 Released version 1.13.3.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2277 * Updated to handle nested /
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2278 * prioritized IRQs
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2279 ************************************************************************
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2280 */
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2281
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2282 @VOID TCT_Interrupt_Context_Save(INT vector)
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2283 @{
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2284
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2285 .globl TCT_Interrupt_Context_Save
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2286 TCT_Interrupt_Context_Save:
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2287 @ Determine if this is a nested interrupt.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2288 LDR r1,Int_Count @ Pickup address of interrupt count
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2289 LDR r2,[r1, #0] @ Pickup interrupt counter
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2290 ADD r2,r2,#1 @ Add 1 to interrupt counter
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2291 STR r2,[r1, #0] @ Store new interrupt counter value
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2292 CMP r2,#1 @ Is it nested?
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2293 BEQ TCT_Not_Nested_Save @ No
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2294
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2295 @ Nested interrupt. Save complete context on the current stack.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2296 TCT_Nested_Save:
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2297
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2298 /* No longer needed in the FreeCalypso version, as we can use r0 instead. */
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2299 #if 0
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
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
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2301 STMDB r13!,{r5}
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2302 #endif
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2303
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2304 @ 2. Save the necessary exception registers into r1-r3
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2305 MOV r1,r13 @ Put the exception r13 into r1
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2306 MOV r2,r14 @ Move the return address for the caller
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2307 @ of this function into r2
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2308 MRS r3,spsr @ Put the exception spsr into r3
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2309
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2310 @ 3. Adjust the exception stack pointer for future exceptions
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2311 ADD r13,r13,#20 @ r13 reset to pre-interrupt value
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2312
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2313 @ 4. Switch CPU modes to save context on system stack
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2314 MRS r0,CPSR @ Pickup the current CPSR
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2315 BIC r0,r0,#MODE_MASK @ Clear the mode bits
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2316
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2317 ORR r0,r0,#SUP_MODE @ Change to supervisor mode (SVD)
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2318
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2319 MSR CPSR,r0 @ Switch modes (IRQ->SVC)
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2320
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
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.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2322 @ FreeCalyspo: using r0 instead
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2323 MOV r0,r13
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2324
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2325 @ 6. Save the exception return address on the stack (r15).
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2326 STMDB r0!,{r4}
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2327
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2328 @ 7. Save r5-r14 on stack (used to be r6-r14)
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2329 STMDB r0!,{r5-r14}
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2330
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2331 @ 8. Switch back to using r13 now that the original r13 has been saved.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2332 MOV r13,r0
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2333
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2334 /* no longer relevant */
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2335 #if 0
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2336 @ 9. Get r5 and exception enable registers off of exception stack and
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2337 @ save r5 (stored in r4) back to the system stack.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2338 LDMIA r1!,{r4-r5}
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2339 STMDB r13!,{r4}
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2340 MOV r4,r5 @ Put exception enable value into r4
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2341 #endif
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2342
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2343 @ 10. Get the rest of the registers off the exception stack and
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2344 @ save them onto the system stack.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2345 LDMIA r1!,{r5-r8,r11} @ Get r0-r4 off exception stack
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2346 STMDB r13!,{r5-r8,r11} @ Put r0-r4 on system stack
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2347
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2348 /* no longer relevant */
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2349 #if 0
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2350 @ 11. Store the exception enable value back on the exception stack.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2351 STMDB r1,{r4}
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2352 #endif
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2353
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2354 @ 12. Save the SPSR on the system stack (CPSR)
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2355 STMDB r13!,{r3}
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2356
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2357 /* TI's approach to interrupt handling does not support re-enabling here */
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2358 #if 0
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2359 @ 13. Re-enable interrupts
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2360 MRS r1,CPSR
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2361 BIC r1,r1,#(IRQ_BIT_OR_FIQ_BIT)
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2362 MSR CPSR,r1
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2363 #endif
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2364
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2365 BX r2 @ Return to calling ISR
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2366 @ }
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2367 @ else
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2368 @ {
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2369 TCT_Not_Nested_Save:
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2370
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2371 @ Determine if a thread was interrupted.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2372 @ if (TCD_Current_Thread)
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2373 @ {
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2374
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2375 LDR r1,Current_Thread @ Pickup current thread ptr address
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2376 LDR r1,[r1, #0] @ Pickup the current thread pointer
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2377 CMP r1,#0 @ Is it NU_NULL?
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2378 BEQ TCT_Idle_Context_Save @ If no, no real save is necessary
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2379
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2380
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2381 @ Yes, a thread was interrupted. Save complete context on the
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2382 @ thread's stack.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2383
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2384 /* No longer needed in the FreeCalypso version, as we can use r0 instead. */
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2385 #if 0
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
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
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2387 STMDB r13!,{r5}
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2388 #endif
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2389
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2390 @ 2. Save the necessary exception registers into r1-r3
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2391 MOV r1,r13 @ Put the exception r13 into r1
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2392 MOV r2,r14 @ Move the return address for the caller
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2393 @ of this function into r2
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2394 MRS r3,spsr @ Put the exception spsr into r3
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2395
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2396 @ 3. Adjust the exception stack pointer for future exceptions
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2397 ADD r13,r13,#20 @ r13 reset to pre-interrupt value
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2398
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2399 @ 4. Switch CPU modes to save context on system stack
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2400 MRS r0,CPSR @ Pickup the current CPSR
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2401 BIC r0,r0,#MODE_MASK @ Clear the mode bits
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2402
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2403 ORR r0,r0,#SUP_MODE @ Change to supervisor mode (SVD)
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2404
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2405 MSR CPSR,r0 @ Switch modes (IRQ->SVC)
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2406
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
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.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2408 @ FreeCalyspo: using r0 instead
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2409 MOV r0,r13
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2410
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2411 @ 6. Save the exception return address on the stack (r15).
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2412 STMDB r0!,{r4}
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2413
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2414 @ 7. Save r5-r14 on stack (used to be r6-r14)
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2415 STMDB r0!,{r5-r14}
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2416
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2417 @ 8. Switch back to using r13 now that the original r13 has been saved.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2418 MOV r13,r0
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2419
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2420 /* no longer relevant */
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2421 #if 0
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2422 @ 9. Get r5 and exception enable registers off of exception stack and
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2423 @ save r5 (stored in r4) back to the system stack.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2424 LDMIA r1!,{r4-r5}
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2425 STMDB r13!,{r4}
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2426 MOV r4,r5 @ Put exception enable value into r4
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2427 #endif
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2428
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2429 @ 10. Get the rest of the registers off the exception stack and
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2430 @ save them onto the system stack.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2431 LDMIA r1!,{r5-r8,r11} @ Get r0-r4 off exception stack
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2432 STMDB r13!,{r5-r8,r11} @ Put r0-r4 on system stack
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2433
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2434 /* no longer relevant */
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2435 #if 0
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2436 @ 11. Store the exception enable value back on the exception stack.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2437 STMDB r1,{r4}
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2438 #endif
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2439
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2440 @ 12. Save the SPSR on the system stack (CPSR)
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2441 STMDB r13!,{r3}
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2442
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2443 @ 13. Save stack type to the task stack (1=interrupt stack)
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2444 MOV r1,#1 @ Interrupt stack type
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2445 STMDB r13!,{r1}
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2446
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2447 @ Save the thread's stack pointer in the control block.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2448 @ REG_Thread_Ptr = (TC_TCB *) TCD_Current_Thread
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2449 @ REG_Thread_Ptr -> tc_stack_pointer = (VOID *) REG_Stack_Ptr
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2450
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2451 LDR r1,Current_Thread @ Pickup current thread ptr address
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2452 LDR r3,[r1, #0] @ Pickup current thread pointer
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2453 STR r13,[r3, #TC_STACK_POINTER] @ Save stack pointer
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2454
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2455 @ Switch to the system stack.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2456 @ REG_Stack_Ptr = TCD_System_Stack
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2457
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2458 LDR r1,System_Stack @ Pickup address of stack pointer
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2459 LDR r3,System_Limit @ Pickup address of stack limit ptr
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2460 LDR r13,[r1, #0] @ Switch to system stack
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2461 LDR r10,[r3, #0] @ Setup system stack limit
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2462
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2463 /* TI's approach to interrupt handling does not support re-enabling here */
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2464 #if 0
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2465 @ Re-enable interrupts
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2466 MRS r1,CPSR
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2467 BIC r1,r1,#(IRQ_BIT_OR_FIQ_BIT)
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2468 MSR CPSR,r1
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2469 #endif
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2470
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2471 @ Return to caller ISR.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2472
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2473 BX r2 @ Return to caller ISR
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2474
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2475 @ }
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2476
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2477 TCT_Idle_Context_Save:
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2478
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2479 MOV r2,r14 @ Save r14 in r2
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2480 @ LDR r3,[r13] @ Get exception enable value from stack
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2481 ADD r13,r13,#20 @ Adjust exception r13 for future interrupts
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2482 @ STR r3,[r13] @ Put exception enable value back on stack
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2483
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2484 MRS r1,CPSR @ Pickup current CPSR
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2485 BIC r1,r1,#MODE_MASK @ Clear the current mode
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2486 @ BIC r1,r1,#(IRQ_BIT_OR_FIQ_BIT) @ Re-enable interrupts
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2487
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2488 ORR r1,r1,#SUP_MODE @ Prepare to switch to supervisor
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2489 @ mode (SVC)
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2490 MSR CPSR,r1 @ Switch to supervisor mode (SVC)
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2491
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2492 BX r2 @ Return to caller ISR
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2493
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2494 @ }
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2495 @}
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2496
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2497 /*
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2498 ************************************************************************
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2499 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2500 * FUNCTION
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2501 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2502 * TCT_Interrupt_Context_Restore
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2503 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2504 * DESCRIPTION
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2505 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2506 * This function restores the interrupt context if a nested
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2507 * interrupt condition is present. Otherwise, this routine
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2508 * transfers control to the scheduling function.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2509 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2510 * CALLED BY
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2511 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2512 * Application ISRs Assembly language ISRs
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2513 * INT_Interrupt_Shell Interrupt handler shell
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2514 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2515 * CALLS
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2516 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2517 * TCT_Schedule Thread scheduling function
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2518 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2519 * INPUTS
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2520 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2521 * None
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2522 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2523 * OUTPUTS
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2524 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2525 * None
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2526 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2527 * HISTORY
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2528 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2529 * NAME DATE REMARKS
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2530 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2531 * W. Lamie 02-15-1994 Created initial version 1.0
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2532 * D. Lamie 02-15-1994 Verified version 1.0
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2533 * D. Driscoll 01-04-2002 Released version 1.13.3.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2534 * Updated to handle nested /
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2535 * prioritized IRQs
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2536 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2537 ************************************************************************
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2538 */
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2539
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2540 @VOID TCT_Interrupt_Context_Restore(void)
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2541 @{
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2542
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2543 .globl TCT_Interrupt_Context_Restore
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2544 TCT_Interrupt_Context_Restore:
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2545 @ It is assumed that anything pushed on the stack by ISRs has been
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2546 @ removed upon entry into this routine.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2547
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2548 @ Decrement and check for nested interrupt conditions.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2549 @ if (--TCD_Interrupt_Count)
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2550 @ {
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2551
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2552 LDR r1,Int_Count @ Pickup address of interrupt count
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2553 LDR r2,[r1, #0] @ Pickup interrupt counter
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2554 SUB r2,r2,#1 @ Decrement interrupt counter
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2555 STR r2,[r1, #0] @ Store interrupt counter
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2556 CMP r2,#0
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2557 BEQ TCT_Not_Nested_Restore
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2558
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2559 @ Restore previous context.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2560
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2561 LDR r1,[r13], #4 @ Pickup the saved CPSR
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2562
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2563 MSR SPSR,r1 @ Place into saved SPSR
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2564 LDMIA r13,{r0-r15}^ @ Return to the point of interrupt
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2565
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2566 @ }
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2567 @ else
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2568 @ {
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2569
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2570 TCT_Not_Nested_Restore:
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2571
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2572 @ Determine if a thread is active.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2573 @ if (TCD_Current_Thread)
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2574 @ {
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2575
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2576 LDR r1,Current_Thread @ Pickup current thread ptr address
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2577 LDR r0,[r1, #0] @ Pickup current thread pointer
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2578 CMP r0,#0 @ Determine if a thread is active
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2579 BEQ TCT_Idle_Context_Restore @ If not, idle system restore
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2580
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2581 @ Clear the current thread pointer.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2582 @ TCD_Current_Thread = NU_NULL
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2583
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2584 MOV r2,#0 @ Build NU_NULL value
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2585 STR r2,[r1, #0] @ Set current thread ptr to NU_NULL
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2586
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2587 @ Determine if a time slice is active. If so, the remaining
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2588 @ time left on the time slice must be saved in the task's
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2589 @ control block.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2590 @ if (TMD_Time_Slice_State == 0)
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2591 @ {
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2592
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2593 LDR r3,Slice_State @ Pickup time slice state address
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2594 LDR r1,[r3, #0] @ Pickup time slice state
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2595 CMP r1,#0 @ Determine if time slice active
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2596 BNE TCT_Idle_Context_Restore @ If not, skip time slice reset
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2597
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2598 @ Pickup the remaining portion of the time slice and save it
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2599 @ in the task's control block.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2600 @ REG_Thread_Ptr -> tc_cur_time_slice = TMD_Time_Slice
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2601 @ TMD_Time_Slice_State = 1
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2602
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2603 LDR r2,Time_Slice @ Pickup address of time slice left
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2604 MOV r1,#1 @ Build disable time slice value
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2605 LDR r2,[r2, #0] @ Pickup remaining time slice
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2606 STR r1,[r3, #0] @ Disable time slice
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2607 STR r2,[r0, #TC_CUR_TIME_SLICE] @ Store remaining time slice
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2608
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2609 @ }
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2610 @ }
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2611 TCT_Idle_Context_Restore:
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2612
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2613 @ Reset the system stack pointer.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2614 LDR r1,System_Stack @ Pickup address of stack pointer
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2615 LDR r2,System_Limit @ Pickup address of stack limit ptr
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2616 LDR r13,[r1, #0] @ Switch to system stack
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2617 LDR r10,[r2, #0] @ Setup system stack limit
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2618
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2619 @ Return to scheduler.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2620
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2621 B TCT_Schedule @ Return to scheduling loop
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2622
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2623 @ }
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2624 @}
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2625
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2626 /*
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2627 ************************************************************************
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2628 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2629 * FUNCTION
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2630 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2631 * TCT_Activate_HISR
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2632 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2633 * DESCRIPTION
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2634 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2635 * This function activates the specified HISR. If the HISR is
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2636 * already activated, the HISR's activation count is simply
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2637 * incremented. Otherwise, the HISR is placed on the appropriate
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2638 * HISR priority list in preparation for execution.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2639 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2640 * CALLED BY
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2641 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2642 * Application LISRs
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2643 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2644 * CALLS
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2645 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2646 * None
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2647 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2648 * INPUTS
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2649 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2650 * hisr Pointer to HISR to activate
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2651 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2652 * OUTPUTS
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2653 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2654 * NU_SUCCESS Successful completion
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2655 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2656 * HISTORY
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2657 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2658 * NAME DATE REMARKS
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2659 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2660 * W. Lamie 02-15-1994 Created initial version 1.0
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2661 * D. Lamie 02-15-1994 Verified version 1.0
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2662 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2663 ************************************************************************
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2664 */
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2665
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2666 @STATUS TCT_Activate_HISR(TC_HCB *hisr)
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2667 @{
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2668
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2669 .globl TCT_Activate_HISR
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2670 TCT_Activate_HISR:
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2671
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2672 @INT priority;
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2673
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2674
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2675 @ Lockout interrupts.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2676
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2677 STR r4,[r13, #-4]! @ Save r4
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2678 MRS r4,CPSR @ Pickup current CPSR
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2679 ORR r1,r4,#LOCKOUT @ Build interrupt lockout value
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2680 MSR CPSR,r1 @ Lockout interrupts
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2681
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2682 @ Determine if the HISR is already active.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2683 @ if (hisr -> tc_activation_count)
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2684 @ {
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2685
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2686 LDR r1,[r0,#0x40] @ Pickup current activation count
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2687 CMP r1,#0 @ Is it the first activation?
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2688 BEQ TCT_First_Activate @ Yes, place it on the correct list
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2689
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2690 @ Increment the activation count. Make sure that it does not go
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2691 @ to zero.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2692 @ hisr -> tc_activation_count++;
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2693
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2694 ADDS r1,r1,#1 @ Increment the activation count
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2695 STR r1,[r0,#0x40] @ Store new activation count
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2696
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2697 @ if (hisr -> tc_activation_count == 0)
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2698
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2699 @ hisr -> tc_activation_count = 0xFFFFFFFFUL;
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2700
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2701 MVNEQ r1,#0 @ If counter rolled-over reset
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2702 STREQ r1,[r0,#0x40] @ Store all ones count
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2703 B TCT_Activate_Done @ Finished with activation
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2704 @ }
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2705 @ else
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2706 @ {
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2707 TCT_First_Activate:
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2708
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2709
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2710 @ Set the activation count to 1.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2711 @ hisr -> tc_activation_count = 1;
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2712
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2713 MOV r1,#1 @ Initial activation count
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2714 STR r1,[r0,#0x40] @ Store initial activation count
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2715
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2716 @ Pickup the HISR's priority.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2717 @ priority = hisr -> tc_priority;
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2718
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2719 @ Determine if there is something in the given priority list.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2720 @ if (TCD_Active_HISR_Tails[priority])
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2721 @ {
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2722
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2723 LDRB r1,[r0,#0x1a] @ Pickup priority of HISR
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2724 LDR r2,HISR_Tails @ Pickup tail pointer base
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2725 LDR r3,[r2,r1,LSL #2] @ Pickup tail pointer for priority
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2726 CMP r3,#0 @ Is this first HISR at priority?
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2727 BEQ TCT_First_HISR @ No, append to end of HISR list
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2728
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2729 @ Something is already on this list. Add after the tail.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2730 @ (TCD_Active_HISR_Tails[priority]) -> tc_active_next = hisr;
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2731 @ TCD_Active_HISR_Tails[priority] = hisr;
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2732
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2733 STR r0,[r3,#0x3c] @ Setup the active next pointer
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2734 STR r0,[r2,r1,LSL #2] @ Setup the tail pointer
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2735 B TCT_Activate_Done @ Finished with activate processing
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2736 @ }
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2737 @ else
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2738 @ {
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2739 TCT_First_HISR:
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2740
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2741 @ Nothing is on this list.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2742 @ TCD_Active_HISR_Heads[priority] = hisr;
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2743 @ TCD_Active_HISR_Tails[priority] = hisr;
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2744
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2745 LDR r3,HISR_Heads @ Pickup address of head pointers
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2746 STR r0,[r2,r1,LSL #2] @ Set tail pointer to this HISR
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2747 STR r0,[r3,r1,LSL #2] @ Set head pointer to this HISR
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2748
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2749 @ Determine the highest priority HISR.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2750 @ if (TCD_Active_HISR_Heads[0])
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2751 @ TCD_Execute_HISR = TCD_Active_HISR_Heads[0];
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2752 @ else if (TCD_Active_HISR_Heads[1])
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2753 @ TCD_Execute_HISR = TCD_Active_HISR_Heads[1];
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2754 @ else
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2755 @ TCD_Execute_HISR = TCD_Active_HISR_Heads[2];
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2756
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2757 LDR r1,[r3,#0] @ Pickup priority 0 head pointer
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2758 LDR r0,Execute_HISR @ Build address to execute HISR ptr
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2759 CMP r1,#0 @ Is priority 0 active?
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2760 LDREQ r1,[r3,#4] @ If not, pickup priority 1 head
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2761 CMPEQ r1,#0 @ Is priority 1 active?
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2762 LDREQ r1,[r3,#8] @ Else, must be priority 2 active
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2763 STR r1,[r0,#0] @ Store which ever priority is the
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2764 @ active one
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2765 @ }
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2766 @ }
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2767 TCT_Activate_Done:
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2768
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2769 MSR CPSR,r4 @ Restore interrupt lockout
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2770 LDR r4,[r13], #4 @ Restore corrupted r4
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2771
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2772 @ return(NU_SUCCESS);
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2773
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2774 MOV r0,#0 @ Always return NU_SUCCESS
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2775
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2776 BX r14 @ Return to caller
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2777
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2778 @}
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2779
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2780 /*
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2781 ************************************************************************
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2782 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2783 * FUNCTION
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2784 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2785 * TCT_HISR_Shell
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2786 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2787 * DESCRIPTION
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2788 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2789 * This function is the execution shell of each and every HISR. If
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2790 * the HISR has completed its processing, this shell routine exits
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2791 * back to the system. Otherwise, it sequentially calls the HISR
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2792 * routine until the activation count goes to zero.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2793 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2794 * CALLED BY
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2795 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2796 * HISR Scheduling
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2797 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2798 * CALLS
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2799 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2800 * hisr -> tc_entry Actual entry function of HISR
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2801 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2802 * INPUTS
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2803 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2804 * None
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2805 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2806 * OUTPUTS
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2807 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2808 * None
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2809 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2810 * HISTORY
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2811 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2812 * NAME DATE REMARKS
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2813 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2814 * W. Lamie 02-15-1994 Created initial version 1.0
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2815 * D. Lamie 02-15-1994 Verified version 1.0
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2816 *
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2817 ************************************************************************
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2818 */
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2819
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2820 @VOID TCT_HISR_Shell(void)
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2821 @{
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2822 .globl TCT_HISR_Shell
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2823 TCT_HISR_Shell:
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2824
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2825 @ Point at the HISR.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2826 @ REG_HISR_Ptr = (TC_HCB *) TCD_Current_Thread;
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2827
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2828 LDR r0,Current_Thread @ Build address of thread pointer
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2829 LDR r5,[r0, #0] @ Pickup control block pointer
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2830
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2831 @ do
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2832 @ {
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2833 TCT_HISR_Loop:
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2834
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2835 @ Call the HISR's entry routine.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2836 @ (*(REG_HISR_Ptr -> tc_entry)) ();
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2837
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2838 /* old TMS470 code:
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2839
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2840 .if THUMB = 0
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2841
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2842 MOV r14,r15 ; Setup return value
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2843 LDR r15,[r5,#44h] ; Call HISR entry function
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2844 .else
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2845 LDR r4,[r5,#44h] ; Get HISR entry function
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2846 TST r4,#1 ; See if calling Thumb or ARM
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2847 BNE Thumbsec
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2848 MOV r14,r15 ; Setup return value
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2849 BX r4
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2850 B ARMCODE
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2851 Thumbsec:
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2852 ADD r14, r15, #1
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2853 BX r4
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2854 .state16
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2855 ThumbAfterHisr
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2856 MOV r1, r15
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2857 BX r1
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2858 .state32
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2859 .endif
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2860 */
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2861
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2862 /* new code for the GNU style of ARM/Thumb interworking */
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2863 ldr r4, [r5, #TC_HISR_ENTRY]
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2864 mov lr, pc
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2865 bx r4
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2866
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2867 @ Lockout interrupts.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2868
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2869 MRS r1,CPSR @ Pickup current CPSR
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2870 ORR r1,r1,#LOCKOUT @ Build interrupt lockout
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2871 MSR CPSR,r1 @ Lockout interrupts
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2872
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2873 @ On return, decrement the activation count and check to see if
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2874 @ it is 0. Once it reaches 0, the HISR should be made inactive.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2875 @ REG_HISR_Ptr -> tc_activation_count--;
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2876
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2877
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2878 LDR r0,[r5, #0x40] @ Pickup current activation count
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2879 SUBS r0,r0,#1 @ Subtract and set condition codes
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2880 STR r0,[r5, #0x40] @ Store new activation count
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2881 BEQ TCT_HISR_Finished @ Finished processing HISR
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2882
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2883 @ Restore interrupts.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2884
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2885 LDR r2,Int_Level @ Pickup address of interrupt level
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2886 MRS r1,CPSR @ Pickup current CPSR
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2887 LDR r3,[r2, #0] @ Pickup interrupt lockout level
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2888 BIC r1,r1,#LOCK_MSK @ Clear lockout bits
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2889 ORR r1,r1,r3 @ Build new interrupt lockout
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2890 MSR CPSR,r1 @ Setup CPSR appropriately
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2891 B TCT_HISR_Loop @ Return to HISR loop
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2892 @ }
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2893 @ while (REG_HISR_Ptr -> tc_activation_count);
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2894
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2895 TCT_HISR_Finished:
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2896
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2897 @ At this point, the HISR needs to be made inactive.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2898
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2899 @ Determine if this is the only HISR on the given priority list.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2900 @ if (REG_HISR_Ptr == TCD_Active_HISR_Tails[REG_HISR_Ptr -> tc_priority])
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2901 @ {
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2902
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2903 LDR r14,HISR_Tails @ Pickup tail pointers address
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2904 LDRB r3,[r5,#0x1a] @ Pickup priority
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2905 LDR r6,[r14,r3,LSL #2] @ Pickup this priority tail pointer
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2906 LDR r2,Execute_HISR @ Build address to execute HISR ptr
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2907 MOV r12,#0 @ Clear r12
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2908 LDR r1,HISR_Heads @ Pickup head pointers address
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2909 CMP r6,r5 @ Is this priority tail the same as
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2910 @ the current HISR?
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2911 BNE TCT_More_HISRs @ If not, more HISRs at this
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2912 @ priority
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2913
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2914 @ The only HISR on the list. Clean up the list and check for the
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2915 @ highest priority HISR.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2916 @ TCD_Active_HISR_Heads[REG_HISR_Ptr -> tc_priority] = NU_NULL;
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2917 @ TCD_Active_HISR_Tails[REG_HISR_Ptr -> tc_priority] = NU_NULL;
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2918
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2919 STR r12,[r1,r3,LSL #2] @ Set head pointer to NU_NULL
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2920 STR r12,[r14,r3,LSL #2] @ Set tail pointer to NU_NULL
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2921
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2922 @ Determine the highest priority HISR.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2923 @ if (TCD_Active_HISR_Heads[0])
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2924 @ TCD_Execute_HISR = TCD_Active_HISR_Heads[0];
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2925 @ else if (TCD_Active_HISR_Heads[1])
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2926 @ TCD_Execute_HISR = TCD_Active_HISR_Heads[1];
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2927 @ else
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2928 @ TCD_Execute_HISR = TCD_Active_HISR_Heads[2];
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2929
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2930 LDR r3,[r1,#0] @ Pickup priority 0 head pointer
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2931 CMP r3,#0 @ Is there an HISR active?
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2932 LDREQ r3,[r1,#4] @ If not, pickup priority 1 pointer
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2933 CMPEQ r3,#0 @ Is there an HISR active?
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2934 LDREQ r3,[r1,#8] @ If not, pickup priority 2 pointer
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2935 STR r3,[r2,#0] @ Setup execute HISR pointer
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2936 B TCT_HISR_Exit @ Exit HISR processing
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2937 @ }
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2938 @ else
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2939 @ {
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2940
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2941 TCT_More_HISRs:
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2942
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2943 @ Move the head pointer to the next HISR in the list.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2944 @ TCD_Active_HISR_Heads[REG_HISR_Ptr -> tc_priority] =
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2945 @ REG_HISR_Ptr -> tc_active_next;
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2946
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2947 @ Also set the TCD_Execute_HISR pointer.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2948 @ TCD_Execute_HISR = REG_HISR_Ptr -> tc_active_next;
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2949
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2950 LDR r14,[r5,#0x3c] @ Pickup next HISR to activate
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2951 STR r14,[r1,r3,LSL #2] @ Setup new head pointer
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2952 STR r14,[r2, #0] @ Setup execute HISR pointer
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2953 @ }
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2954
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2955 TCT_HISR_Exit:
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2956
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2957 @ Build fake return to the top of this loop. The next time the HISR
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2958 @ is activated, it will return to the top of this function.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2959
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2960 LDR r14,HISR_Shell @ Pickup address of shell entry
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2961 STMDB r13!,{r4-r12,r14} @ Save minimal context of thread on
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2962 @ the current stack
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2963 MOV r2,#0 @ Build solicited stack type value
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2964 @ and NU_NULL value
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2965 #if 1 /* was .if THUMB */
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2966 STR r2,[r13, #-4]! @ Save state mask
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2967 #endif
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2968 STR r2,[r13, #-4]! @ Place it on the top of the stack
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2969
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2970 @ Clear the current thread control block.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2971 @ TCD_Current_Thread = NU_NULL;
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2972
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2973 LDR r1,Current_Thread @ Pickup current thread ptr address
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2974 STR r2,[r1, #0] @ Set current thread pointer to
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2975 @ NU_NULL
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2976
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2977 @ Save off the current stack pointer in the control block.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2978 @ REG_HISR_Ptr -> tc_stack_pointer = (VOID *) REG_Stack_Ptr;
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2979
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2980
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2981 STR r13,[r5, #0x2c] @ Save the thread's stack pointer
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2982
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2983
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2984 @ Switch to the system stack.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2985 @ REG_Stack_Ptr = (BYTE_PTR) TCD_System_Stack;
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2986
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2987 LDR r1,System_Stack @ Pickup address of stack pointer
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2988 LDR r2,System_Limit @ Pickup address of stack limit ptr
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2989 LDR r13,[r1, #0] @ Switch to system stack
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2990 LDR r10,[r2, #0] @ Setup system stack limit
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2991
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2992 @ Transfer control to the main scheduling loop.
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2993
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2994 B TCT_Schedule @ Return to main scheduling loop
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2995 @}
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2996
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2997 /* FreeCalypso addition, used by riviera/rvf/rvf_task.c: */
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2998 .globl INT_Check_IRQ_Mask
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2999 INT_Check_IRQ_Mask:
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
3000 MRS r0,CPSR
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
3001 BX lr
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
3002