Changeset f9d0a86 in mainline for uspace/lib/usb/include/usb/usb.h


Ignore:
Timestamp:
2017-11-14T12:24:42Z (6 years ago)
Author:
Aearsis <Hlavaty.Ondrej@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
6cad776
Parents:
887c9de (diff), d2d142a (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:
Aearsis <Hlavaty.Ondrej@…> (2017-11-14 01:04:19)
git-committer:
Aearsis <Hlavaty.Ondrej@…> (2017-11-14 12:24:42)
Message:

Merge tag '0.7.1'

The merge wasn't clean, because of changes in build system. The most
significant change was partial revert of usbhc callback refactoring,
which now does not take usb transfer batch, but few named fields again.

File:
1 edited

Legend:

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

    r887c9de rf9d0a86  
    3939#include <stdint.h>
    4040#include <types/common.h>
     41#include <usb_iface.h>
    4142
    4243/** Convert 16bit value from native (host) endianness to USB endianness. */
     
    5253#define uint32_usb2host(n) uint32_t_le2host((n))
    5354
    54 
    55 /** USB transfer type. */
    56 typedef enum {
    57         USB_TRANSFER_CONTROL = 0,
    58         USB_TRANSFER_ISOCHRONOUS = 1,
    59         USB_TRANSFER_BULK = 2,
    60         USB_TRANSFER_INTERRUPT = 3
    61 } usb_transfer_type_t;
    62 
    6355const char * usb_str_transfer_type(usb_transfer_type_t t);
    6456const char * usb_str_transfer_type_short(usb_transfer_type_t t);
    6557
    66 /** USB data transfer direction. */
    67 typedef enum {
    68         USB_DIRECTION_IN,
    69         USB_DIRECTION_OUT,
    70         USB_DIRECTION_BOTH
    71 } usb_direction_t;
    72 
    7358const char *usb_str_direction(usb_direction_t);
    74 
    75 /** USB speeds. */
    76 typedef enum {
    77         /** USB 1.1 low speed (1.5Mbits/s). */
    78         USB_SPEED_LOW,
    79         /** USB 1.1 full speed (12Mbits/s). */
    80         USB_SPEED_FULL,
    81         /** USB 2.0 high speed (480Mbits/s). */
    82         USB_SPEED_HIGH,
    83         /** USB 3.0 super speed (5Gbits/s). */
    84         USB_SPEED_SUPER,
    85         /** Psuedo-speed serving as a boundary. */
    86         USB_SPEED_MAX
    87 } usb_speed_t;
    8859
    8960static inline bool usb_speed_is_11(const usb_speed_t s)
     
    11081} usb_request_recipient_t;
    11182
    112 /** USB address type.
    113  * Negative values could be used to indicate error.
    114  */
    115 typedef int16_t usb_address_t;
    116 
    117 typedef struct {
    118         usb_address_t address;
    119         unsigned port;
    120 } usb_tt_address_t;
    121 
    12283/** Default USB address. */
    12384#define USB_ADDRESS_DEFAULT 0
     
    139100}
    140101
    141 /** USB endpoint number type.
    142  * Negative values could be used to indicate error.
    143  */
    144 typedef int16_t usb_endpoint_t;
    145 
    146102/** Default control endpoint */
    147103#define USB_ENDPOINT_DEFAULT_CONTROL 0
     
    162118            (ep < USB11_ENDPOINT_MAX);
    163119}
    164 
    165 
    166 /** USB complete address type.
    167  * Pair address + endpoint is identification of transaction recipient.
    168  */
    169 typedef union {
    170         struct {
    171                 usb_address_t address;
    172                 usb_endpoint_t endpoint;
    173         } __attribute__((packed));
    174         uint32_t packed;
    175 } usb_target_t;
    176 
    177 /** Description of usb endpoint.
    178  */
    179 typedef struct {
    180         /** Endpoint number. */
    181         usb_endpoint_t endpoint_no;
    182 
    183         /** Endpoint transfer type. */
    184         usb_transfer_type_t transfer_type;
    185 
    186         /** Endpoint direction. */
    187         usb_direction_t direction;
    188 
    189         /** Maximum packet size for the endpoint. */
    190         size_t max_packet_size;
    191 
    192         /** Number of packets per frame/uframe.
    193          * Only valid for HS INT and ISO transfers. All others should set to 1*/
    194         unsigned packets;
    195 
    196         struct {
    197                 unsigned polling_interval;
    198         } usb2;
    199 
    200         struct {
    201                 unsigned max_burst;
    202                 unsigned max_streams;
    203         } usb3;
    204 } usb_endpoint_desc_t;
    205120
    206121/** Check USB target for allowed values (address and endpoint).
Note: See TracChangeset for help on using the changeset viewer.