Ignore:
Timestamp:
2016-07-22T08:24:47Z (8 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
f76d2c2
Parents:
5b18137 (diff), 8351f9a4 (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.
Message:

Merge from lp:~jan.vesely/helenos/usb

File:
1 edited

Legend:

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

    r5b18137 rb4b534ac  
    4141#include <usb/dev/pipes.h>
    4242#include <usb/descriptor.h>
    43 
    44 /** USB device status - device is self powered (opposed to bus powered). */
    45 #define USB_DEVICE_STATUS_SELF_POWERED ((uint16_t)(1 << 0))
    46 
    47 /** USB device status - remote wake-up signaling is enabled. */
    48 #define USB_DEVICE_STATUS_REMOTE_WAKEUP ((uint16_t)(1 << 1))
    49 
    50 /** USB endpoint status - endpoint is halted (stalled). */
    51 #define USB_ENDPOINT_STATUS_HALTED ((uint16_t)(1 << 0))
    52 
    53 /** USB feature selector - endpoint halt (stall). */
    54 #define USB_FEATURE_SELECTOR_ENDPOINT_HALT (0)
    55 
    56 /** USB feature selector - device remote wake-up. */
    57 #define USB_FEATURE_SELECTOR_REMOTE_WAKEUP (1)
    58 
    59 /** Standard device request. */
    60 typedef enum {
    61         USB_DEVREQ_GET_STATUS = 0,
    62         USB_DEVREQ_CLEAR_FEATURE = 1,
    63         USB_DEVREQ_SET_FEATURE = 3,
    64         USB_DEVREQ_SET_ADDRESS = 5,
    65         USB_DEVREQ_GET_DESCRIPTOR = 6,
    66         USB_DEVREQ_SET_DESCRIPTOR = 7,
    67         USB_DEVREQ_GET_CONFIGURATION = 8,
    68         USB_DEVREQ_SET_CONFIGURATION = 9,
    69         USB_DEVREQ_GET_INTERFACE = 10,
    70         USB_DEVREQ_SET_INTERFACE = 11,
    71         USB_DEVREQ_SYNCH_FRAME = 12,
    72         USB_DEVREQ_LAST_STD
    73 } usb_stddevreq_t;
    74 
    75 /** Device request setup packet.
    76  * The setup packet describes the request.
    77  */
    78 typedef struct {
    79         /** Request type.
    80          * The type combines transfer direction, request type and
    81          * intended recipient.
    82          */
    83         uint8_t request_type;
    84 #define SETUP_REQUEST_TYPE_DEVICE_TO_HOST (1 << 7)
    85 #define SETUP_REQUEST_TYPE_GET_TYPE(rt) ((rt >> 5) & 0x3)
    86 #define SETUP_REQUEST_TYPE_GET_RECIPIENT(rec) (rec & 0x1f)
    87 #define SETUP_REQUEST_TO_HOST(type, recipient) \
    88     (uint8_t)((1 << 7) | ((type & 0x3) << 5) | (recipient & 0x1f))
    89 #define SETUP_REQUEST_TO_DEVICE(type, recipient) \
    90     (uint8_t)(((type & 0x3) << 5) | (recipient & 0x1f))
    91 
    92         /** Request identification. */
    93         uint8_t request;
    94         /** Main parameter to the request. */
    95         union __attribute__ ((packed)) {
    96                 uint16_t value;
    97                 /* FIXME: add #ifdefs according to host endianness */
    98                 struct __attribute__ ((packed)) {
    99                         uint8_t value_low;
    100                         uint8_t value_high;
    101                 };
    102         };
    103         /** Auxiliary parameter to the request.
    104          * Typically, it is offset to something.
    105          */
    106         uint16_t index;
    107         /** Length of extra data. */
    108         uint16_t length;
    109 } __attribute__ ((packed)) usb_device_request_setup_packet_t;
     43#include <usb/request.h>
    11044
    11145int usb_control_request_set(usb_pipe_t *,
    11246    usb_request_type_t, usb_request_recipient_t, uint8_t,
    113     uint16_t, uint16_t, void *, size_t);
     47    uint16_t, uint16_t, const void *, size_t);
    11448
    11549int usb_control_request_get(usb_pipe_t *,
     
    13569    void *, size_t, size_t *);
    13670int usb_request_get_full_configuration_descriptor_alloc(usb_pipe_t *,
    137     int, void **, size_t *);
     71    int, const void **, size_t *);
    13872int usb_request_set_descriptor(usb_pipe_t *, usb_request_type_t,
    139     usb_request_recipient_t, uint8_t, uint8_t, uint16_t, void *, size_t);
     73    usb_request_recipient_t, uint8_t, uint8_t, uint16_t, const void *, size_t);
    14074
    14175int usb_request_get_configuration(usb_pipe_t *, uint8_t *);
    14276int usb_request_set_configuration(usb_pipe_t *, uint8_t);
     77
    14378int usb_request_get_interface(usb_pipe_t *, uint8_t, uint8_t *);
    14479int usb_request_set_interface(usb_pipe_t *, uint8_t, uint8_t);
Note: See TracChangeset for help on using the changeset viewer.