FreeCalypso > hg > fc-selenite
comparison src/g23m-fad/tcpip/rnet/rnet_rt/rnet_rt_handle_message.c @ 1:d393cd9bb723
src/g23m-*: initial import from Magnetite
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sun, 15 Jul 2018 04:40:46 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
0:b6a5e36de839 | 1:d393cd9bb723 |
---|---|
1 /** | |
2 * @file rnet_rt_handle_message.c | |
3 * | |
4 * RNET_RT handle_msg function, which is called when the SWE | |
5 * receives a new message in its mailbox. | |
6 * | |
7 * @author Jose Yp-Tcha (j-yp-tcha@ti.com) | |
8 * @version 0.1 | |
9 */ | |
10 | |
11 /* | |
12 * $Id: rnet_rt_handle_message.c,v 1.6 2002/10/30 15:23:34 rf Exp $ | |
13 * $Name: ti_20021030 $ | |
14 * | |
15 * History: | |
16 * | |
17 * Date Author Modification | |
18 * ------------------------------------------------------------------- | |
19 * 3/19/2002 Jose Yp-Tcha (j-yp-tcha@ti.com) Create. | |
20 * 3/??/2002 Regis Feneon Completed | |
21 * | |
22 * (C) Copyright 2002 by TI, All Rights Reserved | |
23 */ | |
24 | |
25 #include "rnet_cfg.h" | |
26 #ifdef RNET_CFG_REAL_TRANSPORT | |
27 | |
28 #include "rnet_rt_i.h" | |
29 #include "rnet_trace_i.h" | |
30 | |
31 #ifdef RNET_RT_ATP_SUPPORT | |
32 #include "atp_messages.h" | |
33 #endif | |
34 | |
35 /** | |
36 * Called every time the SW entity is in WAITING state | |
37 * and get a new message in its mailbox. | |
38 * | |
39 * The message in parameter is freed in this function. | |
40 * | |
41 * @param msg_p Pointer on the header of the message. | |
42 * @return RVM_OK or RVM_MEMORY_ERR. | |
43 */ | |
44 | |
45 T_RVM_RETURN rnet_rt_handle_message( T_RV_HDR *msg_p) | |
46 { | |
47 | |
48 if( msg_p != NULL) { | |
49 | |
50 switch( msg_p->msg_id) { | |
51 | |
52 case RNET_RT_NGIP_INPUT: | |
53 /* call NexGenIP input processing */ | |
54 rvf_lock_mutex( &rnet_rt_env_ctrl_blk_p->mutex); | |
55 rnet_rt_ngip_input( ((T_RNET_RT_NGIP_INPUT *) msg_p)->bufp); | |
56 rvf_unlock_mutex( &rnet_rt_env_ctrl_blk_p->mutex); | |
57 break; | |
58 | |
59 #ifdef RNET_RT_ATP_SUPPORT | |
60 | |
61 case ATP_OPEN_PORT_IND: | |
62 case ATP_OPEN_PORT_CFM: | |
63 case ATP_PORT_CLOSED: | |
64 case ATP_TXT_CMD_RDY: | |
65 case ATP_CMD_RDY: | |
66 case ATP_DATA_RDY: | |
67 case ATP_NO_COPY_DATA_RDY: | |
68 case ATP_SIGNAL_CHANGED: | |
69 case ATP_PORT_MODE_CHANGED: | |
70 /* forward the message to the ATP interface */ | |
71 rvf_lock_mutex( &rnet_rt_env_ctrl_blk_p->mutex); | |
72 ((NGifnet *)&rnet_rt_env_ctrl_blk_p->ifnet_atp)->if_cntl_f( | |
73 (NGifnet *)&rnet_rt_env_ctrl_blk_p->ifnet_atp, | |
74 NG_CNTL_SET, | |
75 NG_RNETIFO_HANDLE_MSG, | |
76 msg_p); | |
77 rvf_unlock_mutex( &rnet_rt_env_ctrl_blk_p->mutex); | |
78 break; | |
79 | |
80 #endif | |
81 | |
82 case RNET_RT_NGIP_NETIF_MSG: | |
83 /* encapsulated message for a network interface driver (ATP) */ | |
84 /* forward the message to the interface */ | |
85 rvf_lock_mutex( &rnet_rt_env_ctrl_blk_p->mutex); | |
86 (void)(((T_RNET_RT_NGIP_NETIF_MSG *) msg_p)->netp->if_cntl_f( | |
87 ((T_RNET_RT_NGIP_NETIF_MSG *) msg_p)->netp, | |
88 NG_CNTL_SET, | |
89 NG_RNETIFO_HANDLE_MSG, | |
90 ((T_RNET_RT_NGIP_NETIF_MSG *) msg_p)->msgp)); | |
91 rvf_unlock_mutex( &rnet_rt_env_ctrl_blk_p->mutex); | |
92 /* release encapsulated message */ | |
93 if( (((T_RNET_RT_NGIP_NETIF_MSG *) msg_p)->msgp != NULL) && | |
94 (rvf_free_msg( ((T_RNET_RT_NGIP_NETIF_MSG *) msg_p)->msgp) != RVF_OK)) { | |
95 RNET_RT_SEND_TRACE("RNET_RT: handle_message: Unable to free interface message", | |
96 RV_TRACE_LEVEL_ERROR); | |
97 } | |
98 break; | |
99 | |
100 default: | |
101 RNET_RT_SEND_TRACE("RNET_RT: handle_message: Unknown message", | |
102 RV_TRACE_LEVEL_WARNING); | |
103 break; | |
104 } | |
105 | |
106 /* Free message */ | |
107 if( rvf_free_msg( msg_p) != RVF_OK) { | |
108 RNET_RT_SEND_TRACE("RNET_RT: handle_message: Unable to free message", | |
109 RV_TRACE_LEVEL_ERROR); | |
110 return( RVM_MEMORY_ERR); | |
111 } | |
112 } | |
113 | |
114 return( RVM_OK); | |
115 } | |
116 | |
117 #endif /* ifdef RNET_CFG_REAL_TRANSPORT */ | |
118 |