comparison gsm-fw/services/dar/dar_env.c @ 309:a7087f91c752

DAR: all C modules compile without RVM_DAR_SWE
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Mon, 17 Mar 2014 04:51:36 +0000
parents 4dccc9d3305f
children
comparison
equal deleted inserted replaced
308:3c5a17928fda 309:a7087f91c752
20 /* Author Stephanie Gerthoux */ 20 /* Author Stephanie Gerthoux */
21 /* */ 21 /* */
22 /* (C) Copyright 2001 by Texas Instruments Incorporated, All Rights Reserved*/ 22 /* (C) Copyright 2001 by Texas Instruments Incorporated, All Rights Reserved*/
23 /****************************************************************************/ 23 /****************************************************************************/
24 24
25 #include "rv/rv_defined_swe.h" 25 #include "../../riviera/rv/rv_defined_swe.h"
26 #ifdef RVM_DAR_SWE 26 #ifdef RVM_DAR_SWE
27 #include "rv/rv_general.h" 27 #include "../../riviera/rv/rv_general.h"
28 #include "rvm/rvm_gen.h" 28 #include "../../riviera/rvm/rvm_gen.h"
29 #include "rvm/rvm_priorities.h" 29 #include "../../riviera/rvm/rvm_priorities.h"
30 #include "rvm/rvm_use_id_list.h" 30 #include "../../riviera/rvm/rvm_use_id_list.h"
31 #include "dar/dar_api.h" 31 #include "dar_api.h"
32 #include "dar/dar_env.h" 32 #include "dar_env.h"
33 #include "dar/dar_macro_i.h" 33 #include "dar_macro_i.h"
34 34
35 #include <string.h> 35 #include <string.h>
36 36
37 extern T_RV_RET dar_core(void); 37 extern T_RV_RET dar_core(void);
38 38
39 /**** Initialisation of the pointer to the Global Environment Control block ****/ 39 /* Initialisation of the pointer to the Global Environment Control block */
40 T_DAR_ENV_CTRL_BLK *dar_gbl_var_p = NULL; 40 T_DAR_ENV_CTRL_BLK *dar_gbl_var_p = NULL;
41 41
42 /**** Define extern variables ****/ 42 /**** Define extern variables ****/
43 /* Get the last status of the system */ 43 /* Get the last status of the system */
44 extern T_DAR_RECOVERY_STATUS dar_current_status; 44 extern T_DAR_RECOVERY_STATUS dar_current_status;
53 extern T_DAR_RECOVERY_STATUS dar_previous_status; 53 extern T_DAR_RECOVERY_STATUS dar_previous_status;
54 54
55 /* DAR previous status */ 55 /* DAR previous status */
56 extern UINT8 dar_previous_exception; 56 extern UINT8 dar_previous_exception;
57 57
58 /********************************************************************************/ 58 /***************************************************************************/
59 /* Function : dar_get_info */ 59 /* Function : dar_get_info */
60 /* */ 60 /* */
61 /* Description : This function is called by the RV Environment to learn */ 61 /* Description : This function is called by the RV Environment to learn */
62 /* diagnose requirements in terms of memory, SWEs... */ 62 /* diagnose requirements in terms of memory, SWEs... */
63 /* */ 63 /* */
64 /* Parameters : T_RVM_INFO_SWE * swe_info: pointer to the structure to fill */ 64 /* Parameters : T_RVM_INFO_SWE * swe_info: pointer to the structure to */
65 /* containing infos related to the diagnose SWE. */ 65 /* fill containing infos related to the diagnose SWE. */
66 /* */ 66 /* */
67 /* Return : T_RV_RETURN */ 67 /* Return : T_RV_RETURN */
68 /* */ 68 /* */
69 /* History : 0.1 (26-September-2001) */ 69 /* History : 0.1 (26-September-2001) */
70 /* */ 70 /* */
71 /* */ 71 /* */
72 /********************************************************************************/ 72 /***************************************************************************/
73 T_RVM_RETURN dar_get_info(T_RVM_INFO_SWE *infoSWEnt) 73 T_RVM_RETURN dar_get_info(T_RVM_INFO_SWE *infoSWEnt)
74 { 74 {
75 /* SWE info */ 75 /* SWE info */
76 infoSWEnt->swe_type = RVM_SWE_TYPE_4; 76 infoSWEnt->swe_type = RVM_SWE_TYPE_4;
77 infoSWEnt->type_info.type4.swe_use_id = DAR_USE_ID; 77 infoSWEnt->type_info.type4.swe_use_id = DAR_USE_ID;
81 infoSWEnt->type_info.type4.stack_size = DAR_STACK_SIZE; 81 infoSWEnt->type_info.type4.stack_size = DAR_STACK_SIZE;
82 infoSWEnt->type_info.type4.priority = RVM_DAR_TASK_PRIORITY; 82 infoSWEnt->type_info.type4.priority = RVM_DAR_TASK_PRIORITY;
83 83
84 84
85 /* Set the return path */ 85 /* Set the return path */
86 infoSWEnt->type_info.type4.return_path.callback_func = NULL; 86 infoSWEnt->type_info.type4.return_path.callback_func = NULL;
87 infoSWEnt->type_info.type4.return_path.addr_id = 0; 87 infoSWEnt->type_info.type4.return_path.addr_id = 0;
88 88
89 89
90 /* memory bank info */ 90 /* memory bank info */
91 infoSWEnt->type_info.type4.nb_mem_bank = 0x01; 91 infoSWEnt->type_info.type4.nb_mem_bank = 0x01;
92 92
93 /* Memory bank used to receive/send the message to/from the entity */ 93 /* Memory bank used to receive/send the message to/from the entity */
94 memcpy ((UINT8 *) infoSWEnt->type_info.type4.mem_bank[0].bank_name, "DAR_MB", sizeof("DAR_MB")); 94 memcpy ((UINT8 *) infoSWEnt->type_info.type4.mem_bank[0].bank_name, "DAR_MB", sizeof("DAR_MB"));
95 infoSWEnt->type_info.type4.mem_bank[0].initial_params.size = DAR_MB_SIZE; 95 infoSWEnt->type_info.type4.mem_bank[0].initial_params.size = DAR_MB_SIZE;
96 infoSWEnt->type_info.type4.mem_bank[0].initial_params.watermark = DAR_MB_WATERMARK; 96 infoSWEnt->type_info.type4.mem_bank[0].initial_params.watermark = DAR_MB_WATERMARK;
97 97
98 /* linked SWE info */ 98 /* linked SWE info */
99 /* this SWE requires the FFS SWE to run */ 99 /* this SWE requires the FFS SWE to run */
109 infoSWEnt->type_info.type4.kill = dar_kill; 109 infoSWEnt->type_info.type4.kill = dar_kill;
110 110
111 return RVM_OK; 111 return RVM_OK;
112 } 112 }
113 113
114 /**************** End of dar_get_info function ********************************/ 114 /**************** End of dar_get_info function *****************************/
115 115
116 /********************************************************************************/ 116 /***************************************************************************/
117 /* Function : dar_set_info */ 117 /* Function : dar_set_info */
118 /* */ 118 /* */
119 /* Description : This function is called by the RV Environment to inform */ 119 /* Description : This function is called by the RV Environment to inform */
120 /* the diagnose SWE about addr_id, mb_id and error function. */ 120 /* the diagnose SWE about addr_id, mb_id and error function. */
121 /* */ 121 /* */
122 /* Parameters : - T_RVF_ADDR_ID addrId: address Id */ 122 /* Parameters : - T_RVF_ADDR_ID addrId: address Id */
123 /* - T_RVF_MB_ID mb_id[]: array of memory bank ids. */ 123 /* - T_RVF_MB_ID mb_id[]: array of memory bank ids. */
124 /* - callback function to call in case of unrecoverable error. */ 124 /* - callback function to call in case of unrecoverable error*/
125 /* */ 125 /* */
126 /* Return : T_RVM_RETURN */ 126 /* Return : T_RVM_RETURN */
127 /* */ 127 /* */
128 /* History : 0.1 (27-September-2001 ) */ 128 /* History : 0.1 (27-September-2001 ) */
129 /* */ 129 /* */
130 /* */ 130 /* */
131 /********************************************************************************/ 131 /***************************************************************************/
132 T_RVM_RETURN dar_set_info(T_RVF_ADDR_ID addrId, 132 T_RVM_RETURN dar_set_info(T_RVF_ADDR_ID addrId,
133 T_RV_RETURN return_path[], 133 T_RV_RETURN return_path[],
134 T_RVF_MB_ID mbId[], 134 T_RVF_MB_ID mbId[],
135 T_RVM_RETURN (*callBackFctError) ( T_RVM_NAME SWEntName, 135 T_RVM_RETURN (*callBackFctError) ( T_RVM_NAME SWEntName,
136 T_RVM_RETURN errorCause, 136 T_RVM_RETURN errorCause,
139 { 139 {
140 140
141 /* Declare local variable.*/ 141 /* Declare local variable.*/
142 T_RVF_MB_STATUS mb_status = RVF_GREEN; 142 T_RVF_MB_STATUS mb_status = RVF_GREEN;
143 143
144 /* Allocate memory required to store the Global Environment control Block. */ 144 /* Allocate memory required to store the Global Environment control
145 Block. */
145 mb_status = rvf_get_buf(mbId[0], 146 mb_status = rvf_get_buf(mbId[0],
146 sizeof(T_DAR_ENV_CTRL_BLK), 147 sizeof(T_DAR_ENV_CTRL_BLK),
147 (T_RVF_BUFFER **) & dar_gbl_var_p); 148 (T_RVF_BUFFER **) & dar_gbl_var_p);
148 149
149 /* If insufficient resources to properly run the DAR's task, then abort. */ 150 /* If insufficient resources to properly run the DAR's task,
151 then abort. */
150 switch (mb_status) 152 switch (mb_status)
151 { 153 {
152 case RVF_GREEN: 154 case RVF_GREEN:
153 { 155 {
154 /* Initialize the Global Environment Control Block */ 156 /* Initialize the Global Environment Control Block */
181 return (RV_MEMORY_ERR); 183 return (RV_MEMORY_ERR);
182 } 184 }
183 } /* switch (mb_status) */ 185 } /* switch (mb_status) */
184 186
185 return (RV_OK); 187 return (RV_OK);
186 } /*************** End of dar_set_info function ********************************/ 188 } /*************** End of dar_set_info function ****************************/
187 189
188 190
189 191
190 /********************************************************************************/ 192 /***************************************************************************/
191 /* Function : dar_init */ 193 /* Function : dar_init */
192 /* */ 194 /* */
193 /* Description : This function is called by the RV Environment to initialize the*/ 195 /* Description : This function is called by the RV Environment to init the */
194 /* diagnose SWE before creating the task and calling dar_start. */ 196 /* diagnose SWE before creating the task and calling */
195 /* */ 197 /* dar_start. */
196 /* Parameters : None */ 198 /* */
197 /* */ 199 /* Parameters : None */
198 /* Return : T_RVM_RETURN */ 200 /* */
199 /* */ 201 /* Return : T_RVM_RETURN */
200 /* History : 0.1 (27-September-2001) */ 202 /* */
201 /* */ 203 /* History : 0.1 (27-September-2001) */
202 /* */ 204 /* */
203 /********************************************************************************/ 205 /* */
206 /***************************************************************************/
204 T_RVM_RETURN dar_init(void) 207 T_RVM_RETURN dar_init(void)
205 { 208 {
206 /*** Declare local variables ***/ 209 /*** Declare local variables ***/
207 UINT16 i = 0; 210 UINT16 i = 0;
208 211
234 237
235 return RV_OK; 238 return RV_OK;
236 } 239 }
237 240
238 241
239 /*************************************************************************************/ 242 /***************************************************************************/
240 /* Function : dar_stop */ 243 /* Function : dar_stop */
241 /* */ 244 /* */
242 /* Description : This function is called by the RV Environment to stop the diagnose */ 245 /* Description : This function is called by the RV Environment to stop the */
243 /* SWE. */ 246 /* diagnose SWE. */
244 /* */ 247 /* */
245 /* Parameters : None */ 248 /* Parameters : None */
246 /* */ 249 /* */
247 /* Return : T_RVM_RETURN */ 250 /* Return : T_RVM_RETURN */
248 /* */ 251 /* */
249 /* History : 0.1 (27-September-2001) */ 252 /* History : 0.1 (27-September-2001) */
250 /* */ 253 /* */
251 /* */ 254 /* */
252 /*************************************************************************************/ 255 /***************************************************************************/
253 T_RVM_RETURN dar_stop(void) 256 T_RVM_RETURN dar_stop(void)
254 { 257 {
255 /* other SWEs have not been killed yet, DAR can send messages to other SWEs */ 258 /* other SWEs have not been killed yet, DAR can send messages to other
259 SWEs */
256 260
257 return RV_OK; 261 return RV_OK;
258 } 262 }
259 263
260 264
261 /*************************************************************************************/ 265 /***************************************************************************/
262 /* Function : dar_kill */ 266 /* Function : dar_kill */
263 /* */ 267 /* */
264 /* Description : This function is called by the RV Environment to kill the diagnose */ 268 /* Description : This function is called by the RV Environment to kill the */
265 /* SWE, after the diagnose_stop function has been called. */ 269 /* diagnose SWE, after the diagnose_stop function has been */
266 /* */ 270 /* called. */
267 /* Parameters : None */ 271 /* */
268 /* */ 272 /* Parameters : None */
269 /* Return : T_RVM_RETURN */ 273 /* */
270 /* */ 274 /* Return : T_RVM_RETURN */
271 /* History : 0.1 (27-September-2001) */ 275 /* */
272 /* */ 276 /* History : 0.1 (27-September-2001) */
273 /* */ 277 /* */
274 /*************************************************************************************/ 278 /* */
279 /***************************************************************************/
275 T_RVM_RETURN dar_kill (void) 280 T_RVM_RETURN dar_kill (void)
276 { 281 {
277 /* free all memory buffer previously allocated */ 282 /* free all memory buffer previously allocated */
278 rvf_free_buf ((T_RVF_BUFFER *) dar_gbl_var_p); 283 rvf_free_buf ((T_RVF_BUFFER *) dar_gbl_var_p);
279 return RV_OK; 284 return RV_OK;