Changeset 8d7ec69d in mainline for uspace/lib/nic/src
- 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/nic/src
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/nic/src/nic_driver.c
re98fe28c r8d7ec69d 53 53 54 54 #include "nic_driver.h" 55 #include "nic_ev.h" 55 56 #include "nic_impl.h" 56 57 … … 106 107 if (!iface->send_frame) 107 108 iface->send_frame = nic_send_frame_impl; 108 if (!iface->c onnect_to_nil)109 iface->c onnect_to_nil = nic_connect_to_nil_impl;109 if (!iface->callback_create) 110 iface->callback_create = nic_callback_create_impl; 110 111 if (!iface->get_address) 111 112 iface->get_address = nic_get_address_impl; … … 494 495 495 496 /* Notify NIL layer (and uppper) if bound - not in add_device */ 496 if (nic_data-> nil_session != NULL) {497 int rc = ni l_addr_changed_msg(nic_data->nil_session,497 if (nic_data->client_session != NULL) { 498 int rc = nic_ev_addr_changed(nic_data->client_session, 498 499 nic_data->device_id, address); 499 500 if (rc != EOK) { … … 603 604 } 604 605 fibril_rwlock_write_unlock(&nic_data->stats_lock); 605 ni l_received_msg(nic_data->nil_session, nic_data->device_id,606 nic_ev_received(nic_data->client_session, nic_data->device_id, 606 607 frame->data, frame->size); 607 608 } else { … … 638 639 fibril_rwlock_write_unlock(&nic_data->stats_lock); 639 640 640 ni l_received_msg(nic_data->nil_session, nic_data->device_id,641 nic_ev_received(nic_data->client_session, nic_data->device_id, 641 642 data, size); 642 643 } … … 692 693 nic_data->device_id = NIC_DEVICE_INVALID_ID; 693 694 nic_data->state = NIC_STATE_STOPPED; 694 nic_data-> nil_session = NULL;695 nic_data->client_session = NULL; 695 696 nic_data->irc_session = NULL; 696 697 nic_data->poll_mode = NIC_POLL_IMMEDIATE; … … 746 747 */ 747 748 static void nic_destroy(nic_t *nic_data) { 748 if (nic_data-> nil_session != NULL) {749 async_hangup(nic_data-> nil_session);749 if (nic_data->client_session != NULL) { 750 async_hangup(nic_data->client_session); 750 751 } 751 752 -
uspace/lib/nic/src/nic_impl.c
re98fe28c r8d7ec69d 40 40 #include <ns.h> 41 41 #include "nic_driver.h" 42 #include "nic_ev.h" 42 43 #include "nic_impl.h" 43 44 … … 85 86 } 86 87 if (state == NIC_STATE_ACTIVE) { 87 if (nic_data-> nil_session == NULL || nic_data->device_id < 0) {88 if (nic_data->client_session == NULL || nic_data->device_id < 0) { 88 89 fibril_rwlock_write_unlock(&nic_data->main_lock); 89 90 return EINVAL; … … 115 116 if (state == NIC_STATE_STOPPED) { 116 117 /* Notify upper layers that we are reseting the MAC */ 117 int rc = ni l_addr_changed_msg(nic_data->nil_session,118 int rc = nic_ev_addr_changed(nic_data->client_session, 118 119 nic_data->device_id, &nic_data->default_mac); 119 120 nic_data->poll_mode = nic_data->default_poll_mode; … … 148 149 nic_data->state = state; 149 150 150 ni l_device_state_msg(nic_data->nil_session, nic_data->device_id, state);151 nic_ev_device_state(nic_data->client_session, nic_data->device_id, state); 151 152 152 153 fibril_rwlock_write_unlock(&nic_data->main_lock); … … 181 182 182 183 /** 183 * Default implementation of the connect_ to_nilmethod.184 * C onnects the driver to the NIL service.184 * Default implementation of the connect_client method. 185 * Creates callback connection to the client. 185 186 * 186 187 * @param fun 187 * @param nil_service ID of the server implementing the NIL service188 188 * @param device_id ID of the device as used in higher layers 189 189 * 190 * @return EOK If the services were bound 191 * @return Negative error code from service_connect_blocking 192 */ 193 int nic_connect_to_nil_impl(ddf_fun_t *fun, services_t nil_service, 194 nic_device_id_t device_id) 195 { 196 nic_t *nic_data = (nic_t *) fun->driver_data; 197 fibril_rwlock_write_lock(&nic_data->main_lock); 190 * @return EOK On success, or negative error code. 191 */ 192 int nic_callback_create_impl(ddf_fun_t *fun, nic_device_id_t device_id) 193 { 194 nic_t *nic = (nic_t *) fun->driver_data; 195 fibril_rwlock_write_lock(&nic->main_lock); 198 196 199 nic _data->device_id = device_id;197 nic->device_id = device_id; 200 198 201 nic_data->nil_session = service_connect_blocking(EXCHANGE_SERIALIZE, 202 nil_service, 0, 0); 203 if (nic_data->nil_session != NULL) { 204 fibril_rwlock_write_unlock(&nic_data->main_lock); 205 return EOK; 199 nic->client_session = async_callback_receive(EXCHANGE_SERIALIZE); 200 if (nic->client_session == NULL) { 201 fibril_rwlock_write_unlock(&nic->main_lock); 202 return ENOMEM; 206 203 } 207 204 208 fibril_rwlock_write_unlock(&nic _data->main_lock);209 return E HANGUP;205 fibril_rwlock_write_unlock(&nic->main_lock); 206 return EOK; 210 207 } 211 208
Note:
See TracChangeset
for help on using the changeset viewer.