Changeset 56c0930 in mainline for uspace/drv/bus/usb/ar9271/wmi.c
- Timestamp:
- 2015-02-20T14:33:29Z (9 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 4cb0148
- Parents:
- ab365c4
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/ar9271/wmi.c
rab365c4 r56c0930 54 54 uint32_t cmd_value = host2uint32_t_be(reg_offset); 55 55 56 size_t buffer_size = MAX_RESPONSE_LENGTH;57 void *resp_buffer = malloc(buffer_size);56 void *resp_buffer = 57 malloc(htc_device->ath_device->ctrl_response_length); 58 58 59 59 int rc = wmi_send_command(htc_device, WMI_REG_READ, … … 90 90 }; 91 91 92 void *resp_buffer = malloc(MAX_RESPONSE_LENGTH); 92 void *resp_buffer = 93 malloc(htc_device->ath_device->ctrl_response_length); 93 94 94 95 int rc = wmi_send_command(htc_device, WMI_REG_WRITE, … … 115 116 * @return EOK if succeed, negative error code otherwise. 116 117 */ 117 int wmi_reg_ clear_set_bit(htc_device_t *htc_device, uint32_t reg_offset,118 int wmi_reg_set_clear_bit(htc_device_t *htc_device, uint32_t reg_offset, 118 119 uint32_t set_bit, uint32_t clear_bit) 119 120 { … … 152 153 uint32_t set_bit) 153 154 { 154 return wmi_reg_ clear_set_bit(htc_device, reg_offset, set_bit, 0);155 return wmi_reg_set_clear_bit(htc_device, reg_offset, set_bit, 0); 155 156 } 156 157 … … 167 168 uint32_t clear_bit) 168 169 { 169 return wmi_reg_ clear_set_bit(htc_device, reg_offset, 0, clear_bit);170 return wmi_reg_set_clear_bit(htc_device, reg_offset, 0, clear_bit); 170 171 } 171 172 … … 184 185 size_t buffer_size = sizeof(wmi_reg_t) * elements; 185 186 void *buffer = malloc(buffer_size); 186 void *resp_buffer = malloc(MAX_RESPONSE_LENGTH); 187 void *resp_buffer = 188 malloc(htc_device->ath_device->ctrl_response_length); 187 189 188 190 /* Convert values to correct endianness. */ … … 240 242 241 243 /* Send message. */ 242 int rc = htc_send_ message(htc_device, buffer, buffer_size,244 int rc = htc_send_control_message(htc_device, buffer, buffer_size, 243 245 htc_device->endpoints.wmi_endpoint); 244 246 if(rc != EOK) { … … 251 253 252 254 bool clean_resp_buffer = false; 255 size_t response_buffer_size = 256 htc_device->ath_device->ctrl_response_length; 253 257 if(response_buffer == NULL) { 254 response_buffer = malloc( MAX_RESPONSE_LENGTH);258 response_buffer = malloc(response_buffer_size); 255 259 clean_resp_buffer = true; 256 260 } 257 261 258 262 /* Read response. */ 259 rc = htc_read_ message(htc_device, response_buffer, MAX_RESPONSE_LENGTH,260 NULL);263 rc = htc_read_control_message(htc_device, response_buffer, 264 response_buffer_size, NULL); 261 265 if(rc != EOK) { 262 266 free(buffer);
Note:
See TracChangeset
for help on using the changeset viewer.