Changeset 9e5a51c in mainline for uspace/drv/bus/usb/ar9271/htc.c
- Timestamp:
- 2015-03-08T22:20:34Z (10 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 864762a
- Parents:
- 4cb0148
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/ar9271/htc.c
r4cb0148 r9e5a51c 71 71 htc_sta_msg_t sta_msg; 72 72 73 memset(&vif_msg, 0, sizeof(htc_vif_msg_t)); 74 memset(&sta_msg, 0, sizeof(htc_sta_msg_t)); 75 73 76 nic_address_t addr; 74 77 nic_t *nic = nic_get_from_ddf_dev(htc_device->ieee80211_dev->ddf_dev); … … 99 102 vif_msg.rts_thres = host2uint16_t_be(HTC_RTS_THRESHOLD); 100 103 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); 107 106 108 107 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); 110 109 sta_msg.sta_index = 0; 111 110 sta_msg.vif_index = 0; 112 111 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); 119 114 120 115 /* Write first 4 bytes of MAC address. */ … … 122 117 memcpy(&id0, &addr.address, 4); 123 118 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 128 121 /* Write last 2 bytes of MAC address (and preserve existing data). */ 129 122 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 133 125 uint16_t id1_addr; 134 126 memcpy(&id1_addr, &addr.address[4], 2); 135 127 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); 139 129 140 130 /* TODO: Set BSSID mask for AP mode. */ … … 146 136 size_t buffer_size, uint8_t endpoint_id) 147 137 { 138 memset(header, 0, sizeof(htc_frame_header_t)); 139 148 140 header->endpoint_id = endpoint_id; 149 header->flags = 0;150 141 header->payload_length = 151 142 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;157 143 } 158 144 … … 257 243 sizeof(htc_service_msg_t); 258 244 void *buffer = malloc(buffer_size); 245 memset(buffer, 0, buffer_size); 259 246 260 247 /* Fill service message structure. */
Note:
See TracChangeset
for help on using the changeset viewer.