Changeset 05aeee0e in mainline


Ignore:
Timestamp:
2017-07-13T19:28:53Z (7 years ago)
Author:
Jaroslav Jindrak <dzejrou@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
7bd99bf
Parents:
4fa5342
Message:

Added reset endpoing and stop endpoint sending functions.

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

Legend:

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

    r4fa5342 r05aeee0e  
    215215}
    216216
     217int xhci_send_reset_endpoint_command(xhci_hc_t *hc, uint32_t slot_id, uint32_t ep_id, uint8_t tcs)
     218{
     219        /**
     220         * Note: TCS can have values 0 or 1. If it is set to 0, see sectuon 4.5.8 for
     221         *       information about this flag.
     222         */
     223        xhci_trb_t trb;
     224        memset(&trb, 0, sizeof(trb));
     225
     226        trb.control = host2xhci(32, XHCI_TRB_TYPE_RESET_ENDPOINT_CMD << 10);
     227        trb.control |= host2xhci(32, hc->command_ring.pcs);
     228        trb.control |= host2xhci(32, (tcs & 0x1) << 9);
     229        trb.control |= host2xhci(32, (ep_id & 0x5) << 16);
     230        trb.control |= host2xhci(32, slot_id << 24);
     231
     232        return enqueue_trb(hc, &trb, 0, 0);
     233}
     234
     235int xhci_send_stop_endpoint_command(xhci_hc_t *hc, uint32_t slot_id, uint32_t ep_id, uint8_t susp)
     236{
     237        xhci_trb_t trb;
     238        memset(&trb, 0, sizeof(trb));
     239
     240        trb.control = host2xhci(32, XHCI_TRB_TYPE_STOP_ENDPOINT_CMD << 10);
     241        trb.control |= host2xhci(32, hc->command_ring.pcs);
     242        trb.control |= host2xhci(32, (ep_id & 0x5) << 16);
     243        trb.control |= host2xhci(32, (susp & 0x1) << 23);
     244        trb.control |= host2xhci(32, slot_id << 24);
     245
     246        return enqueue_trb(hc, &trb, 0, 0);
     247
     248}
     249
    217250int xhci_handle_command_completion(xhci_hc_t *hc, xhci_trb_t *trb)
    218251{
     
    250283        case XHCI_TRB_TYPE_EVALUATE_CONTEXT_CMD:
    251284                return EOK;
     285        case XHCI_TRB_TYPE_RESET_ENDPOINT_CMD:
     286                return EOK;
     287        case XHCI_TRB_TYPE_STOP_ENDPOINT_CMD:
     288                // Note: If the endpoint was in the middle of a transfer, then the xHC
     289                //       will add a Transfer TRB before the Event TRB, research that and
     290                //       handle it appropriately!
     291                return EOK;
    252292        default:
    253293                usb_log_debug2("Unsupported command trb.");
  • uspace/drv/bus/usb/xhci/commands.h

    r4fa5342 r05aeee0e  
    4747int xhci_send_configure_endpoint_command(xhci_hc_t *, uint32_t, xhci_input_ctx_t *);
    4848int xhci_send_evaluate_context_command(xhci_hc_t *, uint32_t, xhci_input_ctx_t *);
     49int xhci_send_reset_endpoint_command(xhci_hc_t *, uint32_t, uint32_t, uint8_t);
     50int xhci_send_stop_endpoint_command(xhci_hc_t *, uint32_t, uint32_t, uint8_t);
    4951
    5052int xhci_handle_command_completion(xhci_hc_t *, xhci_trb_t *);
Note: See TracChangeset for help on using the changeset viewer.