comparison src/nucleus/tc_defs.h @ 7:0f80e1e4dce4

src/nucleus: library C code import from FreeNucleus package
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 15 Jul 2018 20:57:33 +0000
parents
children
comparison
equal deleted inserted replaced
6:8b2a9a374324 7:0f80e1e4dce4
1 /*************************************************************************/
2 /* */
3 /* Copyright Mentor Graphics Corporation 2002 */
4 /* All Rights Reserved. */
5 /* */
6 /* THIS WORK CONTAINS TRADE SECRET AND PROPRIETARY INFORMATION WHICH IS */
7 /* THE PROPERTY OF MENTOR GRAPHICS CORPORATION OR ITS LICENSORS AND IS */
8 /* SUBJECT TO LICENSE TERMS. */
9 /* */
10 /*************************************************************************/
11
12 /*************************************************************************/
13 /* */
14 /* FILE NAME VERSION */
15 /* */
16 /* tc_defs.h Nucleus PLUS 1.14 */
17 /* */
18 /* COMPONENT */
19 /* */
20 /* TC - Thread Control */
21 /* */
22 /* DESCRIPTION */
23 /* */
24 /* This file contains data structure definitions and constants for */
25 /* the component that controls the various threads of execution in */
26 /* system. Threads include tasks, HISRs, signal handlers, etc. */
27 /* */
28 /* DATA STRUCTURES */
29 /* */
30 /* TC_TCB Task Control Block */
31 /* TC_HCB HISR Control Block */
32 /* TC_PROTECT Task/HISR protection struct */
33 /* */
34 /* FUNCTIONS */
35 /* */
36 /* None */
37 /* */
38 /* DEPENDENCIES */
39 /* */
40 /* cs_defs.h Common service definitions */
41 /* tm_defs.h Timer control definitions */
42 /* */
43 /* HISTORY */
44 /* */
45 /* DATE REMARKS */
46 /* */
47 /* 03-01-1993 Created initial version 1.0 */
48 /* 04-19-1993 Verified version 1.0 */
49 /* 06-01-1993 Added padding conditional into */
50 /* TC_TCB structure, making */
51 /* version 1.0a */
52 /* 06-01-1993 Verified version 1.0a */
53 /* 03-01-1994 Moved include files outside of */
54 /* the file #ifndef to allow the */
55 /* use of actual data structures, */
56 /* added four reserved words in */
57 /* both the task and HISR blocks, */
58 /* resulting in version 1.1 */
59 /* */
60 /* 03-18-1994 Verified version 1.1 */
61 /* 04-17-1996 updated to version 1.2 */
62 /* 03-24-1998 Released version 1.3 */
63 /* 03-26-1999 Released 1.11m (new release */
64 /* numbering scheme) */
65 /* 04-07-1999 Release 1.11mA */
66 /* 04-17-2002 Released version 1.13m */
67 /* 11-07-2002 Released version 1.14 */
68 /*************************************************************************/
69
70 #include "cs_defs.h" /* Common service constants */
71 #include "tm_defs.h" /* Timer control structures */
72
73
74 /* Check to see if the file has been included already. */
75
76 #ifndef TC_DEFS
77 #define TC_DEFS
78
79
80 /* Define constants local to this component. */
81
82 #define TC_TASK_ID 0x5441534bUL
83 #define TC_HISR_ID 0x48495352UL
84 #define TC_PRIORITIES 256
85 #define TC_HISR_PRIORITIES 3
86 #define TC_MAX_GROUPS (TC_PRIORITIES/8)
87 #define TC_HIGHEST_MASK 0x000000FFUL
88 #define TC_NEXT_HIGHEST_MASK 0x0000FF00UL
89 #define TC_NEXT_LOWEST_MASK 0x00FF0000UL
90 #define TC_LOWEST_MASK 0xFF000000UL
91
92 /* Define the Task Control Block data type. */
93
94 typedef struct TC_TCB_STRUCT
95 {
96 /* Standard thread information first. This information is used by
97 the target dependent portion of this component. Changes made
98 to this area of the structure can have undesirable side effects. */
99
100 CS_NODE tc_created; /* Node for linking to */
101 /* created task list */
102 UNSIGNED tc_id; /* Internal TCB ID */
103 CHAR tc_name[NU_MAX_NAME]; /* Task name */
104 DATA_ELEMENT tc_status; /* Task status */
105 BOOLEAN tc_delayed_suspend; /* Delayed task suspension*/
106 DATA_ELEMENT tc_priority; /* Task priority */
107 BOOLEAN tc_preemption; /* Task preemption enable */
108 UNSIGNED tc_scheduled; /* Task scheduled count */
109 UNSIGNED tc_cur_time_slice; /* Current time slice */
110 VOID *tc_stack_start; /* Stack starting address */
111 VOID *tc_stack_end; /* Stack ending address */
112 VOID *tc_stack_pointer; /* Task stack pointer */
113 UNSIGNED tc_stack_size; /* Task stack's size */
114 UNSIGNED tc_stack_minimum; /* Minimum stack size */
115 struct TC_PROTECT_STRUCT
116 *tc_current_protect; /* Current protection */
117 VOID *tc_saved_stack_ptr; /* Previous stack pointer */
118 UNSIGNED tc_time_slice; /* Task time slice value */
119
120 /* Information after this point is not used in the target dependent
121 portion of this component. Hence, changes in the following section
122 should not impact assembly language routines. */
123 struct TC_TCB_STRUCT
124 *tc_ready_previous, /* Previously ready TCB */
125 *tc_ready_next; /* next and previous ptrs */
126
127 /* Task control information follows. */
128
129 UNSIGNED tc_priority_group; /* Priority group mask bit*/
130 struct TC_TCB_STRUCT
131 **tc_priority_head; /* Pointer to list head */
132 DATA_ELEMENT *tc_sub_priority_ptr; /* Pointer to sub-group */
133 DATA_ELEMENT tc_sub_priority; /* Mask of sub-group bit */
134 DATA_ELEMENT tc_saved_status; /* Previous task status */
135 BOOLEAN tc_signal_active; /* Signal active flag */
136
137 #if PAD_3
138 DATA_ELEMENT tc_padding[PAD_3];
139 #endif
140
141 /* Task entry function */
142 VOID (*tc_entry)(UNSIGNED, VOID *);
143 UNSIGNED tc_argc; /* Optional task argument */
144 VOID *tc_argv; /* Optional task argument */
145 VOID (*tc_cleanup) (VOID *);/* Clean-up routine */
146 VOID *tc_cleanup_info; /* Clean-up information */
147 struct TC_PROTECT_STRUCT
148 *tc_suspend_protect; /* Protection at time of */
149 /* task suspension */
150
151 /* Task timer information. */
152 INT tc_timer_active; /* Active timer flag */
153 TM_TCB tc_timer_control; /* Timer control block */
154
155 /* Task signal control information. */
156
157 UNSIGNED tc_signals; /* Current signals */
158 UNSIGNED tc_enabled_signals; /* Enabled signals */
159
160 /* tc_saved_status and tc_signal_active are now defined above in an
161 attempt to keep DATA_ELEMENT types together. */
162
163 /* Signal handling routine. */
164 VOID (*tc_signal_handler) (UNSIGNED);
165
166 /* Reserved words for the system and a single reserved word for the
167 application. */
168 UNSIGNED tc_system_reserved_1; /* System reserved word */
169 UNSIGNED tc_system_reserved_2; /* System reserved word */
170 UNSIGNED tc_system_reserved_3; /* System reserved word */
171 UNSIGNED tc_app_reserved_1; /* Application reserved */
172
173 /* This information is accessed in assembly */
174 #if ((NU_SUPERV_USER_MODE == 1)||(NU_MODULE_SUPPORT == 1))
175 UNSIGNED tc_su_mode; /* Supervisor/User mode indicator */
176 UNSIGNED tc_module; /* Module identifier */
177 #endif
178
179 } TC_TCB;
180
181
182 /* Define the High-Level Interrupt Service Routine Control Block data type. */
183
184 typedef struct TC_HCB_STRUCT
185 {
186 /* Standard thread information first. This information is used by
187 the target dependent portion of this component. Changes made
188 to this area of the structure can have undesirable side effects. */
189
190 CS_NODE tc_created; /* Node for linking to */
191 /* created task list */
192 UNSIGNED tc_id; /* Internal TCB ID */
193 CHAR tc_name[NU_MAX_NAME]; /* HISR name */
194 DATA_ELEMENT tc_not_used_1; /* Not used field */
195 DATA_ELEMENT tc_not_used_2; /* Not used field */
196 DATA_ELEMENT tc_priority; /* HISR priority */
197 DATA_ELEMENT tc_not_used_3; /* Not used field */
198 UNSIGNED tc_scheduled; /* HISR scheduled count */
199 UNSIGNED tc_cur_time_slice; /* Not used in HISR */
200 VOID *tc_stack_start; /* Stack starting address */
201 VOID *tc_stack_end; /* Stack ending address */
202 VOID *tc_stack_pointer; /* HISR stack pointer */
203 UNSIGNED tc_stack_size; /* HISR stack's size */
204 UNSIGNED tc_stack_minimum; /* Minimum stack size */
205 struct TC_PROTECT_STRUCT
206 *tc_current_protect; /* Current protection */
207 struct TC_HCB_STRUCT
208 *tc_active_next; /* Next activated HISR */
209 UNSIGNED tc_activation_count; /* Activation counter */
210 VOID (*tc_entry)(VOID); /* HISR entry function */
211
212 /* Information after this point is not used in the target dependent
213 portion of this component. Hence, changes in the following section
214 should not impact assembly language routines. */
215
216
217 /* Reserved words for the system and a single reserved word for the
218 application. */
219 UNSIGNED tc_system_reserved_1; /* System reserved word */
220 UNSIGNED tc_system_reserved_2; /* System reserved word */
221 UNSIGNED tc_system_reserved_3; /* System reserved word */
222 UNSIGNED tc_app_reserved_1; /* Application reserved */
223
224 /* This information is accessed in assembly */
225 #if ((NU_SUPERV_USER_MODE == 1)||(NU_MODULE_SUPPORT == 1))
226 UNSIGNED tc_su_mode; /* Supervisor/User mode indicator */
227 UNSIGNED tc_module; /* Module identifier */
228 #endif
229
230 } TC_HCB;
231
232
233 /* Define the Task/HISR protection structure type. */
234
235 typedef struct TC_PROTECT_STRUCT
236 {
237 TC_TCB *tc_tcb_pointer; /* Owner of the protection */
238 UNSIGNED tc_thread_waiting; /* Waiting thread flag */
239 } TC_PROTECT;
240
241 #endif
242
243
244
245