Changeset 92f924c8 in mainline for uspace/drv/uhci/root_hub/port.c


Ignore:
Timestamp:
2011-01-07T13:27:58Z (13 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
7bd34e5
Parents:
28f660d
Message:

block fibril until address is assigned

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/uhci/root_hub/port.c

    r28f660d r92f924c8  
    11
     2#include <atomic.h>
     3#include <errno.h>
    24#include <usb/devreq.h>
    35#include <usb/usb.h>
    4 #include <errno.h>
    56
    67#include "debug.h"
     
    89#include "port.h"
    910#include "port_status.h"
     11#include "utils/hc_synchronizer.h"
    1012
    1113struct usb_match {
     
    104106        pio_write_16( port->address, port_status.raw_value );
    105107
    106         uhci_print_info( "Enabled port %d.\n", port );
     108        uhci_print_info( "Enabled port %d.\n", port->number );
    107109        return EOK;
    108110}
     
    191193        /* get new address */
    192194        const usb_address_t usb_address =
    193           usb_address_keeping_request( &uhci_instance->address_manager );
     195          usb_address_keeping_request(&uhci_instance->address_manager);
     196
     197        if (usb_address <= 0) {
     198                return usb_address;
     199        }
    194200
    195201        /* assign new address */
    196202        usb_target_t new_device = { USB_ADDRESS_DEFAULT, 0 };
    197         usb_device_request_setup_packet_t data;
     203        usb_device_request_setup_packet_t data =
     204        {
     205                .request_type = 0,
     206                .request = USB_DEVREQ_SET_ADDRESS,
     207                { .value = usb_address },
     208                .index = 0,
     209                .length = 0
     210        };
     211
     212        sync_value_t value;
    198213
    199214        uhci_setup(
    200           hc, new_device, USB_TRANSFER_CONTROL, &data, sizeof(data), NULL, NULL );
    201         uhci_print_verbose( "address assignment sent, waiting to complete.\n" );
    202 
     215          hc, new_device, USB_TRANSFER_CONTROL, &data, sizeof(data),
     216                sync_out_callback, (void*)&value );
     217        uhci_print_verbose("address assignment sent, waiting to complete.\n");
     218
     219//      sync_wait_for(&value);
    203220
    204221        uhci_print_info( "Assigned address %#x.\n", usb_address );
Note: See TracChangeset for help on using the changeset viewer.