Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset fd17ab5 in mainline


Ignore:
Timestamp:
2010-10-13T06:42:53Z (10 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
master
Children:
2c381250
Parents:
2b887bf7
Message:

libusb: base types in separate file

Base USB types (address, protocol type etc.) are now in separate file usb.h.

Also added HID protocol type enum to hid.h.

Location:
uspace/lib/usb
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/usb/Makefile

    r2b887bf7 rfd17ab5  
    3131
    3232SOURCES = \
    33         hcd.c
     33        hcd.c \
     34        usb.c
    3435
    3536include $(USPACE_PREFIX)/Makefile.common
  • uspace/lib/usb/hcd.h

    r2b887bf7 rfd17ab5  
    3636#define LIBUSB_HCD_H_
    3737
     38#include "usb.h"
     39
    3840#include <ipc/ipc.h>
    3941#include <async.h>
     
    4143/** Maximum size of transaction payload. */
    4244#define USB_MAX_PAYLOAD_SIZE 1020
    43 
    44 /** USB transfer type. */
    45 typedef enum {
    46         USB_TRANSFER_CONTROL = 0,
    47         USB_TRANSFER_ISOCHRONOUS = 1,
    48         USB_TRANSFER_BULK = 2,
    49         USB_TRANSFER_INTERRUPT = 3
    50 } usb_transfer_type_t;
    51 
    52 const char * usb_str_transfer_type(usb_transfer_type_t t);
    53 
    54 /** USB data transfer direction. */
    55 typedef enum {
    56         USB_DIRECTION_IN,
    57         USB_DIRECTION_OUT
    58 } usb_direction_t;
    59 
    60 /** USB address type.
    61  * Negative values could be used to indicate error.
    62  */
    63 typedef int usb_address_t;
    64 
    65 /** USB endpoint number type.
    66  * Negative values could be used to indicate error.
    67  */
    68 typedef int usb_endpoint_t;
    69 
    70 /** USB complete address type.
    71  * Pair address + endpoint is identification of transaction recipient.
    72  */
    73 typedef struct {
    74         usb_address_t address;
    75         usb_endpoint_t endpoint;
    76 } usb_target_t;
    77 
    78 static inline int usb_target_same(usb_target_t a, usb_target_t b)
    79 {
    80         return (a.address == b.address)
    81             && (a.endpoint == b.endpoint);
    82 }
    8345
    8446/** Opaque handle of active USB transaction.
  • uspace/lib/usb/hid.h

    r2b887bf7 rfd17ab5  
    4747} usb_hid_request_t;
    4848
     49/** USB/HID interface protocols. */
     50typedef enum {
     51        USB_HID_PROTOCOL_NONE = 0,
     52        USB_HID_PROTOCOL_KEYBOARD = 1,
     53        USB_HID_PROTOCOL_MOUSE = 2
     54} usb_hid_protocol_t;
    4955
    5056#endif
Note: See TracChangeset for help on using the changeset viewer.