FreeCalypso > hg > freecalypso-citrine
comparison services/dar/dar_api.c @ 0:75a11d740a02
initial import of gsm-fw from freecalypso-sw rev 1033:5ab737ac3ad7
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Thu, 09 Jun 2016 00:02:41 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:75a11d740a02 |
---|---|
1 /****************************************************************************/ | |
2 /* */ | |
3 /* File Name: dar_api.c */ | |
4 /* */ | |
5 /* Purpose: This file contains all the functions used to service */ | |
6 /* primitives. */ | |
7 /* */ | |
8 /* Version 0.1 */ | |
9 /* */ | |
10 /* Date Modification */ | |
11 /* ---------------------------------------------------------------------- */ | |
12 /* 2 October 2001 Create */ | |
13 /* */ | |
14 /* Author - Stephanie Gerthoux */ | |
15 /* */ | |
16 /* (C) Copyright 2001 by Texas Instruments Incorporated, All Rights Reserved*/ | |
17 /****************************************************************************/ | |
18 | |
19 #include "../../riviera/rv/rv_defined_swe.h" | |
20 | |
21 | |
22 #ifdef RVM_DAR_SWE | |
23 #include "../../include/config.h" | |
24 | |
25 #include "../../bsp/abb+spi/abb.h" | |
26 #include "../../riviera/rv/rv_general.h" | |
27 #include "../../riviera/rvm/rvm_gen.h" | |
28 #include "dar_api.h" | |
29 #include "dar_env.h" | |
30 #include "dar_error_hdlr_i.h" | |
31 #include "dar_messages_i.h" | |
32 #include "dar_msg_ft.h" | |
33 #include "dar_macro_i.h" | |
34 #include "dar_diagnose_i.h" | |
35 #include "dar_const_i.h" | |
36 #include "dar_emergency.h" | |
37 | |
38 #ifndef _WINDOWS | |
39 /* enable the timer */ | |
40 #include "../../bsp/mem.h" | |
41 #include "../../bsp/timer.h" | |
42 #include "../../bsp/iq.h" | |
43 #if (CHIPSET == 12) | |
44 #include "inth/sys_inth.h" | |
45 #endif | |
46 #endif | |
47 | |
48 /**** Global variable ****/ | |
49 /* Define load timer */ | |
50 static UINT16 dar_load_tim = 0x0; | |
51 | |
52 /* Increment variable */ | |
53 static BOOLEAN dar_increment = TRUE; | |
54 | |
55 /* DAR previous status */ | |
56 T_DAR_RECOVERY_STATUS dar_previous_status; | |
57 | |
58 /* DAR previous exception*/ | |
59 UINT8 dar_previous_exception; | |
60 | |
61 /**** Define extern variables ****/ | |
62 /* Get the status of the system */ | |
63 extern T_DAR_RECOVERY_STATUS dar_current_status; | |
64 | |
65 /* dar_exception_status : to get the status of the exception */ | |
66 extern UINT8 dar_exception_status; | |
67 | |
68 /* Define the recovery buffer */ | |
69 extern UINT8 dar_recovery_buffer[DAR_RECOVERY_DATA_MAX_BUFFER_SIZE]; | |
70 | |
71 /* Define a pointer to the Global Environment Control block */ | |
72 extern T_DAR_ENV_CTRL_BLK *dar_gbl_var_p; | |
73 | |
74 /* *********************************************************************** */ | |
75 /* RECOVERY */ | |
76 /* *********************************************************************** */ | |
77 | |
78 /***************************************************************************/ | |
79 /* */ | |
80 /* Function Name: dar_recovery_get_status */ | |
81 /* */ | |
82 /* Purpose: This function is called by the MMI at the beginning of the */ | |
83 /* procedure, in order to get the status of the last reset of */ | |
84 /* the system. */ | |
85 /* */ | |
86 /* Input Parameters: */ | |
87 /* Dar recovery status */ | |
88 /* */ | |
89 /* Output Parameters: */ | |
90 /* Validation of the function execution. */ | |
91 /* */ | |
92 /* Note: */ | |
93 /* None. */ | |
94 /* */ | |
95 /* Revision History: */ | |
96 /* None. */ | |
97 /* */ | |
98 /***************************************************************************/ | |
99 T_RV_RET dar_recovery_get_status(T_DAR_RECOVERY_STATUS* status) | |
100 { | |
101 /* Variable to know the status of th Omega VRPC register */ | |
102 UINT16 dar_pwr_status; | |
103 | |
104 *status = dar_previous_status; | |
105 switch (dar_previous_status) | |
106 { | |
107 case (DAR_WATCHDOG): | |
108 { | |
109 DAR_SEND_TRACE("Dar Entity: Status of the last reset of the system = WATCHDOG",RV_TRACE_LEVEL_DEBUG_HIGH); | |
110 break; | |
111 } | |
112 case (DAR_NORMAL_SCUTTLING): | |
113 { | |
114 DAR_SEND_TRACE("Dar Entity: Status of the last reset of the system = NORMAL SCUTTLING",RV_TRACE_LEVEL_DEBUG_HIGH); | |
115 break; | |
116 } | |
117 case (DAR_EMERGENCY_SCUTTLING): | |
118 { | |
119 DAR_SEND_TRACE("Dar Entity: Status of the last reset of the system = EMERGENCY SCUTTLING",RV_TRACE_LEVEL_DEBUG_HIGH); | |
120 switch (dar_previous_exception) | |
121 { | |
122 case (DAR_EXCEPTION_DATA_ABORT): | |
123 { | |
124 DAR_SEND_TRACE(" A DATA ABORT exception has occured",RV_TRACE_LEVEL_DEBUG_HIGH); | |
125 break; | |
126 } | |
127 | |
128 case (DAR_EXCEPTION_PREFETCH_ABORT): | |
129 { | |
130 DAR_SEND_TRACE(" A PREFETCH ABORT exception has occured",RV_TRACE_LEVEL_DEBUG_HIGH); | |
131 break; | |
132 } | |
133 | |
134 case (DAR_EXCEPTION_UNDEFINED): | |
135 { | |
136 DAR_SEND_TRACE(" A UNDEFINED INSTRUCTION exception has occured",RV_TRACE_LEVEL_DEBUG_HIGH); | |
137 break; | |
138 } | |
139 | |
140 case (DAR_EXCEPTION_SWI): | |
141 { | |
142 DAR_SEND_TRACE(" A SWI exception has occured",RV_TRACE_LEVEL_DEBUG_HIGH); | |
143 break; | |
144 } | |
145 | |
146 case (DAR_EXCEPTION_RESERVED): | |
147 { | |
148 DAR_SEND_TRACE(" A RESERVED exception has occured",RV_TRACE_LEVEL_DEBUG_HIGH); | |
149 break; | |
150 } | |
151 | |
152 default: | |
153 { | |
154 DAR_SEND_TRACE(" An error has been detected",RV_TRACE_LEVEL_DEBUG_HIGH); | |
155 break; | |
156 } | |
157 | |
158 } | |
159 | |
160 break; | |
161 } | |
162 default: | |
163 { | |
164 #if 1 //(_GSM==1) || (defined _WINDOWS) | |
165 dar_pwr_status = ABB_Read_Status(); | |
166 | |
167 #if ((ANALOG == 1) || (ANALOG == 2)) | |
168 if (dar_pwr_status & ONBSTS) | |
169 #elif (ANALOG == 3) | |
170 if (dar_pwr_status & PWONBSTS) | |
171 #endif | |
172 { | |
173 /* Switch on Condition on ON BUTTON Push */ | |
174 DAR_SEND_TRACE("Dar Entity: Status of the last reset of the system = POWER ON/OFF",RV_TRACE_LEVEL_DEBUG_HIGH); | |
175 break; | |
176 } | |
177 else | |
178 { | |
179 /* Branch to a reset at adress 0 */ | |
180 DAR_SEND_TRACE("Dar Entity: Status of the last reset of the system = BRANCH to adress 0",RV_TRACE_LEVEL_DEBUG_HIGH); | |
181 break; | |
182 } | |
183 #else | |
184 /* the SPI is not available in BOARD_TEST configuration */ | |
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); | |
186 #endif | |
187 } | |
188 }/* switch */ | |
189 | |
190 return(RV_OK); | |
191 | |
192 } /* dar_recovery_get_status */ | |
193 | |
194 /***************************************************************************/ | |
195 /* */ | |
196 /* Function Name: dar_recovery_config */ | |
197 /* */ | |
198 /* Purpose: This function is used to store a callback function that */ | |
199 /* will be called by the recovery system when a recovery */ | |
200 /* procedure has been initiated */ | |
201 /* */ | |
202 /* Input Parameters: */ | |
203 /* dar callback function */ | |
204 /* */ | |
205 /* Output Parameters: */ | |
206 /* Validation of the function execution. */ | |
207 /* */ | |
208 /* Note: */ | |
209 /* None. */ | |
210 /* */ | |
211 /* Revision History: */ | |
212 /* None. */ | |
213 /* */ | |
214 /***************************************************************************/ | |
215 T_RV_RET dar_recovery_config(T_RV_RET (*dar_store_recovery_data) | |
216 (T_DAR_BUFFER buffer_p, | |
217 UINT16 length)) | |
218 { | |
219 /* call the callback function */ | |
220 dar_gbl_var_p->entity_dar_callback = dar_store_recovery_data; | |
221 | |
222 return(RV_OK); | |
223 } /* dar_recovery_config */ | |
224 | |
225 /***************************************************************************/ | |
226 /* */ | |
227 /* Function Name: dar_get_recovery_data */ | |
228 /* */ | |
229 /* Purpose: This function is used to retrieve data that have been */ | |
230 /* stored in the buffer just before a reset. */ | |
231 /* */ | |
232 /* Input Parameters: */ | |
233 /* - the buffer in whom important data have been stored before the */ | |
234 /* reset */ | |
235 /* - the length of the buffer */ | |
236 /* */ | |
237 /* Output Parameters: */ | |
238 /* Validation of the function execution. */ | |
239 /* */ | |
240 /* Note: */ | |
241 /* None. */ | |
242 /* */ | |
243 /* Revision History: */ | |
244 /* None. */ | |
245 /* */ | |
246 /***************************************************************************/ | |
247 T_RV_RET dar_get_recovery_data( T_DAR_BUFFER buffer_p, UINT16 length ) | |
248 { | |
249 /* Local variables */ | |
250 UINT8 i; | |
251 | |
252 if (buffer_p != NULL) | |
253 { | |
254 if(length <= DAR_RECOVERY_DATA_MAX_BUFFER_SIZE) | |
255 { | |
256 /* Retrieve data that have been stored in the global buffer */ | |
257 for(i=0;i<length;i++) | |
258 { | |
259 buffer_p[i] = dar_recovery_buffer[i]; | |
260 } | |
261 } | |
262 | |
263 else | |
264 /* the lenth is longer than DAR_RECOVERY_DATA_MAX_BUFFER_SIZE */ | |
265 { | |
266 /* So retrieve "DAR_RECOVERY_DATA_MAX_BUFFER_SIZE" data that have been stored */ | |
267 /* in the global buffer, the other data (length -"DAR_RECOVERY_DATA_MAX_BUFFER_SIZE") */ | |
268 /* are lost*/ | |
269 for(i=0;i<DAR_RECOVERY_DATA_MAX_BUFFER_SIZE;i++) | |
270 { | |
271 buffer_p[i] = dar_recovery_buffer[i]; | |
272 } | |
273 | |
274 DAR_SEND_TRACE_PARAM("Bytes nb that haven't be saved due to not enough memory space ",(DAR_RECOVERY_DATA_MAX_BUFFER_SIZE-length),DAR_WARNING); | |
275 } | |
276 } /* if (buffer_p != NULL) */ | |
277 | |
278 return(RV_OK); | |
279 | |
280 } /* dar_get_recovery_data */ | |
281 | |
282 | |
283 /* *********************************************************************** */ | |
284 /* WATCHDOG */ | |
285 /* *********************************************************************** */ | |
286 | |
287 /***************************************************************************/ | |
288 /* */ | |
289 /* Function Name: dar_start_watchdog_timer */ | |
290 /* */ | |
291 /* Purpose: This function uses the timer as a general purpose timer */ | |
292 /* instead of Watchdog. It loads the timer, starts it and */ | |
293 /* then unmasks the interrupt. */ | |
294 /* */ | |
295 /* Input Parameters: */ | |
296 /* time's interval in milliseconds before the timer expires */ | |
297 /* */ | |
298 /* Output Parameters: */ | |
299 /* Validation of the function execution. */ | |
300 /* */ | |
301 /* Note: */ | |
302 /* None. */ | |
303 /* */ | |
304 /* Revision History: */ | |
305 /* None. */ | |
306 /* */ | |
307 /***************************************************************************/ | |
308 T_RV_RET dar_start_watchdog_timer(UINT16 timer_expiration_value) | |
309 { | |
310 DAR_SEND_TRACE("DAR Watchdog timer",RV_TRACE_LEVEL_DEBUG_LOW); | |
311 | |
312 /* use Watchdog timer set as a general purpose timer */ | |
313 /* Calculate the load value thanks to the formula: */ | |
314 /* timer_expiration_value * 1000 = Tclk * (DAR_LOAD_TIM+1)*2^(PTV+1)*/ | |
315 /* (in Watchdog mode, the value of PTV is fixed to 7) */ | |
316 dar_load_tim = ((timer_expiration_value * 1000)/(1.078*256))-1; | |
317 | |
318 #ifndef _WINDOWS | |
319 /* Load "dar_load_tim" value */ | |
320 TIMER_WriteValue(dar_load_tim); | |
321 | |
322 /* Start timer with PTV = 7, no autoreload, free = 0 */ | |
323 *(volatile UINT16*)TIMER_CNTL_REG = 0x0E80; | |
324 | |
325 /* Unmask IRQ0 */ | |
326 #if (CHIPSET == 12) | |
327 F_INTH_ENABLE_ONE_IT(C_INTH_WATCHDOG_IT); | |
328 #else | |
329 IQ_Unmask(IQ_WATCHDOG); | |
330 #endif | |
331 #endif | |
332 | |
333 return(RV_OK); | |
334 | |
335 } /* dar_start_watchdog_timer */ | |
336 | |
337 /***************************************************************************/ | |
338 /* */ | |
339 /* Function Name: dar_reload_watchdog_timer */ | |
340 /* */ | |
341 /* Purpose: This function is used to maintain the timer in reloading */ | |
342 /* it periodically before it expires. */ | |
343 /* */ | |
344 /* Input Parameters: */ | |
345 /* None */ | |
346 /* */ | |
347 /* Output Parameters: */ | |
348 /* Validation of the function execution. */ | |
349 /* */ | |
350 /* Note: */ | |
351 /* None. */ | |
352 /* */ | |
353 /* Revision History: */ | |
354 /* None. */ | |
355 /* */ | |
356 /***************************************************************************/ | |
357 T_RV_RET dar_reload_watchdog_timer() | |
358 { | |
359 #ifndef _WINDOWS | |
360 | |
361 DAR_SEND_TRACE("Reload Watchdog ",RV_TRACE_LEVEL_DEBUG_LOW); | |
362 | |
363 /* Stop the timer */ | |
364 *(volatile UINT16*)TIMER_CNTL_REG = 0x0E00; | |
365 | |
366 /* Reload the timer with a different value each time */ | |
367 if (dar_increment == TRUE) | |
368 { | |
369 TIMER_WriteValue(++dar_load_tim); | |
370 dar_increment = FALSE; | |
371 } | |
372 else | |
373 { | |
374 TIMER_WriteValue(--dar_load_tim); | |
375 dar_increment = TRUE; | |
376 } | |
377 | |
378 /* Restart timer with PTV = 7, no autoreload, free = 0 */ | |
379 *(volatile UINT16*)TIMER_CNTL_REG = 0x0E80; | |
380 #endif | |
381 | |
382 return(RV_OK); | |
383 | |
384 } /* dar_reload_watchdog_timer */ | |
385 | |
386 /***************************************************************************/ | |
387 /* */ | |
388 /* Function Name: dar_stop_watchdog_timer */ | |
389 /* */ | |
390 /* Purpose: This function stops the timer used as a general purpose */ | |
391 /* timer instead of watchdog. */ | |
392 /* */ | |
393 /* Input Parameters: */ | |
394 /* None */ | |
395 /* */ | |
396 /* Output Parameters: */ | |
397 /* Validation of the function execution. */ | |
398 /* */ | |
399 /* Note: */ | |
400 /* None. */ | |
401 /* */ | |
402 /* Revision History: */ | |
403 /* None. */ | |
404 /* */ | |
405 /***************************************************************************/ | |
406 T_RV_RET dar_stop_watchdog_timer() | |
407 { | |
408 #ifndef _WINDOWS | |
409 /* Stop the timer */ | |
410 *(volatile UINT16*)TIMER_CNTL_REG = 0x0E00; | |
411 | |
412 /* Mask IRQ0 */ | |
413 #if (CHIPSET == 12) | |
414 F_INTH_DISABLE_ONE_IT(C_INTH_WATCHDOG_IT); | |
415 #else | |
416 IQ_Mask(IQ_WATCHDOG); | |
417 #endif | |
418 #endif | |
419 | |
420 return(RV_OK); | |
421 | |
422 } /* dar_stop_watchdog_timer */ | |
423 | |
424 | |
425 /* *********************************************************************** */ | |
426 /* RESET */ | |
427 /* *********************************************************************** */ | |
428 | |
429 /***************************************************************************/ | |
430 /* */ | |
431 /* Function Name: dar_reset_system */ | |
432 /* */ | |
433 /* Purpose: This function can be used to reset the system voluntarily. */ | |
434 /* */ | |
435 /* Input Parameters: */ | |
436 /* None */ | |
437 /* */ | |
438 /* Output Parameters: */ | |
439 /* Validation of the function execution. */ | |
440 /* */ | |
441 /* Note: */ | |
442 /* None. */ | |
443 /* */ | |
444 /* Revision History: */ | |
445 /* None. */ | |
446 /* */ | |
447 /***************************************************************************/ | |
448 T_RV_RET dar_reset_system(void) | |
449 { | |
450 | |
451 /* Update the DAR recovery status */ | |
452 dar_current_status = DAR_NORMAL_SCUTTLING; | |
453 | |
454 /* Call the MMI callback function to save some parameters before reset */ | |
455 dar_gbl_var_p->entity_dar_callback(dar_recovery_buffer,DAR_RECOVERY_DATA_MAX_BUFFER_SIZE); | |
456 | |
457 /* Send a trace before the reset of the system */ | |
458 DAR_SEND_TRACE("Voluntary reset of the system",RV_TRACE_LEVEL_DEBUG_HIGH); | |
459 | |
460 dar_reset(); | |
461 | |
462 return(RV_OK); | |
463 } | |
464 | |
465 /* *********************************************************************** */ | |
466 /* DIAGNOSE */ | |
467 /* *********************************************************************** */ | |
468 | |
469 /***************************************************************************/ | |
470 /* */ | |
471 /* Function Name: dar_diagnose_swe_filter */ | |
472 /* */ | |
473 /* Purpose: This function is called to configure the Diagnose filtering.*/ | |
474 /* It allows to determine what Software Entity ( dar_use_id ) */ | |
475 /* wants to use the Diagnose and allows to indicate the level */ | |
476 /* threshold of the diagnose messages. (Warning or Debug) */ | |
477 /* */ | |
478 /* Input Parameters: */ | |
479 /* - the dar use id */ | |
480 /* - the dar level */ | |
481 /* */ | |
482 /* Output Parameters: */ | |
483 /* Validation of the function execution. */ | |
484 /* */ | |
485 /* */ | |
486 /* Note: */ | |
487 /* None */ | |
488 /* */ | |
489 /***************************************************************************/ | |
490 | |
491 T_RV_RET dar_diagnose_swe_filter ( T_RVM_USE_ID dar_use_id, | |
492 T_DAR_LEVEL dar_level) | |
493 { | |
494 /* Declare local variables */ | |
495 T_RVF_MB_STATUS mb_status = RVF_GREEN; | |
496 T_DAR_FILTER_START *use_id_p = NULL; | |
497 | |
498 /*********************** dar_diagnose_swe_filter function *************/ | |
499 | |
500 if (dar_gbl_var_p == NULL ) | |
501 { | |
502 dar_error_trace(DAR_ENTITY_NOT_START); | |
503 return(RV_NOT_READY); | |
504 } | |
505 | |
506 /* allocate the memory for the message to send */ | |
507 mb_status = rvf_get_buf (dar_gbl_var_p->mb_dar, | |
508 sizeof (T_DAR_FILTER_START), | |
509 (T_RVF_BUFFER **) (&use_id_p)); | |
510 | |
511 /* If insufficient resources, then report a memory error and abort. */ | |
512 if (mb_status == RVF_YELLOW) | |
513 { | |
514 /* deallocate the memory */ | |
515 rvf_free_buf((T_RVF_BUFFER *)use_id_p); | |
516 dar_error_trace(DAR_ENTITY_NO_MEMORY); | |
517 return (RV_NOT_SUPPORTED); | |
518 } | |
519 else | |
520 if (mb_status == RVF_RED) | |
521 { | |
522 dar_error_trace(DAR_ENTITY_NO_MEMORY); | |
523 return (RV_MEMORY_ERR); | |
524 } | |
525 | |
526 /* fill the message id */ | |
527 use_id_p ->os_hdr.msg_id = DAR_FILTER_REQ; | |
528 | |
529 /* fill the addr source id */ | |
530 use_id_p->os_hdr.src_addr_id = dar_gbl_var_p->addrId; | |
531 | |
532 /* fill the message parameters (group, mask and level) */ | |
533 use_id_p->use_msg_parameter.group_nb = (dar_use_id>>16)& 0x7FFF; | |
534 use_id_p->use_msg_parameter.mask = (dar_use_id)&0xFFFF; | |
535 use_id_p->use_msg_parameter.level = dar_level; | |
536 | |
537 /* send the messsage to the DAR entity */ | |
538 rvf_send_msg (dar_gbl_var_p->addrId, | |
539 use_id_p); | |
540 | |
541 return (RV_OK); | |
542 | |
543 | |
544 } /* dar_diagnose_swe_filter */ | |
545 | |
546 /***************************************************************************/ | |
547 /* */ | |
548 /* Function Name: dar_diagnose_write */ | |
549 /* */ | |
550 /* Purpose: This function is called to store diagnose data in RAM */ | |
551 /* buffer. */ | |
552 /* */ | |
553 /* Input Parameters: */ | |
554 /* Pointer to the message to store */ | |
555 /* Data Format, ( the Binary format is not supported) */ | |
556 /* Data level, */ | |
557 /* Data Use Id, */ | |
558 /* */ | |
559 /* Output Parameters: */ | |
560 /* Validation of the diagnose execution. */ | |
561 /* */ | |
562 /* */ | |
563 /* */ | |
564 /* Revision History: */ | |
565 /* None. */ | |
566 /* */ | |
567 /***************************************************************************/ | |
568 T_RV_RET dar_diagnose_write( T_DAR_INFO *buffer_p, | |
569 T_DAR_FORMAT format, | |
570 T_DAR_LEVEL diagnose_info_level, | |
571 T_RVM_USE_ID dar_use_id) | |
572 { | |
573 /* Declare local variables */ | |
574 UINT8 index =0 ; /* local index */ | |
575 | |
576 /* Check if the dar_use_id group_nb exists */ | |
577 /* If the group exists... */ | |
578 if(dar_search_group((dar_use_id>>16)& 0x7FFF,&index) == RV_OK) | |
579 { | |
580 /* Check the Dar level */ | |
581 switch(diagnose_info_level) | |
582 { | |
583 case DAR_WARNING: | |
584 { | |
585 /* The DAR entity wants to process Warning messages */ | |
586 /* check if the mask_warning is in the dar_filter array */ | |
587 if (((dar_gbl_var_p ->dar_filter_array[index].mask_warning) | |
588 & ((dar_use_id)&0xFFFF)) !=0) | |
589 { | |
590 /* The Warning messages must be diagnosed */ | |
591 dar_send_write_data( buffer_p, format, diagnose_info_level, | |
592 dar_use_id); | |
593 } | |
594 | |
595 else | |
596 { | |
597 /* | |
598 * There is no mask_warning for this use_id in the dar_filter | |
599 * array; the warning messages can't be diagnosed. | |
600 */ | |
601 DAR_TRACE_WARNING("The Warning messages can't be diagnosed"); | |
602 } | |
603 | |
604 break; | |
605 } /* case DAR_WARNING */ | |
606 | |
607 case DAR_DEBUG: | |
608 { | |
609 /* The DAR entity wants to process Debug messages */ | |
610 /* Check if the mask_debug is in the dar_filter array */ | |
611 | |
612 if (((dar_gbl_var_p ->dar_filter_array[index].mask_debug) | |
613 & ((dar_use_id)&0xFFFF)) !=0) | |
614 { | |
615 /* The Debug messages must be diagnosed */ | |
616 dar_send_write_data( buffer_p, format, diagnose_info_level, | |
617 dar_use_id); | |
618 } | |
619 | |
620 else | |
621 { | |
622 /* | |
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"); | |
627 } | |
628 break; | |
629 } /* case DAR_DEBUG */ | |
630 | |
631 default: | |
632 { | |
633 /* Unknow level has been received */ | |
634 DAR_TRACE_WARNING("A DAR unknown level has been received"); | |
635 break; | |
636 } | |
637 } /* switch(msg_p->use_msg_parameter.level) */ | |
638 } /* if (search_group(dar_use_id.group_nb,&index)== RV_OK) */ | |
639 | |
640 else | |
641 { | |
642 /* An unknow group message has been received */ | |
643 DAR_TRACE_WARNING("A DAR unknown group level message has been received"); | |
644 } | |
645 | |
646 return (RV_OK); | |
647 } /* dar_diagnose_write */ | |
648 | |
649 | |
650 /***************************************************************************/ | |
651 /* */ | |
652 /* Function Name: dar_diagnose_generate_emergency */ | |
653 /* */ | |
654 /* Purpose: This function is called to store diagnose data in RAM */ | |
655 /* buffer when an emergency has been detected and goes to */ | |
656 /* emergency (automatic reset) */ | |
657 /* */ | |
658 /* */ | |
659 /* */ | |
660 /* Input Parameters: */ | |
661 /* Pointer to the message to store */ | |
662 /* Data Format, ( the Binary format is not supported) */ | |
663 /* Data Use Id, */ | |
664 /* */ | |
665 /* Output Parameters: */ | |
666 /* Validation of the diagnose execution. */ | |
667 /* */ | |
668 /* */ | |
669 /* */ | |
670 /* Revision History: */ | |
671 /* None. */ | |
672 /* */ | |
673 /***************************************************************************/ | |
674 T_RV_RET dar_diagnose_generate_emergency( T_DAR_INFO *buffer_p, | |
675 T_DAR_FORMAT format, | |
676 T_RVM_USE_ID dar_use_id) | |
677 { | |
678 if (dar_gbl_var_p != NULL) | |
679 { | |
680 /* Process the diagnose emergency */ | |
681 dar_process_emergency(buffer_p, format, dar_use_id, | |
682 DAR_EMERGENCY_RESET|DAR_NEW_ENTRY); | |
683 | |
684 return (RV_OK); | |
685 } | |
686 else | |
687 { | |
688 return (RV_NOT_READY); | |
689 } | |
690 | |
691 } /* dar_diagnose_write */ | |
692 | |
693 | |
694 /***************************************************************************/ | |
695 /* */ | |
696 /* Function Name: dar_diagnose_write_emergency */ | |
697 /* */ | |
698 /* Purpose: This function is called to store diagnose data in RAM */ | |
699 /* buffer when an emergency has been detected. Data is */ | |
700 /* written directly compared to dar_diagnode_write where data */ | |
701 /* is sent to DAR via messages. Depending on the passed flags */ | |
702 /* a RESET will be done. */ | |
703 /* */ | |
704 /* */ | |
705 /* Input Parameters: */ | |
706 /* Pointer to the message to store */ | |
707 /* Data Format, ( the Binary format is not supported) */ | |
708 /* Data Use Id, */ | |
709 /* Flags */ | |
710 /* */ | |
711 /* Output Parameters: */ | |
712 /* Validation of the diagnose execution. */ | |
713 /* */ | |
714 /* */ | |
715 /* */ | |
716 /* Revision History: */ | |
717 /* None. */ | |
718 /* */ | |
719 /***************************************************************************/ | |
720 T_RV_RET dar_diagnose_write_emergency( T_DAR_INFO *buffer_p, | |
721 T_DAR_FORMAT format, | |
722 T_RVM_USE_ID dar_use_id, | |
723 UINT32 flags) | |
724 { | |
725 if (dar_gbl_var_p != NULL) | |
726 { | |
727 /* Process the diagnose emergency */ | |
728 dar_process_emergency(buffer_p, format, dar_use_id, flags); | |
729 | |
730 return (RV_OK); | |
731 } | |
732 else | |
733 { | |
734 return (RV_NOT_READY); | |
735 } | |
736 | |
737 } /* dar_diagnose_write_emergency */ | |
738 | |
739 #else | |
740 | |
741 /* ************************************************ */ | |
742 /* THE DAR ENTITY IS DISABLED */ | |
743 /* ************************************************ */ | |
744 | |
745 #include "../../riviera/rv/rv_general.h" | |
746 #include "../../riviera/rvm/rvm_gen.h" | |
747 #include "../../riviera/rvm/rvm_priorities.h" | |
748 #include "../../riviera/rvf/rvf_target.h" | |
749 #include "../../riviera/rvf/rvf_i.h" | |
750 #include "dar_gen.h" | |
751 | |
752 T_RV_RET dar_diagnose_swe_filter ( T_RVM_USE_ID dar_use_id, | |
753 T_DAR_LEVEL dar_level) | |
754 { | |
755 return (RV_OK); | |
756 | |
757 } /* dar_diagnose_swe_filter */ | |
758 | |
759 | |
760 T_RV_RET dar_diagnose_write( T_DAR_INFO *buffer_p, | |
761 T_DAR_FORMAT format, | |
762 T_DAR_LEVEL diagnose_info_level, | |
763 T_RVM_USE_ID dar_use_id) | |
764 { | |
765 return (RV_OK); | |
766 | |
767 } /* dar_diagnose_write */ | |
768 | |
769 | |
770 | |
771 T_RV_RET dar_diagnose_generate_emergency( T_DAR_INFO *buffer_p, | |
772 T_DAR_FORMAT format, | |
773 T_RVM_USE_ID dar_use_id) | |
774 { | |
775 | |
776 return (RV_OK); | |
777 | |
778 } /* dar_diagnose_generate_emergency */ | |
779 | |
780 | |
781 T_RV_RET dar_diagnose_write_emergency( T_DAR_INFO *buffer_p, | |
782 T_DAR_FORMAT format, | |
783 T_RVM_USE_ID dar_use_id, | |
784 UINT32 flags) | |
785 { | |
786 return (RV_OK); | |
787 } /* dar_diagnose_write_emergency */ | |
788 | |
789 | |
790 #endif /* #ifdef RVM_DAR_SWE */ |