Changeset d32d51d in mainline


Ignore:
Timestamp:
2017-08-20T12:01:35Z (7 years ago)
Author:
Petr Manek <petr.manek@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
07c08ea
Parents:
5ff9e1d
Message:

Updated RH implementation with virtual hub emulation structure.

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

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/xhci/Makefile

    r5ff9e1d rd32d51d  
    3131LIBS = \
    3232        $(LIBUSBHOST_PREFIX)/libusbhost.a \
     33        $(LIBUSBVIRT_PREFIX)/libusbvirt.a \
    3334        $(LIBUSB_PREFIX)/libusb.a \
    3435        $(LIBDRV_PREFIX)/libdrv.a
     
    3637EXTRA_CFLAGS += \
    3738        -I$(LIBUSB_PREFIX)/include \
     39        -I$(LIBUSBDEV_PREFIX)/include \
    3840        -I$(LIBUSBHOST_PREFIX)/include \
     41        -I$(LIBUSBVIRT_PREFIX)/include \
    3942        -I$(LIBDRV_PREFIX)/include
    4043
  • uspace/drv/bus/usb/xhci/endpoint.c

    r5ff9e1d rd32d51d  
    5555
    5656        usb_log_debug("Endpoint %d:%d initialized.", ep->address, ep->endpoint);
     57
    5758        return EOK;
    5859}
  • uspace/drv/bus/usb/xhci/hc.c

    r5ff9e1d rd32d51d  
    220220                goto err_event_ring;
    221221
    222         return EOK;
    223 
     222        if ((err = xhci_rh_init(&hc->rh)))
     223                goto err_rh;
     224
     225        return EOK;
     226
     227err_rh:
     228        xhci_rh_fini(&hc->rh);
    224229err_event_ring:
    225230        xhci_event_ring_fini(&hc->event_ring);
     
    362367        assert(batch);
    363368
     369        /* Check for root hub communication */
     370        /* FIXME: Zero is a very crude workaround. Detect RH better. */
     371        if (batch->ep->address == 0) {
     372                usb_log_debug("XHCI root hub request.\n");
     373                return xhci_rh_schedule(&hc->rh, batch);
     374        }
     375
    364376        usb_log_debug2("EP(%d:%d) started %s transfer of size %lu.",
    365377                batch->ep->address, batch->ep->endpoint,
     
    386398        }
    387399
    388         return ENAK;
     400        return EOK;
    389401}
    390402
     
    515527        hc_dcbaa_fini(hc);
    516528        xhci_fini_commands(hc);
     529        xhci_rh_fini(&hc->rh);
    517530        pio_disable(hc->base, RNGSZ(hc->mmio_range));
    518531        usb_log_info("HC(%p): Finalized.", hc);
  • uspace/drv/bus/usb/xhci/hc.h

    r5ff9e1d rd32d51d  
    4242#include "scratchpad.h"
    4343#include "trb_ring.h"
     44#include "rh.h"
    4445
    4546typedef struct xhci_virt_device_ctx {
     
    7576        xhci_scratchpad_t *scratchpad;
    7677
     78  /* Root hub emulation */
     79        xhci_rh_t rh;
     80
    7781        /* Cached capabilities */
    7882        xhci_port_speed_t speeds [16];
  • uspace/drv/bus/usb/xhci/rh.c

    r5ff9e1d rd32d51d  
    4444#include "rh.h"
    4545
     46int xhci_rh_init(xhci_rh_t *rh)
     47{
     48        /* TODO: Implement me! */
     49        return EOK;
     50}
     51
    4652// TODO: Check device deallocation, we free device_ctx in hc.c, not
    4753//       sure about the other structs.
     
    221227}
    222228
     229int xhci_rh_schedule(xhci_rh_t *rh, usb_transfer_batch_t *batch)
     230{
     231        /* TODO: Implement me! */
     232        return EOK;
     233}
     234
     235int xhci_rh_fini(xhci_rh_t *rh)
     236{
     237        /* TODO: Implement me! */
     238        return EOK;
     239}
     240
    223241
    224242/**
  • uspace/drv/bus/usb/xhci/rh.h

    r5ff9e1d rd32d51d  
    3737#define XHCI_RH_H
    3838
     39#include <usb/host/usb_transfer_batch.h>
     40#include <usbvirt/virthub_base.h>
     41
     42/* XHCI root hub instance */
     43typedef struct {
     44        /** Virtual hub instance */
     45        virthub_base_t base;
     46} xhci_rh_t;
     47
     48int xhci_rh_init(xhci_rh_t *);
     49int xhci_rh_fini(xhci_rh_t *);
    3950int xhci_handle_port_status_change_event(xhci_hc_t *, xhci_trb_t *);
    4051int xhci_get_hub_port(xhci_trb_t *);
    4152int xhci_reset_hub_port(xhci_hc_t *, uint8_t);
     53int xhci_rh_schedule(xhci_rh_t *, usb_transfer_batch_t *);
    4254
    4355#endif
Note: See TracChangeset for help on using the changeset viewer.