Changeset eadaeae8 in mainline for uspace/drv/bus/usb


Ignore:
Timestamp:
2018-03-21T20:58:49Z (8 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
3be9d10
Parents:
874381a
Message:

Make capability handles type-safe

Define distinct pointer types for the handles of the supported
capability types and use them instead of integer handles. This makes it
virtually impossible to pass a non-handle or a handle of different type
instead of the proper handle. Also turn cap_handle_t into an "untyped"
capability handle that can be assigned to and from the "typed" handles.

This commit also fixes a bug in msim-con driver, which wrongly used the
IRQ number instead of the IRQ capability handle to unregister the IRQ.

This commit also fixes the wrong use of the capability handle instead
of error code in libusbhost.

Location:
uspace/drv/bus/usb
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/ohci/hc.c

    r874381a readaeae8  
    512512
    513513        /* Enable interrupts */
    514         if (instance->base.irq_cap >= 0) {
     514        if (CAP_HANDLE_VALID(instance->base.irq_handle)) {
    515515                OHCI_WR(instance->registers->interrupt_enable,
    516516                    OHCI_USED_INTERRUPTS);
  • uspace/drv/bus/usb/uhci/hc.c

    r874381a readaeae8  
    294294        pio_write_32(&registers->flbaseadd, pa);
    295295
    296         if (instance->base.irq_cap >= 0) {
     296        if (CAP_HANDLE_VALID(instance->base.irq_handle)) {
    297297                /* Enable all interrupts, but resume interrupt */
    298298                pio_write_16(&instance->registers->usbintr,
  • uspace/drv/bus/usb/xhci/hc.c

    r874381a readaeae8  
    495495        XHCI_REG_WR(intr0, XHCI_INTR_ERSTBA, erstba_phys);
    496496
    497         if (hc->base.irq_cap > 0) {
     497        if (CAP_HANDLE_VALID(hc->base.irq_handle)) {
    498498                XHCI_REG_SET(intr0, XHCI_INTR_IE, 1);
    499499                XHCI_REG_SET(hc->op_regs, XHCI_OP_INTE, 1);
Note: See TracChangeset for help on using the changeset viewer.