Changeset cfb79747 in mainline for uspace/lib/nic/src/nic_impl.c
- Timestamp:
- 2012-02-14T22:06:15Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- a31aad1
- Parents:
- 199112e4 (diff), e10d41a (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 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/nic/src/nic_impl.c
r199112e4 rcfb79747 36 36 */ 37 37 38 #include <errno.h> 38 39 #include <str_error.h> 39 40 #include <ipc/services.h> 40 41 #include <ns.h> 41 42 #include "nic_driver.h" 43 #include "nic_ev.h" 42 44 #include "nic_impl.h" 43 45 … … 85 87 } 86 88 if (state == NIC_STATE_ACTIVE) { 87 if (nic_data->nil_session == NULL || nic_data->net_session == NULL 88 || nic_data->device_id < 0) { 89 if (nic_data->client_session == NULL) { 89 90 fibril_rwlock_write_unlock(&nic_data->main_lock); 90 91 return EINVAL; … … 116 117 if (state == NIC_STATE_STOPPED) { 117 118 /* Notify upper layers that we are reseting the MAC */ 118 int rc = ni l_addr_changed_msg(nic_data->nil_session,119 nic_data->device_id,&nic_data->default_mac);119 int rc = nic_ev_addr_changed(nic_data->client_session, 120 &nic_data->default_mac); 120 121 nic_data->poll_mode = nic_data->default_poll_mode; 121 122 memcpy(&nic_data->poll_period, &nic_data->default_poll_period, … … 149 150 nic_data->state = state; 150 151 151 ni l_device_state_msg(nic_data->nil_session, nic_data->device_id, state);152 nic_ev_device_state(nic_data->client_session, state); 152 153 153 154 fibril_rwlock_write_unlock(&nic_data->main_lock); … … 182 183 183 184 /** 184 * Default implementation of the connect_ to_nilmethod.185 * C onnects the driver to the NIL service.185 * Default implementation of the connect_client method. 186 * Creates callback connection to the client. 186 187 * 187 188 * @param fun 188 * @param nil_service ID of the server implementing the NIL service 189 * @param device_id ID of the device as used in higher layers 190 * 191 * @return EOK If the services were bound 192 * @return Negative error code from service_connect_blocking 193 */ 194 int nic_connect_to_nil_impl(ddf_fun_t *fun, services_t nil_service, 195 nic_device_id_t device_id) 196 { 197 nic_t *nic_data = (nic_t *) fun->driver_data; 198 fibril_rwlock_write_lock(&nic_data->main_lock); 189 * 190 * @return EOK On success, or negative error code. 191 */ 192 int nic_callback_create_impl(ddf_fun_t *fun) 193 { 194 nic_t *nic = (nic_t *) fun->driver_data; 195 fibril_rwlock_write_lock(&nic->main_lock); 199 196 200 nic_data->device_id = device_id; 197 nic->client_session = async_callback_receive(EXCHANGE_SERIALIZE); 198 if (nic->client_session == NULL) { 199 fibril_rwlock_write_unlock(&nic->main_lock); 200 return ENOMEM; 201 } 201 202 202 nic_data->nil_session = service_connect_blocking(EXCHANGE_SERIALIZE, 203 nil_service, 0, 0); 204 if (nic_data->nil_session != NULL) { 205 fibril_rwlock_write_unlock(&nic_data->main_lock); 206 return EOK; 207 } 208 209 fibril_rwlock_write_unlock(&nic_data->main_lock); 210 return EHANGUP; 203 fibril_rwlock_write_unlock(&nic->main_lock); 204 return EOK; 211 205 } 212 206 … … 805 799 } 806 800 807 /** Default implementation of the device_added method808 *809 * Just calls nic_ready.810 *811 * @param dev812 *813 */814 void nic_device_added_impl(ddf_dev_t *dev)815 {816 nic_ready((nic_t *) dev->driver_data);817 }818 819 801 /** 820 802 * Default handler for unknown methods (outside of the NIC interface).
Note:
See TracChangeset
for help on using the changeset viewer.