Changes in uspace/drv/nic/ar9271/wmi.c [b7fd2a0:38d150e] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/nic/ar9271/wmi.c
rb7fd2a0 r38d150e 35 35 #include <usb/debug.h> 36 36 #include <errno.h> 37 #include <str_error.h>38 37 #include <stdlib.h> 39 38 #include <mem.h> … … 47 46 * @param res Stored result. 48 47 * 49 * @return EOK if succeed, error code otherwise.50 * 51 */ 52 errno_t wmi_reg_read(htc_device_t *htc_device, uint32_t reg_offset, uint32_t *res)48 * @return EOK if succeed, negative error code otherwise. 49 * 50 */ 51 int wmi_reg_read(htc_device_t *htc_device, uint32_t reg_offset, uint32_t *res) 53 52 { 54 53 uint32_t cmd_value = host2uint32_t_be(reg_offset); … … 57 56 malloc(htc_device->ath_device->ctrl_response_length); 58 57 59 errno_t rc = wmi_send_command(htc_device, WMI_REG_READ,58 int rc = wmi_send_command(htc_device, WMI_REG_READ, 60 59 (uint8_t *) &cmd_value, sizeof(cmd_value), resp_buffer); 61 60 … … 79 78 * @param val Value to be written 80 79 * 81 * @return EOK if succeed, error code otherwise.82 * 83 */ 84 errno_t wmi_reg_write(htc_device_t *htc_device, uint32_t reg_offset, uint32_t val)80 * @return EOK if succeed, negative error code otherwise. 81 * 82 */ 83 int wmi_reg_write(htc_device_t *htc_device, uint32_t reg_offset, uint32_t val) 85 84 { 86 85 uint32_t cmd_buffer[] = { … … 92 91 malloc(htc_device->ath_device->ctrl_response_length); 93 92 94 errno_t rc = wmi_send_command(htc_device, WMI_REG_WRITE,93 int rc = wmi_send_command(htc_device, WMI_REG_WRITE, 95 94 (uint8_t *) &cmd_buffer, sizeof(cmd_buffer), resp_buffer); 96 95 … … 112 111 * @param clear_bit Bit to be cleared. 113 112 * 114 * @return EOK if succeed, error code otherwise.115 * 116 */ 117 errno_t wmi_reg_set_clear_bit(htc_device_t *htc_device, uint32_t reg_offset,113 * @return EOK if succeed, negative error code otherwise. 114 * 115 */ 116 int wmi_reg_set_clear_bit(htc_device_t *htc_device, uint32_t reg_offset, 118 117 uint32_t set_bit, uint32_t clear_bit) 119 118 { 120 119 uint32_t value; 121 120 122 errno_t rc = wmi_reg_read(htc_device, reg_offset, &value);121 int rc = wmi_reg_read(htc_device, reg_offset, &value); 123 122 if (rc != EOK) { 124 123 usb_log_error("Failed to read registry value in RMW " … … 146 145 * @param set_bit Bit to be set. 147 146 * 148 * @return EOK if succeed, error code otherwise.149 * 150 */ 151 errno_t wmi_reg_set_bit(htc_device_t *htc_device, uint32_t reg_offset,147 * @return EOK if succeed, negative error code otherwise. 148 * 149 */ 150 int wmi_reg_set_bit(htc_device_t *htc_device, uint32_t reg_offset, 152 151 uint32_t set_bit) 153 152 { … … 161 160 * @param clear_bit Bit to be cleared. 162 161 * 163 * @return EOK if succeed, error code otherwise.164 * 165 */ 166 errno_t wmi_reg_clear_bit(htc_device_t *htc_device, uint32_t reg_offset,162 * @return EOK if succeed, negative error code otherwise. 163 * 164 */ 165 int wmi_reg_clear_bit(htc_device_t *htc_device, uint32_t reg_offset, 167 166 uint32_t clear_bit) 168 167 { … … 176 175 * @param elements Number of elements in array. 177 176 * 178 * @return EOK if succeed, error code otherwise.179 * 180 */ 181 errno_t wmi_reg_buffer_write(htc_device_t *htc_device, wmi_reg_t *reg_buffer,177 * @return EOK if succeed, negative error code otherwise. 178 * 179 */ 180 int wmi_reg_buffer_write(htc_device_t *htc_device, wmi_reg_t *reg_buffer, 182 181 size_t elements) 183 182 { … … 198 197 } 199 198 200 errno_t rc = wmi_send_command(htc_device, WMI_REG_WRITE,199 int rc = wmi_send_command(htc_device, WMI_REG_WRITE, 201 200 (uint8_t *) buffer, buffer_size, resp_buffer); 202 201 … … 220 219 * @param response_buffer Buffer with response data. 221 220 * 222 * @return EOK if succeed, error code otherwise.223 * 224 */ 225 errno_t wmi_send_command(htc_device_t *htc_device, wmi_command_t command_id,221 * @return EOK if succeed, negative error code otherwise. 222 * 223 */ 224 int wmi_send_command(htc_device_t *htc_device, wmi_command_t command_id, 226 225 uint8_t *command_buffer, uint32_t command_length, void *response_buffer) 227 226 { … … 242 241 243 242 /* Send message. */ 244 errno_t rc = htc_send_control_message(htc_device, buffer, buffer_size,243 int rc = htc_send_control_message(htc_device, buffer, buffer_size, 245 244 htc_device->endpoints.wmi_endpoint); 246 245 if (rc != EOK) { 247 246 free(buffer); 248 usb_log_error("Failed to send WMI message. Error: % s\n", str_error_name(rc));247 usb_log_error("Failed to send WMI message. Error: %d\n", rc); 249 248 return rc; 250 249 } … … 269 268 free(buffer); 270 269 usb_log_error("Failed to receive WMI message response. " 271 "Error: % s\n", str_error_name(rc));270 "Error: %d\n", rc); 272 271 return rc; 273 272 }
Note:
See TracChangeset
for help on using the changeset viewer.