Changeset 60af4cdb in mainline for uspace/drv/bus/usb/xhci/commands.c


Ignore:
Timestamp:
2017-10-19T14:01:18Z (7 years ago)
Author:
Michal Staruch <salmelu@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
0f6b50f
Parents:
95c675b
Message:

Added get port bandwidth command

File:
1 edited

Legend:

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

    r95c675b r60af4cdb  
    5050#define TRB_SET_SUSP(trb, susp) (trb).control |= host2xhci(32, ((susp) & 0x1) << 23)
    5151#define TRB_SET_SLOT(trb, slot) (trb).control |= host2xhci(32, (slot) << 24)
     52#define TRB_SET_DEV_SPEED(trb, speed)   (trb).control |= host2xhci(32, (speed & 0xF) << 16)
    5253
    5354/**
     
    418419}
    419420
     421int xhci_get_port_bandwidth_command(xhci_hc_t *hc, xhci_cmd_t *cmd,
     422        xhci_port_bandwidth_ctx_t *ctx, uint8_t device_speed)
     423{
     424        assert(hc);
     425        assert(cmd);
     426
     427        xhci_trb_clean(&cmd->trb);
     428
     429        uint64_t phys_addr = (uint64_t) addr_to_phys(ctx);
     430        TRB_SET_ICTX(cmd->trb, phys_addr);
     431
     432        TRB_SET_TYPE(cmd->trb, XHCI_TRB_TYPE_GET_PORT_BANDWIDTH_CMD);
     433        TRB_SET_SLOT(cmd->trb, cmd->slot_id);
     434        TRB_SET_DEV_SPEED(cmd->trb, device_speed);
     435
     436        return enqueue_command(hc, cmd, 0, 0);
     437}
     438
    420439int xhci_handle_command_completion(xhci_hc_t *hc, xhci_trb_t *trb)
    421440{
Note: See TracChangeset for help on using the changeset viewer.