Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset c95c00e in mainline


Ignore:
Timestamp:
2013-01-06T02:46:00Z (9 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master
Children:
3848fec
Parents:
ea30cc1
Message:

uhci: Add root hub emulation.

This device uses libusbvirt and si controlled by standard usbhub driver.

Location:
uspace/drv/bus/usb/uhci
Files:
2 added
4 edited

Legend:

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

    rea30cc1 rc95c00e  
    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
     
    4952        uhci.c \
    5053        uhci_batch.c \
     54        uhci_rh.c \
    5155        hw_struct/transfer_descriptor.c
    5256
  • uspace/drv/bus/usb/uhci/hc.c

    rea30cc1 rc95c00e  
    130130        memcpy(cmds, uhci_irq_commands, sizeof(uhci_irq_commands));
    131131        uhci_regs_t *registers = (uhci_regs_t *) regs;
    132         cmds[0].addr = &registers->usbsts;
    133         cmds[3].addr = &registers->usbsts;
     132        cmds[0].addr = (void*)&registers->usbsts;
     133        cmds[3].addr = (void*)&registers->usbsts;
    134134
    135135        return EOK;
     
    242242        }
    243243        (void)hc_debug_checker;
     244
     245        uhci_rh_init(&instance->rh, &instance->registers->ports[0]);
    244246
    245247        return EOK;
     
    406408        assert(instance);
    407409        assert(batch);
     410
     411//      if (batch->ep->address == uhci_rh_get_address(&instance->rh))
     412//              return uhci_rh_schedule(&instance->rh, batch);
     413
    408414        uhci_transfer_batch_t *uhci_batch = uhci_transfer_batch_get(batch);
    409415        if (!uhci_batch) {
  • uspace/drv/bus/usb/uhci/hc.h

    rea30cc1 rc95c00e  
    3737
    3838#include <fibril.h>
     39#include <macros.h>
    3940#include <usb/host/hcd.h>
     41#include "uhci_rh.h"
    4042
    4143#include "transfer_list.h"
     
    4446typedef struct uhci_regs {
    4547        /** Command register, controls HC behaviour */
    46         uint16_t usbcmd;
     48        ioport16_t usbcmd;
    4749#define UHCI_CMD_MAX_PACKET (1 << 7)
    4850#define UHCI_CMD_CONFIGURE  (1 << 6)
     
    5557
    5658        /** Status register, 1 means interrupt is asserted (if enabled) */
    57         uint16_t usbsts;
     59        ioport16_t usbsts;
    5860#define UHCI_STATUS_HALTED (1 << 5)
    5961#define UHCI_STATUS_PROCESS_ERROR (1 << 4)
     
    6668
    6769        /** Interrupt enabled registers */
    68         uint16_t usbintr;
     70        ioport16_t usbintr;
    6971#define UHCI_INTR_SHORT_PACKET (1 << 3)
    7072#define UHCI_INTR_COMPLETE (1 << 2)
     
    7375
    7476        /** Register stores frame number used in SOF packet */
    75         uint16_t frnum;
     77        ioport16_t frnum;
    7678
    7779        /** Pointer(physical) to the Frame List */
    78         uint32_t flbaseadd;
     80        ioport32_t flbaseadd;
    7981
    8082        /** SOF modification to match external timers */
    81         uint8_t sofmod;
     83        ioport8_t sofmod;
     84
     85        PADD8[3];
     86        ioport16_t ports[];
    8287} uhci_regs_t;
    8388
     
    9095/** Main UHCI driver structure */
    9196typedef struct hc {
     97        uhci_rh_t rh;
    9298        /** Addresses of I/O registers */
    9399        uhci_regs_t *registers;
  • uspace/drv/bus/usb/uhci/uhci.c

    rea30cc1 rc95c00e  
    161161        ret = rh_init(device, (uintptr_t)hc->registers + 0x10, 4,
    162162            ddf_fun_get_handle(hc_fun));
     163//      ret = hcd_ddf_setup_root_hub(device, USB_SPEED_FULL);
    163164        CHECK_RET_FINI_RETURN(ret,
    164165            "Failed to setup UHCI root hub: %s.\n", str_error(ret));
Note: See TracChangeset for help on using the changeset viewer.