Changeset cd3fa47 in mainline for uspace/drv/bus/usb/uhci/uhci_rh.c


Ignore:
Timestamp:
2018-01-21T18:35:09Z (6 years ago)
Author:
Ondřej Hlavatý <aearsis@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
3f02935
Parents:
32b2a6f2
Message:

usb: definition of status bits have changed between USB 2 and 3, remove the confusion

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/uhci/uhci_rh.c

    r32b2a6f2 rcd3fa47  
    210210#define BIT_VAL(val, bit) \
    211211        ((val & bit) ? 1 : 0)
    212 #define UHCI2USB(val, bit, feat) \
    213         (BIT_VAL(val, bit) << feat)
     212#define UHCI2USB(val, bit, mask) \
     213        (BIT_VAL(val, bit) ? (mask) : 0)
    214214
    215215/** Port status request handler.
     
    236236        const uint16_t val = pio_read_16(hub->ports[port]);
    237237        const uint32_t status = uint32_host2usb(
    238             UHCI2USB(val, STATUS_CONNECTED, USB_HUB_FEATURE_PORT_CONNECTION) |
    239             UHCI2USB(val, STATUS_ENABLED, USB_HUB_FEATURE_PORT_ENABLE) |
    240             UHCI2USB(val, STATUS_SUSPEND, USB_HUB_FEATURE_PORT_SUSPEND) |
    241             UHCI2USB(val, STATUS_IN_RESET, USB_HUB_FEATURE_PORT_RESET) |
    242             UHCI2USB(val, STATUS_ALWAYS_ONE, USB_HUB_FEATURE_PORT_POWER) |
    243             UHCI2USB(val, STATUS_LOW_SPEED, USB_HUB_FEATURE_PORT_LOW_SPEED) |
    244             UHCI2USB(val, STATUS_CONNECTED_CHANGED, USB_HUB_FEATURE_C_PORT_CONNECTION) |
    245             UHCI2USB(val, STATUS_ENABLED_CHANGED, USB_HUB_FEATURE_C_PORT_ENABLE) |
    246 //          UHCI2USB(val, STATUS_SUSPEND, USB_HUB_FEATURE_C_PORT_SUSPEND) |
    247             ((hub->reset_changed[port] ? 1 : 0) << USB_HUB_FEATURE_C_PORT_RESET)
     238            UHCI2USB(val, STATUS_CONNECTED, USB_HUB_PORT_STATUS_CONNECTION) |
     239            UHCI2USB(val, STATUS_ENABLED, USB_HUB_PORT_STATUS_ENABLE) |
     240            UHCI2USB(val, STATUS_SUSPEND, USB2_HUB_PORT_STATUS_SUSPEND) |
     241            UHCI2USB(val, STATUS_IN_RESET, USB_HUB_PORT_STATUS_RESET) |
     242            UHCI2USB(val, STATUS_ALWAYS_ONE, USB2_HUB_PORT_STATUS_POWER) |
     243            UHCI2USB(val, STATUS_LOW_SPEED, USB2_HUB_PORT_STATUS_LOW_SPEED) |
     244            UHCI2USB(val, STATUS_CONNECTED_CHANGED, USB_HUB_PORT_STATUS_C_CONNECTION) |
     245            UHCI2USB(val, STATUS_ENABLED_CHANGED, USB2_HUB_PORT_STATUS_C_ENABLE) |
     246//          UHCI2USB(val, STATUS_SUSPEND, USB2_HUB_PORT_STATUS_C_SUSPEND) |
     247            (hub->reset_changed[port] ?  USB_HUB_PORT_STATUS_C_RESET : 0)
    248248        );
    249249        RH_DEBUG(hub, port, "Port status %" PRIx32 " (source %" PRIx16
     
    274274        const uint16_t val = status & (~STATUS_WC_BITS);
    275275        switch (feature) {
    276         case USB_HUB_FEATURE_PORT_ENABLE:
     276        case USB2_HUB_FEATURE_PORT_ENABLE:
    277277                RH_DEBUG(hub, port, "Clear port enable (status %"
    278278                    PRIx16 ")", status);
    279279                pio_write_16(hub->ports[port], val & ~STATUS_ENABLED);
    280280                break;
    281         case USB_HUB_FEATURE_PORT_SUSPEND:
     281        case USB2_HUB_FEATURE_PORT_SUSPEND:
    282282                RH_DEBUG(hub, port, "Clear port suspend (status %"
    283283                    PRIx16 ")", status);
     
    302302                hub->reset_changed[port] = false;
    303303                break;
    304         case USB_HUB_FEATURE_C_PORT_ENABLE:
     304        case USB2_HUB_FEATURE_C_PORT_ENABLE:
    305305                RH_DEBUG(hub, port, "Clear port enable change (status %"
    306306                    PRIx16 ")", status);
    307307                pio_write_16(hub->ports[port], status | STATUS_ENABLED_CHANGED);
    308308                break;
    309         case USB_HUB_FEATURE_C_PORT_SUSPEND:
     309        case USB2_HUB_FEATURE_C_PORT_SUSPEND:
    310310                RH_DEBUG(hub, port, "Clear port suspend change (status %"
    311311                    PRIx16 ")", status);
     
    354354                    ")", pio_read_16(hub->ports[port]));
    355355                break;
    356         case USB_HUB_FEATURE_PORT_SUSPEND:
     356        case USB2_HUB_FEATURE_PORT_SUSPEND:
    357357                RH_DEBUG(hub, port, "Set port suspend (status %" PRIx16
    358358                    ")", status);
     
    368368                break;
    369369        case USB_HUB_FEATURE_C_PORT_CONNECTION:
    370         case USB_HUB_FEATURE_C_PORT_ENABLE:
    371         case USB_HUB_FEATURE_C_PORT_SUSPEND:
     370        case USB2_HUB_FEATURE_C_PORT_ENABLE:
     371        case USB2_HUB_FEATURE_C_PORT_SUSPEND:
    372372        case USB_HUB_FEATURE_C_PORT_OVER_CURRENT:
    373373                RH_DEBUG(hub, port, "Set port change flag (status %" PRIx16
Note: See TracChangeset for help on using the changeset viewer.