Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset fe5db713 in mainline


Ignore:
Timestamp:
2017-07-16T17:20:35Z (3 years ago)
Author:
Jaroslav Jindrak <dzejrou@…>
Branches:
master
Children:
c8bb7090
Parents:
c058a388
Message:

Added stream context and input control context extraction macros.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/xhci/hw_struct/context.h

    rc058a388 rfe5db713  
    108108typedef struct xhci_stream_ctx {
    109109        uint64_t data [2];
     110#define XHCI_STREAM_DCS(ctx)       XHCI_QWORD_EXTRACT((ctx).data[0],  0, 0)
     111#define XHCI_STREAM_SCT(ctx)       XHCI_QWORD_EXTRACT((ctx).data[0],  3, 1)
     112#define XHCI_STREAM_DEQ_PTR(ctx)   XHCI_QWORD_EXTRACT((ctx).data[0], 63, 4)
     113#define XHCI_STREAM_EDTLA(ctx)     XHCI_QWORD_EXTRACT((ctx).data[1], 24, 0)
    110114} __attribute__((packed)) xhci_stream_ctx_t;
    111115
    112116/**
    113117 * Input control context: section 6.2.5.1
    114  * TODO: According to section 6.2.5.1 figure 78,
    115  *       the context size register value in
    116  *       hccparams1 dictates whether input
    117  *       control context shall have 32 or 64 bytes.
    118  *       How to do this?
    119  * TODO: Add register macros for XHCI_REG_RD/WR for
    120  *       this data structure.
     118 * Note: According to section 6.2.5.1 figure 78,
     119 *       the context size register value in hccparams1
     120 *       dictates whether input control context shall have
     121 *       32 or 64 bytes, but in any case only dwords 0, 1 and 7
     122 *       are used, the rest are reserved.
    121123 */
    122124typedef struct xhci_input_ctrl_ctx {
    123         uint64_t data [8];
     125        uint32_t data [16];
     126#define XHCI_INPUT_CTRL_CTX_DROP(ctx, idx) \
     127        (assert((idx) > 1 && (idx) < 32), XHCI_DWORD_EXTRACT((ctx).data[0], (idx), (idx)))
     128#define XHCI_INPUT_CTRL_CTX_ADD(ctx, idx) \
     129        (assert((idx) >= 0 && (idx) < 32), XHCI_DWORD_EXTRACT((ctx).data[1], (idx), (idx)))
     130#define XHCI_INPUT_CTRL_CTX_CONFIG_VALUE(ctx)   XHCI_DWORD_EXTRACT((ctx).data[7],  7,  0)
     131#define XHCI_INPUT_CTRL_CTX_IFACE_NUMBER(ctx)   XHCI_DWORD_EXTRACT((ctx).data[7], 15,  8)
     132#define XHCI_INPUT_CTRL_CTX_ALTER_SETTING(ctx)  XHCI_DWORD_EXTRACT((ctx).data[7], 23, 16)
    124133} __attribute__((packed)) xhci_input_ctrl_ctx_t;
    125134
Note: See TracChangeset for help on using the changeset viewer.