Changes in / [f58154c5:b2995c3] in mainline


Ignore:
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • .bzrignore

    rf58154c5 rb2995c3  
    5353./uspace/app/klog/klog
    5454./uspace/app/lsusb/lsusb
    55 ./uspace/app/mkbd/mkbd
    5655./uspace/app/mkfat/mkfat
    5756./uspace/app/netstart/netstart
  • uspace/drv/ohci/batch.c

    rf58154c5 rb2995c3  
    4444#include "hw_struct/transfer_descriptor.h"
    4545
    46 /** OHCI specific data required for USB transfer */
    4746typedef struct ohci_transfer_batch {
    48         /** Endpoint descriptor of the target endpoint. */
    4947        ed_t *ed;
    50         /** List of TDs needed for the transfer */
    5148        td_t **tds;
    52         /** Number of TDs used by the transfer */
    5349        size_t td_count;
    54         /** Dummy TD to be left at the ED and used by the next transfer */
    5550        size_t leave_td;
    56         /** Data buffer, must be accessible byb the OHCI hw. */
    57         void *device_buffer;
     51        char *device_buffer;
    5852} ohci_transfer_batch_t;
    59 /*----------------------------------------------------------------------------*/
    60 static void batch_control(usb_transfer_batch_t *instance,
    61     usb_direction_t data_dir, usb_direction_t status_dir);
    62 static void batch_data(usb_transfer_batch_t *instance);
    63 /*----------------------------------------------------------------------------*/
    64 /** Safely destructs ohci_transfer_batch_t structure
    65  *
    66  * @param[in] ohci_batch Instance to destroy.
    67  */
     53
    6854static void ohci_transfer_batch_dispose(void *ohci_batch)
    6955{
     
    8369}
    8470/*----------------------------------------------------------------------------*/
    85 /** Allocate memory initialize internal structures
    86  *
    87  * @param[in] fun DDF function to pass to callback.
    88  * @param[in] ep Communication target
    89  * @param[in] buffer Data source/destination.
    90  * @param[in] buffer_size Size of the buffer.
    91  * @param[in] setup_buffer Setup data source (if not NULL)
    92  * @param[in] setup_size Size of setup_buffer (should be always 8)
    93  * @param[in] func_in function to call on inbound transfer completion
    94  * @param[in] func_out function to call on outbound transfer completion
    95  * @param[in] arg additional parameter to func_in or func_out
    96  * @return Valid pointer if all structures were successfully created,
    97  * NULL otherwise.
    98  *
    99  * Allocates and initializes structures needed by the OHCI hw for the transfer.
    100  */
     71static void batch_control(usb_transfer_batch_t *instance,
     72    usb_direction_t data_dir, usb_direction_t status_dir);
     73static void batch_data(usb_transfer_batch_t *instance);
     74/*----------------------------------------------------------------------------*/
    10175usb_transfer_batch_t * batch_get(ddf_fun_t *fun, endpoint_t *ep,
    10276    char *buffer, size_t buffer_size, char* setup_buffer, size_t setup_size,
     
    133107        }
    134108
    135         /* We need an extra place for TD that is currently assigned to hcd_ep*/
     109        /* we need one extra place for td that is currently assigned to hcd_ep*/
    136110        data->tds = calloc(sizeof(td_t*), data->td_count + 1);
    137111        CHECK_NULL_DISPOSE_RETURN(data->tds,
    138112            "Failed to allocate transfer descriptors.\n");
    139113
    140         /* Add TD left over by the previous transfer */
    141114        data->tds[0] = hcd_ep->td;
    142115        data->leave_td = 0;
     
    150123        data->ed = hcd_ep->ed;
    151124
    152         /* NOTE: OHCI is capable of handling buffer that crosses page boundaries
    153          * it is, however, not capable of handling buffer that occupies more
    154          * than two pages (the first page is computed using start pointer, the
    155          * other using the end pointer) */
    156125        if (setup_size + buffer_size > 0) {
    157126                data->device_buffer = malloc32(setup_size + buffer_size);
     
    166135}
    167136/*----------------------------------------------------------------------------*/
    168 /** Check batch TDs' status.
    169  *
    170  * @param[in] instance Batch structure to use.
    171  * @return False, if there is an active TD, true otherwise.
    172  *
    173  * Walk all TDs (usually there is just one). Stop with false if there is an
    174  * active TD. Stop with true if an error is found. Return true if the walk
    175  * completes with the last TD.
    176  */
    177137bool batch_is_complete(usb_transfer_batch_t *instance)
    178138{
     
    180140        ohci_transfer_batch_t *data = instance->private_data;
    181141        assert(data);
     142        size_t tds = data->td_count;
    182143        usb_log_debug("Batch(%p) checking %zu td(s) for completion.\n",
    183             instance, data->td_count);
     144            instance, tds);
    184145        usb_log_debug("ED: %x:%x:%x:%x.\n",
    185146            data->ed->status, data->ed->td_head, data->ed->td_tail,
     
    187148        size_t i = 0;
    188149        instance->transfered_size = instance->buffer_size;
    189         for (; i < data->td_count; ++i) {
     150        for (; i < tds; ++i) {
    190151                assert(data->tds[i] != NULL);
    191152                usb_log_debug("TD %zu: %x:%x:%x:%x.\n", i,
     
    212173        assert(hcd_ep);
    213174        hcd_ep->td = data->tds[i];
    214         assert(i > 0);
    215         for (--i;i < data->td_count; ++i)
    216                 instance->transfered_size -= td_remain_size(data->tds[i]);
     175        if (i > 0)
     176                instance->transfered_size -= td_remain_size(data->tds[i - 1]);
    217177
    218178        /* Clear possible ED HALT */
    219179        data->ed->td_head &= ~ED_TDHEAD_HALTED_FLAG;
    220         const uint32_t pa = addr_to_phys(hcd_ep->td);
     180        uint32_t pa = addr_to_phys(hcd_ep->td);
    221181        assert(pa == (data->ed->td_head & ED_TDHEAD_PTR_MASK));
    222182        assert(pa == (data->ed->td_tail & ED_TDTAIL_PTR_MASK));
     
    225185}
    226186/*----------------------------------------------------------------------------*/
    227 /** Starts execution of the TD list
    228  *
    229  * @param[in] instance Batch structure to use
    230  */
    231187void batch_commit(usb_transfer_batch_t *instance)
    232188{
     
    237193}
    238194/*----------------------------------------------------------------------------*/
    239 /** Prepares control write transfer.
    240  *
    241  * @param[in] instance Batch structure to use.
    242  *
    243  * Uses generic control transfer using direction OUT(data stage) and
    244  * IN(status stage).
    245  */
    246195void batch_control_write(usb_transfer_batch_t *instance)
    247196{
     
    254203}
    255204/*----------------------------------------------------------------------------*/
    256 /** Prepares control read transfer.
    257  *
    258  * @param[in] instance Batch structure to use.
    259  *
    260  * Uses generic control transfer using direction IN(data stage) and
    261  * OUT(status stage).
    262  */
    263205void batch_control_read(usb_transfer_batch_t *instance)
    264206{
     
    269211}
    270212/*----------------------------------------------------------------------------*/
    271 /** Prepare interrupt in transfer.
    272  *
    273  * @param[in] instance Batch structure to use.
    274  *
    275  * Data transfer.
    276  */
    277213void batch_interrupt_in(usb_transfer_batch_t *instance)
    278214{
     
    283219}
    284220/*----------------------------------------------------------------------------*/
    285 /** Prepare interrupt out transfer.
    286  *
    287  * @param[in] instance Batch structure to use.
    288  *
    289  * Data transfer.
    290  */
    291221void batch_interrupt_out(usb_transfer_batch_t *instance)
    292222{
     
    299229}
    300230/*----------------------------------------------------------------------------*/
    301 /** Prepare bulk in transfer.
    302  *
    303  * @param[in] instance Batch structure to use.
    304  *
    305  * Data transfer.
    306  */
    307231void batch_bulk_in(usb_transfer_batch_t *instance)
    308232{
     
    313237}
    314238/*----------------------------------------------------------------------------*/
    315 /** Prepare bulk out transfer.
    316  *
    317  * @param[in] instance Batch structure to use.
    318  *
    319  * Data transfer.
    320  */
    321239void batch_bulk_out(usb_transfer_batch_t *instance)
    322240{
     
    329247}
    330248/*----------------------------------------------------------------------------*/
    331 /** Prepare generic control transfer
    332  *
    333  * @param[in] instance Batch structure to use.
    334  * @param[in] data_dir Direction to use for data stage.
    335  * @param[in] status_dir Direction to use for status stage.
    336  *
    337  * Setup stage with toggle 0 and direction BOTH(SETUP_PID)
    338  * Data stage with alternating toggle and direction supplied by parameter.
    339  * Status stage with toggle 1 and direction supplied by parameter.
    340  */
     249ed_t * batch_ed(usb_transfer_batch_t *instance)
     250{
     251        assert(instance);
     252        ohci_transfer_batch_t *data = instance->private_data;
     253        assert(data);
     254        return data->ed;
     255}
     256/*----------------------------------------------------------------------------*/
    341257void batch_control(usb_transfer_batch_t *instance,
    342258    usb_direction_t data_dir, usb_direction_t status_dir)
     
    387303}
    388304/*----------------------------------------------------------------------------*/
    389 /** Prepare generic data transfer
    390  *
    391  * @param[in] instance Batch structure to use.
    392  *
    393  * Direction is supplied by the associated ep and toggle is maintained by the
    394  * OHCI hw in ED.
    395  */
    396305void batch_data(usb_transfer_batch_t *instance)
    397306{
  • uspace/drv/ohci/batch.h

    rf58154c5 rb2995c3  
    4141#include <usb/host/batch.h>
    4242
     43#include "hw_struct/endpoint_descriptor.h"
     44
    4345usb_transfer_batch_t * batch_get(
    4446    ddf_fun_t *fun, endpoint_t *ep, char *buffer, size_t size,
     
    6365
    6466void batch_bulk_out(usb_transfer_batch_t *instance);
     67
     68ed_t * batch_ed(usb_transfer_batch_t *instance);
    6569#endif
    6670/**
  • uspace/drv/ohci/endpoint_list.c

    rf58154c5 rb2995c3  
    3434#include <errno.h>
    3535#include <usb/debug.h>
    36 #include <arch/barrier.h>
    3736
    3837#include "endpoint_list.h"
     
    4443 * @return Error code
    4544 *
    46  * Allocates memory for internal ed_t structure.
     45 * Allocates memory for internal qh_t structure.
    4746 */
    4847int endpoint_list_init(endpoint_list_t *instance, const char *name)
     
    6968 * @param[in] instance List to lead.
    7069 * @param[in] next List to append.
    71  *
    72  * Does not check whether this replaces an existing list.
     70 * @return Error code
     71 *
     72 * Does not check whether this replaces an existing list .
    7373 */
    7474void endpoint_list_set_next(endpoint_list_t *instance, endpoint_list_t *next)
     
    7979}
    8080/*----------------------------------------------------------------------------*/
    81 /** Add endpoint to the list and queue.
    82  *
    83  * @param[in] instance List to use.
    84  * @param[in] endpoint Endpoint to add.
     81/** Submit transfer endpoint to the list and queue.
     82 *
     83 * @param[in] instance List to use.
     84 * @param[in] endpoint Transfer endpoint to submit.
     85 * @return Error code
    8586 *
    8687 * The endpoint is added to the end of the list and queue.
     
    9899        /* Add to the hardware queue. */
    99100        if (list_empty(&instance->endpoint_list)) {
    100                 /* There are no active EDs */
     101                /* There is nothing scheduled */
    101102                last_ed = instance->list_head;
    102103        } else {
    103                 /* There are active EDs, get the last one */
     104                /* There is something scheduled */
    104105                hcd_endpoint_t *last = list_get_instance(
    105106                    instance->endpoint_list.prev, hcd_endpoint_t, link);
    106                 assert(last);
    107107                last_ed = last->ed;
    108108        }
    109         /* Keep link */
     109        /* keep link */
    110110        hcd_ep->ed->next = last_ed->next;
    111         /* Make sure ED is written to the memory */
    112         write_barrier();
    113 
    114         /* Add ed to the hw queue */
    115111        ed_append_ed(last_ed, hcd_ep->ed);
    116         /* Make sure ED is updated */
    117         write_barrier();
    118 
    119         /* Add to the sw list */
     112
     113        asm volatile ("": : :"memory");
     114
     115        /* Add to the driver list */
    120116        list_append(&hcd_ep->link, &instance->endpoint_list);
    121117
     
    133129}
    134130/*----------------------------------------------------------------------------*/
    135 /** Remove endpoint from the list and queue.
    136  *
    137  * @param[in] instance List to use.
    138  * @param[in] endpoint Endpoint to remove.
     131#if 0
     132/** Create list for finished endpoints.
     133 *
     134 * @param[in] instance List to use.
     135 * @param[in] done list to fill
     136 */
     137void endpoint_list_remove_finished(endpoint_list_t *instance, link_t *done)
     138{
     139        assert(instance);
     140        assert(done);
     141
     142        fibril_mutex_lock(&instance->guard);
     143        usb_log_debug2("Checking list %s for completed endpointes(%d).\n",
     144            instance->name, list_count(&instance->endpoint_list));
     145        link_t *current = instance->endpoint_list.next;
     146        while (current != &instance->endpoint_list) {
     147                link_t *next = current->next;
     148                hcd_endpoint_t *endpoint =
     149                    list_get_instance(current, hcd_endpoint_t, link);
     150
     151                if (endpoint_is_complete(endpoint)) {
     152                        /* Save for post-processing */
     153                        endpoint_list_remove_endpoint(instance, endpoint);
     154                        list_append(current, done);
     155                }
     156                current = next;
     157        }
     158        fibril_mutex_unlock(&instance->guard);
     159}
     160/*----------------------------------------------------------------------------*/
     161/** Walk the list and abort all endpointes.
     162 *
     163 * @param[in] instance List to use.
     164 */
     165void endpoint_list_abort_all(endpoint_list_t *instance)
     166{
     167        fibril_mutex_lock(&instance->guard);
     168        while (!list_empty(&instance->endpoint_list)) {
     169                link_t *current = instance->endpoint_list.next;
     170                hcd_endpoint_t *endpoint =
     171                    list_get_instance(current, hcd_endpoint_t, link);
     172                endpoint_list_remove_endpoint(instance, endpoint);
     173                hcd_endpoint_finish_error(endpoint, EIO);
     174        }
     175        fibril_mutex_unlock(&instance->guard);
     176}
     177#endif
     178/*----------------------------------------------------------------------------*/
     179/** Remove a transfer endpoint from the list and queue.
     180 *
     181 * @param[in] instance List to use.
     182 * @param[in] endpoint Transfer endpoint to remove.
     183 * @return Error code
     184 *
     185 * Does not lock the transfer list, caller is responsible for that.
    139186 */
    140187void endpoint_list_remove_ep(endpoint_list_t *instance, hcd_endpoint_t *hcd_ep)
     
    165212        assert((prev_ed->next & ED_NEXT_PTR_MASK) == addr_to_phys(hcd_ep->ed));
    166213        prev_ed->next = hcd_ep->ed->next;
    167         /* Make sure ED is updated */
    168         write_barrier();
    169 
     214
     215        asm volatile ("": : :"memory");
    170216        usb_log_debug("HCD EP(%p) removed (%s) from %s, next %x.\n",
    171217            hcd_ep, qpos, instance->name, hcd_ep->ed->next);
  • uspace/drv/ohci/endpoint_list.h

    rf58154c5 rb2995c3  
    4141#include "utils/malloc32.h"
    4242
    43 /** Structure maintains both OHCI queue and software list of active endpoints.*/
    44 typedef struct endpoint_list
    45 {
    46         /** Guard against add/remove races */
     43typedef struct endpoint_list {
    4744        fibril_mutex_t guard;
    48         /** OHCI hw structure at the beginning of the queue */
    4945        ed_t *list_head;
    50         /** Physical address of the first(dummy) ED */
    5146        uint32_t list_head_pa;
    52         /** Assigned name, provides nicer debug output */
    5347        const char *name;
    54         /** Sw list of all active EDs */
    5548        link_t endpoint_list;
    5649} endpoint_list_t;
     
    6053 * @param[in] instance Memory place to use.
    6154 *
    62  * Frees memory of the internal ed_t structure.
     55 * Frees memory for internal qh_t structure.
    6356 */
    6457static inline void endpoint_list_fini(endpoint_list_t *instance)
     
    7568
    7669void endpoint_list_remove_ep(endpoint_list_t *instance, hcd_endpoint_t *hcd_ep);
     70#if 0
     71void endpoint_list_remove_finished(endpoint_list_t *instance, link_t *done);
     72
     73void endpoint_list_abort_all(endpoint_list_t *instance);
     74#endif
    7775#endif
    7876/**
  • uspace/drv/ohci/hc.c

    rf58154c5 rb2995c3  
    293293                rh_interrupt(&instance->rh);
    294294
     295
    295296        if (status & I_WDH) {
    296297                fibril_mutex_lock(&instance->guard);
     
    315316                fibril_mutex_unlock(&instance->guard);
    316317        }
    317 
    318         if (status & I_UE) {
    319                 hc_start_hw(instance);
    320         }
    321 
    322318}
    323319/*----------------------------------------------------------------------------*/
     
    454450{
    455451        assert(instance);
     452
    456453#define SETUP_ENDPOINT_LIST(type) \
    457454do { \
     
    461458                usb_log_error("Failed(%d) to setup %s endpoint list.\n", \
    462459                    ret, name); \
    463                 endpoint_list_fini(&instance->lists[USB_TRANSFER_ISOCHRONOUS]);\
     460                endpoint_list_fini(&instance->lists[USB_TRANSFER_ISOCHRONOUS]); \
    464461                endpoint_list_fini(&instance->lists[USB_TRANSFER_INTERRUPT]); \
    465462                endpoint_list_fini(&instance->lists[USB_TRANSFER_CONTROL]); \
  • uspace/drv/ohci/hcd_endpoint.h

    rf58154c5 rb2995c3  
    3737#include <assert.h>
    3838#include <adt/list.h>
     39
    3940#include <usb/host/endpoint.h>
    4041
     
    4243#include "hw_struct/transfer_descriptor.h"
    4344
    44 typedef struct hcd_endpoint
    45 {
     45typedef struct hcd_endpoint {
    4646        ed_t *ed;
    4747        td_t *td;
  • uspace/drv/ohci/hw_struct/transfer_descriptor.c

    rf58154c5 rb2995c3  
    4444        assert(instance);
    4545        bzero(instance, sizeof(td_t));
    46         instance->status = 0
     46        instance-> status = 0
    4747            | ((dp[dir] & TD_STATUS_DP_MASK) << TD_STATUS_DP_SHIFT)
    4848            | ((CC_NOACCESS2 & TD_STATUS_CC_MASK) << TD_STATUS_CC_SHIFT);
  • uspace/drv/ohci/hw_struct/transfer_descriptor.h

    rf58154c5 rb2995c3  
    4141#include "completion_codes.h"
    4242
    43 /* OHCI TDs can handle up to 8KB buffers, however, it can use max 2 pages.
    44  * Using 4KB buffers guarantees the page count condition.
    45  * (OHCI assumes 4KB pages) */
    46 #define OHCI_TD_MAX_TRANSFER (4 * 1024)
     43/* OHCI TDs can handle up to 8KB buffers */
     44#define OHCI_TD_MAX_TRANSFER (8 * 1024)
    4745
    4846typedef struct td {
  • uspace/drv/uhci-hcd/batch.c

    rf58154c5 rb2995c3  
    4545#define DEFAULT_ERROR_COUNT 3
    4646
    47 /** UHCI specific data required for USB transfer */
    4847typedef struct uhci_transfer_batch {
    49         /** Queue head
    50          * This QH is used to maintain UHCI schedule structure and the element
    51          * pointer points to the first TD of this batch.
    52          */
    5348        qh_t *qh;
    54         /** List of TDs needed for the transfer */
    5549        td_t *tds;
    56         /** Number of TDs used by the transfer */
     50        void *device_buffer;
    5751        size_t td_count;
    58         /** Data buffer, must be accessible by the UHCI hw */
    59         void *device_buffer;
    6052} uhci_transfer_batch_t;
    6153/*----------------------------------------------------------------------------*/
     54static void uhci_transfer_batch_dispose(void *uhci_batch)
     55{
     56        uhci_transfer_batch_t *instance = uhci_batch;
     57        assert(instance);
     58        free32(instance->device_buffer);
     59        free(instance);
     60}
     61/*----------------------------------------------------------------------------*/
     62
    6263static void batch_control(usb_transfer_batch_t *instance,
    6364    usb_packet_id data_stage, usb_packet_id status_stage);
    6465static void batch_data(usb_transfer_batch_t *instance, usb_packet_id pid);
    65 /*----------------------------------------------------------------------------*/
    66 /** Safely destructs uhci_transfer_batch_t structure
    67  *
    68  * @param[in] uhci_batch Instance to destroy.
    69  */
    70 static void uhci_transfer_batch_dispose(void *uhci_batch)
    71 {
    72         uhci_transfer_batch_t *instance = uhci_batch;
    73         assert(instance);
    74         free32(instance->device_buffer);
    75         free(instance);
    76 }
    77 /*----------------------------------------------------------------------------*/
     66
    7867/** Allocate memory and initialize internal data structure.
    7968 *
     
    184173                instance->error = td_status(&data->tds[i]);
    185174                if (instance->error != EOK) {
    186                         usb_log_debug("Batch(%p) found error TD(%zu):%"
    187                             PRIx32 ".\n", instance, i, data->tds[i].status);
     175                        usb_log_debug("Batch(%p) found error TD(%zu):%" PRIx32 ".\n",
     176                            instance, i, data->tds[i].status);
    188177                        td_print_status(&data->tds[i]);
    189178
     
    408397/*----------------------------------------------------------------------------*/
    409398/** Provides access to QH data structure.
    410  *
    411399 * @param[in] instance Batch pointer to use.
    412400 * @return Pointer to the QH used by the batch.
  • uspace/drv/uhci-hcd/transfer_list.c

    rf58154c5 rb2995c3  
    3434#include <errno.h>
    3535#include <usb/debug.h>
    36 #include <arch/barrier.h>
    3736
    3837#include "transfer_list.h"
     
    7271 * @param[in] instance Memory place to use.
    7372 *
    74  * Frees memory of the internal qh_t structure.
     73 * Frees memory for internal qh_t structure.
    7574 */
    7675void transfer_list_fini(transfer_list_t *instance)
     
    127126        assert((pa & LINK_POINTER_ADDRESS_MASK) == pa);
    128127
    129         /* Make sure all data in the batch are written */
    130         write_barrier();
    131 
    132128        /* keep link */
    133129        batch_qh(batch)->next = last_qh->next;
    134130        qh_set_next_qh(last_qh, batch_qh(batch));
    135131
    136         /* Make sure the pointer is updated */
    137         write_barrier();
     132        asm volatile ("": : :"memory");
    138133
    139134        /* Add to the driver list */
     
    227222            == addr_to_phys(batch_qh(batch)));
    228223        prev_qh->next = batch_qh(batch)->next;
    229 
    230         /* Make sure the pointer is updated */
    231         write_barrier();
    232 
     224        asm volatile ("": : :"memory");
    233225        /* Remove from the batch list */
    234226        list_remove(&batch->link);
  • uspace/drv/uhci-hcd/utils/malloc32.h

    rf58154c5 rb2995c3  
    7474        if (size <= SLAB_ELEMENT_SIZE)
    7575                return slab_malloc_g();
    76         usb_log_warning("Requested %zu bytes, current allocator can't handle "
    77             "that amount, pray that the standard malloc will suffice.", size);
     76        assert(false);
    7877        return memalign(UHCI_STRCUTURES_ALIGNMENT, size);
    7978}
  • uspace/drv/uhci-rhd/port.c

    rf58154c5 rb2995c3  
    227227                while (uhci_port_read_status(port) & STATUS_IN_RESET);
    228228        }
    229         /* PIO delay, should not be longer than 3ms as the device might
    230          * enter suspend state. */
    231229        udelay(10);
    232230        /* Enable the port. */
    233231        uhci_port_set_enabled(port, true);
     232
     233        /* Reset recovery period,
     234         * devices do not have to respond during this period
     235         */
     236        async_usleep(10000);
    234237        return EOK;
    235238}
  • uspace/lib/usbdev/src/hub.c

    rf58154c5 rb2995c3  
    4141#include <assert.h>
    4242#include <usb/debug.h>
    43 #include <time.h>
    4443
    4544/** How much time to wait between attempts to register endpoint 0:0.
     
    219218
    220219        int rc;
    221         struct timeval start_time;
    222 
    223         rc = gettimeofday(&start_time, NULL);
    224         if (rc != EOK) {
    225                 return rc;
    226         }
    227220
    228221        rc = usb_hc_connection_open(&hc_conn);
     
    271264                }
    272265        } while (rc != EOK);
    273         struct timeval end_time;
    274 
    275         rc = gettimeofday(&end_time, NULL);
    276         if (rc != EOK) {
    277                 goto leave_release_default_address;
    278         }
    279 
    280         /* According to the USB spec part 9.1.2 host allows 100ms time for
    281          * the insertion process to complete. According to 7.1.7.1 this is the
    282          * time between attach detected and port reset. However, the setup done
    283          * above might use much of this time so we should only wait to fill
    284          * up the 100ms quota*/
    285         suseconds_t elapsed = tv_sub(&end_time, &start_time);
    286         if (elapsed < 100000) {
    287                 async_usleep(100000 - elapsed);
    288         }
    289266
    290267        /*
     
    296273                goto leave_release_default_address;
    297274        }
    298         /* USB spec 7.1.7.1: The USB System Software guarantees a minimum of
    299          * 10ms for reset recovery. Device response to any bus transactions
    300          * addressed to the default device address during the reset recovery
    301          * time is undefined.
    302          */
    303         async_usleep(10000);
    304275
    305276        rc = usb_pipe_probe_default_control(&ctrl_pipe);
Note: See TracChangeset for help on using the changeset viewer.