Rev 4271 | Rev 4502 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4271 | Rev 4307 | ||
---|---|---|---|
Line 48... | Line 48... | ||
48 | 48 | ||
49 | #define NET_NETIF_COUNT 8 |
49 | #define NET_NETIF_COUNT 8 |
50 | #define NET_NET_COUNT 9 |
50 | #define NET_NET_COUNT 9 |
51 | #define NET_NIL_COUNT 7 |
51 | #define NET_NIL_COUNT 7 |
52 | #define NET_ETH_COUNT 0 |
52 | #define NET_ETH_COUNT 0 |
53 | #define NET_IL_COUNT 3 |
53 | #define NET_IL_COUNT 4 |
54 | #define NET_IP_COUNT 2 |
54 | #define NET_IP_COUNT 0 |
55 | #define NET_ARP_COUNT 4 |
55 | #define NET_ARP_COUNT 4 |
56 | #define NET_RARP_COUNT 0 |
56 | #define NET_RARP_COUNT 0 |
57 | #define NET_ICMP_COUNT 0 |
57 | #define NET_ICMP_COUNT 0 |
58 | #define NET_UDP_COUNT 0 |
58 | #define NET_UDP_COUNT 0 |
59 | #define NET_TCP_COUNT 0 |
59 | #define NET_TCP_COUNT 0 |
Line 119... | Line 119... | ||
119 | #define IPC_GET_DEVICE( call ) ( device_id_t ) IPC_GET_ARG1( * call ) |
119 | #define IPC_GET_DEVICE( call ) ( device_id_t ) IPC_GET_ARG1( * call ) |
120 | 120 | ||
121 | /** Returns the packet identifier message parameter. |
121 | /** Returns the packet identifier message parameter. |
122 | */ |
122 | */ |
123 | #define IPC_GET_PACKET( call ) ( packet_id_t ) IPC_GET_ARG2( * call ) |
123 | #define IPC_GET_PACKET( call ) ( packet_id_t ) IPC_GET_ARG2( * call ) |
124 | - | ||
- | 124 | #define IPC_GET_COUNT( call ) ( int ) IPC_GET_ARG2( * call ) |
|
125 | #define IPC_GET_STATE( call ) ( device_state_t ) IPC_GET_ARG2( * call ) |
125 | #define IPC_GET_STATE( call ) ( device_state_t ) IPC_GET_ARG2( * call ) |
126 | 126 | ||
127 | /** Returns the device driver service message parameter. |
127 | /** Returns the device driver service message parameter. |
128 | */ |
128 | */ |
129 | #define IPC_GET_SERVICE( call ) ( services_t ) IPC_GET_ARG3( * call ) |
129 | #define IPC_GET_SERVICE( call ) ( services_t ) IPC_GET_ARG3( * call ) |
Line 154... | Line 154... | ||
154 | NET_NET_START, |
154 | NET_NET_START, |
155 | /* ( device_id ) */ |
155 | /* ( device_id ) */ |
156 | NET_NET_STOP, |
156 | NET_NET_STOP, |
157 | /* ( device_id ) ipc_data_read( stats ) */ |
157 | /* ( device_id ) ipc_data_read( stats ) */ |
158 | NET_NET_STATS, |
158 | NET_NET_STATS, |
159 | /* ( device_id, nil_service ) */ |
- | |
160 | NET_IL_DEVICE = NET_IL_FIRST, |
- | |
161 | /* ( device_id, state ) */ |
- | |
162 | NET_IL_DEVICE_STATE, |
- | |
163 | /* ( device_id ), packet_send */ |
- | |
164 | NET_IL_RECEIVED, |
- | |
165 | /* ( device_id ), measured_strings_send( address ) */ |
- | |
166 | // NET_IL_MY_ADDR, |
- | |
167 | NET_IP_ECHO = NET_IP_FIRST, |
- | |
168 | /* ( packet_id ) */ |
- | |
169 | NET_IP_SEND, |
- | |
170 | NET_PACKET_CREATE_1 = NET_PACKET_FIRST, |
- | |
171 | NET_PACKET_CREATE_4, |
- | |
172 | NET_PACKET_GET, |
- | |
173 | NET_PACKET_GET_SIZE, |
- | |
174 | NET_PACKET_RELEASE |
- | |
175 | } net_messages; |
159 | } net_messages; |
176 | 160 | ||
177 | static inline int generic_get_addr( int phone, int message, device_id_t device_id, measured_string_ref * address, char ** data ){ |
161 | static inline int generic_get_addr( int phone, int message, device_id_t device_id, measured_string_ref * address, char ** data ){ |
178 | aid_t message_id; |
162 | aid_t message_id; |
179 | ipcarg_t result; |
163 | ipcarg_t result; |
180 | int string; |
164 | int string; |
181 | 165 | ||
182 | if( !( address && data )) return EBADMEM; |
166 | if( !( address && data )) return EBADMEM; |
183 | message_id = async_send_1( phone, message, device_id, NULL ); |
167 | message_id = async_send_1( phone, ( ipcarg_t ) message, ( ipcarg_t ) device_id, NULL ); |
184 | string = measured_strings_return( phone, address, data, 1 ); |
168 | string = measured_strings_return( phone, address, data, 1 ); |
185 | async_wait_for( message_id, & result ); |
169 | async_wait_for( message_id, & result ); |
186 | if(( string == EOK ) && ( result != EOK )){ |
170 | if(( string == EOK ) && ( result != EOK )){ |
187 | free( * address ); |
171 | free( * address ); |
188 | free( * data ); |
172 | free( * data ); |
189 | } |
173 | } |
190 | return result; |
174 | return ( int ) result; |
- | 175 | } |
|
- | 176 | ||
- | 177 | static inline int generic_translate_req( int phone, int message, device_id_t device_id, services_t service, measured_string_ref configuration, size_t count, measured_string_ref * translation, char ** data ){ |
|
- | 178 | aid_t message_id; |
|
- | 179 | ipcarg_t result; |
|
- | 180 | int string; |
|
- | 181 | ||
- | 182 | if( !( configuration && ( count > 0 ))) return EINVAL; |
|
- | 183 | if( !( translation && data )) return EBADMEM; |
|
- | 184 | message_id = async_send_3( phone, ( ipcarg_t ) message, ( ipcarg_t ) device_id, ( ipcarg_t ) count, ( ipcarg_t ) service, NULL ); |
|
- | 185 | measured_strings_send( phone, configuration, count ); |
|
- | 186 | string = measured_strings_return( phone, translation, data, count ); |
|
- | 187 | async_wait_for( message_id, & result ); |
|
- | 188 | if(( string == EOK ) && ( result != EOK )){ |
|
- | 189 | free( * translation ); |
|
- | 190 | free( * data ); |
|
- | 191 | } |
|
- | 192 | return ( int ) result; |
|
191 | } |
193 | } |
192 | 194 | ||
193 | static inline void generic_send_msg( int phone, int message, device_id_t device_id, packet_id_t packet_id, services_t sender ){ |
195 | static inline int generic_send_msg( int phone, int message, device_id_t device_id, packet_id_t packet_id, services_t sender ){ |
194 | async_msg_3( phone, message, device_id, packet_id, sender ); |
196 | async_msg_3( phone, ( ipcarg_t ) message, ( ipcarg_t ) device_id, ( ipcarg_t ) packet_id, ( ipcarg_t ) sender ); |
- | 197 | return EOK; |
|
195 | } |
198 | } |
196 | 199 | ||
197 | static inline int generic_packet_size_req( int phone, int message, device_id_t device_id, size_t * addr_len, size_t * prefix, size_t * content, size_t * suffix ){ |
200 | static inline int generic_packet_size_req( int phone, int message, device_id_t device_id, size_t * addr_len, size_t * prefix, size_t * content, size_t * suffix ){ |
198 | return async_req_1_4( phone, message, device_id, ( ipcarg_t * ) addr_len, ( ipcarg_t * ) prefix, ( ipcarg_t * ) content, ( ipcarg_t * ) suffix ); |
201 | return ( int ) async_req_1_4( phone, ( ipcarg_t ) message, ( ipcarg_t ) device_id, ( ipcarg_t * ) addr_len, ( ipcarg_t * ) prefix, ( ipcarg_t * ) content, ( ipcarg_t * ) suffix ); |
199 | } |
202 | } |
200 | 203 | ||
201 | static inline void generic_device_state_msg( int phone, int message, device_id_t device_id, int state ){ |
204 | static inline int generic_device_state_msg( int phone, int message, device_id_t device_id, int state ){ |
202 | async_msg_2( phone, message, device_id, state ); |
205 | async_msg_2( phone, ( ipcarg_t ) message, ( ipcarg_t ) device_id, ( ipcarg_t ) state ); |
- | 206 | return EOK; |
|
203 | } |
207 | } |
204 | 208 | ||
205 | static inline void generic_received_msg( int phone, int message, device_id_t device_id, packet_id_t packet_id, services_t target ){ |
209 | static inline int generic_received_msg( int phone, int message, device_id_t device_id, packet_id_t packet_id, services_t target ){ |
206 | async_msg_3( phone, message, device_id, packet_id, target ); |
210 | async_msg_3( phone, ( ipcarg_t ) message, ( ipcarg_t ) device_id, ( ipcarg_t ) packet_id, ( ipcarg_t ) target ); |
- | 211 | return EOK; |
|
207 | } |
212 | } |
208 | 213 | ||
209 | static inline int generic_device_req( int phone, int message, device_id_t device_id, int arg2, services_t service ){ |
214 | static inline int generic_device_req( int phone, int message, device_id_t device_id, int arg2, services_t service ){ |
210 | return async_req_3_0( phone, message, device_id, arg2, service ); |
215 | return ( int ) async_req_3_0( phone, ( ipcarg_t ) message, ( ipcarg_t ) device_id, ( ipcarg_t ) arg2, ( ipcarg_t ) service ); |
211 | } |
216 | } |
212 | 217 | ||
213 | #endif |
218 | #endif |
214 | 219 | ||
215 | /** @} |
220 | /** @} |