Changeset b7fd2a0 in mainline for uspace/drv/nic/ar9271/ar9271.c
- Timestamp:
- 2018-01-13T03:10:29Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- a53ed3a
- Parents:
- 36f0738
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/nic/ar9271/ar9271.c
r36f0738 rb7fd2a0 99 99 100 100 /* Callback when new device is to be controlled by this driver. */ 101 static int ar9271_add_device(ddf_dev_t *);101 static errno_t ar9271_add_device(ddf_dev_t *); 102 102 103 103 /* IEEE 802.11 callbacks */ 104 static int ar9271_ieee80211_start(ieee80211_dev_t *);105 static int ar9271_ieee80211_tx_handler(ieee80211_dev_t *, void *, size_t);106 static int ar9271_ieee80211_set_freq(ieee80211_dev_t *, uint16_t);107 static int ar9271_ieee80211_bssid_change(ieee80211_dev_t *, bool);108 static int ar9271_ieee80211_key_config(ieee80211_dev_t *, ieee80211_key_config_t *,104 static errno_t ar9271_ieee80211_start(ieee80211_dev_t *); 105 static errno_t ar9271_ieee80211_tx_handler(ieee80211_dev_t *, void *, size_t); 106 static errno_t ar9271_ieee80211_set_freq(ieee80211_dev_t *, uint16_t); 107 static errno_t ar9271_ieee80211_bssid_change(ieee80211_dev_t *, bool); 108 static errno_t ar9271_ieee80211_key_config(ieee80211_dev_t *, ieee80211_key_config_t *, 109 109 bool); 110 110 … … 128 128 static ieee80211_iface_t ar9271_ieee80211_iface; 129 129 130 static int ar9271_get_device_info(ddf_fun_t *, nic_device_info_t *);131 static int ar9271_get_cable_state(ddf_fun_t *, nic_cable_state_t *);132 static int ar9271_get_operation_mode(ddf_fun_t *, int *, nic_channel_mode_t *,130 static errno_t ar9271_get_device_info(ddf_fun_t *, nic_device_info_t *); 131 static errno_t ar9271_get_cable_state(ddf_fun_t *, nic_cable_state_t *); 132 static errno_t ar9271_get_operation_mode(ddf_fun_t *, int *, nic_channel_mode_t *, 133 133 nic_role_t *); 134 134 … … 144 144 * 145 145 */ 146 static int ar9271_get_device_info(ddf_fun_t *dev, nic_device_info_t *info)146 static errno_t ar9271_get_device_info(ddf_fun_t *dev, nic_device_info_t *info) 147 147 { 148 148 assert(dev); … … 164 164 * 165 165 */ 166 static int ar9271_get_cable_state(ddf_fun_t *fun, nic_cable_state_t *state)166 static errno_t ar9271_get_cable_state(ddf_fun_t *fun, nic_cable_state_t *state) 167 167 { 168 168 *state = NIC_CS_PLUGGED; … … 174 174 * 175 175 */ 176 static int ar9271_get_operation_mode(ddf_fun_t *fun, int *speed,176 static errno_t ar9271_get_operation_mode(ddf_fun_t *fun, int *speed, 177 177 nic_channel_mode_t *duplex, nic_role_t *role) 178 178 { … … 187 187 * 188 188 */ 189 static int ar9271_on_multicast_mode_change(nic_t *nic,189 static errno_t ar9271_on_multicast_mode_change(nic_t *nic, 190 190 nic_multicast_mode_t mode, const nic_address_t *addr, size_t addr_cnt) 191 191 { … … 210 210 * 211 211 */ 212 static int ar9271_on_unicast_mode_change(nic_t *nic, nic_unicast_mode_t mode,212 static errno_t ar9271_on_unicast_mode_change(nic_t *nic, nic_unicast_mode_t mode, 213 213 const nic_address_t *addr, size_t addr_cnt) 214 214 { … … 236 236 * 237 237 */ 238 static int ar9271_on_broadcast_mode_change(nic_t *nic,238 static errno_t ar9271_on_broadcast_mode_change(nic_t *nic, 239 239 nic_broadcast_mode_t mode) 240 240 { … … 258 258 } 259 259 260 static int ar9271_data_polling(void *arg)260 static errno_t ar9271_data_polling(void *arg) 261 261 { 262 262 assert(arg); … … 319 319 * 320 320 */ 321 static int ar9271_ieee80211_set_freq(ieee80211_dev_t *ieee80211_dev,321 static errno_t ar9271_ieee80211_set_freq(ieee80211_dev_t *ieee80211_dev, 322 322 uint16_t freq) 323 323 { … … 330 330 wmi_send_command(ar9271->htc_device, WMI_STOP_RECV, NULL, 0, NULL); 331 331 332 int rc = hw_freq_switch(ar9271, freq);332 errno_t rc = hw_freq_switch(ar9271, freq); 333 333 if (rc != EOK) { 334 334 usb_log_error("Failed to HW switch frequency.\n"); … … 352 352 } 353 353 354 static int ar9271_ieee80211_bssid_change(ieee80211_dev_t *ieee80211_dev,354 static errno_t ar9271_ieee80211_bssid_change(ieee80211_dev_t *ieee80211_dev, 355 355 bool connected) 356 356 { … … 401 401 } 402 402 403 static int ar9271_ieee80211_key_config(ieee80211_dev_t *ieee80211_dev,403 static errno_t ar9271_ieee80211_key_config(ieee80211_dev_t *ieee80211_dev, 404 404 ieee80211_key_config_t *key_conf, bool insert) 405 405 { … … 519 519 } 520 520 521 static int ar9271_ieee80211_tx_handler(ieee80211_dev_t *ieee80211_dev,521 static errno_t ar9271_ieee80211_tx_handler(ieee80211_dev_t *ieee80211_dev, 522 522 void *buffer, size_t buffer_size) 523 523 { … … 608 608 } 609 609 610 static int ar9271_ieee80211_start(ieee80211_dev_t *ieee80211_dev)610 static errno_t ar9271_ieee80211_start(ieee80211_dev_t *ieee80211_dev) 611 611 { 612 612 assert(ieee80211_dev); … … 616 616 wmi_send_command(ar9271->htc_device, WMI_FLUSH_RECV, NULL, 0, NULL); 617 617 618 int rc = hw_reset(ar9271);618 errno_t rc = hw_reset(ar9271); 619 619 if (rc != EOK) { 620 620 usb_log_error("Failed to do HW reset.\n"); … … 666 666 } 667 667 668 static int ar9271_init(ar9271_t *ar9271, usb_device_t *usb_device)668 static errno_t ar9271_init(ar9271_t *ar9271, usb_device_t *usb_device) 669 669 { 670 670 ar9271->starting_up = true; … … 680 680 } 681 681 682 int rc = ath_usb_init(ar9271->ath_device, usb_device);682 errno_t rc = ath_usb_init(ar9271->ath_device, usb_device); 683 683 if (rc != EOK) { 684 684 free(ar9271->ath_device); … … 737 737 * 738 738 */ 739 static int ar9271_upload_fw(ar9271_t *ar9271)739 static errno_t ar9271_upload_fw(ar9271_t *ar9271) 740 740 { 741 741 usb_device_t *usb_device = ar9271->usb_device; … … 775 775 memcpy(buffer, current_data, chunk_size); 776 776 usb_pipe_t *ctrl_pipe = usb_device_get_default_pipe(usb_device); 777 int rc = usb_control_request_set(ctrl_pipe,777 errno_t rc = usb_control_request_set(ctrl_pipe, 778 778 USB_REQUEST_TYPE_VENDOR, 779 779 USB_REQUEST_RECIPIENT_DEVICE, … … 803 803 */ 804 804 usb_pipe_t *ctrl_pipe = usb_device_get_default_pipe(usb_device); 805 int rc = usb_control_request_set(ctrl_pipe,805 errno_t rc = usb_control_request_set(ctrl_pipe, 806 806 USB_REQUEST_TYPE_VENDOR, 807 807 USB_REQUEST_RECIPIENT_DEVICE, … … 834 834 /* USB framework initialization. */ 835 835 const char *err_msg = NULL; 836 int rc = usb_device_create_ddf(dev, endpoints, &err_msg);836 errno_t rc = usb_device_create_ddf(dev, endpoints, &err_msg); 837 837 if (rc != EOK) { 838 838 usb_log_error("Failed to create USB device: %s, " … … 879 879 * @return EOK if succeed, error code otherwise 880 880 */ 881 static int ar9271_add_device(ddf_dev_t *dev)881 static errno_t ar9271_add_device(ddf_dev_t *dev) 882 882 { 883 883 assert(dev); … … 896 896 897 897 /* Initialize AR9271 HTC services. */ 898 int rc = htc_init(ar9271->htc_device);898 errno_t rc = htc_init(ar9271->htc_device); 899 899 if (rc != EOK) { 900 900 ar9271_delete_dev_data(ar9271);
Note:
See TracChangeset
for help on using the changeset viewer.