FreeCalypso > hg > freecalypso-sw
comparison nuc-fw/nucleus/tc_extr.h @ 79:947b1f473960
beginning of nuc-fw
author | Michael Spacefalcon <msokolov@ivan.Harhan.ORG> |
---|---|
date | Sun, 11 Aug 2013 07:17:25 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
78:2c266d4339ff | 79:947b1f473960 |
---|---|
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_extr.h Nucleus PLUS 1.14 */ | |
17 /* */ | |
18 /* COMPONENT */ | |
19 /* */ | |
20 /* TC - Thread Control */ | |
21 /* */ | |
22 /* DESCRIPTION */ | |
23 /* */ | |
24 /* This file contains function prototypes of all functions */ | |
25 /* accessible to other components. */ | |
26 /* */ | |
27 /* DATA STRUCTURES */ | |
28 /* */ | |
29 /* None */ | |
30 /* */ | |
31 /* FUNCTIONS */ | |
32 /* */ | |
33 /* None */ | |
34 /* */ | |
35 /* DEPENDENCIES */ | |
36 /* */ | |
37 /* tc_defs.h Thread Control constants */ | |
38 /* */ | |
39 /* HISTORY */ | |
40 /* */ | |
41 /* DATE REMARKS */ | |
42 /* */ | |
43 /* 03-01-1993 Created initial version 1.0 */ | |
44 /* 04-19-1993 Verified version 1.0 */ | |
45 /* 03-01-1994 Added validation utility for */ | |
46 /* error checking functions for */ | |
47 /* resume service and resume */ | |
48 /* driver, resulting in */ | |
49 /* version 1.0a */ | |
50 /* 03-01-1994 Verified version 1.0a */ | |
51 /* 03-01-1994 Moved include files outside of */ | |
52 /* the file #ifndef to allow the */ | |
53 /* use of actual data structures, */ | |
54 /* added system protect pseudo */ | |
55 /* function, added set suspend */ | |
56 /* protect pseudo function, */ | |
57 /* added optimization for targets */ | |
58 /* able to access pointers in a */ | |
59 /* single instruction, changed */ | |
60 /* function names due to changes */ | |
61 /* in file structure, resulting */ | |
62 /* in version 1.1 */ | |
63 /* */ | |
64 /* 03-18-1994 Verified version 1.1 */ | |
65 /* */ | |
66 /* 01-24-1996 Corrected a type on line 200: */ | |
67 /* TCT_Control_Interrupts, */ | |
68 /* resulting in version 1.1+ */ | |
69 /* 04-17-1996 updated to version 1.2 */ | |
70 /* 03-24-1998 Released version 1.3 */ | |
71 /* 03-26-1999 Released 1.11m (new release */ | |
72 /* numbering scheme) */ | |
73 /* 04-17-2002 Released version 1.13m */ | |
74 /* 11-07-2002 Released version 1.14 */ | |
75 /*************************************************************************/ | |
76 | |
77 #include "tc_defs.h" /* Include TC constants */ | |
78 | |
79 | |
80 /* Check to see if the file has been included already. */ | |
81 | |
82 #ifndef TC_EXTR | |
83 #define TC_EXTR | |
84 | |
85 | |
86 /* Define external reference for the system protection. */ | |
87 | |
88 extern TC_PROTECT TCD_System_Protect; | |
89 extern VOID *TCD_Current_Thread; | |
90 | |
91 | |
92 /* Initialization functions. */ | |
93 | |
94 VOID TCI_Initialize(VOID); | |
95 | |
96 | |
97 /* Core error checking functions. */ | |
98 | |
99 #ifndef NU_NO_ERROR_CHECKING | |
100 BOOLEAN TCC_Validate_Resume(OPTION resume_type, NU_TASK *task_ptr); | |
101 #endif | |
102 | |
103 STATUS TCCE_Activate_HISR(NU_HISR *hisr_ptr); | |
104 STATUS TCCE_Create_Task(NU_TASK *task_ptr, CHAR *name, | |
105 VOID (*task_entry)(UNSIGNED, VOID *), UNSIGNED argc, | |
106 VOID *argv, VOID *stack_address, UNSIGNED stack_size, | |
107 OPTION priority, UNSIGNED time_slice, | |
108 OPTION preempt, OPTION auto_start); | |
109 STATUS TCCE_Reset_Task(NU_TASK *task_ptr, UNSIGNED argc, VOID *argv); | |
110 STATUS TCCE_Create_HISR(NU_HISR *hisr_ptr, CHAR *name, | |
111 VOID (*hisr_entry)(VOID), OPTION priority, | |
112 VOID *stack_address, UNSIGNED stack_size); | |
113 STATUS TCCE_Terminate_Task(NU_TASK *task_ptr); | |
114 STATUS TCCE_Delete_Task(NU_TASK *task_ptr); | |
115 STATUS TCCE_Delete_HISR(NU_HISR *hisr_ptr); | |
116 STATUS TCCE_Resume_Service(NU_TASK *task_ptr); | |
117 STATUS TCCE_Suspend_Service(NU_TASK *task_ptr); | |
118 VOID TCCE_Relinquish(VOID); | |
119 VOID TCCE_Task_Sleep(UNSIGNED ticks); | |
120 STATUS TCCE_Validate_Resume(OPTION resume_type, NU_TASK *task_ptr); | |
121 INT TCCE_Suspend_Error(VOID); | |
122 STATUS TCFE_Task_Information(NU_TASK *task_ptr, CHAR *name, | |
123 DATA_ELEMENT *status, UNSIGNED *scheduled_count, | |
124 DATA_ELEMENT *priority, OPTION *preempt, UNSIGNED *time_slice, | |
125 VOID **stack_base, UNSIGNED *stack_size, | |
126 UNSIGNED *minimum_stack); | |
127 | |
128 | |
129 /* Supplemental error checking functions. */ | |
130 | |
131 OPTION TCSE_Change_Priority(NU_TASK *task_ptr, OPTION new_priority); | |
132 OPTION TCSE_Change_Preemption(OPTION preempt); | |
133 UNSIGNED TCSE_Change_Time_Slice(NU_TASK *task_ptr, UNSIGNED time_slice); | |
134 UNSIGNED TCSE_Control_Signals(UNSIGNED signal_enable_mask); | |
135 UNSIGNED TCSE_Receive_Signals(VOID); | |
136 STATUS TCSE_Register_Signal_Handler(VOID (*signal_handler)(UNSIGNED)); | |
137 STATUS TCSE_Send_Signals(NU_TASK *task_ptr, UNSIGNED signals); | |
138 | |
139 | |
140 /* Core processing functions. */ | |
141 | |
142 STATUS TCT_Activate_HISR(NU_HISR *hisr_ptr); | |
143 STATUS TCC_Create_Task(NU_TASK *task_ptr, CHAR *name, | |
144 VOID (*task_entry)(UNSIGNED, VOID *), UNSIGNED argc, | |
145 VOID *argv, VOID *stack_address, UNSIGNED stack_size, | |
146 OPTION priority, UNSIGNED time_slice, | |
147 OPTION preempt, OPTION auto_start); | |
148 STATUS TCC_Reset_Task(NU_TASK *task_ptr, UNSIGNED argc, VOID *argv); | |
149 STATUS TCC_Create_HISR(NU_HISR *hisr_ptr, CHAR *name, | |
150 VOID (*hisr_entry)(VOID), OPTION priority, | |
151 VOID *stack_address, UNSIGNED stack_size); | |
152 STATUS TCC_Terminate_Task(NU_TASK *task_ptr); | |
153 STATUS TCC_Delete_Task(NU_TASK *task_ptr); | |
154 STATUS TCC_Delete_HISR(NU_HISR *hisr_ptr); | |
155 STATUS TCC_Resume_Task(NU_TASK *task_ptr, OPTION suspend_type); | |
156 STATUS TCC_Resume_Service(NU_TASK *task_ptr); | |
157 VOID TCC_Suspend_Task(NU_TASK *task_ptr, OPTION suspend_type, | |
158 VOID (*cleanup)(VOID *), | |
159 VOID *information, UNSIGNED timeout); | |
160 STATUS TCC_Suspend_Service(NU_TASK *task_ptr); | |
161 VOID TCC_Task_Timeout(NU_TASK *task_ptr); | |
162 VOID TCC_Task_Sleep(UNSIGNED ticks); | |
163 VOID TCC_Relinquish(VOID); | |
164 VOID TCC_Time_Slice(NU_TASK *task_ptr); | |
165 NU_TASK *TCC_Current_Task_Pointer(VOID); | |
166 NU_HISR *TCC_Current_HISR_Pointer(VOID); | |
167 VOID TCC_Dispatch_LISR(INT vector); | |
168 STATUS TCC_Register_LISR(INT vector, VOID (*new_lisr)(INT), | |
169 VOID (**old_lisr)(INT)); | |
170 | |
171 | |
172 /* Supplemental functions. */ | |
173 | |
174 OPTION TCS_Change_Priority(NU_TASK *task_ptr, OPTION new_priority); | |
175 OPTION TCS_Change_Preemption(OPTION preempt); | |
176 UNSIGNED TCS_Change_Time_Slice(NU_TASK *task_ptr, UNSIGNED time_slice); | |
177 UNSIGNED TCS_Control_Signals(UNSIGNED signal_enable_mask); | |
178 UNSIGNED TCS_Receive_Signals(VOID); | |
179 STATUS TCS_Register_Signal_Handler(VOID (*signal_handler)(UNSIGNED)); | |
180 STATUS TCS_Send_Signals(NU_TASK *task, UNSIGNED signals); | |
181 | |
182 | |
183 /* Information retrieval functions. */ | |
184 | |
185 UNSIGNED TCF_Established_Tasks(VOID); | |
186 UNSIGNED TCF_Established_HISRs(VOID); | |
187 STATUS TCF_Task_Information(NU_TASK *task, CHAR *name, | |
188 DATA_ELEMENT *status, UNSIGNED *scheduled_count, | |
189 OPTION *priority, OPTION *preempt, | |
190 UNSIGNED *time_slice, VOID **stack_base, | |
191 UNSIGNED *stack_size, UNSIGNED *minimum_stack); | |
192 STATUS TCF_HISR_Information(NU_HISR *hisr, CHAR *name, | |
193 UNSIGNED *scheduled_count, DATA_ELEMENT *priority, | |
194 VOID **stack_base, UNSIGNED *stack_size, | |
195 UNSIGNED *minimum_stack); | |
196 UNSIGNED TCF_Task_Pointers(NU_TASK **pointer_list, | |
197 UNSIGNED maximum_pointers); | |
198 UNSIGNED TCF_HISR_Pointers(NU_HISR **pointer_list, | |
199 UNSIGNED maximum_pointers); | |
200 | |
201 /* Target dependent functions. */ | |
202 | |
203 UNSIGNED TCT_Check_Stack(VOID); | |
204 VOID TCT_Schedule(VOID); | |
205 VOID TCT_Restore_Interrupts(VOID); | |
206 VOID TCT_Protect(TC_PROTECT *protect); | |
207 VOID TCT_Unprotect(VOID); | |
208 VOID TCT_Unprotect_Specific(TC_PROTECT *protect); | |
209 VOID TCT_Set_Current_Protect(TC_PROTECT *protect); | |
210 VOID TCT_Control_To_System(VOID); | |
211 INT TCT_Control_Interrupts(INT new_level); | |
212 INT TCT_Local_Control_Interrupts(INT new_level); | |
213 | |
214 #ifdef NU_ENABLE_STACK_CHECK | |
215 #define NU_CHECK_STACK() TCT_Check_Stack() | |
216 #else /* no stack checking */ | |
217 #define NU_CHECK_STACK() ((void)0) | |
218 #endif /* NU_ENABLE_STACK_CHECK */ | |
219 | |
220 | |
221 /* Determine if pointers are accessible with a single instruction. If so, | |
222 just reference the pointer directly. Otherwise, call the assembly | |
223 service. */ | |
224 | |
225 #if NU_POINTER_ACCESS == 1 | |
226 extern TC_TCB *TCD_Execute_Task; | |
227 #define TCT_Current_Thread() TCD_Current_Thread | |
228 #define TCT_Set_Execute_Task(task) TCD_Execute_Task = task | |
229 #else | |
230 VOID *TCT_Current_Thread(VOID); | |
231 VOID TCT_Set_Execute_Task(TC_TCB *task); | |
232 #endif | |
233 | |
234 /* Define pseudo function used by internal components of the system. */ | |
235 | |
236 #define TCT_System_Protect() TCT_Protect(&TCD_System_Protect) | |
237 #define TCT_System_Unprotect() \ | |
238 TCT_Unprotect_Specific(&TCD_System_Protect) | |
239 #define TCT_Set_Suspend_Protect(protect) \ | |
240 ((TC_TCB *) TCD_Current_Thread) -> tc_suspend_protect = \ | |
241 (TC_PROTECT *) protect | |
242 #define TCT_Get_Current_Protect() \ | |
243 ((TC_TCB *) TCD_Current_Thread) -> tc_current_protect | |
244 #define TCC_Task_Priority(task) ((TC_TCB *) (task)) -> tc_priority | |
245 #endif | |
246 | |
247 | |
248 | |
249 | |
250 |