Changeset 6843a9c in mainline for uspace/lib/nic/src/nic_ev.c
- Timestamp:
- 2012-06-29T13:02:14Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 722912e
- Parents:
- ba72f2b (diff), 0bbd13e (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/nic/src/nic_ev.c
rba72f2b r6843a9c 1 1 /* 2 * Copyright (c) 20 09 Lukas Mejdrech2 * Copyright (c) 2011 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 27 27 */ 28 28 29 /** @addtogroup libnet 29 /** 30 * @addtogroup libnic 30 31 * @{ 31 32 */ 32 33 /** @file34 * Character string to module map.33 /** 34 * @file 35 * @brief 35 36 */ 36 37 37 #ifndef LIBNET_MODULES_MAP_H_ 38 #define LIBNET_MODULES_MAP_H_ 38 #include <async.h> 39 #include <device/nic.h> 40 #include <errno.h> 41 #include "nic_ev.h" 39 42 40 #include <task.h> 41 #include <async.h> 42 #include <net/modules.h> 43 #include <adt/generic_char_map.h> 43 /** Device address changed. */ 44 int nic_ev_addr_changed(async_sess_t *sess, const nic_address_t *addr) 45 { 46 async_exch_t *exch = async_exchange_begin(sess); 44 47 45 /** Type definition of the module structure. 46 * @see module_struct 47 */ 48 typedef struct module_struct module_t;48 ipc_call_t answer; 49 aid_t req = async_send_0(exch, NIC_EV_ADDR_CHANGED, &answer); 50 sysarg_t retval = async_data_write_start(exch, addr, 51 sizeof(nic_address_t)); 49 52 50 /** Module map. 51 * Sorted by module names. 52 * @see generic_char_map.h 53 */ 54 GENERIC_CHAR_MAP_DECLARE(modules, module_t) 53 async_exchange_end(exch); 55 54 56 /** Module structure. */ 57 struct module_struct { 58 /** Module task identifier if running. */ 59 task_id_t task_id; 60 /** Module service identifier. */ 61 services_t service; 62 /** Module session if running and connected. */ 63 async_sess_t *sess; 64 /** Usage counter. */ 65 int usage; 66 /** Module name. */ 67 const uint8_t *name; 68 /** Module full path filename. */ 69 const uint8_t *filename; 70 /** Connecting function. */ 71 connect_module_t *connect_module; 72 }; 55 if (retval != EOK) { 56 async_forget(req); 57 return retval; 58 } 73 59 74 extern int add_module(module_t **, modules_t *, const uint8_t *, 75 const uint8_t *, services_t, task_id_t, connect_module_t *); 76 extern module_t *get_running_module(modules_t *, uint8_t *); 77 extern task_id_t net_spawn(const uint8_t *); 60 async_wait_for(req, &retval); 61 return retval; 62 } 78 63 79 #endif 64 /** Device state changed. */ 65 int nic_ev_device_state(async_sess_t *sess, sysarg_t state) 66 { 67 int rc; 68 69 async_exch_t *exch = async_exchange_begin(sess); 70 rc = async_req_1_0(exch, NIC_EV_DEVICE_STATE, state); 71 async_exchange_end(exch); 72 73 return rc; 74 } 75 76 /** Frame received. */ 77 int nic_ev_received(async_sess_t *sess, void *data, size_t size) 78 { 79 async_exch_t *exch = async_exchange_begin(sess); 80 81 ipc_call_t answer; 82 aid_t req = async_send_0(exch, NIC_EV_RECEIVED, &answer); 83 sysarg_t retval = async_data_write_start(exch, data, size); 84 85 async_exchange_end(exch); 86 87 if (retval != EOK) { 88 async_forget(req); 89 return retval; 90 } 91 92 async_wait_for(req, &retval); 93 return retval; 94 } 80 95 81 96 /** @}
Note:
See TracChangeset
for help on using the changeset viewer.