Changeset df6ded8 in mainline for uspace/lib/usb/include/usb/request.h


Ignore:
Timestamp:
2018-02-28T16:37:50Z (6 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
1b20da0
Parents:
f5e5f73 (diff), b2dca8de (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
git-author:
Jakub Jermar <jakub@…> (2018-02-28 16:06:42)
git-committer:
Jakub Jermar <jakub@…> (2018-02-28 16:37:50)
Message:

Merge github.com:helenos-xhci-team/helenos

This commit merges support for USB 3 and generally refactors, fixes,
extends and cleans up the existing USB framework.

Notable additions and features:

  • new host controller driver has been implemented to control various xHC models (among others, NEC Renesas uPD720200)
  • isochronous data transfer mode
  • support for explicit USB device removal
  • USB tablet driver
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/usb/include/usb/request.h

    rf5e5f73 rdf6ded8  
    11/*
    22 * Copyright (c) 2012 Jan Vesely
     3 * Copyright (c) 2018 Ondrej Hlavaty
    34 * All rights reserved.
    45 *
     
    7172#define USB_ENDPOINT_STATUS_HALTED ((uint16_t)(1 << 0))
    7273
     74/** Size of the USB setup packet */
     75#define USB_SETUP_PACKET_SIZE 8
     76
    7377/** Device request setup packet.
    7478 * The setup packet describes the request.
     
    8286#define SETUP_REQUEST_TYPE_DEVICE_TO_HOST (1 << 7)
    8387#define SETUP_REQUEST_TYPE_HOST_TO_DEVICE (0 << 7)
     88#define SETUP_REQUEST_TYPE_IS_DEVICE_TO_HOST(rt) ((rt) & (1 << 7))
    8489#define SETUP_REQUEST_TYPE_GET_TYPE(rt) ((rt >> 5) & 0x3)
    8590#define SETUP_REQUEST_TYPE_GET_RECIPIENT(rec) (rec & 0x1f)
     
    108113} __attribute__ ((packed)) usb_device_request_setup_packet_t;
    109114
    110 static_assert(sizeof(usb_device_request_setup_packet_t) == 8);
     115static_assert(sizeof(usb_device_request_setup_packet_t) == USB_SETUP_PACKET_SIZE);
    111116
    112 int usb_request_needs_toggle_reset(
    113     const usb_device_request_setup_packet_t *request);
     117#define GET_DEVICE_DESC(size) \
     118{ \
     119        .request_type = SETUP_REQUEST_TYPE_DEVICE_TO_HOST \
     120            | (USB_REQUEST_TYPE_STANDARD << 5) \
     121            | USB_REQUEST_RECIPIENT_DEVICE, \
     122        .request = USB_DEVREQ_GET_DESCRIPTOR, \
     123        .value = uint16_host2usb(USB_DESCTYPE_DEVICE << 8), \
     124        .index = uint16_host2usb(0), \
     125        .length = uint16_host2usb(size), \
     126};
     127
     128#define SET_ADDRESS(address) \
     129{ \
     130        .request_type = SETUP_REQUEST_TYPE_HOST_TO_DEVICE \
     131            | (USB_REQUEST_TYPE_STANDARD << 5) \
     132            | USB_REQUEST_RECIPIENT_DEVICE, \
     133        .request = USB_DEVREQ_SET_ADDRESS, \
     134        .value = uint16_host2usb(address), \
     135        .index = uint16_host2usb(0), \
     136        .length = uint16_host2usb(0), \
     137};
     138
     139#define CTRL_PIPE_MIN_PACKET_SIZE 8
    114140
    115141#endif
Note: See TracChangeset for help on using the changeset viewer.