comparison chipsetsw/os/nucleus/tc_defs.h @ 0:509db1a7b7b8

initial import: leo2moko-r1
author Space Falcon <falcon@ivan.Harhan.ORG>
date Mon, 01 Jun 2015 03:24:05 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:509db1a7b7b8
1 /*************************************************************************/
2 /* */
3 /* Copyright (c) 1993-1994 Accelerated Technology, Inc. */
4 /* */
5 /* PROPRIETARY RIGHTS of Accelerated Technology are involved in the */
6 /* subject matter of this material. All manufacturing, reproduction, */
7 /* use, and sales rights pertaining to this subject matter are governed */
8 /* by the license agreement. The recipient of this software implicitly */
9 /* accepts the terms of the license. */
10 /* */
11 /*************************************************************************/
12
13 /*************************************************************************/
14 /* */
15 /* FILE NAME VERSION */
16 /* */
17 /* tc_defs.h PLUS 1.1 */
18 /* */
19 /* COMPONENT */
20 /* */
21 /* TC - Thread Control */
22 /* */
23 /* DESCRIPTION */
24 /* */
25 /* This file contains data structure definitions and constants for */
26 /* the component that controls the various threads of execution in */
27 /* system. Threads include tasks, HISRs, signal handlers, etc. */
28 /* */
29 /* AUTHOR */
30 /* */
31 /* William E. Lamie, Accelerated Technology, Inc. */
32 /* */
33 /* DATA STRUCTURES */
34 /* */
35 /* TC_TCB Task Control Block */
36 /* TC_HCB HISR Control Block */
37 /* TC_PROTECT Task/HISR protection struct */
38 /* */
39 /* FUNCTIONS */
40 /* */
41 /* None */
42 /* */
43 /* DEPENDENCIES */
44 /* */
45 /* cs_defs.h Common service definitions */
46 /* tm_defs.h Timer control definitions */
47 /* */
48 /* HISTORY */
49 /* */
50 /* NAME DATE REMARKS */
51 /* */
52 /* W. Lamie 03-01-1993 Created initial version 1.0 */
53 /* D. Lamie 04-19-1993 Verified version 1.0 */
54 /* W. Lamie 06-01-1993 Added padding conditional into */
55 /* TC_TCB structure, making */
56 /* version 1.0a */
57 /* D. Lamie 06-01-1993 Verified version 1.0a */
58 /* W. Lamie 03-01-1994 Moved include files outside of */
59 /* the file #ifndef to allow the */
60 /* use of actual data structures, */
61 /* added four reserved words in */
62 /* both the task and HISR blocks, */
63 /* resulting in version 1.1 */
64 /* R. Pfaff - */
65 /* D. Lamie 03-18-1994 Verified version 1.1 */
66 /* */
67 /*************************************************************************/
68
69 #include "cs_defs.h" /* Common service constants */
70 #include "tm_defs.h" /* Timer control structures */
71
72
73 /* Check to see if the file has been included already. */
74
75 #ifndef TC_DEFS
76 #define TC_DEFS
77
78
79 /* Define constants local to this component. */
80
81 #define TC_TASK_ID 0x5441534bUL
82 #define TC_HISR_ID 0x48495352UL
83 #define TC_PRIORITIES 256
84 #define TC_HISR_PRIORITIES 3
85 #define TC_MAX_GROUPS TC_PRIORITIES/8
86 #define TC_HIGHEST_MASK 0x000000FFUL
87 #define TC_NEXT_HIGHEST_MASK 0x0000FF00UL
88 #define TC_NEXT_LOWEST_MASK 0x00FF0000UL
89 #define TC_LOWEST_MASK 0xFF000000UL
90
91 /* Define the Task Control Block data type. */
92
93 typedef struct TC_TCB_STRUCT
94 {
95 /* Standard thread information first. This information is used by
96 the target dependent portion of this component. Changes made
97 to this area of the structure can have undesirable side effects. */
98
99 CS_NODE tc_created; /* Node for linking to */
100 /* created task list */
101 UNSIGNED tc_id; /* Internal TCB ID */
102 CHAR tc_name[NU_MAX_NAME]; /* Task name */
103 DATA_ELEMENT tc_status; /* Task status */
104 DATA_ELEMENT tc_delayed_suspend; /* Delayed task suspension*/
105 DATA_ELEMENT tc_priority; /* Task priority */
106 DATA_ELEMENT tc_preemption; /* Task preemption enable */
107 UNSIGNED tc_scheduled; /* Task scheduled count */
108 UNSIGNED tc_cur_time_slice; /* Current time slice */
109 VOID *tc_stack_start; /* Stack starting address */
110 VOID *tc_stack_end; /* Stack ending address */
111 VOID *tc_stack_pointer; /* Task stack pointer */
112 UNSIGNED tc_stack_size; /* Task stack's size */
113 UNSIGNED tc_stack_minimum; /* Minimum stack size */
114 struct TC_PROTECT_STRUCT
115 *tc_current_protect; /* Current protection */
116 VOID *tc_saved_stack_ptr; /* Previous stack pointer */
117 UNSIGNED tc_time_slice; /* Task time slice value */
118
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 DATA_ELEMENT 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 } TC_TCB;
174
175
176 /* Define the High-Level Interrupt Service Routine Control Block data type. */
177
178 typedef struct TC_HCB_STRUCT
179 {
180 /* Standard thread information first. This information is used by
181 the target dependent portion of this component. Changes made
182 to this area of the structure can have undesirable side effects. */
183
184 CS_NODE tc_created; /* Node for linking to */
185 /* created task list */
186 UNSIGNED tc_id; /* Internal TCB ID */
187 CHAR tc_name[NU_MAX_NAME]; /* HISR name */
188 DATA_ELEMENT tc_not_used_1; /* Not used field */
189 DATA_ELEMENT tc_not_used_2; /* Not used field */
190 DATA_ELEMENT tc_priority; /* HISR priority */
191 DATA_ELEMENT tc_not_used_3; /* Not used field */
192 UNSIGNED tc_scheduled; /* HISR scheduled count */
193 UNSIGNED tc_cur_time_slice; /* Not used in HISR */
194 VOID *tc_stack_start; /* Stack starting address */
195 VOID *tc_stack_end; /* Stack ending address */
196 VOID *tc_stack_pointer; /* HISR stack pointer */
197 UNSIGNED tc_stack_size; /* HISR stack's size */
198 UNSIGNED tc_stack_minimum; /* Minimum stack size */
199 struct TC_PROTECT_STRUCT
200 *tc_current_protect; /* Current protection */
201 struct TC_HCB_STRUCT
202 *tc_active_next; /* Next activated HISR */
203
204 /* Information after this point is not used in the target dependent
205 portion of this component. Hence, changes in the following section
206 should not impact assembly language routines. */
207 UNSIGNED tc_activation_count; /* Activation counter */
208 VOID (*tc_entry)(VOID); /* HISR entry function */
209
210 /* Reserved words for the system and a single reserved word for the
211 application. */
212 UNSIGNED tc_system_reserved_1; /* System reserved word */
213 UNSIGNED tc_system_reserved_2; /* System reserved word */
214 UNSIGNED tc_system_reserved_3; /* System reserved word */
215 UNSIGNED tc_app_reserved_1; /* Application reserved */
216
217 } TC_HCB;
218
219
220 /* Define the Task/HISR protection structure type. */
221
222 typedef struct TC_PROTECT_STRUCT
223 {
224 TC_TCB *tc_tcb_pointer; /* Owner of the protection */
225 UNSIGNED tc_thread_waiting; /* Waiting thread flag */
226 } TC_PROTECT;
227
228 #endif