Ignore:
File:
1 edited

Legend:

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

    rb7fd2a0 r8a64320e  
    3636#include <byteorder.h>
    3737#include <errno.h>
    38 #include <str_error.h>
    3938#include "wmi.h"
    4039#include "htc.h"
     
    6665}
    6766
    68 errno_t htc_init_new_vif(htc_device_t *htc_device)
     67int htc_init_new_vif(htc_device_t *htc_device)
    6968{
    7069        htc_vif_msg_t vif_msg;
     
    150149 * @param endpoint_id Destination endpoint.
    151150 *
    152  * @return EOK if succeed, error code otherwise.
    153  *
    154  */
    155 errno_t htc_send_control_message(htc_device_t *htc_device, void *buffer,
     151 * @return EOK if succeed, negative error code otherwise.
     152 *
     153 */
     154int htc_send_control_message(htc_device_t *htc_device, void *buffer,
    156155    size_t buffer_size, uint8_t endpoint_id)
    157156{
     
    173172 * @param endpoint_id Destination endpoint.
    174173 *
    175  * @return EOK if succeed, error code otherwise.
    176  *
    177  */
    178 errno_t htc_send_data_message(htc_device_t *htc_device, void *buffer,
     174 * @return EOK if succeed, negative error code otherwise.
     175 *
     176 */
     177int htc_send_data_message(htc_device_t *htc_device, void *buffer,
    179178    size_t buffer_size, uint8_t endpoint_id)
    180179{
     
    196195 * @param transferred_size Real size of read data.
    197196 *
    198  * @return EOK if succeed, error code otherwise.
    199  *
    200  */
    201 errno_t htc_read_data_message(htc_device_t *htc_device, void *buffer,
     197 * @return EOK if succeed, negative error code otherwise.
     198 *
     199 */
     200int htc_read_data_message(htc_device_t *htc_device, void *buffer,
    202201    size_t buffer_size, size_t *transferred_size)
    203202{
     
    216215 * @param transferred_size Real size of read data.
    217216 *
    218  * @return EOK if succeed, error code otherwise.
    219  *
    220  */
    221 errno_t htc_read_control_message(htc_device_t *htc_device, void *buffer,
     217 * @return EOK if succeed, negative error code otherwise.
     218 *
     219 */
     220int htc_read_control_message(htc_device_t *htc_device, void *buffer,
    222221    size_t buffer_size, size_t *transferred_size)
    223222{
     
    236235 *
    237236 * @return EOK if succeed, EINVAL when failed to connect service,
    238  *         error code otherwise.
    239  *
    240  */
    241 static errno_t htc_connect_service(htc_device_t *htc_device,
     237 *         negative error code otherwise.
     238 *
     239 */
     240static int htc_connect_service(htc_device_t *htc_device,
    242241    wmi_services_t service_id, int *response_endpoint_no)
    243242{
     
    261260       
    262261        /* Send HTC message. */
    263         errno_t rc = htc_send_control_message(htc_device, buffer, buffer_size,
     262        int rc = htc_send_control_message(htc_device, buffer, buffer_size,
    264263            htc_device->endpoints.ctrl_endpoint);
    265264        if (rc != EOK) {
    266265                free(buffer);
    267                 usb_log_error("Failed to send HTC message. Error: %s\n", str_error_name(rc));
     266                usb_log_error("Failed to send HTC message. Error: %d\n", rc);
    268267                return rc;
    269268        }
     
    279278                free(buffer);
    280279                usb_log_error("Failed to receive HTC service connect response. "
    281                     "Error: %s\n", str_error_name(rc));
     280                    "Error: %d\n", rc);
    282281                return rc;
    283282        }
     
    309308 * @param htc_device HTC device structure.
    310309 *
    311  * @return EOK if succeed, error code otherwise.
    312  *
    313  */
    314 static errno_t htc_config_credits(htc_device_t *htc_device)
     310 * @return EOK if succeed, negative error code otherwise.
     311 *
     312 */
     313static int htc_config_credits(htc_device_t *htc_device)
    315314{
    316315        size_t buffer_size = sizeof(htc_frame_header_t) +
     
    327326       
    328327        /* Send HTC message. */
    329         errno_t rc = htc_send_control_message(htc_device, buffer, buffer_size,
     328        int rc = htc_send_control_message(htc_device, buffer, buffer_size,
    330329            htc_device->endpoints.ctrl_endpoint);
    331330        if (rc != EOK) {
    332331                free(buffer);
    333332                usb_log_error("Failed to send HTC config message. "
    334                     "Error: %s\n", str_error_name(rc));
     333                    "Error: %d\n", rc);
    335334                return rc;
    336335        }
     
    345344        if (rc != EOK) {
    346345                usb_log_error("Failed to receive HTC config response message. "
    347                     "Error: %s\n", str_error_name(rc));
     346                    "Error: %d\n", rc);
    348347        }
    349348       
     
    357356 * @param htc_device HTC device structure.
    358357 *
    359  * @return EOK if succeed, error code otherwise.
    360  *
    361  */
    362 static errno_t htc_complete_setup(htc_device_t *htc_device)
     358 * @return EOK if succeed, negative error code otherwise.
     359 *
     360 */
     361static int htc_complete_setup(htc_device_t *htc_device)
    363362{
    364363        size_t buffer_size = sizeof(htc_frame_header_t) +
     
    373372       
    374373        /* Send HTC message. */
    375         errno_t rc = htc_send_control_message(htc_device, buffer, buffer_size,
     374        int rc = htc_send_control_message(htc_device, buffer, buffer_size,
    376375            htc_device->endpoints.ctrl_endpoint);
    377376        if (rc != EOK)
    378377                usb_log_error("Failed to send HTC setup complete message. "
    379                     "Error: %s\n", str_error_name(rc));
     378                    "Error: %d\n", rc);
    380379       
    381380        free(buffer);
     
    391390 *
    392391 * @return EOK if succeed, EINVAL if response error,
    393  *         error code otherwise.
    394  *
    395  */
    396 static errno_t htc_check_ready(htc_device_t *htc_device)
     392 *         negative error code otherwise.
     393 *
     394 */
     395static int htc_check_ready(htc_device_t *htc_device)
    397396{
    398397        size_t buffer_size = htc_device->ath_device->ctrl_response_length;
     
    400399       
    401400        /* Read response from device. */
    402         errno_t rc = htc_read_control_message(htc_device, buffer, buffer_size,
     401        int rc = htc_read_control_message(htc_device, buffer, buffer_size,
    403402            NULL);
    404403        if (rc != EOK) {
    405404                free(buffer);
    406405                usb_log_error("Failed to receive HTC check ready message. "
    407                     "Error: %s\n", str_error_name(rc));
     406                    "Error: %d\n", rc);
    408407                return rc;
    409408        }
     
    427426 * @param htc_device HTC device structure to be initialized.
    428427 *
    429  * @return EOK if succeed, error code otherwise.
    430  *
    431  */
    432 errno_t htc_device_init(ath_t *ath_device, ieee80211_dev_t *ieee80211_dev,
     428 * @return EOK if succeed, negative error code otherwise.
     429 *
     430 */
     431int htc_device_init(ath_t *ath_device, ieee80211_dev_t *ieee80211_dev,
    433432    htc_device_t *htc_device)
    434433{
     
    448447 * @param htc_device HTC device structure.
    449448 *
    450  * @return EOK if succeed, error code otherwise.
    451  *
    452  */
    453 errno_t htc_init(htc_device_t *htc_device)
     449 * @return EOK if succeed, negative error code otherwise.
     450 *
     451 */
     452int htc_init(htc_device_t *htc_device)
    454453{
    455454        /* First check ready message in device. */
    456         errno_t rc = htc_check_ready(htc_device);
     455        int rc = htc_check_ready(htc_device);
    457456        if (rc != EOK) {
    458457                usb_log_error("Device is not in ready state after loading "
Note: See TracChangeset for help on using the changeset viewer.