Changeset 92574f4 in mainline for uspace/lib/usb/include


Ignore:
Timestamp:
2011-02-24T12:03:27Z (15 years ago)
Author:
Lubos Slovak <lubos.slovak@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
e7b7ebd5
Parents:
4837092 (diff), a80849c (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:

Merged development (changes in DDF, etc.).

Conflicts in uspace/drv/usbkbd/main.c

Location:
uspace/lib/usb/include/usb
Files:
4 added
3 deleted
8 edited
1 moved

Legend:

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

    r4837092 r92574f4  
    3131 */
    3232/** @file
    33  * @brief HC driver.
     33 * USB address keeping for host controller drivers.
    3434 */
    35 #ifndef LIBUSB_HCD_H_
    36 #define LIBUSB_HCD_H_
     35#ifndef LIBUSB_ADDRKEEP_H_
     36#define LIBUSB_ADDRKEEP_H_
    3737
    3838#include <usb/usb.h>
  • uspace/lib/usb/include/usb/classes/hid.h

    r4837092 r92574f4  
    5050        USB_HIDREQ_SET_PROTOCOL = 11
    5151} usb_hid_request_t;
     52
     53/** USB/HID subclass constants. */
     54typedef enum {
     55        USB_HID_SUBCLASS_NONE = 0,
     56        USB_HID_SUBCLASS_BOOT = 1
     57} usb_hid_subclass_t;
    5258
    5359/** USB/HID interface protocols. */
  • uspace/lib/usb/include/usb/classes/hub.h

    r4837092 r92574f4  
    11/*
    2  * Copyright (c) 2010 Vojtech Horky
     2 * Copyright (c) 2010 Matus Dekanek
    33 * All rights reserved.
    44 *
     
    3333 * @brief USB hub related structures.
    3434 */
    35 #ifndef LIBUSB_HUB_H_
    36 #define LIBUSB_HUB_H_
     35#ifndef LIBUSB_CLASS_HUB_H_
     36#define LIBUSB_CLASS_HUB_H_
    3737
    3838#include <sys/types.h>
    39 #include <usb/hcdhubd.h>
    40 
    4139
    4240/** Hub class feature selector.
     
    8078    /**
    8179            D1...D0: Logical Power Switching Mode
    82             00: Ganged power switching (all ports power at
     80            00: Ganged power switching (all ports power at
    8381            once)
    8482            01: Individual port power switching
     
    9189            00: Global Over-current Protection. The hub
    9290            reports over-current as a summation of all
    93             ports current draw, without a breakdown of
     91            ports current draw, without a breakdown of
    9492            individual port over-current status.
    9593            01: Individual Port Over-current Protection. The
  • uspace/lib/usb/include/usb/descriptor.h

    r4837092 r92574f4  
    3636#define LIBUSB_DESCRIPTOR_H_
    3737
    38 #include <ipc/ipc.h>
    3938#include <async.h>
    4039
  • uspace/lib/usb/include/usb/dp.h

    r4837092 r92574f4  
    4545} usb_dp_descriptor_nesting_t;
    4646
     47extern usb_dp_descriptor_nesting_t usb_dp_standard_descriptor_nesting[];
     48
    4749typedef struct {
    4850        usb_dp_descriptor_nesting_t *nesting;
  • uspace/lib/usb/include/usb/pipes.h

    r4837092 r92574f4  
    3131 */
    3232/** @file
    33  * Communication between device drivers and host controller driver.
     33 * USB pipes representation.
    3434 */
    3535#ifndef LIBUSB_PIPES_H_
     
    3838#include <sys/types.h>
    3939#include <usb/usb.h>
     40#include <usb/usbdevice.h>
     41#include <usb/descriptor.h>
    4042#include <ipc/devman.h>
    41 #include <driver.h>
     43#include <ddf/driver.h>
    4244
    4345/**
     
    7375        usb_direction_t direction;
    7476
     77        /** Maximum packet size for the endpoint. */
     78        size_t max_packet_size;
     79
    7580        /** Phone to the host controller.
    7681         * Negative when no session is active.
     
    8085
    8186
     87/** Description of endpoint characteristics. */
     88typedef struct {
     89        /** Transfer type (e.g. control or interrupt). */
     90        usb_transfer_type_t transfer_type;
     91        /** Transfer direction (to or from a device). */
     92        usb_direction_t direction;
     93        /** Interface class this endpoint belongs to (-1 for any). */
     94        int interface_class;
     95        /** Interface subclass this endpoint belongs to (-1 for any). */
     96        int interface_subclass;
     97        /** Interface protocol this endpoint belongs to (-1 for any). */
     98        int interface_protocol;
     99        /** Extra endpoint flags. */
     100        unsigned int flags;
     101} usb_endpoint_description_t;
     102
     103/** Mapping of endpoint pipes and endpoint descriptions. */
     104typedef struct {
     105        /** Endpoint pipe. */
     106        usb_endpoint_pipe_t *pipe;
     107        /** Endpoint description. */
     108        const usb_endpoint_description_t *description;
     109        /** Interface number the endpoint must belong to (-1 for any). */
     110        const int interface_no;
     111        /** Found descriptor fitting the description. */
     112        usb_standard_endpoint_descriptor_t *descriptor;
     113        /** Interface the endpoint belongs to. */
     114        usb_standard_interface_descriptor_t *interface;
     115        /** Whether the endpoint was actually found. */
     116        bool present;
     117} usb_endpoint_mapping_t;
     118
     119int usb_device_connection_initialize_on_default_address(
     120    usb_device_connection_t *, usb_hc_connection_t *);
    82121int usb_device_connection_initialize_from_device(usb_device_connection_t *,
    83     device_t *);
     122    ddf_dev_t *);
    84123int usb_device_connection_initialize(usb_device_connection_t *,
    85124    devman_handle_t, usb_address_t);
    86125
     126int usb_device_get_assigned_interface(ddf_dev_t *);
     127
    87128int usb_endpoint_pipe_initialize(usb_endpoint_pipe_t *,
    88129    usb_device_connection_t *,
    89     usb_endpoint_t, usb_transfer_type_t, usb_direction_t);
     130    usb_endpoint_t, usb_transfer_type_t, size_t, usb_direction_t);
    90131int usb_endpoint_pipe_initialize_default_control(usb_endpoint_pipe_t *,
    91132    usb_device_connection_t *);
     133int usb_endpoint_pipe_initialize_from_configuration(usb_endpoint_mapping_t *,
     134    size_t, uint8_t *, size_t, usb_device_connection_t *);
    92135
    93136
    94137int usb_endpoint_pipe_start_session(usb_endpoint_pipe_t *);
    95138int usb_endpoint_pipe_end_session(usb_endpoint_pipe_t *);
     139bool usb_endpoint_pipe_is_session_started(usb_endpoint_pipe_t *);
    96140
    97141int usb_endpoint_pipe_read(usb_endpoint_pipe_t *, void *, size_t, size_t *);
     
    103147    void *, size_t);
    104148
    105 
    106 
    107 int usb_endpoint_pipe_async_read(usb_endpoint_pipe_t *, void *, size_t,
    108     size_t *, usb_handle_t *);
    109 int usb_endpoint_pipe_async_write(usb_endpoint_pipe_t *, void *, size_t,
    110     usb_handle_t *);
    111 
    112 int usb_endpoint_pipe_async_control_read(usb_endpoint_pipe_t *, void *, size_t,
    113     void *, size_t, size_t *, usb_handle_t *);
    114 int usb_endpoint_pipe_async_control_write(usb_endpoint_pipe_t *, void *, size_t,
    115     void *, size_t, usb_handle_t *);
    116 
    117 int usb_endpoint_pipe_wait_for(usb_endpoint_pipe_t *, usb_handle_t);
    118 
    119149#endif
    120150/**
  • uspace/lib/usb/include/usb/request.h

    r4837092 r92574f4  
    3737
    3838#include <sys/types.h>
     39#include <l18n/langs.h>
    3940#include <usb/usb.h>
    4041#include <usb/pipes.h>
    4142#include <usb/descriptor.h>
     43
     44/** Standard device request. */
     45typedef enum {
     46        USB_DEVREQ_GET_STATUS = 0,
     47        USB_DEVREQ_CLEAR_FEATURE = 1,
     48        USB_DEVREQ_SET_FEATURE = 3,
     49        USB_DEVREQ_SET_ADDRESS = 5,
     50        USB_DEVREQ_GET_DESCRIPTOR = 6,
     51        USB_DEVREQ_SET_DESCRIPTOR = 7,
     52        USB_DEVREQ_GET_CONFIGURATION = 8,
     53        USB_DEVREQ_SET_CONFIGURATION = 9,
     54        USB_DEVREQ_GET_INTERFACE = 10,
     55        USB_DEVREQ_SET_INTERFACE = 11,
     56        USB_DEVREQ_SYNCH_FRAME = 12,
     57        USB_DEVREQ_LAST_STD
     58} usb_stddevreq_t;
     59
     60/** Device request setup packet.
     61 * The setup packet describes the request.
     62 */
     63typedef struct {
     64        /** Request type.
     65         * The type combines transfer direction, request type and
     66         * intended recipient.
     67         */
     68        uint8_t request_type;
     69        /** Request identification. */
     70        uint8_t request;
     71        /** Main parameter to the request. */
     72        union {
     73                uint16_t value;
     74                /* FIXME: add #ifdefs according to host endianess */
     75                struct {
     76                        uint8_t value_low;
     77                        uint8_t value_high;
     78                };
     79        };
     80        /** Auxiliary parameter to the request.
     81         * Typically, it is offset to something.
     82         */
     83        uint16_t index;
     84        /** Length of extra data. */
     85        uint16_t length;
     86} __attribute__ ((packed)) usb_device_request_setup_packet_t;
    4287
    4388int usb_control_request_set(usb_endpoint_pipe_t *,
     
    5297int usb_request_get_descriptor(usb_endpoint_pipe_t *, usb_request_type_t,
    5398    uint8_t, uint8_t, uint16_t, void *, size_t, size_t *);
     99int usb_request_get_descriptor_alloc(usb_endpoint_pipe_t *, usb_request_type_t,
     100    uint8_t, uint8_t, uint16_t, void **, size_t *);
    54101int usb_request_get_device_descriptor(usb_endpoint_pipe_t *,
    55102    usb_standard_device_descriptor_t *);
     
    60107int usb_request_set_configuration(usb_endpoint_pipe_t *, uint8_t);
    61108
     109int usb_request_get_supported_languages(usb_endpoint_pipe_t *,
     110    l18_win_locales_t **, size_t *);
     111int usb_request_get_string(usb_endpoint_pipe_t *, size_t, l18_win_locales_t,
     112    char **);
     113
    62114#endif
    63115/**
  • uspace/lib/usb/include/usb/usb.h

    r4837092 r92574f4  
    3838#include <sys/types.h>
    3939#include <byteorder.h>
    40 #include <ipc/ipc.h>
    4140
    4241/** Convert 16bit value from native (host) endianness to USB endianness. */
     
    7069} usb_direction_t;
    7170
     71/** USB speeds. */
     72typedef enum {
     73        /** USB 1.1 low speed (1.5Mbits/s). */
     74        USB_SPEED_LOW,
     75        /** USB 1.1 full speed (12Mbits/s). */
     76        USB_SPEED_FULL,
     77        /** USB 2.0 high speed (480Mbits/s). */
     78        USB_SPEED_HIGH
     79} usb_speed_t;
     80
    7281/** USB request type target. */
    7382typedef enum {
     
    8392        USB_REQUEST_RECIPIENT_ENDPOINT = 2
    8493} usb_request_recipient_t;
    85 
    86 /** USB transaction outcome. */
    87 typedef enum {
    88         USB_OUTCOME_OK,
    89         USB_OUTCOME_CRCERROR,
    90         USB_OUTCOME_BABBLE
    91 } usb_transaction_outcome_t;
    92 
    93 const char * usb_str_transaction_outcome(usb_transaction_outcome_t o);
    9494
    9595/** USB address type.
  • uspace/lib/usb/include/usb/usbmem.h

    r4837092 r92574f4  
    11/*
    2  * Copyright (c) 2010 Matus Dekanek
     2 * Copyright (c) 2011 Matus Dekanek
    33 * All rights reserved.
    44 *
     
    3535 * @{
    3636 */
    37 /** @file definitions of special memory management, used mostly in usb stack
     37/** @file definitions of memory management with address translation, used mostly in usb stack
    3838 *
    3939 * USB HCD needs traslation between physical and virtual addresses. These
     
    5959
    6060extern void * mman_malloc(
    61                 size_t size,
    62                 size_t alignment,
    63                 unsigned long max_physical_address);
     61    size_t size,
     62    size_t alignment,
     63    unsigned long max_physical_address);
    6464
    6565extern void * mman_getVA(void * addr);
Note: See TracChangeset for help on using the changeset viewer.