Changeset 5a6cc679 in mainline for uspace/drv/nic/ar9271


Ignore:
Timestamp:
2018-01-31T02:21:24Z (8 years ago)
Author:
Jenda <jenda.jzqk73@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
a0a9cc2
Parents:
132ab5d1
Message:

Merge commit '50f19b7ee8e94570b5c63896736c4eb49cfa18db' into forwardport

Not all ints are converted to errno_t in xhci tree yet, however it compiles and works :)

Location:
uspace/drv/nic/ar9271
Files:
10 edited

Legend:

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

    r132ab5d1 r5a6cc679  
    9999
    100100/* Callback when new device is to be controlled by this driver. */
    101 static int ar9271_add_device(ddf_dev_t *);
     101static errno_t ar9271_add_device(ddf_dev_t *);
    102102
    103103/* 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 *,
     104static errno_t ar9271_ieee80211_start(ieee80211_dev_t *);
     105static errno_t ar9271_ieee80211_tx_handler(ieee80211_dev_t *, void *, size_t);
     106static errno_t ar9271_ieee80211_set_freq(ieee80211_dev_t *, uint16_t);
     107static errno_t ar9271_ieee80211_bssid_change(ieee80211_dev_t *, bool);
     108static errno_t ar9271_ieee80211_key_config(ieee80211_dev_t *, ieee80211_key_config_t *,
    109109    bool);
    110110
     
    128128static ieee80211_iface_t ar9271_ieee80211_iface;
    129129
    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 *,
     130static errno_t ar9271_get_device_info(ddf_fun_t *, nic_device_info_t *);
     131static errno_t ar9271_get_cable_state(ddf_fun_t *, nic_cable_state_t *);
     132static errno_t ar9271_get_operation_mode(ddf_fun_t *, int *, nic_channel_mode_t *,
    133133    nic_role_t *);
    134134
     
    144144 *
    145145 */
    146 static int ar9271_get_device_info(ddf_fun_t *dev, nic_device_info_t *info)
     146static errno_t ar9271_get_device_info(ddf_fun_t *dev, nic_device_info_t *info)
    147147{
    148148        assert(dev);
     
    164164 *
    165165 */
    166 static int ar9271_get_cable_state(ddf_fun_t *fun, nic_cable_state_t *state)
     166static errno_t ar9271_get_cable_state(ddf_fun_t *fun, nic_cable_state_t *state)
    167167{
    168168        *state = NIC_CS_PLUGGED;
     
    174174 *
    175175 */
    176 static int ar9271_get_operation_mode(ddf_fun_t *fun, int *speed,
     176static errno_t ar9271_get_operation_mode(ddf_fun_t *fun, int *speed,
    177177    nic_channel_mode_t *duplex, nic_role_t *role)
    178178{
     
    187187 *
    188188 */
    189 static int ar9271_on_multicast_mode_change(nic_t *nic,
     189static errno_t ar9271_on_multicast_mode_change(nic_t *nic,
    190190    nic_multicast_mode_t mode, const nic_address_t *addr, size_t addr_cnt)
    191191{
     
    210210 *
    211211 */
    212 static int ar9271_on_unicast_mode_change(nic_t *nic, nic_unicast_mode_t mode,
     212static errno_t ar9271_on_unicast_mode_change(nic_t *nic, nic_unicast_mode_t mode,
    213213    const nic_address_t *addr, size_t addr_cnt)
    214214{
     
    236236 *
    237237 */
    238 static int ar9271_on_broadcast_mode_change(nic_t *nic,
     238static errno_t ar9271_on_broadcast_mode_change(nic_t *nic,
    239239    nic_broadcast_mode_t mode)
    240240{
     
    258258}
    259259
    260 static int ar9271_data_polling(void *arg)
     260static errno_t ar9271_data_polling(void *arg)
    261261{
    262262        assert(arg);
     
    319319 *
    320320 */
    321 static int ar9271_ieee80211_set_freq(ieee80211_dev_t *ieee80211_dev,
     321static errno_t ar9271_ieee80211_set_freq(ieee80211_dev_t *ieee80211_dev,
    322322    uint16_t freq)
    323323{
     
    330330        wmi_send_command(ar9271->htc_device, WMI_STOP_RECV, NULL, 0, NULL);
    331331       
    332         int rc = hw_freq_switch(ar9271, freq);
     332        errno_t rc = hw_freq_switch(ar9271, freq);
    333333        if (rc != EOK) {
    334334                usb_log_error("Failed to HW switch frequency.\n");
     
    352352}
    353353
    354 static int ar9271_ieee80211_bssid_change(ieee80211_dev_t *ieee80211_dev,
     354static errno_t ar9271_ieee80211_bssid_change(ieee80211_dev_t *ieee80211_dev,
    355355    bool connected)
    356356{
     
    401401}
    402402
    403 static int ar9271_ieee80211_key_config(ieee80211_dev_t *ieee80211_dev,
     403static errno_t ar9271_ieee80211_key_config(ieee80211_dev_t *ieee80211_dev,
    404404    ieee80211_key_config_t *key_conf, bool insert)
    405405{
     
    519519}
    520520
    521 static int ar9271_ieee80211_tx_handler(ieee80211_dev_t *ieee80211_dev,
     521static errno_t ar9271_ieee80211_tx_handler(ieee80211_dev_t *ieee80211_dev,
    522522    void *buffer, size_t buffer_size)
    523523{
     
    608608}
    609609
    610 static int ar9271_ieee80211_start(ieee80211_dev_t *ieee80211_dev)
     610static errno_t ar9271_ieee80211_start(ieee80211_dev_t *ieee80211_dev)
    611611{
    612612        assert(ieee80211_dev);
     
    616616        wmi_send_command(ar9271->htc_device, WMI_FLUSH_RECV, NULL, 0, NULL);
    617617       
    618         int rc = hw_reset(ar9271);
     618        errno_t rc = hw_reset(ar9271);
    619619        if (rc != EOK) {
    620620                usb_log_error("Failed to do HW reset.\n");
     
    666666}
    667667
    668 static int ar9271_init(ar9271_t *ar9271, usb_device_t *usb_device, const usb_endpoint_description_t **endpoints)
     668static errno_t ar9271_init(ar9271_t *ar9271, usb_device_t *usb_device, const usb_endpoint_description_t **endpoints)
    669669{
    670670        ar9271->starting_up = true;
     
    680680        }
    681681       
    682         int rc = ath_usb_init(ar9271->ath_device, usb_device, endpoints);
     682        errno_t rc = ath_usb_init(ar9271->ath_device, usb_device, endpoints);
    683683        if (rc != EOK) {
    684684                free(ar9271->ath_device);
     
    737737 *
    738738 */
    739 static int ar9271_upload_fw(ar9271_t *ar9271)
     739static errno_t ar9271_upload_fw(ar9271_t *ar9271)
    740740{
    741741        usb_device_t *usb_device = ar9271->usb_device;
     
    775775                memcpy(buffer, current_data, chunk_size);
    776776                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,
    778778                    USB_REQUEST_TYPE_VENDOR,
    779779                    USB_REQUEST_RECIPIENT_DEVICE,
     
    803803        */
    804804        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,
    806806            USB_REQUEST_TYPE_VENDOR,
    807807            USB_REQUEST_RECIPIENT_DEVICE,
     
    834834        /* USB framework initialization. */
    835835        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);
    837837        if (rc != EOK) {
    838838                usb_log_error("Failed to create USB device: %s, "
     
    879879 * @return EOK if succeed, error code otherwise
    880880 */
    881 static int ar9271_add_device(ddf_dev_t *dev)
     881static errno_t ar9271_add_device(ddf_dev_t *dev)
    882882{
    883883        assert(dev);
     
    896896       
    897897        /* Initialize AR9271 HTC services. */
    898         int rc = htc_init(ar9271->htc_device);
     898        errno_t rc = htc_init(ar9271->htc_device);
    899899        if (rc != EOK) {
    900900                ar9271_delete_dev_data(ar9271);
  • uspace/drv/nic/ar9271/ath.h

    r132ab5d1 r5a6cc679  
    4040/** Atheros wifi operations. */
    4141typedef struct {
    42         int (*send_ctrl_message)(struct ath *, void *, size_t);
    43         int (*read_ctrl_message)(struct ath *, void *, size_t, size_t *);
    44         int (*send_data_message)(struct ath *, void *, size_t);
    45         int (*read_data_message)(struct ath *, void *, size_t, size_t *);
     42        errno_t (*send_ctrl_message)(struct ath *, void *, size_t);
     43        errno_t (*read_ctrl_message)(struct ath *, void *, size_t, size_t *);
     44        errno_t (*send_data_message)(struct ath *, void *, size_t);
     45        errno_t (*read_data_message)(struct ath *, void *, size_t, size_t *);
    4646} ath_ops_t;
    4747
  • uspace/drv/nic/ar9271/ath_usb.c

    r132ab5d1 r5a6cc679  
    3939#include "ath_usb.h"
    4040
    41 static int ath_usb_send_ctrl_message(ath_t *, void *, size_t);
    42 static int ath_usb_read_ctrl_message(ath_t *, void *, size_t, size_t *);
    43 static int ath_usb_send_data_message(ath_t *, void *, size_t);
    44 static int ath_usb_read_data_message(ath_t *, void *, size_t, size_t *);
     41static errno_t ath_usb_send_ctrl_message(ath_t *, void *, size_t);
     42static errno_t ath_usb_read_ctrl_message(ath_t *, void *, size_t, size_t *);
     43static errno_t ath_usb_send_data_message(ath_t *, void *, size_t);
     44static errno_t ath_usb_read_data_message(ath_t *, void *, size_t, size_t *);
    4545
    4646static ath_ops_t ath_usb_ops = {
     
    5959 *
    6060 */
    61 int ath_usb_init(ath_t *ath, usb_device_t *usb_device, const usb_endpoint_description_t **endpoints)
     61errno_t ath_usb_init(ath_t *ath, usb_device_t *usb_device, const usb_endpoint_description_t **endpoints)
    6262{
    6363        ath_usb_t *ath_usb = malloc(sizeof(ath_usb_t));
     
    110110 *
    111111 */
    112 static int ath_usb_send_ctrl_message(ath_t *ath, void *buffer,
     112static errno_t ath_usb_send_ctrl_message(ath_t *ath, void *buffer,
    113113    size_t buffer_size)
    114114{
     
    127127 *
    128128 */
    129 static int ath_usb_read_ctrl_message(ath_t *ath, void *buffer,
     129static errno_t ath_usb_read_ctrl_message(ath_t *ath, void *buffer,
    130130    size_t buffer_size, size_t *transferred_size)
    131131{
     
    143143 *
    144144 */
    145 static int ath_usb_send_data_message(ath_t *ath, void *buffer,
     145static errno_t ath_usb_send_data_message(ath_t *ath, void *buffer,
    146146    size_t buffer_size)
    147147{
     
    158158       
    159159        ath_usb_t *ath_usb = (ath_usb_t *) ath->specific_data;
    160         int ret_val = usb_pipe_write(ath_usb->output_data_pipe, complete_buffer,
    161             complete_buffer_size);
     160        const errno_t ret_val = usb_pipe_write(ath_usb->output_data_pipe,
     161            complete_buffer, complete_buffer_size);
    162162       
    163163        free(complete_buffer);
     
    176176 *
    177177 */
    178 static int ath_usb_read_data_message(ath_t *ath, void *buffer,
     178static errno_t ath_usb_read_data_message(ath_t *ath, void *buffer,
    179179    size_t buffer_size, size_t *transferred_size)
    180180{
  • uspace/drv/nic/ar9271/ath_usb.h

    r132ab5d1 r5a6cc679  
    5959} ath_usb_data_header_t;
    6060
    61 extern int ath_usb_init(ath_t *, usb_device_t *, const usb_endpoint_description_t **endpoints);
     61extern errno_t ath_usb_init(ath_t *, usb_device_t *, const usb_endpoint_description_t **endpoints);
    6262
    6363#endif  /* ATHEROS_ATH_USB_H */
  • uspace/drv/nic/ar9271/htc.c

    r132ab5d1 r5a6cc679  
    6666}
    6767
    68 int htc_init_new_vif(htc_device_t *htc_device)
     68errno_t htc_init_new_vif(htc_device_t *htc_device)
    6969{
    7070        htc_vif_msg_t vif_msg;
     
    153153 *
    154154 */
    155 int htc_send_control_message(htc_device_t *htc_device, void *buffer,
     155errno_t htc_send_control_message(htc_device_t *htc_device, void *buffer,
    156156    size_t buffer_size, uint8_t endpoint_id)
    157157{
     
    176176 *
    177177 */
    178 int htc_send_data_message(htc_device_t *htc_device, void *buffer,
     178errno_t htc_send_data_message(htc_device_t *htc_device, void *buffer,
    179179    size_t buffer_size, uint8_t endpoint_id)
    180180{
     
    199199 *
    200200 */
    201 int htc_read_data_message(htc_device_t *htc_device, void *buffer,
     201errno_t htc_read_data_message(htc_device_t *htc_device, void *buffer,
    202202    size_t buffer_size, size_t *transferred_size)
    203203{
     
    219219 *
    220220 */
    221 int htc_read_control_message(htc_device_t *htc_device, void *buffer,
     221errno_t htc_read_control_message(htc_device_t *htc_device, void *buffer,
    222222    size_t buffer_size, size_t *transferred_size)
    223223{
     
    239239 *
    240240 */
    241 static int htc_connect_service(htc_device_t *htc_device,
     241static errno_t htc_connect_service(htc_device_t *htc_device,
    242242    wmi_services_t service_id, int *response_endpoint_no)
    243243{
     
    261261       
    262262        /* Send HTC message. */
    263         int rc = htc_send_control_message(htc_device, buffer, buffer_size,
     263        errno_t rc = htc_send_control_message(htc_device, buffer, buffer_size,
    264264            htc_device->endpoints.ctrl_endpoint);
    265265        if (rc != EOK) {
     
    312312 *
    313313 */
    314 static int htc_config_credits(htc_device_t *htc_device)
     314static errno_t htc_config_credits(htc_device_t *htc_device)
    315315{
    316316        size_t buffer_size = sizeof(htc_frame_header_t) +
     
    327327       
    328328        /* Send HTC message. */
    329         int rc = htc_send_control_message(htc_device, buffer, buffer_size,
     329        errno_t rc = htc_send_control_message(htc_device, buffer, buffer_size,
    330330            htc_device->endpoints.ctrl_endpoint);
    331331        if (rc != EOK) {
     
    360360 *
    361361 */
    362 static int htc_complete_setup(htc_device_t *htc_device)
     362static errno_t htc_complete_setup(htc_device_t *htc_device)
    363363{
    364364        size_t buffer_size = sizeof(htc_frame_header_t) +
     
    373373       
    374374        /* Send HTC message. */
    375         int rc = htc_send_control_message(htc_device, buffer, buffer_size,
     375        errno_t rc = htc_send_control_message(htc_device, buffer, buffer_size,
    376376            htc_device->endpoints.ctrl_endpoint);
    377377        if (rc != EOK)
     
    394394 *
    395395 */
    396 static int htc_check_ready(htc_device_t *htc_device)
     396static errno_t htc_check_ready(htc_device_t *htc_device)
    397397{
    398398        size_t buffer_size = htc_device->ath_device->ctrl_response_length;
     
    400400       
    401401        /* Read response from device. */
    402         int rc = htc_read_control_message(htc_device, buffer, buffer_size,
     402        errno_t rc = htc_read_control_message(htc_device, buffer, buffer_size,
    403403            NULL);
    404404        if (rc != EOK) {
     
    430430 *
    431431 */
    432 int htc_device_init(ath_t *ath_device, ieee80211_dev_t *ieee80211_dev,
     432errno_t htc_device_init(ath_t *ath_device, ieee80211_dev_t *ieee80211_dev,
    433433    htc_device_t *htc_device)
    434434{
     
    451451 *
    452452 */
    453 int htc_init(htc_device_t *htc_device)
     453errno_t htc_init(htc_device_t *htc_device)
    454454{
    455455        /* First check ready message in device. */
    456         int rc = htc_check_ready(htc_device);
     456        errno_t rc = htc_check_ready(htc_device);
    457457        if (rc != EOK) {
    458458                usb_log_error("Device is not in ready state after loading "
  • uspace/drv/nic/ar9271/htc.h

    r132ab5d1 r5a6cc679  
    297297} __attribute__((packed)) htc_setup_complete_msg_t;
    298298
    299 extern int htc_device_init(ath_t *, ieee80211_dev_t *, htc_device_t *);
    300 extern int htc_init(htc_device_t *);
    301 extern int htc_init_new_vif(htc_device_t *);
    302 extern int htc_read_control_message(htc_device_t *, void *, size_t, size_t *);
    303 extern int htc_read_data_message(htc_device_t *, void *, size_t, size_t *);
    304 extern int htc_send_control_message(htc_device_t *, void *, size_t, uint8_t);
    305 extern int htc_send_data_message(htc_device_t *, void *, size_t, uint8_t);
     299extern errno_t htc_device_init(ath_t *, ieee80211_dev_t *, htc_device_t *);
     300extern errno_t htc_init(htc_device_t *);
     301extern errno_t htc_init_new_vif(htc_device_t *);
     302extern errno_t htc_read_control_message(htc_device_t *, void *, size_t, size_t *);
     303extern errno_t htc_read_data_message(htc_device_t *, void *, size_t, size_t *);
     304extern errno_t htc_send_control_message(htc_device_t *, void *, size_t, uint8_t);
     305extern errno_t htc_send_data_message(htc_device_t *, void *, size_t, uint8_t);
    306306
    307307#endif  /* ATHEROS_HTC_H */
  • uspace/drv/nic/ar9271/hw.c

    r132ab5d1 r5a6cc679  
    5252 *
    5353 */
    54 static int hw_read_wait(ar9271_t *ar9271, uint32_t offset, uint32_t mask,
     54static errno_t hw_read_wait(ar9271_t *ar9271, uint32_t offset, uint32_t mask,
    5555    uint32_t value)
    5656{
     
    6767}
    6868
    69 static int hw_reset_power_on(ar9271_t *ar9271)
     69static errno_t hw_reset_power_on(ar9271_t *ar9271)
    7070{
    7171        wmi_reg_t buffer[] = {
     
    9393        wmi_reg_write(ar9271->htc_device, AR9271_RTC_RESET, 1);
    9494       
    95         int rc = hw_read_wait(ar9271,
     95        errno_t rc = hw_read_wait(ar9271,
    9696            AR9271_RTC_STATUS,
    9797            AR9271_RTC_STATUS_MASK,
     
    105105}
    106106
    107 static int hw_set_reset(ar9271_t *ar9271, bool cold)
     107static errno_t hw_set_reset(ar9271_t *ar9271, bool cold)
    108108{
    109109        uint32_t reset_value = AR9271_RTC_RC_MAC_WARM;
     
    135135        wmi_reg_write(ar9271->htc_device, AR9271_RTC_RC, 0);
    136136       
    137         int rc = hw_read_wait(ar9271, AR9271_RTC_RC, AR9271_RTC_RC_MASK, 0);
     137        errno_t rc = hw_read_wait(ar9271, AR9271_RTC_RC, AR9271_RTC_RC_MASK, 0);
    138138        if (rc != EOK) {
    139139                usb_log_error("Failed to wait for RTC RC register.\n");
     
    148148}
    149149
    150 static int hw_addr_init(ar9271_t *ar9271)
     150static errno_t hw_addr_init(ar9271_t *ar9271)
    151151{
    152152        uint32_t value;
     
    164164        nic_t *nic = nic_get_from_ddf_dev(ar9271->ddf_dev);
    165165       
    166         int rc = nic_report_address(nic, &ar9271_address);
     166        errno_t rc = nic_report_address(nic, &ar9271_address);
    167167        if (rc != EOK) {
    168168                usb_log_error("Failed to report NIC HW address.\n");
     
    173173}
    174174
    175 static int hw_gpio_set_output(ar9271_t *ar9271, uint32_t gpio, uint32_t type)
     175static errno_t hw_gpio_set_output(ar9271_t *ar9271, uint32_t gpio, uint32_t type)
    176176{
    177177        uint32_t address;
     
    204204}
    205205
    206 static int hw_gpio_set_value(ar9271_t *ar9271, uint32_t gpio, uint32_t value)
     206static errno_t hw_gpio_set_value(ar9271_t *ar9271, uint32_t gpio, uint32_t value)
    207207{
    208208        wmi_reg_set_clear_bit(ar9271->htc_device, AR9271_GPIO_IN_OUT,
     
    218218 *
    219219 */
    220 static int hw_init_proc(ar9271_t *ar9271)
    221 {
    222         int rc = hw_reset_power_on(ar9271);
     220static errno_t hw_init_proc(ar9271_t *ar9271)
     221{
     222        errno_t rc = hw_reset_power_on(ar9271);
    223223        if (rc != EOK) {
    224224                usb_log_error("Failed to HW reset power on.\n");
     
    241241}
    242242
    243 static int hw_init_led(ar9271_t *ar9271)
    244 {
    245         int rc = hw_gpio_set_output(ar9271, AR9271_LED_PIN,
     243static errno_t hw_init_led(ar9271_t *ar9271)
     244{
     245        errno_t rc = hw_gpio_set_output(ar9271, AR9271_LED_PIN,
    246246            AR9271_GPIO_OUT_MUX_AS_OUT);
    247247        if (rc != EOK) {
     
    259259}
    260260
    261 static int hw_activate_phy(ar9271_t *ar9271)
     261static errno_t hw_activate_phy(ar9271_t *ar9271)
    262262{
    263263        wmi_reg_write(ar9271->htc_device, AR9271_PHY_ACTIVE, 1);
     
    267267}
    268268
    269 static int hw_set_operating_mode(ar9271_t *ar9271,
     269static errno_t hw_set_operating_mode(ar9271_t *ar9271,
    270270    ieee80211_operating_mode_t op_mode)
    271271{
     
    295295}
    296296
    297 static int hw_reset_operating_mode(ar9271_t *ar9271)
    298 {
    299         int rc = hw_set_operating_mode(ar9271, IEEE80211_OPMODE_STATION);
     297static errno_t hw_reset_operating_mode(ar9271_t *ar9271)
     298{
     299        errno_t rc = hw_set_operating_mode(ar9271, IEEE80211_OPMODE_STATION);
    300300        if (rc != EOK) {
    301301                usb_log_error("Failed to set opmode to station.\n");
     
    306306}
    307307
    308 static int hw_noise_floor_calibration(ar9271_t *ar9271)
     308static errno_t hw_noise_floor_calibration(ar9271_t *ar9271)
    309309{
    310310        uint32_t value;
     
    325325            AR9271_AGC_CONTROL_NF_CALIB);
    326326       
    327         int rc = hw_read_wait(ar9271, AR9271_AGC_CONTROL,
     327        errno_t rc = hw_read_wait(ar9271, AR9271_AGC_CONTROL,
    328328            AR9271_AGC_CONTROL_NF_CALIB, 0);
    329329        if (rc != EOK) {
     
    344344}
    345345
    346 static int hw_set_freq(ar9271_t *ar9271, uint16_t freq)
     346static errno_t hw_set_freq(ar9271_t *ar9271, uint16_t freq)
    347347{
    348348        /* Not supported channel frequency. */
     
    373373}
    374374
    375 int hw_freq_switch(ar9271_t *ar9271, uint16_t freq)
     375errno_t hw_freq_switch(ar9271_t *ar9271, uint16_t freq)
    376376{
    377377        wmi_reg_write(ar9271->htc_device, AR9271_PHY_RFBUS_KILL, 0x1);
    378378       
    379         int rc = hw_read_wait(ar9271, AR9271_PHY_RFBUS_GRANT, 0x1, 0x1);
     379        errno_t rc = hw_read_wait(ar9271, AR9271_PHY_RFBUS_GRANT, 0x1, 0x1);
    380380        if (rc != EOK) {
    381381                usb_log_error("Failed to kill RF bus.\n");
     
    407407}
    408408
    409 int hw_set_rx_filter(ar9271_t *ar9271, bool assoc)
     409errno_t hw_set_rx_filter(ar9271_t *ar9271, bool assoc)
    410410{
    411411        uint32_t additional_bits = 0;
     
    425425}
    426426
    427 int hw_set_bssid(ar9271_t *ar9271)
     427errno_t hw_set_bssid(ar9271_t *ar9271)
    428428{
    429429        ieee80211_dev_t *ieee80211_dev = ar9271->ieee80211_dev;
     
    445445}
    446446
    447 int hw_rx_init(ar9271_t *ar9271)
     447errno_t hw_rx_init(ar9271_t *ar9271)
    448448{
    449449        wmi_reg_write(ar9271->htc_device, AR9271_COMMAND,
    450450            AR9271_COMMAND_RX_ENABLE);
    451451       
    452         int rc = hw_set_rx_filter(ar9271, false);
     452        errno_t rc = hw_set_rx_filter(ar9271, false);
    453453        if (rc != EOK) {
    454454                usb_log_error("Failed to set RX filtering.\n");
     
    465465}
    466466
    467 static int hw_init_pll(ar9271_t *ar9271)
     467static errno_t hw_init_pll(ar9271_t *ar9271)
    468468{
    469469        /* Some magic here (set for 2GHz channels). But VERY important :-) */
     
    510510}
    511511
    512 static int hw_calibration(ar9271_t *ar9271)
     512static errno_t hw_calibration(ar9271_t *ar9271)
    513513{
    514514        wmi_reg_set_bit(ar9271->htc_device, AR9271_CARRIER_LEAK_CONTROL,
     
    523523            AR9271_AGC_CONTROL_CALIB);
    524524       
    525         int rc = hw_read_wait(ar9271, AR9271_AGC_CONTROL,
     525        errno_t rc = hw_read_wait(ar9271, AR9271_AGC_CONTROL,
    526526            AR9271_AGC_CONTROL_CALIB, 0);
    527527        if (rc != EOK) {
     
    540540}
    541541
    542 int hw_reset(ar9271_t *ar9271)
     542errno_t hw_reset(ar9271_t *ar9271)
    543543{
    544544        /* Set physical layer as deactivated. */
     
    559559                hw_set_reset(ar9271, true);
    560560       
    561         int rc = hw_init_pll(ar9271);
     561        errno_t rc = hw_init_pll(ar9271);
    562562        if (rc != EOK) {
    563563                usb_log_error("Failed to init PLL.\n");
     
    638638 * @return EOK if succeed, error code otherwise.
    639639 */
    640 int hw_init(ar9271_t *ar9271)
    641 {
    642         int rc = hw_init_proc(ar9271);
     640errno_t hw_init(ar9271_t *ar9271)
     641{
     642        errno_t rc = hw_init_proc(ar9271);
    643643        if (rc != EOK) {
    644644                usb_log_error("Failed to HW reset device.\n");
  • uspace/drv/nic/ar9271/hw.h

    r132ab5d1 r5a6cc679  
    4141#define HW_WAIT_TIME_US  10
    4242
    43 extern int hw_init(ar9271_t *);
    44 extern int hw_freq_switch(ar9271_t *, uint16_t);
    45 extern int hw_rx_init(ar9271_t *);
    46 extern int hw_reset(ar9271_t *);
    47 extern int hw_set_bssid(ar9271_t *);
    48 extern int hw_set_rx_filter(ar9271_t *, bool);
     43extern errno_t hw_init(ar9271_t *);
     44extern errno_t hw_freq_switch(ar9271_t *, uint16_t);
     45extern errno_t hw_rx_init(ar9271_t *);
     46extern errno_t hw_reset(ar9271_t *);
     47extern errno_t hw_set_bssid(ar9271_t *);
     48extern errno_t hw_set_rx_filter(ar9271_t *, bool);
    4949
    5050#endif  /* ATHEROS_HW_H */
  • uspace/drv/nic/ar9271/wmi.c

    r132ab5d1 r5a6cc679  
    5050 *
    5151 */
    52 int wmi_reg_read(htc_device_t *htc_device, uint32_t reg_offset, uint32_t *res)
     52errno_t wmi_reg_read(htc_device_t *htc_device, uint32_t reg_offset, uint32_t *res)
    5353{
    5454        uint32_t cmd_value = host2uint32_t_be(reg_offset);
     
    5757            malloc(htc_device->ath_device->ctrl_response_length);
    5858       
    59         int rc = wmi_send_command(htc_device, WMI_REG_READ,
     59        errno_t rc = wmi_send_command(htc_device, WMI_REG_READ,
    6060            (uint8_t *) &cmd_value, sizeof(cmd_value), resp_buffer);
    6161       
     
    8282 *
    8383 */
    84 int wmi_reg_write(htc_device_t *htc_device, uint32_t reg_offset, uint32_t val)
     84errno_t wmi_reg_write(htc_device_t *htc_device, uint32_t reg_offset, uint32_t val)
    8585{
    8686        uint32_t cmd_buffer[] = {
     
    9292            malloc(htc_device->ath_device->ctrl_response_length);
    9393       
    94         int rc = wmi_send_command(htc_device, WMI_REG_WRITE,
     94        errno_t rc = wmi_send_command(htc_device, WMI_REG_WRITE,
    9595            (uint8_t *) &cmd_buffer, sizeof(cmd_buffer), resp_buffer);
    9696       
     
    115115 *
    116116 */
    117 int wmi_reg_set_clear_bit(htc_device_t *htc_device, uint32_t reg_offset,
     117errno_t wmi_reg_set_clear_bit(htc_device_t *htc_device, uint32_t reg_offset,
    118118    uint32_t set_bit, uint32_t clear_bit)
    119119{
    120120        uint32_t value;
    121121       
    122         int rc = wmi_reg_read(htc_device, reg_offset, &value);
     122        errno_t rc = wmi_reg_read(htc_device, reg_offset, &value);
    123123        if (rc != EOK) {
    124124                usb_log_error("Failed to read registry value in RMW "
     
    149149 *
    150150 */
    151 int wmi_reg_set_bit(htc_device_t *htc_device, uint32_t reg_offset,
     151errno_t wmi_reg_set_bit(htc_device_t *htc_device, uint32_t reg_offset,
    152152    uint32_t set_bit)
    153153{
     
    164164 *
    165165 */
    166 int wmi_reg_clear_bit(htc_device_t *htc_device, uint32_t reg_offset,
     166errno_t wmi_reg_clear_bit(htc_device_t *htc_device, uint32_t reg_offset,
    167167    uint32_t clear_bit)
    168168{
     
    179179 *
    180180 */
    181 int wmi_reg_buffer_write(htc_device_t *htc_device, wmi_reg_t *reg_buffer,
     181errno_t wmi_reg_buffer_write(htc_device_t *htc_device, wmi_reg_t *reg_buffer,
    182182    size_t elements)
    183183{
     
    198198        }
    199199       
    200         int rc = wmi_send_command(htc_device, WMI_REG_WRITE,
     200        errno_t rc = wmi_send_command(htc_device, WMI_REG_WRITE,
    201201            (uint8_t *) buffer, buffer_size, resp_buffer);
    202202       
     
    223223 *
    224224 */
    225 int wmi_send_command(htc_device_t *htc_device, wmi_command_t command_id,
     225errno_t wmi_send_command(htc_device_t *htc_device, wmi_command_t command_id,
    226226    uint8_t *command_buffer, uint32_t command_length, void *response_buffer)
    227227{
     
    242242       
    243243        /* Send message. */
    244         int rc = htc_send_control_message(htc_device, buffer, buffer_size,
     244        errno_t rc = htc_send_control_message(htc_device, buffer, buffer_size,
    245245            htc_device->endpoints.wmi_endpoint);
    246246        if (rc != EOK) {
  • uspace/drv/nic/ar9271/wmi.h

    r132ab5d1 r5a6cc679  
    117117} wmi_reg_t;
    118118
    119 extern int wmi_reg_read(htc_device_t *, uint32_t, uint32_t *);
    120 extern int wmi_reg_write(htc_device_t *, uint32_t, uint32_t);
    121 extern int wmi_reg_set_clear_bit(htc_device_t *, uint32_t, uint32_t, uint32_t);
    122 extern int wmi_reg_set_bit(htc_device_t *, uint32_t, uint32_t);
    123 extern int wmi_reg_clear_bit(htc_device_t *, uint32_t, uint32_t);
    124 extern int wmi_reg_buffer_write(htc_device_t *, wmi_reg_t *, size_t);
    125 extern int wmi_send_command(htc_device_t *, wmi_command_t, uint8_t *, uint32_t,
     119extern errno_t wmi_reg_read(htc_device_t *, uint32_t, uint32_t *);
     120extern errno_t wmi_reg_write(htc_device_t *, uint32_t, uint32_t);
     121extern errno_t wmi_reg_set_clear_bit(htc_device_t *, uint32_t, uint32_t, uint32_t);
     122extern errno_t wmi_reg_set_bit(htc_device_t *, uint32_t, uint32_t);
     123extern errno_t wmi_reg_clear_bit(htc_device_t *, uint32_t, uint32_t);
     124extern errno_t wmi_reg_buffer_write(htc_device_t *, wmi_reg_t *, size_t);
     125extern errno_t wmi_send_command(htc_device_t *, wmi_command_t, uint8_t *, uint32_t,
    126126    void *);
    127127
Note: See TracChangeset for help on using the changeset viewer.