Changeset 36fb6d7 in mainline for uspace/drv/bus/usb/xhci/debug.c


Ignore:
Timestamp:
2018-01-13T17:32:56Z (6 years ago)
Author:
Ondřej Hlavatý <aearsis@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
001778c
Parents:
9b56e528
Message:

xhci: add debug functions to dump contexts

File:
1 edited

Legend:

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

    r9b56e528 r36fb6d7  
    341341}
    342342
     343static void xhci_dump_slot_ctx(const struct xhci_slot_ctx *ctx)
     344{
     345#define SLOT_DUMP(name) usb_log_debug("\t" #name ":\t0x%x", XHCI_SLOT_##name(*ctx))
     346        SLOT_DUMP(ROUTE_STRING);
     347        SLOT_DUMP(SPEED);
     348        SLOT_DUMP(MTT);
     349        SLOT_DUMP(CTX_ENTRIES);
     350        SLOT_DUMP(MAX_EXIT_LATENCY);
     351        SLOT_DUMP(ROOT_HUB_PORT);
     352        SLOT_DUMP(NUM_OF_PORTS);
     353        SLOT_DUMP(TT_HUB_SLOT_ID);
     354        SLOT_DUMP(TT_PORT_NUM);
     355        SLOT_DUMP(TT_THINK_TIME);
     356        SLOT_DUMP(INTERRUPTER);
     357        SLOT_DUMP(DEVICE_ADDRESS);
     358        SLOT_DUMP(SLOT_STATE);
     359#undef SLOT_DUMP
     360}
     361
     362static void xhci_dump_endpoint_ctx(const struct xhci_endpoint_ctx *ctx)
     363{
     364#define EP_DUMP_DW(name)        usb_log_debug("\t" #name ":\t0x%x", XHCI_EP_##name(*ctx))
     365#define EP_DUMP_QW(name)        usb_log_debug("\t" #name ":\t0x%llx", XHCI_EP_##name(*ctx))
     366        EP_DUMP_DW(STATE);
     367        EP_DUMP_DW(MULT);
     368        EP_DUMP_DW(MAX_P_STREAMS);
     369        EP_DUMP_DW(LSA);
     370        EP_DUMP_DW(INTERVAL);
     371        EP_DUMP_DW(ERROR_COUNT);
     372        EP_DUMP_DW(TYPE);
     373        EP_DUMP_DW(HID);
     374        EP_DUMP_DW(MAX_BURST_SIZE);
     375        EP_DUMP_DW(MAX_PACKET_SIZE);
     376        EP_DUMP_QW(DCS);
     377        EP_DUMP_QW(TR_DPTR);
     378        EP_DUMP_DW(MAX_ESIT_PAYLOAD_LO);
     379        EP_DUMP_DW(MAX_ESIT_PAYLOAD_HI);
     380#undef EP_DUMP_DW
     381#undef EP_DUMP_QW
     382}
     383
     384void xhci_dump_input_ctx(const struct xhci_input_ctx *ctx)
     385{
     386        usb_log_debug("Input control context:");
     387        usb_log_debug("\tDrop:\t0x%08x", xhci2host(32, ctx->ctrl_ctx.data[0]));
     388        usb_log_debug("\tAdd:\t0x%08x", xhci2host(32, ctx->ctrl_ctx.data[1]));
     389
     390        usb_log_debug("\tConfig:\t0x%02x", XHCI_INPUT_CTRL_CTX_CONFIG_VALUE(ctx->ctrl_ctx));
     391        usb_log_debug("\tIface:\t0x%02x", XHCI_INPUT_CTRL_CTX_IFACE_NUMBER(ctx->ctrl_ctx));
     392        usb_log_debug("\tAlternate:\t0x%02x", XHCI_INPUT_CTRL_CTX_ALTER_SETTING(ctx->ctrl_ctx));
     393
     394        usb_log_debug("Slot context:");
     395        xhci_dump_slot_ctx(&ctx->slot_ctx);
     396
     397        for (uint8_t dci = 1; dci <= XHCI_EP_COUNT; dci++)
     398                if (XHCI_INPUT_CTRL_CTX_DROP(ctx->ctrl_ctx, dci)
     399                    || XHCI_INPUT_CTRL_CTX_ADD(ctx->ctrl_ctx, dci)) {
     400                        usb_log_debug("Endpoint context DCI %u:", dci);
     401                        xhci_dump_endpoint_ctx(&ctx->endpoint_ctx[dci - 1]);
     402                }
     403}
     404
    343405/**
    344406 * @}
Note: See TracChangeset for help on using the changeset viewer.