Changeset 26beeda in mainline
- Timestamp:
- 2018-01-20T19:17:35Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 4397984
- Parents:
- 45e49e6
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/xhci/hw_struct/context.h
r45e49e6 r26beeda 179 179 #define XHCI_CTX_SIZE_SMALL 32 180 180 #define XHCI_ONE_CTX_SIZE(hc) (XHCI_CTX_SIZE_SMALL << hc->csz) 181 #define XHCI_GET_CTX_FIELD(type, ctx, hc, ci) (xhci_##type##_ctx_to_charptr(ctx) + (ci) * XHCI_ONE_CTX_SIZE(hc)) 182 183 /** 184 * Device context: section 6.2.1 185 */ 181 186 #define XHCI_DEVICE_CTX_SIZE(hc) ((1 + XHCI_EP_COUNT) * XHCI_ONE_CTX_SIZE(hc)) 182 183 /** 184 * Device context: section 6.2.1 185 */ 186 #define XHCI_GET_DC_FIELD(dev_ctx, hc, dci) ((char*)dev_ctx + (dci) * XHCI_ONE_CTX_SIZE(hc)) 187 #define XHCI_GET_EP_CTX(dev_ctx, hc, dci) ((xhci_ep_ctx_t *) XHCI_GET_DC_FIELD(dev_ctx, hc, dci)) 188 #define XHCI_GET_SLOT_CTX(dev_ctx, hc) ((xhci_slot_ctx_t *) XHCI_GET_DC_FIELD(dev_ctx, hc, 0)) 187 #define XHCI_GET_EP_CTX(dev_ctx, hc, dci) ((xhci_ep_ctx_t *) XHCI_GET_CTX_FIELD(device, (dev_ctx), (hc), (dci))) 188 #define XHCI_GET_SLOT_CTX(dev_ctx, hc) ((xhci_slot_ctx_t *) XHCI_GET_CTX_FIELD(device, (dev_ctx), (hc), 0)) 189 189 190 190 /** … … 196 196 typedef struct xhci_device_ctx { 197 197 } xhci_device_ctx_t; 198 199 /** 200 * Force type checking. 201 */ 202 static inline char *xhci_device_ctx_to_charptr(const xhci_device_ctx_t *ctx) 203 { 204 return (char *) ctx; 205 } 198 206 199 207 /** … … 243 251 * Input context: section 6.2.5 244 252 */ 245 246 #define XHCI_CTRL_CTX_OFFSET 0 247 #define XHCI_DEVICE_CTX_OFFSET 1 248 #define XHCI_INPUT_CTX_SIZE(hc) (XHCI_DEVICE_CTX_OFFSET * XHCI_ONE_CTX_SIZE(hc) + XHCI_DEVICE_CTX_SIZE(hc)) 249 #define XHCI_GET_CTRL_CTX(ictx, hc) (xhci_input_ctrl_ctx_t*)((char*)ictx + XHCI_CTRL_CTX_OFFSET * XHCI_ONE_CTX_SIZE(hc)) 250 #define XHCI_GET_DEVICE_CTX(ictx, hc) (xhci_device_ctx_t *)((char*)ictx + XHCI_DEVICE_CTX_OFFSET * XHCI_ONE_CTX_SIZE(hc)) 253 #define XHCI_INPUT_CTX_SIZE(hc) (XHCI_ONE_CTX_SIZE(hc) + XHCI_DEVICE_CTX_SIZE(hc)) 254 #define XHCI_GET_CTRL_CTX(ictx, hc) ((xhci_input_ctrl_ctx_t *) XHCI_GET_CTX_FIELD(input, (ictx), (hc), 0)) 255 #define XHCI_GET_DEVICE_CTX(dev_ctx, hc) ((xhci_device_ctx_t *) XHCI_GET_CTX_FIELD(input, (ictx), (hc), 1)) 251 256 252 257 typedef struct xhci_input_ctx { 253 258 } xhci_input_ctx_t; 259 260 /** 261 * Force type checking. 262 */ 263 static inline char *xhci_input_ctx_to_charptr(const xhci_input_ctx_t *ctx) 264 { 265 return (char *) ctx; 266 } 254 267 255 268 /**
Note:
See TracChangeset
for help on using the changeset viewer.