Changeset 8d7ec69d in mainline for uspace/lib/c
- Timestamp:
- 2012-01-22T10:40:07Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- c38e417, cf9cb36
- Parents:
- e98fe28c
- Location:
- uspace/lib/c
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/device/nic.c
re98fe28c r8d7ec69d 73 73 } 74 74 75 /** Connect the driver to the NET and NIL services 76 * 77 * @param[in] dev_sess 78 * @param[in] nil_service Service identifier for the NIL service 75 /** Create callback connection from NIC service 76 * 77 * @param[in] dev_sess 79 78 * @param[in] device_id 80 79 * … … 82 81 * 83 82 */ 84 int nic_connect_to_nil(async_sess_t *dev_sess, services_t nil_service, 85 nic_device_id_t device_id) 86 { 87 async_exch_t *exch = async_exchange_begin(dev_sess); 88 int rc = async_req_3_0(exch, DEV_IFACE_ID(NIC_DEV_IFACE), 89 NIC_CONNECT_TO_NIL, nil_service, device_id); 90 async_exchange_end(exch); 91 92 return rc; 83 int nic_callback_create(async_sess_t *dev_sess, nic_device_id_t device_id, 84 async_client_conn_t cfun, void *carg) 85 { 86 ipc_call_t answer; 87 int rc; 88 sysarg_t retval; 89 90 async_exch_t *exch = async_exchange_begin(dev_sess); 91 aid_t req = async_send_2(exch, DEV_IFACE_ID(NIC_DEV_IFACE), 92 NIC_CALLBACK_CREATE, device_id, &answer); 93 94 rc = async_connect_to_me(exch, 0, 0, 0, cfun, carg); 95 if (rc != EOK) { 96 async_wait_for(req, NULL); 97 return rc; 98 } 99 async_exchange_end(exch); 100 101 async_wait_for(req, &retval); 102 return (int) retval; 93 103 } 94 104 -
uspace/lib/c/include/device/nic.h
re98fe28c r8d7ec69d 39 39 #include <net/device.h> 40 40 #include <net/packet.h> 41 #include <ipc/common.h> 41 42 #include <ipc/services.h> 42 43 43 44 typedef enum { 44 45 NIC_SEND_MESSAGE = 0, 45 NIC_C ONNECT_TO_NIL,46 NIC_CALLBACK_CREATE, 46 47 NIC_GET_STATE, 47 48 NIC_SET_STATE, … … 85 86 } nic_funcs_t; 86 87 88 typedef enum { 89 NIC_EV_ADDR_CHANGED = IPC_FIRST_USER_METHOD, 90 NIC_EV_RECEIVED, 91 NIC_EV_DEVICE_STATE 92 } nic_event_t; 93 87 94 extern int nic_send_frame(async_sess_t *, void *, size_t); 88 extern int nic_connect_to_nil(async_sess_t *, services_t, nic_device_id_t); 95 extern int nic_callback_create(async_sess_t *, nic_device_id_t, 96 async_client_conn_t, void *); 89 97 extern int nic_get_state(async_sess_t *, nic_device_state_t *); 90 98 extern int nic_set_state(async_sess_t *, nic_device_state_t); -
uspace/lib/c/include/ipc/nil.h
re98fe28c r8d7ec69d 46 46 */ 47 47 NET_NIL_DEVICE = NET_NIL_FIRST, 48 /** New device state message.49 * @see nil_device_state_msg()50 */51 NET_NIL_DEVICE_STATE,52 /** Received packet queue message.53 * @see nil_received_msg()54 */55 NET_NIL_RECEIVED,56 48 /** Send packet queue message. 57 49 * @see nil_send_msg() … … 69 61 * @see nil_get_broadcast_addr() 70 62 */ 71 NET_NIL_BROADCAST_ADDR, 72 /** Device has changed address 73 * @see nil_addr_changed_msg() 74 */ 75 NET_NIL_ADDR_CHANGED 63 NET_NIL_BROADCAST_ADDR 76 64 } nil_messages; 77 65
Note:
See TracChangeset
for help on using the changeset viewer.