Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/nic/ar9271/htc.c

    r8a64320e rb7fd2a0  
    3636#include <byteorder.h>
    3737#include <errno.h>
     38#include <str_error.h>
    3839#include "wmi.h"
    3940#include "htc.h"
     
    6566}
    6667
    67 int htc_init_new_vif(htc_device_t *htc_device)
     68errno_t htc_init_new_vif(htc_device_t *htc_device)
    6869{
    6970        htc_vif_msg_t vif_msg;
     
    149150 * @param endpoint_id Destination endpoint.
    150151 *
    151  * @return EOK if succeed, negative error code otherwise.
    152  *
    153  */
    154 int htc_send_control_message(htc_device_t *htc_device, void *buffer,
     152 * @return EOK if succeed, error code otherwise.
     153 *
     154 */
     155errno_t htc_send_control_message(htc_device_t *htc_device, void *buffer,
    155156    size_t buffer_size, uint8_t endpoint_id)
    156157{
     
    172173 * @param endpoint_id Destination endpoint.
    173174 *
    174  * @return EOK if succeed, negative error code otherwise.
    175  *
    176  */
    177 int htc_send_data_message(htc_device_t *htc_device, void *buffer,
     175 * @return EOK if succeed, error code otherwise.
     176 *
     177 */
     178errno_t htc_send_data_message(htc_device_t *htc_device, void *buffer,
    178179    size_t buffer_size, uint8_t endpoint_id)
    179180{
     
    195196 * @param transferred_size Real size of read data.
    196197 *
    197  * @return EOK if succeed, negative error code otherwise.
    198  *
    199  */
    200 int htc_read_data_message(htc_device_t *htc_device, void *buffer,
     198 * @return EOK if succeed, error code otherwise.
     199 *
     200 */
     201errno_t htc_read_data_message(htc_device_t *htc_device, void *buffer,
    201202    size_t buffer_size, size_t *transferred_size)
    202203{
     
    215216 * @param transferred_size Real size of read data.
    216217 *
    217  * @return EOK if succeed, negative error code otherwise.
    218  *
    219  */
    220 int htc_read_control_message(htc_device_t *htc_device, void *buffer,
     218 * @return EOK if succeed, error code otherwise.
     219 *
     220 */
     221errno_t htc_read_control_message(htc_device_t *htc_device, void *buffer,
    221222    size_t buffer_size, size_t *transferred_size)
    222223{
     
    235236 *
    236237 * @return EOK if succeed, EINVAL when failed to connect service,
    237  *         negative error code otherwise.
    238  *
    239  */
    240 static int htc_connect_service(htc_device_t *htc_device,
     238 *         error code otherwise.
     239 *
     240 */
     241static errno_t htc_connect_service(htc_device_t *htc_device,
    241242    wmi_services_t service_id, int *response_endpoint_no)
    242243{
     
    260261       
    261262        /* Send HTC message. */
    262         int rc = htc_send_control_message(htc_device, buffer, buffer_size,
     263        errno_t rc = htc_send_control_message(htc_device, buffer, buffer_size,
    263264            htc_device->endpoints.ctrl_endpoint);
    264265        if (rc != EOK) {
    265266                free(buffer);
    266                 usb_log_error("Failed to send HTC message. Error: %d\n", rc);
     267                usb_log_error("Failed to send HTC message. Error: %s\n", str_error_name(rc));
    267268                return rc;
    268269        }
     
    278279                free(buffer);
    279280                usb_log_error("Failed to receive HTC service connect response. "
    280                     "Error: %d\n", rc);
     281                    "Error: %s\n", str_error_name(rc));
    281282                return rc;
    282283        }
     
    308309 * @param htc_device HTC device structure.
    309310 *
    310  * @return EOK if succeed, negative error code otherwise.
    311  *
    312  */
    313 static int htc_config_credits(htc_device_t *htc_device)
     311 * @return EOK if succeed, error code otherwise.
     312 *
     313 */
     314static errno_t htc_config_credits(htc_device_t *htc_device)
    314315{
    315316        size_t buffer_size = sizeof(htc_frame_header_t) +
     
    326327       
    327328        /* Send HTC message. */
    328         int rc = htc_send_control_message(htc_device, buffer, buffer_size,
     329        errno_t rc = htc_send_control_message(htc_device, buffer, buffer_size,
    329330            htc_device->endpoints.ctrl_endpoint);
    330331        if (rc != EOK) {
    331332                free(buffer);
    332333                usb_log_error("Failed to send HTC config message. "
    333                     "Error: %d\n", rc);
     334                    "Error: %s\n", str_error_name(rc));
    334335                return rc;
    335336        }
     
    344345        if (rc != EOK) {
    345346                usb_log_error("Failed to receive HTC config response message. "
    346                     "Error: %d\n", rc);
     347                    "Error: %s\n", str_error_name(rc));
    347348        }
    348349       
     
    356357 * @param htc_device HTC device structure.
    357358 *
    358  * @return EOK if succeed, negative error code otherwise.
    359  *
    360  */
    361 static int htc_complete_setup(htc_device_t *htc_device)
     359 * @return EOK if succeed, error code otherwise.
     360 *
     361 */
     362static errno_t htc_complete_setup(htc_device_t *htc_device)
    362363{
    363364        size_t buffer_size = sizeof(htc_frame_header_t) +
     
    372373       
    373374        /* Send HTC message. */
    374         int rc = htc_send_control_message(htc_device, buffer, buffer_size,
     375        errno_t rc = htc_send_control_message(htc_device, buffer, buffer_size,
    375376            htc_device->endpoints.ctrl_endpoint);
    376377        if (rc != EOK)
    377378                usb_log_error("Failed to send HTC setup complete message. "
    378                     "Error: %d\n", rc);
     379                    "Error: %s\n", str_error_name(rc));
    379380       
    380381        free(buffer);
     
    390391 *
    391392 * @return EOK if succeed, EINVAL if response error,
    392  *         negative error code otherwise.
    393  *
    394  */
    395 static int htc_check_ready(htc_device_t *htc_device)
     393 *         error code otherwise.
     394 *
     395 */
     396static errno_t htc_check_ready(htc_device_t *htc_device)
    396397{
    397398        size_t buffer_size = htc_device->ath_device->ctrl_response_length;
     
    399400       
    400401        /* Read response from device. */
    401         int rc = htc_read_control_message(htc_device, buffer, buffer_size,
     402        errno_t rc = htc_read_control_message(htc_device, buffer, buffer_size,
    402403            NULL);
    403404        if (rc != EOK) {
    404405                free(buffer);
    405406                usb_log_error("Failed to receive HTC check ready message. "
    406                     "Error: %d\n", rc);
     407                    "Error: %s\n", str_error_name(rc));
    407408                return rc;
    408409        }
     
    426427 * @param htc_device HTC device structure to be initialized.
    427428 *
    428  * @return EOK if succeed, negative error code otherwise.
    429  *
    430  */
    431 int htc_device_init(ath_t *ath_device, ieee80211_dev_t *ieee80211_dev,
     429 * @return EOK if succeed, error code otherwise.
     430 *
     431 */
     432errno_t htc_device_init(ath_t *ath_device, ieee80211_dev_t *ieee80211_dev,
    432433    htc_device_t *htc_device)
    433434{
     
    447448 * @param htc_device HTC device structure.
    448449 *
    449  * @return EOK if succeed, negative error code otherwise.
    450  *
    451  */
    452 int htc_init(htc_device_t *htc_device)
     450 * @return EOK if succeed, error code otherwise.
     451 *
     452 */
     453errno_t htc_init(htc_device_t *htc_device)
    453454{
    454455        /* First check ready message in device. */
    455         int rc = htc_check_ready(htc_device);
     456        errno_t rc = htc_check_ready(htc_device);
    456457        if (rc != EOK) {
    457458                usb_log_error("Device is not in ready state after loading "
Note: See TracChangeset for help on using the changeset viewer.