Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/nic/ar9271/ar9271.c

    rb7fd2a0 r908d634  
    4242#include <ddf/interrupt.h>
    4343#include <errno.h>
    44 #include <str_error.h>
    4544#include <nic.h>
    4645#include <macros.h>
     
    9998
    10099/* Callback when new device is to be controlled by this driver. */
    101 static errno_t ar9271_add_device(ddf_dev_t *);
     100static int ar9271_add_device(ddf_dev_t *);
    102101
    103102/* IEEE 802.11 callbacks */
    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 *,
     103static int ar9271_ieee80211_start(ieee80211_dev_t *);
     104static int ar9271_ieee80211_tx_handler(ieee80211_dev_t *, void *, size_t);
     105static int ar9271_ieee80211_set_freq(ieee80211_dev_t *, uint16_t);
     106static int ar9271_ieee80211_bssid_change(ieee80211_dev_t *, bool);
     107static int ar9271_ieee80211_key_config(ieee80211_dev_t *, ieee80211_key_config_t *,
    109108    bool);
    110109
     
    128127static ieee80211_iface_t ar9271_ieee80211_iface;
    129128
    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 *,
     129static int ar9271_get_device_info(ddf_fun_t *, nic_device_info_t *);
     130static int ar9271_get_cable_state(ddf_fun_t *, nic_cable_state_t *);
     131static int ar9271_get_operation_mode(ddf_fun_t *, int *, nic_channel_mode_t *,
    133132    nic_role_t *);
    134133
     
    144143 *
    145144 */
    146 static errno_t ar9271_get_device_info(ddf_fun_t *dev, nic_device_info_t *info)
     145static int ar9271_get_device_info(ddf_fun_t *dev, nic_device_info_t *info)
    147146{
    148147        assert(dev);
     
    164163 *
    165164 */
    166 static errno_t ar9271_get_cable_state(ddf_fun_t *fun, nic_cable_state_t *state)
     165static int ar9271_get_cable_state(ddf_fun_t *fun, nic_cable_state_t *state)
    167166{
    168167        *state = NIC_CS_PLUGGED;
     
    174173 *
    175174 */
    176 static errno_t ar9271_get_operation_mode(ddf_fun_t *fun, int *speed,
     175static int ar9271_get_operation_mode(ddf_fun_t *fun, int *speed,
    177176    nic_channel_mode_t *duplex, nic_role_t *role)
    178177{
     
    187186 *
    188187 */
    189 static errno_t ar9271_on_multicast_mode_change(nic_t *nic,
     188static int ar9271_on_multicast_mode_change(nic_t *nic,
    190189    nic_multicast_mode_t mode, const nic_address_t *addr, size_t addr_cnt)
    191190{
     
    210209 *
    211210 */
    212 static errno_t ar9271_on_unicast_mode_change(nic_t *nic, nic_unicast_mode_t mode,
     211static int ar9271_on_unicast_mode_change(nic_t *nic, nic_unicast_mode_t mode,
    213212    const nic_address_t *addr, size_t addr_cnt)
    214213{
     
    236235 *
    237236 */
    238 static errno_t ar9271_on_broadcast_mode_change(nic_t *nic,
     237static int ar9271_on_broadcast_mode_change(nic_t *nic,
    239238    nic_broadcast_mode_t mode)
    240239{
     
    258257}
    259258
    260 static errno_t ar9271_data_polling(void *arg)
     259static int ar9271_data_polling(void *arg)
    261260{
    262261        assert(arg);
     
    319318 *
    320319 */
    321 static errno_t ar9271_ieee80211_set_freq(ieee80211_dev_t *ieee80211_dev,
     320static int ar9271_ieee80211_set_freq(ieee80211_dev_t *ieee80211_dev,
    322321    uint16_t freq)
    323322{
     
    330329        wmi_send_command(ar9271->htc_device, WMI_STOP_RECV, NULL, 0, NULL);
    331330       
    332         errno_t rc = hw_freq_switch(ar9271, freq);
     331        int rc = hw_freq_switch(ar9271, freq);
    333332        if (rc != EOK) {
    334333                usb_log_error("Failed to HW switch frequency.\n");
     
    352351}
    353352
    354 static errno_t ar9271_ieee80211_bssid_change(ieee80211_dev_t *ieee80211_dev,
     353static int ar9271_ieee80211_bssid_change(ieee80211_dev_t *ieee80211_dev,
    355354    bool connected)
    356355{
     
    401400}
    402401
    403 static errno_t ar9271_ieee80211_key_config(ieee80211_dev_t *ieee80211_dev,
     402static int ar9271_ieee80211_key_config(ieee80211_dev_t *ieee80211_dev,
    404403    ieee80211_key_config_t *key_conf, bool insert)
    405404{
     
    519518}
    520519
    521 static errno_t ar9271_ieee80211_tx_handler(ieee80211_dev_t *ieee80211_dev,
     520static int ar9271_ieee80211_tx_handler(ieee80211_dev_t *ieee80211_dev,
    522521    void *buffer, size_t buffer_size)
    523522{
     
    608607}
    609608
    610 static errno_t ar9271_ieee80211_start(ieee80211_dev_t *ieee80211_dev)
     609static int ar9271_ieee80211_start(ieee80211_dev_t *ieee80211_dev)
    611610{
    612611        assert(ieee80211_dev);
     
    616615        wmi_send_command(ar9271->htc_device, WMI_FLUSH_RECV, NULL, 0, NULL);
    617616       
    618         errno_t rc = hw_reset(ar9271);
     617        int rc = hw_reset(ar9271);
    619618        if (rc != EOK) {
    620619                usb_log_error("Failed to do HW reset.\n");
     
    666665}
    667666
    668 static errno_t ar9271_init(ar9271_t *ar9271, usb_device_t *usb_device)
     667static int ar9271_init(ar9271_t *ar9271, usb_device_t *usb_device)
    669668{
    670669        ar9271->starting_up = true;
     
    680679        }
    681680       
    682         errno_t rc = ath_usb_init(ar9271->ath_device, usb_device);
     681        int rc = ath_usb_init(ar9271->ath_device, usb_device);
    683682        if (rc != EOK) {
    684683                free(ar9271->ath_device);
     
    734733 * @param ar9271 AR9271 device structure
    735734 *
    736  * @return EOK if succeed, error code otherwise
    737  *
    738  */
    739 static errno_t ar9271_upload_fw(ar9271_t *ar9271)
     735 * @return EOK if succeed, negative error code otherwise
     736 *
     737 */
     738static int ar9271_upload_fw(ar9271_t *ar9271)
    740739{
    741740        usb_device_t *usb_device = ar9271->usb_device;
     
    775774                memcpy(buffer, current_data, chunk_size);
    776775                usb_pipe_t *ctrl_pipe = usb_device_get_default_pipe(usb_device);
    777                 errno_t rc = usb_control_request_set(ctrl_pipe,
     776                int rc = usb_control_request_set(ctrl_pipe,
    778777                    USB_REQUEST_TYPE_VENDOR,
    779778                    USB_REQUEST_RECIPIENT_DEVICE,
     
    785784                        free(buffer);
    786785                        usb_log_error("Error while uploading firmware. "
    787                             "Error: %s\n", str_error_name(rc));
     786                            "Error: %d\n", rc);
    788787                        return rc;
    789788                }
     
    803802        */
    804803        usb_pipe_t *ctrl_pipe = usb_device_get_default_pipe(usb_device);
    805         errno_t rc = usb_control_request_set(ctrl_pipe,
     804        int rc = usb_control_request_set(ctrl_pipe,
    806805            USB_REQUEST_TYPE_VENDOR,
    807806            USB_REQUEST_RECIPIENT_DEVICE,
     
    834833        /* USB framework initialization. */
    835834        const char *err_msg = NULL;
    836         errno_t rc = usb_device_create_ddf(dev, endpoints, &err_msg);
     835        int rc = usb_device_create_ddf(dev, endpoints, &err_msg);
    837836        if (rc != EOK) {
    838837                usb_log_error("Failed to create USB device: %s, "
    839                     "ERR_NUM = %s\n", err_msg, str_error_name(rc));
     838                    "ERR_NUM = %d\n", err_msg, rc);
    840839                return NULL;
    841840        }
     
    854853        if (rc != EOK) {
    855854                free(ar9271);
    856                 usb_log_error("Failed to initialize AR9271 structure: %s\n",
    857                     str_error_name(rc));
     855                usb_log_error("Failed to initialize AR9271 structure: %d\n",
     856                    rc);
    858857                return NULL;
    859858        }
     
    877876 * @param dev The device structure.
    878877 *
    879  * @return EOK if succeed, error code otherwise
    880  */
    881 static errno_t ar9271_add_device(ddf_dev_t *dev)
     878 * @return EOK if succeed, negative error code otherwise
     879 */
     880static int ar9271_add_device(ddf_dev_t *dev)
    882881{
    883882        assert(dev);
     
    896895       
    897896        /* Initialize AR9271 HTC services. */
    898         errno_t rc = htc_init(ar9271->htc_device);
     897        int rc = htc_init(ar9271->htc_device);
    899898        if (rc != EOK) {
    900899                ar9271_delete_dev_data(ar9271);
Note: See TracChangeset for help on using the changeset viewer.