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