FreeCalypso > hg > freecalypso-sw
comparison gsm-fw/services/dar/dar_api.c @ 307:749ca89741fa
DAR: starting to compile
author | Michael Spacefalcon <msokolov@ivan.Harhan.ORG> |
---|---|
date | Sun, 16 Mar 2014 07:39:29 +0000 |
parents | 4dccc9d3305f |
children | 3c5a17928fda |
comparison
equal
deleted
inserted
replaced
306:81bee6125882 | 307:749ca89741fa |
---|---|
14 /* Author - Stephanie Gerthoux */ | 14 /* Author - Stephanie Gerthoux */ |
15 /* */ | 15 /* */ |
16 /* (C) Copyright 2001 by Texas Instruments Incorporated, All Rights Reserved*/ | 16 /* (C) Copyright 2001 by Texas Instruments Incorporated, All Rights Reserved*/ |
17 /****************************************************************************/ | 17 /****************************************************************************/ |
18 | 18 |
19 #include "rv/rv_defined_swe.h" | 19 #include "../../riviera/rv/rv_defined_swe.h" |
20 | 20 |
21 | 21 |
22 #ifdef RVM_DAR_SWE | 22 #ifdef RVM_DAR_SWE |
23 #ifndef _WINDOWS | 23 #include "../../include/config.h" |
24 #include "swconfig.cfg" | 24 |
25 #include "sys.cfg" | 25 #include "../../bsp/abb+spi/abb.h" |
26 #include "l1sw.cfg" | 26 #include "../../riviera/rv/rv_general.h" |
27 #include "chipset.cfg" | 27 #include "../../riviera/rvm/rvm_gen.h" |
28 #endif | 28 #include "dar_api.h" |
29 | 29 #include "dar_env.h" |
30 #include "abb/abb.h" | 30 #include "dar_error_hdlr_i.h" |
31 #include "rv/rv_general.h" | 31 #include "dar_messages_i.h" |
32 #include "rvm/rvm_gen.h" | 32 #include "dar_msg_ft.h" |
33 #include "dar/dar_api.h" | 33 #include "dar_macro_i.h" |
34 #include "dar/dar_env.h" | 34 #include "dar_diagnose_i.h" |
35 #include "dar/dar_error_hdlr_i.h" | 35 #include "dar_const_i.h" |
36 #include "dar/dar_messages_i.h" | 36 #include "dar_emergency.h" |
37 #include "dar/dar_msg_ft.h" | |
38 #include "dar/dar_macro_i.h" | |
39 #include "dar/dar_diagnose_i.h" | |
40 #include "dar/dar_const_i.h" | |
41 #include "dar/dar_emergency.h" | |
42 | |
43 | 37 |
44 #ifndef _WINDOWS | 38 #ifndef _WINDOWS |
45 /* enable the timer */ | 39 /* enable the timer */ |
46 #include "memif/mem.h" | 40 #include "../../bsp/mem.h" |
47 #include "timer/timer.h" | 41 #include "../../bsp/timer.h" |
48 #include "inth/iq.h" | 42 #include "../../bsp/iq.h" |
49 #if (CHIPSET == 12) | 43 #if (CHIPSET == 12) |
50 #include "inth/sys_inth.h" | 44 #include "inth/sys_inth.h" |
51 #endif | 45 #endif |
52 #endif | 46 #endif |
53 | 47 |
54 | |
55 /**** Global variable ****/ | 48 /**** Global variable ****/ |
56 /* Define load timer */ | 49 /* Define load timer */ |
57 static UINT16 dar_load_tim = 0x0; | 50 static UINT16 dar_load_tim = 0x0; |
58 | 51 |
59 /* Increment variable */ | 52 /* Increment variable */ |
76 extern UINT8 dar_recovery_buffer[DAR_RECOVERY_DATA_MAX_BUFFER_SIZE]; | 69 extern UINT8 dar_recovery_buffer[DAR_RECOVERY_DATA_MAX_BUFFER_SIZE]; |
77 | 70 |
78 /* Define a pointer to the Global Environment Control block */ | 71 /* Define a pointer to the Global Environment Control block */ |
79 extern T_DAR_ENV_CTRL_BLK *dar_gbl_var_p; | 72 extern T_DAR_ENV_CTRL_BLK *dar_gbl_var_p; |
80 | 73 |
81 /* **************************************************************************** */ | 74 /* *********************************************************************** */ |
82 /* RECOVERY */ | 75 /* RECOVERY */ |
83 /* **************************************************************************** */ | 76 /* *********************************************************************** */ |
84 | 77 |
85 /********************************************************************************/ | 78 /***************************************************************************/ |
86 /* */ | 79 /* */ |
87 /* Function Name: dar_recovery_get_status */ | 80 /* Function Name: dar_recovery_get_status */ |
88 /* */ | 81 /* */ |
89 /* Purpose: This function is called by the MMI at the beginning of the */ | 82 /* Purpose: This function is called by the MMI at the beginning of the */ |
90 /* procedure, in order to get the status of the last reset of */ | 83 /* procedure, in order to get the status of the last reset of */ |
91 /* the system. */ | 84 /* the system. */ |
92 /* */ | 85 /* */ |
93 /* Input Parameters: */ | 86 /* Input Parameters: */ |
94 /* Dar recovery status */ | 87 /* Dar recovery status */ |
95 /* */ | 88 /* */ |
96 /* Output Parameters: */ | 89 /* Output Parameters: */ |
97 /* Validation of the function execution. */ | 90 /* Validation of the function execution. */ |
98 /* */ | 91 /* */ |
99 /* Note: */ | 92 /* Note: */ |
100 /* None. */ | 93 /* None. */ |
101 /* */ | 94 /* */ |
102 /* Revision History: */ | 95 /* Revision History: */ |
103 /* None. */ | 96 /* None. */ |
104 /* */ | 97 /* */ |
105 /********************************************************************************/ | 98 /***************************************************************************/ |
106 T_RV_RET dar_recovery_get_status(T_DAR_RECOVERY_STATUS* status) | 99 T_RV_RET dar_recovery_get_status(T_DAR_RECOVERY_STATUS* status) |
107 { | 100 { |
108 /* Variable to know the status of th Omega VRPC register */ | 101 /* Variable to know the status of th Omega VRPC register */ |
109 UINT16 dar_pwr_status; | 102 UINT16 dar_pwr_status; |
110 | 103 |
166 | 159 |
167 break; | 160 break; |
168 } | 161 } |
169 default: | 162 default: |
170 { | 163 { |
171 #if (_GSM==1) || (defined _WINDOWS) | 164 #if 1 //(_GSM==1) || (defined _WINDOWS) |
172 dar_pwr_status = ABB_Read_Status(); | 165 dar_pwr_status = ABB_Read_Status(); |
173 | 166 |
174 #if ((ANLG_FAM == 1) || (ANLG_FAM == 2)) | 167 #if ((ANALOG == 1) || (ANALOG == 2)) |
175 if (dar_pwr_status & ONBSTS) | 168 if (dar_pwr_status & ONBSTS) |
176 #elif (ANLG_FAM == 3) | 169 #elif (ANALOG == 3) |
177 if (dar_pwr_status & PWONBSTS) | 170 if (dar_pwr_status & PWONBSTS) |
178 #endif | 171 #endif |
179 { | 172 { |
180 /* Switch on Condition on ON BUTTON Push */ | 173 /* Switch on Condition on ON BUTTON Push */ |
181 DAR_SEND_TRACE("Dar Entity: Status of the last reset of the system = POWER ON/OFF",RV_TRACE_LEVEL_DEBUG_HIGH); | 174 DAR_SEND_TRACE("Dar Entity: Status of the last reset of the system = POWER ON/OFF",RV_TRACE_LEVEL_DEBUG_HIGH); |
182 break; | 175 break; |
183 } | 176 } |
184 else | 177 else |
185 { | 178 { |
186 /* Branch to a reset at adress 0 */ | 179 /* Branch to a reset at adress 0 */ |
187 DAR_SEND_TRACE("Dar Entity: Status of the last reset of the system = BRANCH to adress 0",RV_TRACE_LEVEL_DEBUG_HIGH); | 180 DAR_SEND_TRACE("Dar Entity: Status of the last reset of the system = BRANCH to adress 0",RV_TRACE_LEVEL_DEBUG_HIGH); |
188 break; | 181 break; |
189 } | 182 } |
190 #else | 183 #else |
191 /* the SPI is not available in BOARD_TEST configuration */ | 184 /* the SPI is not available in BOARD_TEST configuration */ |
192 DAR_SEND_TRACE("Dar Entity: Status of the last reset of the system = POWER ON/OFF or BRANCH to adress 0",RV_TRACE_LEVEL_DEBUG_HIGH); | 185 DAR_SEND_TRACE("Dar Entity: Status of the last reset of the system = POWER ON/OFF or BRANCH to adress 0",RV_TRACE_LEVEL_DEBUG_HIGH); |
193 #endif | 186 #endif |
194 } | 187 } |
195 }/* switch */ | 188 }/* switch */ |
196 | 189 |
197 return(RV_OK); | 190 return(RV_OK); |
198 | 191 |
199 } /* dar_recovery_get_status */ | 192 } /* dar_recovery_get_status */ |
200 | 193 |
201 /********************************************************************************/ | 194 /***************************************************************************/ |
202 /* */ | 195 /* */ |
203 /* Function Name: dar_recovery_config */ | 196 /* Function Name: dar_recovery_config */ |
204 /* */ | 197 /* */ |
205 /* Purpose: This function is used to store a callback function that will be */ | 198 /* Purpose: This function is used to store a callback function that */ |
206 /* called by the recovery system when a recovery procedure has */ | 199 /* will be called by the recovery system when a recovery */ |
207 /* been initiated */ | 200 /* procedure has been initiated */ |
208 /* */ | 201 /* */ |
209 /* Input Parameters: */ | 202 /* Input Parameters: */ |
210 /* dar callback function */ | 203 /* dar callback function */ |
211 /* */ | 204 /* */ |
212 /* Output Parameters: */ | 205 /* Output Parameters: */ |
213 /* Validation of the function execution. */ | 206 /* Validation of the function execution. */ |
214 /* */ | 207 /* */ |
215 /* Note: */ | 208 /* Note: */ |
216 /* None. */ | 209 /* None. */ |
217 /* */ | 210 /* */ |
218 /* Revision History: */ | 211 /* Revision History: */ |
219 /* None. */ | 212 /* None. */ |
220 /* */ | 213 /* */ |
221 /********************************************************************************/ | 214 /***************************************************************************/ |
222 T_RV_RET dar_recovery_config(T_RV_RET (*dar_store_recovery_data) | 215 T_RV_RET dar_recovery_config(T_RV_RET (*dar_store_recovery_data) |
223 (T_DAR_BUFFER buffer_p, | 216 (T_DAR_BUFFER buffer_p, |
224 UINT16 length)) | 217 UINT16 length)) |
225 { | 218 { |
226 /* call the callback function */ | 219 /* call the callback function */ |
227 dar_gbl_var_p->entity_dar_callback = dar_store_recovery_data; | 220 dar_gbl_var_p->entity_dar_callback = dar_store_recovery_data; |
228 | 221 |
229 return(RV_OK); | 222 return(RV_OK); |
230 } /* dar_recovery_config */ | 223 } /* dar_recovery_config */ |
231 | 224 |
232 /********************************************************************************/ | 225 /***************************************************************************/ |
233 /* */ | 226 /* */ |
234 /* Function Name: dar_get_recovery_data */ | 227 /* Function Name: dar_get_recovery_data */ |
235 /* */ | 228 /* */ |
236 /* Purpose: This function is used to retrieve data that have been stored */ | 229 /* Purpose: This function is used to retrieve data that have been */ |
237 /* in the buffer just before a reset. */ | 230 /* stored in the buffer just before a reset. */ |
238 /* */ | 231 /* */ |
239 /* Input Parameters: */ | 232 /* Input Parameters: */ |
240 /* - the buffer in whom important data have been stored before the reset */ | 233 /* - the buffer in whom important data have been stored before the */ |
241 /* - the length of the buffer */ | 234 /* reset */ |
242 /* */ | 235 /* - the length of the buffer */ |
243 /* Output Parameters: */ | 236 /* */ |
244 /* Validation of the function execution. */ | 237 /* Output Parameters: */ |
245 /* */ | 238 /* Validation of the function execution. */ |
246 /* Note: */ | 239 /* */ |
247 /* None. */ | 240 /* Note: */ |
248 /* */ | 241 /* None. */ |
249 /* Revision History: */ | 242 /* */ |
250 /* None. */ | 243 /* Revision History: */ |
251 /* */ | 244 /* None. */ |
252 /********************************************************************************/ | 245 /* */ |
253 T_RV_RET dar_get_recovery_data( T_DAR_BUFFER buffer_p, UINT16 length ) | 246 /***************************************************************************/ |
247 T_RV_RET dar_get_recovery_data( T_DAR_BUFFER buffer_p, UINT16 length ) | |
254 { | 248 { |
255 /* Local variables */ | 249 /* Local variables */ |
256 UINT8 i; | 250 UINT8 i; |
257 | 251 |
258 if (buffer_p != NULL) | 252 if (buffer_p != NULL) |
259 { | 253 { |
260 if(length <= DAR_RECOVERY_DATA_MAX_BUFFER_SIZE) | 254 if(length <= DAR_RECOVERY_DATA_MAX_BUFFER_SIZE) |
261 { | 255 { |
262 /* Retrieve data that have been stored in the global buffer */ | 256 /* Retrieve data that have been stored in the global buffer */ |
263 for(i=0;i<length;i++) | 257 for(i=0;i<length;i++) |
284 return(RV_OK); | 278 return(RV_OK); |
285 | 279 |
286 } /* dar_get_recovery_data */ | 280 } /* dar_get_recovery_data */ |
287 | 281 |
288 | 282 |
289 /* **************************************************************************** */ | 283 /* *********************************************************************** */ |
290 /* WATCHDOG */ | 284 /* WATCHDOG */ |
291 /* **************************************************************************** */ | 285 /* *********************************************************************** */ |
292 | 286 |
293 /********************************************************************************/ | 287 /***************************************************************************/ |
294 /* */ | 288 /* */ |
295 /* Function Name: dar_start_watchdog_timer */ | 289 /* Function Name: dar_start_watchdog_timer */ |
296 /* */ | 290 /* */ |
297 /* Purpose: This function uses the timer as a general purpose timer instead */ | 291 /* Purpose: This function uses the timer as a general purpose timer */ |
298 /* of Watchdog. It loads the timer , starts it and then unmasks */ | 292 /* instead of Watchdog. It loads the timer, starts it and */ |
299 /* the interrupt. */ | 293 /* then unmasks the interrupt. */ |
300 /* */ | 294 /* */ |
301 /* Input Parameters: */ | 295 /* Input Parameters: */ |
302 /* time's interval in milliseconds before the timer expires */ | 296 /* time's interval in milliseconds before the timer expires */ |
303 /* */ | 297 /* */ |
304 /* Output Parameters: */ | 298 /* Output Parameters: */ |
305 /* Validation of the function execution. */ | 299 /* Validation of the function execution. */ |
306 /* */ | 300 /* */ |
307 /* Note: */ | 301 /* Note: */ |
308 /* None. */ | 302 /* None. */ |
309 /* */ | 303 /* */ |
310 /* Revision History: */ | 304 /* Revision History: */ |
311 /* None. */ | 305 /* None. */ |
312 /* */ | 306 /* */ |
313 /********************************************************************************/ | 307 /***************************************************************************/ |
314 T_RV_RET dar_start_watchdog_timer(UINT16 timer_expiration_value) | 308 T_RV_RET dar_start_watchdog_timer(UINT16 timer_expiration_value) |
315 { | 309 { |
316 DAR_SEND_TRACE("DAR Watchdog timer",RV_TRACE_LEVEL_DEBUG_LOW); | 310 DAR_SEND_TRACE("DAR Watchdog timer",RV_TRACE_LEVEL_DEBUG_LOW); |
317 | 311 |
318 /* use Watchdog timer set as a general purpose timer */ | 312 /* use Watchdog timer set as a general purpose timer */ |
319 /* Calculate the load value thanks to the formula: */ | 313 /* Calculate the load value thanks to the formula: */ |
320 /* timer_expiration_value * 1000 = Tclk * (DAR_LOAD_TIM+1)*2^(PTV+1)*/ | 314 /* timer_expiration_value * 1000 = Tclk * (DAR_LOAD_TIM+1)*2^(PTV+1)*/ |
321 /* (in Watchdog mode, the value of PTV is fixed to 7) */ | 315 /* (in Watchdog mode, the value of PTV is fixed to 7) */ |
322 dar_load_tim = ((timer_expiration_value * 1000)/(1.078*256))-1; | 316 dar_load_tim = ((timer_expiration_value * 1000)/(1.078*256))-1; |
323 | 317 |
324 #ifndef _WINDOWS | 318 #ifndef _WINDOWS |
325 /* Load "dar_load_tim" value */ | 319 /* Load "dar_load_tim" value */ |
326 TIMER_WriteValue(dar_load_tim); | 320 TIMER_WriteValue(dar_load_tim); |
338 | 332 |
339 return(RV_OK); | 333 return(RV_OK); |
340 | 334 |
341 } /* dar_start_watchdog_timer */ | 335 } /* dar_start_watchdog_timer */ |
342 | 336 |
343 /********************************************************************************/ | 337 /***************************************************************************/ |
344 /* */ | 338 /* */ |
345 /* Function Name: dar_reload_watchdog_timer */ | 339 /* Function Name: dar_reload_watchdog_timer */ |
346 /* */ | 340 /* */ |
347 /* Purpose: This function is used to maintain the timer in reloading it */ | 341 /* Purpose: This function is used to maintain the timer in reloading */ |
348 /* periodically before it expires */ | 342 /* it periodically before it expires. */ |
349 /* */ | 343 /* */ |
350 /* Input Parameters: */ | 344 /* Input Parameters: */ |
351 /* None */ | 345 /* None */ |
352 /* */ | 346 /* */ |
353 /* Output Parameters: */ | 347 /* Output Parameters: */ |
354 /* Validation of the function execution. */ | 348 /* Validation of the function execution. */ |
355 /* */ | 349 /* */ |
356 /* Note: */ | 350 /* Note: */ |
357 /* None. */ | 351 /* None. */ |
358 /* */ | 352 /* */ |
359 /* Revision History: */ | 353 /* Revision History: */ |
360 /* None. */ | 354 /* None. */ |
361 /* */ | 355 /* */ |
362 /********************************************************************************/ | 356 /***************************************************************************/ |
363 T_RV_RET dar_reload_watchdog_timer() | 357 T_RV_RET dar_reload_watchdog_timer() |
364 { | 358 { |
365 #ifndef _WINDOWS | 359 #ifndef _WINDOWS |
366 | 360 |
367 DAR_SEND_TRACE("Reload Watchdog ",RV_TRACE_LEVEL_DEBUG_LOW); | 361 DAR_SEND_TRACE("Reload Watchdog ",RV_TRACE_LEVEL_DEBUG_LOW); |
387 | 381 |
388 return(RV_OK); | 382 return(RV_OK); |
389 | 383 |
390 } /* dar_reload_watchdog_timer */ | 384 } /* dar_reload_watchdog_timer */ |
391 | 385 |
392 /********************************************************************************/ | 386 /***************************************************************************/ |
393 /* */ | 387 /* */ |
394 /* Function Name: dar_stop_watchdog_timer */ | 388 /* Function Name: dar_stop_watchdog_timer */ |
395 /* */ | 389 /* */ |
396 /* Purpose: This function stops the timer used as a general purpose timer */ | 390 /* Purpose: This function stops the timer used as a general purpose */ |
397 /* instead of watchdog */ | 391 /* timer instead of watchdog. */ |
398 /* */ | 392 /* */ |
399 /* Input Parameters: */ | 393 /* Input Parameters: */ |
400 /* None */ | 394 /* None */ |
401 /* */ | 395 /* */ |
402 /* Output Parameters: */ | 396 /* Output Parameters: */ |
403 /* Validation of the function execution. */ | 397 /* Validation of the function execution. */ |
404 /* */ | 398 /* */ |
405 /* Note: */ | 399 /* Note: */ |
406 /* None. */ | 400 /* None. */ |
407 /* */ | 401 /* */ |
408 /* Revision History: */ | 402 /* Revision History: */ |
409 /* None. */ | 403 /* None. */ |
410 /* */ | 404 /* */ |
411 /********************************************************************************/ | 405 /***************************************************************************/ |
412 T_RV_RET dar_stop_watchdog_timer() | 406 T_RV_RET dar_stop_watchdog_timer() |
413 { | 407 { |
414 #ifndef _WINDOWS | 408 #ifndef _WINDOWS |
415 /* Stop the timer */ | 409 /* Stop the timer */ |
416 *(volatile UINT16*)TIMER_CNTL_REG = 0x0E00; | 410 *(volatile UINT16*)TIMER_CNTL_REG = 0x0E00; |
426 return(RV_OK); | 420 return(RV_OK); |
427 | 421 |
428 } /* dar_stop_watchdog_timer */ | 422 } /* dar_stop_watchdog_timer */ |
429 | 423 |
430 | 424 |
431 /* **************************************************************************** */ | 425 /* *********************************************************************** */ |
432 /* RESET */ | 426 /* RESET */ |
433 /* **************************************************************************** */ | 427 /* *********************************************************************** */ |
434 | 428 |
435 /********************************************************************************/ | 429 /***************************************************************************/ |
436 /* */ | 430 /* */ |
437 /* Function Name: dar_reset_system */ | 431 /* Function Name: dar_reset_system */ |
438 /* */ | 432 /* */ |
439 /* Purpose: This function can be used to reset the system voluntarily */ | 433 /* Purpose: This function can be used to reset the system voluntarily. */ |
440 /* */ | 434 /* */ |
441 /* Input Parameters: */ | 435 /* Input Parameters: */ |
442 /* None */ | 436 /* None */ |
443 /* */ | 437 /* */ |
444 /* Output Parameters: */ | 438 /* Output Parameters: */ |
445 /* Validation of the function execution. */ | 439 /* Validation of the function execution. */ |
446 /* */ | 440 /* */ |
447 /* Note: */ | 441 /* Note: */ |
448 /* None. */ | 442 /* None. */ |
449 /* */ | 443 /* */ |
450 /* Revision History: */ | 444 /* Revision History: */ |
451 /* None. */ | 445 /* None. */ |
452 /* */ | 446 /* */ |
453 /********************************************************************************/ | 447 /***************************************************************************/ |
454 T_RV_RET dar_reset_system(void) | 448 T_RV_RET dar_reset_system(void) |
455 { | 449 { |
456 | 450 |
457 /* Update the DAR recovery status */ | 451 /* Update the DAR recovery status */ |
458 dar_current_status = DAR_NORMAL_SCUTTLING; | 452 dar_current_status = DAR_NORMAL_SCUTTLING; |
466 dar_reset(); | 460 dar_reset(); |
467 | 461 |
468 return(RV_OK); | 462 return(RV_OK); |
469 } | 463 } |
470 | 464 |
471 /* **************************************************************************** */ | 465 /* *********************************************************************** */ |
472 /* DIAGNOSE */ | 466 /* DIAGNOSE */ |
473 /* **************************************************************************** */ | 467 /* *********************************************************************** */ |
474 | 468 |
475 /********************************************************************************/ | 469 /***************************************************************************/ |
476 /* */ | 470 /* */ |
477 /* Function Name: dar_diagnose_swe_filter */ | 471 /* Function Name: dar_diagnose_swe_filter */ |
478 /* */ | 472 /* */ |
479 /* Purpose: This function is called to configure the Diagnose filtering. */ | 473 /* Purpose: This function is called to configure the Diagnose filtering.*/ |
480 /* It allows to determine what Software Entity ( dar_use_id ) */ | 474 /* It allows to determine what Software Entity ( dar_use_id ) */ |
481 /* wants to use the Diagnose and allows to indicate the level */ | 475 /* wants to use the Diagnose and allows to indicate the level */ |
482 /* threshold of the diagnose messages. (Warning or Debug) */ | 476 /* threshold of the diagnose messages. (Warning or Debug) */ |
483 /* */ | 477 /* */ |
484 /* Input Parameters: */ | 478 /* Input Parameters: */ |
485 /* - the dar use id */ | 479 /* - the dar use id */ |
486 /* - the dar level */ | 480 /* - the dar level */ |
487 /* */ | 481 /* */ |
488 /* Output Parameters: */ | 482 /* Output Parameters: */ |
489 /* Validation of the function execution. */ | 483 /* Validation of the function execution. */ |
490 /* */ | 484 /* */ |
491 /* */ | 485 /* */ |
492 /* Note: */ | 486 /* Note: */ |
493 /* None */ | 487 /* None */ |
494 /* */ | 488 /* */ |
495 /********************************************************************************/ | 489 /***************************************************************************/ |
496 | 490 |
497 T_RV_RET dar_diagnose_swe_filter ( T_RVM_USE_ID dar_use_id, | 491 T_RV_RET dar_diagnose_swe_filter ( T_RVM_USE_ID dar_use_id, |
498 T_DAR_LEVEL dar_level) | 492 T_DAR_LEVEL dar_level) |
499 { | 493 { |
500 /* Declare local variables */ | 494 /* Declare local variables */ |
501 T_RVF_MB_STATUS mb_status = RVF_GREEN; | 495 T_RVF_MB_STATUS mb_status = RVF_GREEN; |
502 T_DAR_FILTER_START *use_id_p = NULL; | 496 T_DAR_FILTER_START *use_id_p = NULL; |
503 | 497 |
504 /************************** dar_diagnose_swe_filter function ***************/ | 498 /*********************** dar_diagnose_swe_filter function *************/ |
505 | 499 |
506 if (dar_gbl_var_p == NULL ) | 500 if (dar_gbl_var_p == NULL ) |
507 { | 501 { |
508 dar_error_trace(DAR_ENTITY_NOT_START); | 502 dar_error_trace(DAR_ENTITY_NOT_START); |
509 return(RV_NOT_READY); | 503 return(RV_NOT_READY); |
512 /* allocate the memory for the message to send */ | 506 /* allocate the memory for the message to send */ |
513 mb_status = rvf_get_buf (dar_gbl_var_p->mb_dar, | 507 mb_status = rvf_get_buf (dar_gbl_var_p->mb_dar, |
514 sizeof (T_DAR_FILTER_START), | 508 sizeof (T_DAR_FILTER_START), |
515 (T_RVF_BUFFER **) (&use_id_p)); | 509 (T_RVF_BUFFER **) (&use_id_p)); |
516 | 510 |
517 /* If insufficient resources, then report a memory error and abort. */ | 511 /* If insufficient resources, then report a memory error and abort. */ |
518 if (mb_status == RVF_YELLOW) | 512 if (mb_status == RVF_YELLOW) |
519 { | 513 { |
520 /* deallocate the memory */ | 514 /* deallocate the memory */ |
521 rvf_free_buf((T_RVF_BUFFER *)use_id_p); | 515 rvf_free_buf((T_RVF_BUFFER *)use_id_p); |
522 dar_error_trace(DAR_ENTITY_NO_MEMORY); | 516 dar_error_trace(DAR_ENTITY_NO_MEMORY); |
544 rvf_send_msg (dar_gbl_var_p->addrId, | 538 rvf_send_msg (dar_gbl_var_p->addrId, |
545 use_id_p); | 539 use_id_p); |
546 | 540 |
547 return (RV_OK); | 541 return (RV_OK); |
548 | 542 |
549 | 543 |
550 } /* dar_diagnose_swe_filter */ | 544 } /* dar_diagnose_swe_filter */ |
551 | 545 |
552 /********************************************************************************/ | 546 /***************************************************************************/ |
553 /* */ | 547 /* */ |
554 /* Function Name: dar_diagnose_write */ | 548 /* Function Name: dar_diagnose_write */ |
555 /* */ | 549 /* */ |
556 /* Purpose: This function is called to store diagnose data in RAM buffer */ | 550 /* Purpose: This function is called to store diagnose data in RAM */ |
557 /* */ | 551 /* buffer. */ |
558 /* */ | 552 /* */ |
559 /* Input Parameters: */ | 553 /* Input Parameters: */ |
560 /* Pointer to the message to store */ | 554 /* Pointer to the message to store */ |
561 /* Data Format, ( the Binary format is not supported) */ | 555 /* Data Format, ( the Binary format is not supported) */ |
562 /* Data level, */ | 556 /* Data level, */ |
563 /* Data Use Id, */ | 557 /* Data Use Id, */ |
564 /* */ | 558 /* */ |
565 /* Output Parameters: */ | 559 /* Output Parameters: */ |
566 /* Validation of the diagnose execution. */ | 560 /* Validation of the diagnose execution. */ |
567 /* */ | 561 /* */ |
568 /* */ | 562 /* */ |
569 /* */ | 563 /* */ |
570 /* Revision History: */ | 564 /* Revision History: */ |
571 /* None. */ | 565 /* None. */ |
572 /* */ | 566 /* */ |
573 /********************************************************************************/ | 567 /***************************************************************************/ |
574 T_RV_RET dar_diagnose_write( T_DAR_INFO *buffer_p, | 568 T_RV_RET dar_diagnose_write( T_DAR_INFO *buffer_p, |
575 T_DAR_FORMAT format, | 569 T_DAR_FORMAT format, |
576 T_DAR_LEVEL diagnose_info_level, | 570 T_DAR_LEVEL diagnose_info_level, |
577 T_RVM_USE_ID dar_use_id) | 571 T_RVM_USE_ID dar_use_id) |
578 { | 572 { |
592 /* check if the mask_warning is in the dar_filter array */ | 586 /* check if the mask_warning is in the dar_filter array */ |
593 if (((dar_gbl_var_p ->dar_filter_array[index].mask_warning) | 587 if (((dar_gbl_var_p ->dar_filter_array[index].mask_warning) |
594 & ((dar_use_id)&0xFFFF)) !=0) | 588 & ((dar_use_id)&0xFFFF)) !=0) |
595 { | 589 { |
596 /* The Warning messages must be diagnosed */ | 590 /* The Warning messages must be diagnosed */ |
597 dar_send_write_data( buffer_p, format, diagnose_info_level, dar_use_id); | 591 dar_send_write_data( buffer_p, format, diagnose_info_level, |
592 dar_use_id); | |
598 } | 593 } |
599 | 594 |
600 else | 595 else |
601 { | 596 { |
602 /* There is no mask_warning for this use_id in the dar_filter array */ | 597 /* |
603 /* The warning messages can't be diagnosed */ | 598 * There is no mask_warning for this use_id in the dar_filter |
599 * array; the warning messages can't be diagnosed. | |
600 */ | |
604 DAR_TRACE_WARNING("The Warning messages can't be diagnosed"); | 601 DAR_TRACE_WARNING("The Warning messages can't be diagnosed"); |
605 } | 602 } |
606 | 603 |
607 break; | 604 break; |
608 } /* case DAR_WARNING */ | 605 } /* case DAR_WARNING */ |
614 | 611 |
615 if (((dar_gbl_var_p ->dar_filter_array[index].mask_debug) | 612 if (((dar_gbl_var_p ->dar_filter_array[index].mask_debug) |
616 & ((dar_use_id)&0xFFFF)) !=0) | 613 & ((dar_use_id)&0xFFFF)) !=0) |
617 { | 614 { |
618 /* The Debug messages must be diagnosed */ | 615 /* The Debug messages must be diagnosed */ |
619 dar_send_write_data( buffer_p, format, diagnose_info_level, dar_use_id); | 616 dar_send_write_data( buffer_p, format, diagnose_info_level, |
617 dar_use_id); | |
620 } | 618 } |
621 | 619 |
622 else | 620 else |
623 { | 621 { |
624 /* There is no mask_debug for this use_id in the dar_filter array */ | 622 /* |
625 /* The debug messages can't be diagnosed */ | 623 * There is no mask_debug for this use_id in the dar_filter |
624 * array; the debug messages can't be diagnosed. | |
625 */ | |
626 DAR_TRACE_WARNING("The Debug messages can't be diagnosed"); | 626 DAR_TRACE_WARNING("The Debug messages can't be diagnosed"); |
627 } | 627 } |
628 break; | 628 break; |
629 } /* case DAR_DEBUG */ | 629 } /* case DAR_DEBUG */ |
630 | 630 |
631 default: | 631 default: |
632 { | 632 { |
633 /* Unknow level has been received */ | 633 /* Unknow level has been received */ |
634 DAR_TRACE_WARNING("A DAR unknow level has been received "); | 634 DAR_TRACE_WARNING("A DAR unknown level has been received"); |
635 break; | 635 break; |
636 } | 636 } |
637 } /* switch(msg_p->use_msg_parameter.level) */ | 637 } /* switch(msg_p->use_msg_parameter.level) */ |
638 } /* if (search_group(dar_use_id.group_nb,&index)== RV_OK) */ | 638 } /* if (search_group(dar_use_id.group_nb,&index)== RV_OK) */ |
639 | 639 |
640 else | 640 else |
641 { | 641 { |
642 /* An unknow group message has been received */ | 642 /* An unknow group message has been received */ |
643 DAR_TRACE_WARNING("A DAR unknow group level message has been received "); | 643 DAR_TRACE_WARNING("A DAR unknown group level message has been received"); |
644 } | 644 } |
645 | 645 |
646 return (RV_OK); | 646 return (RV_OK); |
647 } /* dar_diagnose_write */ | 647 } /* dar_diagnose_write */ |
648 | 648 |
649 | 649 |
650 /********************************************************************************/ | 650 /***************************************************************************/ |
651 /* */ | 651 /* */ |
652 /* Function Name: dar_diagnose_generate_emergency */ | 652 /* Function Name: dar_diagnose_generate_emergency */ |
653 /* */ | 653 /* */ |
654 /* Purpose: This function is called to store diagnose data in RAM buffer */ | 654 /* Purpose: This function is called to store diagnose data in RAM */ |
655 /* when an emergency has been detected and goes to emergency */ | 655 /* buffer when an emergency has been detected and goes to */ |
656 /* (automatic reset) */ | 656 /* emergency (automatic reset) */ |
657 /* */ | 657 /* */ |
658 /* */ | 658 /* */ |
659 /* */ | 659 /* */ |
660 /* Input Parameters: */ | 660 /* Input Parameters: */ |
661 /* Pointer to the message to store */ | 661 /* Pointer to the message to store */ |
662 /* Data Format, ( the Binary format is not supported) */ | 662 /* Data Format, ( the Binary format is not supported) */ |
663 /* Data Use Id, */ | 663 /* Data Use Id, */ |
664 /* */ | 664 /* */ |
665 /* Output Parameters: */ | 665 /* Output Parameters: */ |
666 /* Validation of the diagnose execution. */ | 666 /* Validation of the diagnose execution. */ |
667 /* */ | 667 /* */ |
668 /* */ | 668 /* */ |
669 /* */ | 669 /* */ |
670 /* Revision History: */ | 670 /* Revision History: */ |
671 /* None. */ | 671 /* None. */ |
672 /* */ | 672 /* */ |
673 /********************************************************************************/ | 673 /***************************************************************************/ |
674 T_RV_RET dar_diagnose_generate_emergency( T_DAR_INFO *buffer_p, | 674 T_RV_RET dar_diagnose_generate_emergency( T_DAR_INFO *buffer_p, |
675 T_DAR_FORMAT format, | 675 T_DAR_FORMAT format, |
676 T_RVM_USE_ID dar_use_id) | 676 T_RVM_USE_ID dar_use_id) |
677 { | 677 { |
678 if (dar_gbl_var_p != NULL) | 678 if (dar_gbl_var_p != NULL) |
679 { | 679 { |
680 /* Process the diagnose emergency */ | 680 /* Process the diagnose emergency */ |
681 dar_process_emergency(buffer_p, format, dar_use_id, DAR_EMERGENCY_RESET|DAR_NEW_ENTRY); | 681 dar_process_emergency(buffer_p, format, dar_use_id, |
682 | 682 DAR_EMERGENCY_RESET|DAR_NEW_ENTRY); |
683 | |
683 return (RV_OK); | 684 return (RV_OK); |
684 } | 685 } |
685 else | 686 else |
686 { | 687 { |
687 return (RV_NOT_READY); | 688 return (RV_NOT_READY); |
688 } | 689 } |
689 | 690 |
690 } /* dar_diagnose_write */ | 691 } /* dar_diagnose_write */ |
691 | 692 |
692 | 693 |
693 /********************************************************************************/ | 694 /***************************************************************************/ |
694 /* */ | 695 /* */ |
695 /* Function Name: dar_diagnose_write_emergency */ | 696 /* Function Name: dar_diagnose_write_emergency */ |
696 /* */ | 697 /* */ |
697 /* Purpose: This function is called to store diagnose data in RAM buffer */ | 698 /* Purpose: This function is called to store diagnose data in RAM */ |
698 /* when an emergency has been detected. Data is written directly */ | 699 /* buffer when an emergency has been detected. Data is */ |
699 /* compared to dar_diagnode_write where data is sent to DAR */ | 700 /* written directly compared to dar_diagnode_write where data */ |
700 /* via messages. Depending on the passed flags a RESET will be */ | 701 /* is sent to DAR via messages. Depending on the passed flags */ |
701 /* done. */ | 702 /* a RESET will be done. */ |
702 /* */ | 703 /* */ |
703 /* */ | 704 /* */ |
704 /* Input Parameters: */ | 705 /* Input Parameters: */ |
705 /* Pointer to the message to store */ | 706 /* Pointer to the message to store */ |
706 /* Data Format, ( the Binary format is not supported) */ | 707 /* Data Format, ( the Binary format is not supported) */ |
707 /* Data Use Id, */ | 708 /* Data Use Id, */ |
708 /* Flags */ | 709 /* Flags */ |
709 /* */ | 710 /* */ |
710 /* Output Parameters: */ | 711 /* Output Parameters: */ |
711 /* Validation of the diagnose execution. */ | 712 /* Validation of the diagnose execution. */ |
712 /* */ | 713 /* */ |
713 /* */ | 714 /* */ |
714 /* */ | 715 /* */ |
715 /* Revision History: */ | 716 /* Revision History: */ |
716 /* None. */ | 717 /* None. */ |
717 /* */ | 718 /* */ |
718 /********************************************************************************/ | 719 /***************************************************************************/ |
719 T_RV_RET dar_diagnose_write_emergency( T_DAR_INFO *buffer_p, | 720 T_RV_RET dar_diagnose_write_emergency( T_DAR_INFO *buffer_p, |
720 T_DAR_FORMAT format, | 721 T_DAR_FORMAT format, |
721 T_RVM_USE_ID dar_use_id, | 722 T_RVM_USE_ID dar_use_id, |
722 UINT32 flags) | 723 UINT32 flags) |
723 { | 724 { |
739 | 740 |
740 /* ************************************************ */ | 741 /* ************************************************ */ |
741 /* THE DAR ENTITY IS DISABLED */ | 742 /* THE DAR ENTITY IS DISABLED */ |
742 /* ************************************************ */ | 743 /* ************************************************ */ |
743 | 744 |
744 #include "rv/rv_general.h" | 745 #include "../../riviera/rv/rv_general.h" |
745 #include "rvm/rvm_gen.h" | 746 #include "../../riviera/rvm/rvm_gen.h" |
746 #include "rvm/rvm_priorities.h" | 747 #include "../../riviera/rvm/rvm_priorities.h" |
747 #include "rvf/rvf_target.h" | 748 #include "../../riviera/rvf/rvf_target.h" |
748 #include "rvf/rvf_i.h" | 749 #include "../../riviera/rvf/rvf_i.h" |
749 #include "dar/dar_gen.h" | 750 #include "dar_gen.h" |
750 | 751 |
751 T_RV_RET dar_diagnose_swe_filter ( T_RVM_USE_ID dar_use_id, | 752 T_RV_RET dar_diagnose_swe_filter ( T_RVM_USE_ID dar_use_id, |
752 T_DAR_LEVEL dar_level) | 753 T_DAR_LEVEL dar_level) |
753 { | 754 { |
754 return (RV_OK); | 755 return (RV_OK); |