FreeCalypso > hg > tcs211-fcmodem
comparison chipsetsw/services/dar/dar_api.c @ 0:509db1a7b7b8
initial import: leo2moko-r1
author | Space Falcon <falcon@ivan.Harhan.ORG> |
---|---|
date | Mon, 01 Jun 2015 03:24:05 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:509db1a7b7b8 |
---|---|
1 /****************************************************************************/ | |
2 /* */ | |
3 /* 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 dar_gbl_var_p->entity_dar_callback(dar_recovery_buffer,DAR_RECOVERY_DATA_MAX_BUFFER_SIZE); | |
462 | |
463 /* Send a trace before the reset of the system */ | |
464 DAR_SEND_TRACE("Voluntary reset of the system",RV_TRACE_LEVEL_DEBUG_HIGH); | |
465 | |
466 dar_reset(); | |
467 | |
468 return(RV_OK); | |
469 } | |
470 | |
471 /* **************************************************************************** */ | |
472 /* DIAGNOSE */ | |
473 /* **************************************************************************** */ | |
474 | |
475 /********************************************************************************/ | |
476 /* */ | |
477 /* Function Name: dar_diagnose_swe_filter */ | |
478 /* */ | |
479 /* Purpose: This function is called to configure the Diagnose filtering. */ | |
480 /* It allows to determine what Software Entity ( dar_use_id ) */ | |
481 /* wants to use the Diagnose and allows to indicate the level */ | |
482 /* threshold of the diagnose messages. (Warning or Debug) */ | |
483 /* */ | |
484 /* Input Parameters: */ | |
485 /* - the dar use id */ | |
486 /* - the dar level */ | |
487 /* */ | |
488 /* Output Parameters: */ | |
489 /* Validation of the function execution. */ | |
490 /* */ | |
491 /* */ | |
492 /* Note: */ | |
493 /* None */ | |
494 /* */ | |
495 /********************************************************************************/ | |
496 | |
497 T_RV_RET dar_diagnose_swe_filter ( T_RVM_USE_ID dar_use_id, | |
498 T_DAR_LEVEL dar_level) | |
499 { | |
500 /* Declare local variables */ | |
501 T_RVF_MB_STATUS mb_status = RVF_GREEN; | |
502 T_DAR_FILTER_START *use_id_p = NULL; | |
503 | |
504 /************************** dar_diagnose_swe_filter function ***************/ | |
505 | |
506 if (dar_gbl_var_p == NULL ) | |
507 { | |
508 dar_error_trace(DAR_ENTITY_NOT_START); | |
509 return(RV_NOT_READY); | |
510 } | |
511 | |
512 /* allocate the memory for the message to send */ | |
513 mb_status = rvf_get_buf (dar_gbl_var_p->mb_dar, | |
514 sizeof (T_DAR_FILTER_START), | |
515 (T_RVF_BUFFER **) (&use_id_p)); | |
516 | |
517 /* If insufficient resources, then report a memory error and abort. */ | |
518 if (mb_status == RVF_YELLOW) | |
519 { | |
520 /* deallocate the memory */ | |
521 rvf_free_buf((T_RVF_BUFFER *)use_id_p); | |
522 dar_error_trace(DAR_ENTITY_NO_MEMORY); | |
523 return (RV_NOT_SUPPORTED); | |
524 } | |
525 else | |
526 if (mb_status == RVF_RED) | |
527 { | |
528 dar_error_trace(DAR_ENTITY_NO_MEMORY); | |
529 return (RV_MEMORY_ERR); | |
530 } | |
531 | |
532 /* fill the message id */ | |
533 use_id_p ->os_hdr.msg_id = DAR_FILTER_REQ; | |
534 | |
535 /* fill the addr source id */ | |
536 use_id_p->os_hdr.src_addr_id = dar_gbl_var_p->addrId; | |
537 | |
538 /* fill the message parameters (group, mask and level) */ | |
539 use_id_p->use_msg_parameter.group_nb = (dar_use_id>>16)& 0x7FFF; | |
540 use_id_p->use_msg_parameter.mask = (dar_use_id)&0xFFFF; | |
541 use_id_p->use_msg_parameter.level = dar_level; | |
542 | |
543 /* send the messsage to the DAR entity */ | |
544 rvf_send_msg (dar_gbl_var_p->addrId, | |
545 use_id_p); | |
546 | |
547 return (RV_OK); | |
548 | |
549 | |
550 } /* dar_diagnose_swe_filter */ | |
551 | |
552 /********************************************************************************/ | |
553 /* */ | |
554 /* Function Name: dar_diagnose_write */ | |
555 /* */ | |
556 /* Purpose: This function is called to store diagnose data in RAM buffer */ | |
557 /* */ | |
558 /* */ | |
559 /* Input Parameters: */ | |
560 /* Pointer to the message to store */ | |
561 /* Data Format, ( the Binary format is not supported) */ | |
562 /* Data level, */ | |
563 /* Data Use Id, */ | |
564 /* */ | |
565 /* Output Parameters: */ | |
566 /* Validation of the diagnose execution. */ | |
567 /* */ | |
568 /* */ | |
569 /* */ | |
570 /* Revision History: */ | |
571 /* None. */ | |
572 /* */ | |
573 /********************************************************************************/ | |
574 T_RV_RET dar_diagnose_write( T_DAR_INFO *buffer_p, | |
575 T_DAR_FORMAT format, | |
576 T_DAR_LEVEL diagnose_info_level, | |
577 T_RVM_USE_ID dar_use_id) | |
578 { | |
579 /* Declare local variables */ | |
580 UINT8 index =0 ; /* local index */ | |
581 | |
582 /* Check if the dar_use_id group_nb exists */ | |
583 /* If the group exists... */ | |
584 if(dar_search_group((dar_use_id>>16)& 0x7FFF,&index) == RV_OK) | |
585 { | |
586 /* Check the Dar level */ | |
587 switch(diagnose_info_level) | |
588 { | |
589 case DAR_WARNING: | |
590 { | |
591 /* The DAR entity wants to process Warning messages */ | |
592 /* check if the mask_warning is in the dar_filter array */ | |
593 if (((dar_gbl_var_p ->dar_filter_array[index].mask_warning) | |
594 & ((dar_use_id)&0xFFFF)) !=0) | |
595 { | |
596 /* The Warning messages must be diagnosed */ | |
597 dar_send_write_data( buffer_p, format, diagnose_info_level, dar_use_id); | |
598 } | |
599 | |
600 else | |
601 { | |
602 /* There is no mask_warning for this use_id in the dar_filter array */ | |
603 /* The warning messages can't be diagnosed */ | |
604 DAR_TRACE_WARNING("The Warning messages can't be diagnosed"); | |
605 } | |
606 | |
607 break; | |
608 } /* case DAR_WARNING */ | |
609 | |
610 case DAR_DEBUG: | |
611 { | |
612 /* The DAR entity wants to process Debug messages */ | |
613 /* Check if the mask_debug is in the dar_filter array */ | |
614 | |
615 if (((dar_gbl_var_p ->dar_filter_array[index].mask_debug) | |
616 & ((dar_use_id)&0xFFFF)) !=0) | |
617 { | |
618 /* The Debug messages must be diagnosed */ | |
619 dar_send_write_data( buffer_p, format, diagnose_info_level, dar_use_id); | |
620 } | |
621 | |
622 else | |
623 { | |
624 /* There is no mask_debug for this use_id in the dar_filter array */ | |
625 /* The debug messages can't be diagnosed */ | |
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 unknow 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 unknow 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 buffer */ | |
655 /* when an emergency has been detected and goes to emergency */ | |
656 /* (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, DAR_EMERGENCY_RESET|DAR_NEW_ENTRY); | |
682 | |
683 return (RV_OK); | |
684 } | |
685 else | |
686 { | |
687 return (RV_NOT_READY); | |
688 } | |
689 | |
690 } /* dar_diagnose_write */ | |
691 | |
692 | |
693 /********************************************************************************/ | |
694 /* */ | |
695 /* Function Name: dar_diagnose_write_emergency */ | |
696 /* */ | |
697 /* Purpose: This function is called to store diagnose data in RAM buffer */ | |
698 /* when an emergency has been detected. Data is written directly */ | |
699 /* compared to dar_diagnode_write where data is sent to DAR */ | |
700 /* via messages. Depending on the passed flags a RESET will be */ | |
701 /* done. */ | |
702 /* */ | |
703 /* */ | |
704 /* Input Parameters: */ | |
705 /* Pointer to the message to store */ | |
706 /* Data Format, ( the Binary format is not supported) */ | |
707 /* Data Use Id, */ | |
708 /* Flags */ | |
709 /* */ | |
710 /* Output Parameters: */ | |
711 /* Validation of the diagnose execution. */ | |
712 /* */ | |
713 /* */ | |
714 /* */ | |
715 /* Revision History: */ | |
716 /* None. */ | |
717 /* */ | |
718 /********************************************************************************/ | |
719 T_RV_RET dar_diagnose_write_emergency( T_DAR_INFO *buffer_p, | |
720 T_DAR_FORMAT format, | |
721 T_RVM_USE_ID dar_use_id, | |
722 UINT32 flags) | |
723 { | |
724 if (dar_gbl_var_p != NULL) | |
725 { | |
726 /* Process the diagnose emergency */ | |
727 dar_process_emergency(buffer_p, format, dar_use_id, flags); | |
728 | |
729 return (RV_OK); | |
730 } | |
731 else | |
732 { | |
733 return (RV_NOT_READY); | |
734 } | |
735 | |
736 } /* dar_diagnose_write_emergency */ | |
737 | |
738 #else | |
739 | |
740 /* ************************************************ */ | |
741 /* THE DAR ENTITY IS DISABLED */ | |
742 /* ************************************************ */ | |
743 | |
744 #include "rv/rv_general.h" | |
745 #include "rvm/rvm_gen.h" | |
746 #include "rvm/rvm_priorities.h" | |
747 #include "rvf/rvf_target.h" | |
748 #include "rvf/rvf_i.h" | |
749 #include "dar/dar_gen.h" | |
750 | |
751 T_RV_RET dar_diagnose_swe_filter ( T_RVM_USE_ID dar_use_id, | |
752 T_DAR_LEVEL dar_level) | |
753 { | |
754 return (RV_OK); | |
755 | |
756 } /* dar_diagnose_swe_filter */ | |
757 | |
758 | |
759 T_RV_RET dar_diagnose_write( T_DAR_INFO *buffer_p, | |
760 T_DAR_FORMAT format, | |
761 T_DAR_LEVEL diagnose_info_level, | |
762 T_RVM_USE_ID dar_use_id) | |
763 { | |
764 return (RV_OK); | |
765 | |
766 } /* dar_diagnose_write */ | |
767 | |
768 | |
769 | |
770 T_RV_RET dar_diagnose_generate_emergency( T_DAR_INFO *buffer_p, | |
771 T_DAR_FORMAT format, | |
772 T_RVM_USE_ID dar_use_id) | |
773 { | |
774 | |
775 return (RV_OK); | |
776 | |
777 } /* dar_diagnose_generate_emergency */ | |
778 | |
779 | |
780 T_RV_RET dar_diagnose_write_emergency( T_DAR_INFO *buffer_p, | |
781 T_DAR_FORMAT format, | |
782 T_RVM_USE_ID dar_use_id, | |
783 UINT32 flags) | |
784 { | |
785 return (RV_OK); | |
786 } /* dar_diagnose_write_emergency */ | |
787 | |
788 | |
789 #endif /* #ifdef RVM_DAR_SWE */ |