Changeset 0cabd10 in mainline


Ignore:
Timestamp:
2017-07-29T21:55:16Z (7 years ago)
Author:
Petr Manek <petr.manek@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
c9bec1c
Parents:
9f5b613
Message:

Added command to set TR dequeue pointer.

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

Legend:

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

    r9f5b613 r0cabd10  
    4747#define TRB_SET_TYPE(trb, type) (trb).control |= host2xhci(32, (type) << 10)
    4848#define TRB_SET_EP(trb, ep)     (trb).control |= host2xhci(32, ((ep) & 0x5) << 16)
     49#define TRB_SET_STREAM(trb, st) (trb).control |= host2xhci(32, ((st) & 0xFFFF) << 16)
    4950#define TRB_SET_SUSP(trb, susp) (trb).control |= host2xhci(32, ((susp) & 0x1) << 23)
    5051#define TRB_SET_SLOT(trb, slot) (trb).control |= host2xhci(32, (slot) << 24)
    5152
     53/**
     54 * TODO: Not sure about SCT and DCS (see section 6.4.3.9).
     55 */
     56#define TRB_SET_DEQUEUE_PTR(trb, dptr) (trb).parameter |= host2xhci(64, (dptr))
    5257#define TRB_SET_ICTX(trb, phys) (trb).parameter |= host2xhci(32, phys_addr & (~0xF))
    5358
     
    421426}
    422427
     428int xhci_send_set_dequeue_ptr_command(xhci_hc_t *hc, xhci_cmd_t *cmd,
     429                                      uintptr_t dequeue_ptr, uint16_t stream_id,
     430                                      uint32_t ep_id)
     431{
     432        assert(hc);
     433        assert(cmd);
     434
     435        xhci_trb_t trb;
     436        memset(&trb, 0, sizeof(trb));
     437
     438        TRB_SET_TYPE(trb, XHCI_TRB_TYPE_SET_TR_DEQUEUE_POINTER_CMD);
     439        TRB_SET_EP(trb, ep_id);
     440        TRB_SET_STREAM(trb, stream_id);
     441        TRB_SET_SLOT(trb, cmd->slot_id);
     442        TRB_SET_DEQUEUE_PTR(trb, dequeue_ptr);
     443
     444        /**
     445         * TODO: Set DCS (see section 4.6.10).
     446         */
     447
     448        cmd = add_cmd(hc, cmd);
     449
     450        return enqueue_trb(hc, &trb, 0, 0);
     451}
     452
    423453int xhci_send_reset_device_command(xhci_hc_t *hc, xhci_cmd_t *cmd)
    424454{
  • uspace/drv/bus/usb/xhci/commands.h

    r9f5b613 r0cabd10  
    7474int xhci_send_reset_endpoint_command(xhci_hc_t *, xhci_cmd_t *, uint32_t, uint8_t);
    7575int xhci_send_stop_endpoint_command(xhci_hc_t *, xhci_cmd_t *, uint32_t, uint8_t);
    76 // TODO: Set dequeue ptr (section 4.6.10).
     76int xhci_send_set_dequeue_ptr_command(xhci_hc_t *, xhci_cmd_t *, uintptr_t, uint16_t, uint32_t);
    7777int xhci_send_reset_device_command(xhci_hc_t *, xhci_cmd_t *);
    7878// TODO: Force event (optional normative, for VMM, section 4.6.12).
Note: See TracChangeset for help on using the changeset viewer.