FreeCalypso > hg > tcs211-c139
comparison chipsetsw/riviera/rvm/rvm_i.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 /* */ | |
4 /* Name rvm_i.h */ | |
5 /* */ | |
6 /* Function this file contains the definitions of internal data */ | |
7 /* structures for the RVM */ | |
8 /* */ | |
9 /* */ | |
10 /* Version 0.1 */ | |
11 /* */ | |
12 /* Date Modification */ | |
13 /* ------------------------------------ */ | |
14 /* 20/01/2000 Create */ | |
15 /* */ | |
16 /* Author David Lamy-Charrier (dlamy@tif.ti.com) */ | |
17 /* */ | |
18 /* (C) Copyright 2000 by Texas Instruments Incorporated, All Rights Reserved*/ | |
19 /****************************************************************************/ | |
20 | |
21 #ifndef __RVM_I_H_ | |
22 #define __RVM_I_H_ | |
23 | |
24 #ifndef _WINDOWS | |
25 #include "config/rv.cfg" | |
26 #include "config/debug.cfg" | |
27 #endif | |
28 | |
29 #include "rvf/rvf_api.h" | |
30 #include "rvm/rvm_api.h" | |
31 #include "rvm/rvm_gen.h" | |
32 //#include "rvf/rvf_pool_size.h" | |
33 #include "rvm/rvm_pool_size.h" | |
34 //#include "rv_general.h" //?? | |
35 | |
36 | |
37 /* MSG MUST BE VERIFIED */ | |
38 #define RVM_MSG_OFFSET BUILD_MESSAGE_OFFSET(RVM_USE_ID) | |
39 | |
40 #define RVM_START_T2_MSG (RVM_MSG_OFFSET | 0x001) | |
41 #define RVM_RT_MOD_YIELD_T2_MSG (RVM_MSG_OFFSET | 0x002) | |
42 #define RVM_STOP_MSG (RVM_MSG_OFFSET | 0x003) | |
43 #define RVM_STOP_REQ_MSG (RVM_MSG_OFFSET | 0x004) | |
44 | |
45 | |
46 #define RVM_YIELD_T2_PS_TM 10 | |
47 #define RVM_YIELD_T2_PRI_MSG_CNT 10 | |
48 #define T_RVM_TASK_ID T_RVF_G_ADDR_ID //UINT8 | |
49 #define SYSTEM_TASK_MEM 204 | |
50 | |
51 #define MAX_GRPS MAX_HOSTING_TASKS | |
52 #define MAX_COMPOSITES MAX_PARASITES | |
53 | |
54 /* definitions related to the RVM as a RVF task */ | |
55 #define RVM_EXPECTED_EVENT RVF_TASK_MBOX_0_EVT_MASK | |
56 #define RVM_MAILBOX RVF_TASK_MBOX_0 | |
57 | |
58 #if (defined BLUETOOTH) || (TEST==1) | |
59 #define RVM_MAX_SWE_USING (5) /* max number of SW Entities using another one within a given appli */ | |
60 #else | |
61 #define RVM_MAX_SWE_USING (3) /* max number of SW Entities using another one within a given appli */ | |
62 #endif | |
63 | |
64 | |
65 #define RVM_INVALID_SWE_INDEX (0xff) | |
66 | |
67 extern T_RVF_MB_ID rvm_mem_bank; | |
68 extern T_RVF_MB_ID rvm_sys_mem_bank; | |
69 extern T_RVF_MB_ID rvm_timer_mem_bank; | |
70 extern T_RVF_MB_ID rvm_tm_notify_mem_bank; | |
71 extern T_RVF_MB_ID rvm_stack_mem_bank; | |
72 | |
73 /* parameters of mb in use */ | |
74 typedef struct | |
75 { T_RVF_MB_NAME mb_name; | |
76 T_RVF_MB_PARAM mb_initial_param; | |
77 }T_RVM_APPLI_MB_PARAMS; | |
78 | |
79 | |
80 #define RVM_INVALID_GROUP_INDEX (0xFFFF) | |
81 #define RVM_OWN_GROUP (0xFFFE) | |
82 | |
83 | |
84 /* list of possible event in the RVM */ | |
85 //#define RVM_START_APPLI (60000) | |
86 //#define RVM_STOP_APPLI (60001) | |
87 //#define RVM_ERROR (60002) | |
88 | |
89 | |
90 typedef enum { | |
91 SWE_NOT_STARTED = 0, | |
92 SWE_RUNNING = 1, | |
93 SWE_STOPPING = 2, | |
94 SWE_KILLED = 3 | |
95 }T_RVM_SWE_STATE; | |
96 | |
97 | |
98 /* structure of message */ | |
99 typedef struct { | |
100 T_RV_HDR header; | |
101 T_RV_RETURN_PATH rp; | |
102 UINT8 swe_num; | |
103 }T_RVM_MSG; | |
104 | |
105 | |
106 /* Information about each known SWE | |
107 This is static information and is built at RVM initialization */ | |
108 typedef struct | |
109 { | |
110 T_RVM_NAME swe_name; | |
111 T_RVM_USE_ID swe_use_id; | |
112 T_RVM_GET_INFO_FUNC swe_get_info; /* pointer to its get_info function */ | |
113 T_RVM_SWE_TYPE swe_type; /* type of the SWE */ | |
114 T_RVF_G_ADDR_ID swe_addr_id; /* unique address id of the SWE */ | |
115 UINT16 group_index; /* for type 2 SWE, index of the hosting group in the group array. */ | |
116 UINT16 swe_stack_size; /* size of the task stack */ | |
117 UINT8 swe_priority; /* priority of the SWE */ | |
118 T_RVM_SWE_STATE swe_state; /* state of the SWE */ | |
119 T_RVF_BUFFER* stack_ptr; /* pointer to the stack of the task */ | |
120 UINT8 nb_using_appli; /* nb of application which uses this SWE */ | |
121 UINT8 using_appli[RVM_MAX_SWE_USING]; /* pointer to each application which use this SWE */ | |
122 T_RV_RETURN_PATH swe_return_path; | |
123 T_RV_RETURN_PATH mmi_return_path; | |
124 }T_RVM_KNOWN_SWE; | |
125 | |
126 typedef struct | |
127 { T_RVM_SWE_STATE host_state; | |
128 UINT8 task_id; | |
129 UINT16 nb_hosted_swe; | |
130 UINT16 stack_size; | |
131 UINT8 task_priority; | |
132 } T_RVM_GROUP_INFO; /* DEPRECATED! */ | |
133 | |
134 | |
135 /* structure containing the SWE generic functions pointers */ | |
136 typedef struct | |
137 { | |
138 T_RVM_RETURN (* set_info) ( T_RVF_ADDR_ID addr_id, | |
139 T_RV_RETURN_PATH return_path[], | |
140 T_RVF_MB_ID bk_id_table[], | |
141 T_RVM_CB_FUNC call_back_error_ft); | |
142 T_RVM_RETURN (* init) (void); | |
143 T_RVM_RETURN (* start) (void); | |
144 T_RVM_RETURN (* handle_message) (T_RV_HDR * msg); | |
145 T_RVM_RETURN (* handle_timer) (T_RV_HDR * msg); | |
146 T_RVM_RETURN (* core) (void); | |
147 T_RVM_RETURN (* stop) (T_RV_HDR* hdr); | |
148 T_RVM_RETURN (* stop1) (void); | |
149 T_RVM_RETURN (* kill) (void); | |
150 } T_RVM_SWE_FUNCTIONS; | |
151 | |
152 /* Information about each processing SWE | |
153 This information is dynamic and lives during start or stop process only*/ | |
154 typedef struct _t_rvm_processing_swe | |
155 { | |
156 UINT8 swe_id; // From known SWE array index | |
157 T_RVM_SWE_TYPE swe_type; | |
158 UINT16 stack_size; | |
159 UINT8 priority; | |
160 UINT8 nb_requested_mb; | |
161 UINT8 nb_created_mb; | |
162 T_RVM_APPLI_MB_PARAMS swe_mem_bank[RVM_MAX_NB_MEM_BK]; | |
163 T_RVM_SWE_FUNCTIONS rvm_functions; | |
164 T_RVF_MB_ID bk_id_table[RVM_MAX_NB_MEM_BK]; | |
165 struct _t_rvm_processing_swe *next_swe; | |
166 } T_RVM_PROCESSING_SWE; | |
167 | |
168 typedef struct { | |
169 T_RV_HDR hdr; | |
170 UINT8 grp[MAX_PARASITES]; // to do ..... constant! | |
171 } T_RVM_START_T2_MSG; | |
172 | |
173 typedef struct { | |
174 T_RV_HDR header; | |
175 UINT8 swe_num; | |
176 T_RV_RETURN_PATH rp; | |
177 T_RVM_SWE_STATE status; | |
178 } T_RVM_STOP_MSG; | |
179 | |
180 /*typedef struct { | |
181 T_RV_HDR header; | |
182 UINT8 swe_num; | |
183 // T_RVF_G_ADDR_ID target; | |
184 // UINT8 attempts; | |
185 // T_RVM_SWE_STATE status; | |
186 } T_RVM_STOP_REQ_MSG; */ | |
187 | |
188 typedef struct { | |
189 T_RV_HDR hdr; | |
190 UINT16 val; | |
191 } T_RVM_RT_MOD_YIELD_T2_MSG; | |
192 | |
193 | |
194 /* information about groups of type2 SWE */ | |
195 #define T_GD_ID UINT8 | |
196 | |
197 typedef struct { | |
198 T_RVM_SWE_STATE host_state; | |
199 T_RVF_GD_ID group_directive; | |
200 T_RVF_G_ADDR_ID host_task_addr; | |
201 // UINT16 hosted_swe_addr[10]; | |
202 UINT8 hosted_swe_db_index[MAX_PARASITES]; // to do ..... constant! | |
203 UINT16 stack_size; | |
204 UINT8 task_priority; | |
205 } T_RVM_GROUP_DIRECTIVE; | |
206 | |
207 T_RV_RET rvm_t2_proxy(void); | |
208 T_RV_RET rvm_t3_proxy(void); | |
209 //typedef TASKPTR rvm_proxy; | |
210 | |
211 /* definitions related to the RVM as a RVF task */ | |
212 #define RVM_TASK_ID (0) | |
213 #define RVM_PRIORITY (220) | |
214 | |
215 /* To do ... should correspond to RVF definitions */ | |
216 #define RVM_TASK 0 /* A-M-E-N-D-E-D ! */ | |
217 #define ET2_HOST_TASK 1 | |
218 #define ET3_TASK 3 | |
219 #define ET4_TASK 4 | |
220 #define ET2_VTASK 5 | |
221 #define PRE_RV_INIT_TASK 10 | |
222 | |
223 | |
224 #define RVM_ERROR_MSG_MAX_LENGTH (100) | |
225 | |
226 | |
227 #define DEFAULT_TIME_SLICING 0 /* default is no time-slicing */ | |
228 | |
229 #define RVM_STACK_SIZE RVF_RVM_STACK_SIZE | |
230 /*#define RVM_STACK_SIZE (1500) */ | |
231 | |
232 /* memory bank related definitions */ | |
233 #define RVM_PRIM_MB "RVM_PRIM" | |
234 #define RVM_PRIM_MB_SIZE RVF_RVM_MB1_SIZE //A-M-E-N-D-E-D | |
235 #define RVM_SYS_MB "RVM_SYS" | |
236 #define RVM_SYS_MB_SIZE RVF_RVM_MB3_SIZE | |
237 #define RVM_TIMER_MB "RVM_TIMER" | |
238 #define RVM_TIMER_MB_SIZE RVF_RVM_MB4_SIZE | |
239 #define RVM_NOTIFY_MB "RVM_NOTIFY" | |
240 #define RVM_NOTIFY_MB_SIZE RVF_RVM_MB5_SIZE | |
241 | |
242 #define RVM_TIMER_MB_WATERMARK (RVM_TIMER_MB_SIZE - 500) | |
243 #define RVM_NOTIFY_MB_WATERMARK (RVM_NOTIFY_MB_SIZE - 500) | |
244 | |
245 #if (defined BLUETOOTH) || (TEST==1) || (TI_PROFILER == 1) || (TI_NUC_MONITOR == 1) | |
246 #define RVM_PRIM_MB_WATERMARK (RVM_PRIM_MB_SIZE - 1000) | |
247 #define RVM_SYS_MB_WATERMARK (RVM_SYS_MB_SIZE - 1000) | |
248 #else | |
249 #define RVM_PRIM_MB_WATERMARK (RVM_PRIM_MB_SIZE - 100) | |
250 #define RVM_SYS_MB_WATERMARK (RVM_SYS_MB_SIZE - 100) | |
251 #endif | |
252 | |
253 #define RVM_STACK_MB "RVM_STACKS" | |
254 #define RVM_STACK_MB_SIZE (RVM_STACK_SIZE + RVF_RVM_MB2_SIZE) | |
255 #define RVM_STACK_MB_WATERMARK RVM_STACK_MB_SIZE | |
256 | |
257 | |
258 | |
259 /***************************************/ | |
260 /* RVM Internal functions declarations */ | |
261 /***************************************/ | |
262 /* function called from rvm_task.c in order to check if an application is startable or stoppable*/ | |
263 | |
264 | |
265 /* functions declarations */ | |
266 T_RVM_RETURN rvm_check_application (T_RVM_USE_ID swe_use_id, UINT8* num_swe, T_RVM_APPLI_ACTION appli_action); | |
267 | |
268 T_RVM_RETURN rvm_error ( T_RVM_NAME swe_name, T_RVM_RETURN error_cause, | |
269 T_RVM_ERROR_TYPE error_type, T_RVM_STRING error_msg); | |
270 | |
271 | |
272 void rvm_task (UINT32 param); | |
273 | |
274 void rvm_launch_appli( T_RVM_MSG * msg_Ptr); | |
275 | |
276 void rvm_stop_appli( T_RVM_STOP_MSG * msg_Ptr); | |
277 | |
278 void rvm_swe_has_stopped(T_RVM_STOP_MSG* p_msg); | |
279 T_RVM_RETURN rvm_dup_stop_msg(T_RVM_STOP_MSG* i_msg, T_RVM_STOP_MSG* o_msg) ; | |
280 void rvm_suspend_swe(UINT8 swe_index); | |
281 T_RVM_RETURN rvm_kill_swe(UINT8 swe_index); | |
282 UINT8 rvm_get_mb_level(UINT8 swe_index) ; | |
283 | |
284 void rvm_shut_down_appli( T_RVM_MSG * msg_Ptr); | |
285 void rvm_shutdown_swe(UINT8 index) ; | |
286 | |
287 T_RVM_TASK_ID rvm_allocate_task_id(UINT8 isRealTask); | |
288 | |
289 T_RVM_RETURN rvm_delete_used_memory ( T_RVM_PROCESSING_SWE * appli); | |
290 | |
291 T_RVM_RETURN rvm_build_swe_list(T_RVM_PROCESSING_SWE ** list, UINT8 swe_num, UINT8 mode); | |
292 | |
293 T_RVM_RETURN rvm_check_memory_requirement( T_RVM_PROCESSING_SWE * appli); // deprected ! | |
294 T_RVM_RETURN rvm_verify_memory_requirement( T_RVM_PROCESSING_SWE * appli,\ | |
295 T_RVM_GROUP_DIRECTIVE* gd, UINT8 cnt); | |
296 | |
297 T_RVM_RETURN rvm_allocate_mb( T_RVM_PROCESSING_SWE * appli); | |
298 | |
299 T_RVM_RETURN rvm_initialize_swe( T_RVM_PROCESSING_SWE * appli, | |
300 T_RVM_GROUP_DIRECTIVE* gd, | |
301 UINT8 cnt); | |
302 | |
303 T_RVM_RETURN rvm_allocate_stack_buffer( UINT32 stack_size, T_RVF_BUFFER** stack_ptr ); | |
304 | |
305 T_RVM_RETURN rvm_delete_created_mb (T_RVM_PROCESSING_SWE * appli); | |
306 | |
307 T_RVM_RETURN rvm_clean_env( T_RVM_PROCESSING_SWE * appli); | |
308 | |
309 T_RVM_RETURN rvm_generic_swe_core(void); | |
310 | |
311 T_RVM_RETURN rvm_init_swe_db (void); | |
312 | |
313 T_RVM_RETURN rvm_snd_msg_to_upper (T_RVM_APPLI_ACTION action, | |
314 T_RVM_RETURN result, | |
315 UINT8 swe_num, | |
316 T_RV_RETURN_PATH return_path); | |
317 | |
318 T_RVM_RETURN rvm_get_swe_index( UINT8 * index, T_RVM_USE_ID swe_use_id); | |
319 | |
320 T_RVM_RETURN rvm_start_group_req(T_RVF_G_ADDR_ID addrId, UINT8* addrGrp) ; | |
321 | |
322 /* | |
323 ** Trace Macros | |
324 */ | |
325 #define RVM_TRACE_ERROR(string)\ | |
326 rvf_send_trace (string,(sizeof(string)-1),NULL_PARAM,RV_TRACE_LEVEL_ERROR,RVM_USE_ID ) | |
327 | |
328 #define RVM_TRACE_ERROR_PARAM(string, param)\ | |
329 rvf_send_trace (string,(sizeof(string)-1),(UINT32)param,RV_TRACE_LEVEL_ERROR,RVM_USE_ID ) | |
330 | |
331 #define RVM_TRACE_WARNING(string)\ | |
332 rvf_send_trace (string,(sizeof(string)-1),NULL_PARAM,RV_TRACE_LEVEL_WARNING,RVM_USE_ID ) | |
333 | |
334 #define RVM_TRACE_WARNING_PARAM(string, param)\ | |
335 rvf_send_trace (string,(sizeof(string)-1),(UINT32)param,RV_TRACE_LEVEL_WARNING,RVM_USE_ID ) | |
336 | |
337 #define RVM_TRACE_DEBUG_HIGH(string)\ | |
338 rvf_send_trace (string,(sizeof(string)-1),NULL_PARAM,RV_TRACE_LEVEL_DEBUG_HIGH,RVM_USE_ID ) | |
339 | |
340 #define RVM_TRACE_DEBUG_HIGH_PARAM(string, param)\ | |
341 rvf_send_trace (string,(sizeof(string)-1),(UINT32)param,RV_TRACE_LEVEL_DEBUG_HIGH,RVM_USE_ID ) | |
342 | |
343 #define RVM_TRACE_DEBUG_LOW(string)\ | |
344 rvf_send_trace (string,(sizeof(string)-1),NULL_PARAM,RV_TRACE_LEVEL_DEBUG_LOW,RVM_USE_ID ) | |
345 | |
346 #define RVM_TRACE_DEBUG_LOW_PARAM(string, param)\ | |
347 rvf_send_trace (string,(sizeof(string)-1),(UINT32)param,RV_TRACE_LEVEL_DEBUG_LOW,RVM_USE_ID ) | |
348 | |
349 | |
350 #endif /* __RVM_I_H_ */ | |
351 |