Changeset 9e5a51c in mainline for uspace/drv/bus/usb/ar9271/htc.c


Ignore:
Timestamp:
2015-03-08T22:20:34Z (9 years ago)
Author:
Jan Kolarik <kolarik@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
864762a
Parents:
4cb0148
Message:

Fixed PLL initialization value that blocked communication with external devices. Started implementing IEEE802.11 scanning and authentication functions.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/ar9271/htc.c

    r4cb0148 r9e5a51c  
    7171        htc_sta_msg_t sta_msg;
    7272       
     73        memset(&vif_msg, 0, sizeof(htc_vif_msg_t));
     74        memset(&sta_msg, 0, sizeof(htc_sta_msg_t));
     75       
    7376        nic_address_t addr;
    7477        nic_t *nic = nic_get_from_ddf_dev(htc_device->ieee80211_dev->ddf_dev);
     
    99102        vif_msg.rts_thres = host2uint16_t_be(HTC_RTS_THRESHOLD);
    100103       
    101         int rc = wmi_send_command(htc_device, WMI_VAP_CREATE,
    102                 (uint8_t *) &vif_msg, sizeof(vif_msg), NULL);
    103         if(rc != EOK) {
    104                 usb_log_error("Failed to send VAP create command.\n");
    105                 return rc;
    106         }
     104        wmi_send_command(htc_device, WMI_VAP_CREATE, (uint8_t *) &vif_msg,
     105                sizeof(vif_msg), NULL);
    107106       
    108107        sta_msg.is_vif_sta = 1;
    109         sta_msg.max_ampdu = host2uint16_t_be(HTC_MAX_AMPDU);
     108        sta_msg.max_ampdu = host2uint16_t_be(0xFFFF);
    110109        sta_msg.sta_index = 0;
    111110        sta_msg.vif_index = 0;
    112111       
    113         rc = wmi_send_command(htc_device, WMI_NODE_CREATE,
    114                 (uint8_t *) &sta_msg, sizeof(sta_msg), NULL);
    115         if(rc != EOK) {
    116                 usb_log_error("Failed to send NODE create command.\n");
    117                 return rc;
    118         }
     112        wmi_send_command(htc_device, WMI_NODE_CREATE, (uint8_t *) &sta_msg,
     113                sizeof(sta_msg), NULL);
    119114       
    120115        /* Write first 4 bytes of MAC address. */
     
    122117        memcpy(&id0, &addr.address, 4);
    123118        id0 = host2uint32_t_le(id0);
    124         rc = wmi_reg_write(htc_device, AR9271_STATION_ID0, id0);
    125         if(rc != EOK)
    126                 return rc;
    127        
     119        wmi_reg_write(htc_device, AR9271_STATION_ID0, id0);
     120
    128121        /* Write last 2 bytes of MAC address (and preserve existing data). */
    129122        uint32_t id1;
    130         rc = wmi_reg_read(htc_device, AR9271_STATION_ID1, &id1);
    131         if(rc != EOK)
    132                 return rc;
     123        wmi_reg_read(htc_device, AR9271_STATION_ID1, &id1);
     124
    133125        uint16_t id1_addr;
    134126        memcpy(&id1_addr, &addr.address[4], 2);
    135127        id1 = (id1 & ~AR9271_STATION_ID1_MASK) | host2uint16_t_le(id1_addr);
    136         rc = wmi_reg_write(htc_device, AR9271_STATION_ID1, id1);
    137         if(rc != EOK)
    138                 return rc;
     128        wmi_reg_write(htc_device, AR9271_STATION_ID1, id1);
    139129       
    140130        /* TODO: Set BSSID mask for AP mode. */
     
    146136        size_t buffer_size, uint8_t endpoint_id)
    147137{
     138        memset(header, 0, sizeof(htc_frame_header_t));
     139       
    148140        header->endpoint_id = endpoint_id;
    149         header->flags = 0;
    150141        header->payload_length =
    151142                host2uint16_t_be(buffer_size - sizeof(htc_frame_header_t));
    152        
    153         header->control_bytes[0] = 0x02;
    154         header->control_bytes[1] = 0x88;
    155         header->control_bytes[2] = 0xFF;
    156         header->control_bytes[3] = 0xFF;
    157143}
    158144
     
    257243                sizeof(htc_service_msg_t);
    258244        void *buffer = malloc(buffer_size);
     245        memset(buffer, 0, buffer_size);
    259246       
    260247        /* Fill service message structure. */
Note: See TracChangeset for help on using the changeset viewer.