Changeset 913007f in mainline


Ignore:
Timestamp:
2017-10-19T21:40:57Z (7 years ago)
Author:
Petr Manek <petr.manek@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
fe1c48d
Parents:
2896ff6
Message:

Final change with respect to command timeouts. Because communication channels are inherently noisy.

Location:
uspace/drv/bus/usb/xhci
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/xhci/commands.c

    r2896ff6 r913007f  
    7676}
    7777
    78 int xhci_cmd_wait(xhci_cmd_t *cmd)
    79 {
    80         const suseconds_t timeout = 1000000;
     78int xhci_cmd_wait(xhci_cmd_t *cmd, suseconds_t timeout)
     79{
    8180        int rv = EOK;
    8281
  • uspace/drv/bus/usb/xhci/commands.h

    r2896ff6 r913007f  
    4242#include "hw_struct/trb.h"
    4343
     44/* Useful timeouts for `xhci_cmd_wait()` */
     45#define XHCI_DEFAULT_TIMEOUT             1000000
     46#define XHCI_BLOCK_INDEFINITELY              0
     47
    4448typedef struct xhci_hc xhci_hc_t;
    4549typedef struct xhci_input_ctx xhci_input_ctx_t;
     
    6771xhci_cmd_t *xhci_cmd_alloc(void);
    6872void xhci_cmd_init(xhci_cmd_t *);
    69 int xhci_cmd_wait(xhci_cmd_t *);
     73int xhci_cmd_wait(xhci_cmd_t *, suseconds_t);
    7074void xhci_cmd_fini(xhci_cmd_t *);
    7175void xhci_cmd_free(xhci_cmd_t *);
  • uspace/drv/bus/usb/xhci/endpoint.c

    r2896ff6 r913007f  
    8787 *
    8888 * For control endpoints >0, the IN endpoint index is used.
    89  * 
     89 *
    9090 * The index returned must be usually offset by a number of contexts preceding
    9191 * the endpoint contexts themselves.
     
    257257                cmd.slot_id = dev->slot_id;
    258258                xhci_send_configure_endpoint_command(dev->hc, &cmd, ictx);
    259                 if ((err = xhci_cmd_wait(&cmd)) != EOK)
     259                if ((err = xhci_cmd_wait(&cmd, XHCI_DEFAULT_TIMEOUT)) != EOK)
    260260                        goto err_cmd;
    261261
     
    324324        cmd.slot_id = dev->slot_id;
    325325        xhci_send_configure_endpoint_command(hc, &cmd, ictx);
    326         if ((err = xhci_cmd_wait(&cmd)) != EOK)
     326        if ((err = xhci_cmd_wait(&cmd, XHCI_DEFAULT_TIMEOUT)) != EOK)
    327327                goto err_cmd;
    328328
  • uspace/drv/bus/usb/xhci/rh.c

    r2896ff6 r913007f  
    9191
    9292        xhci_send_enable_slot_command(hc, &cmd);
    93         if ((err = xhci_cmd_wait(&cmd)) != EOK)
     93        if ((err = xhci_cmd_wait(&cmd, XHCI_DEFAULT_TIMEOUT)) != EOK)
    9494                return err;
    9595
     
    155155        cmd.slot_id = slot_id;
    156156        xhci_send_address_device_command(hc, &cmd, ictx);
    157         if ((err = xhci_cmd_wait(&cmd)) != EOK)
     157        if ((err = xhci_cmd_wait(&cmd, XHCI_DEFAULT_TIMEOUT)) != EOK)
    158158                goto err_dctx;
    159159
     
    400400        xhci_get_port_bandwidth_command(dev->hc, &cmd, ctx, speed);
    401401
    402         int err = xhci_cmd_wait(&cmd);
     402        int err = xhci_cmd_wait(&cmd, XHCI_DEFAULT_TIMEOUT);
    403403        if(err != EOK) {
    404404                free(ctx);
Note: See TracChangeset for help on using the changeset viewer.