Changeset 8d7ec69d in mainline for uspace/lib/nic/src/nic_impl.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
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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.