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