comparison src/cs/services/dar/dar_handle_message.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_handle_message.c */
4 /* */
5 /* Purpose: This function is called when the DAR entity receives a new */
6 /* message in its mailbox. */
7 /* */
8 /* */
9 /* Version 0.1 */
10 /* */
11 /* Date Modification */
12 /* ------------------------------------ */
13 /* 17 October 2001 Create */
14 /* */
15 /* Author Stephanie Gerthoux */
16 /* */
17 /* (C) Copyright 2001 by Texas Instruments Incorporated, All Rights Reserved*/
18 /****************************************************************************/
19
20 #include "rv/rv_defined_swe.h"
21 #ifdef RVM_DAR_SWE
22
23 #include "rv/rv_general.h"
24 #include "rvm/rvm_gen.h"
25 #include "rvm/rvm_priorities.h"
26 #include "dar/dar_api.h"
27 #include "dar/dar_env.h"
28 #include "dar/dar_macro_i.h"
29 #include "dar/dar_messages_i.h"
30 #include "dar/dar_msg_ft.h"
31
32 /********************************************************************************/
33 /* Function dar_handle_message */
34 /* */
35 /* Description This function is called every time the DAR entity received */
36 /* a new message in its mailbox */
37 /* */
38 /********************************************************************************/
39
40 T_RV_RET dar_handle_msg(T_RV_HDR *msg_p)
41 {
42 /* Declare local variables */
43 T_RV_RET status = RVF_GREEN;
44
45 if (msg_p != NULL)
46 {
47 switch (msg_p->msg_id)
48 {
49 case DAR_FILTER_REQ:
50 {
51 //DAR_SEND_TRACE_PARAM("DAR Diagnose with the msg", msg_p->msg_id, RV_TRACE_LEVEL_DEBUG_LOW);
52 /* process the dar filter */
53 dar_filter_request((T_DAR_FILTER_START *)msg_p);
54 break;
55 }
56
57 case DAR_WRITE_REQ:
58 {
59 //DAR_SEND_TRACE_PARAM("DAR Diagnose with the msg", msg_p->msg_id, RV_TRACE_LEVEL_DEBUG_LOW);
60 /* process the dar to write */
61 dar_write_data_in_buffer((T_DAR_WRITE_START *)msg_p);
62 break;
63 }
64
65 default:
66 {
67 /* Unknow message has been received */
68 DAR_TRACE_WARNING("A DAR unknow message has been received ");
69 break;
70 };
71 } /* switch (msg_p->msg_id) */
72
73 /* Free message buffer */
74 status = rvf_free_buf((T_RVF_BUFFER *)msg_p);
75 if (status != RVF_GREEN)
76 {
77 DAR_SEND_TRACE(" DAR ERROR (env). A wrong message is deallocated ",
78 RV_TRACE_LEVEL_ERROR);
79 }
80 } /* if (msg_p != NULL) */
81
82 return RV_OK;
83 }
84
85 #endif /* #ifdef RVM_DAR_SWE */