1 #ifndef DEVICES_USB_HUB_H
    2 #define DEVICES_USB_HUB_H
    3 /*
    4 **	$VER: usb_hub.h 2.0 (15.12.07)
    5 **
    6 **	usb definitions include file
    7 **
    8 **	(C) Copyright 2002-2007 Chris Hodges
    9 **	    All Rights Reserved
   10 */
   11 
   12 #include <exec/types.h>
   13 
   14 #if defined(__GNUC__)
   15 # pragma pack(1)
   16 #endif
   17 
   18 /* Usb Hub Requests */
   19 #define UHR_GET_STATE         0x02 /* URTF_OTHER for port and URTF_DEVICE for Hub itself */
   20 #define UHR_CLEAR_TT_BUFFER   0x08
   21 #define UHR_RESET_TT_BUFFER   0x09
   22 #define UHR_GET_TT_STATE      0x0a
   23 #define UHR_STOP_TT           0x0b
   24 
   25 /* Usb Hub Feature Selectors */
   26 #define UFS_C_HUB_LOCAL_POWER     0x00
   27 #define UFS_C_HUB_OVER_CURRENT    0x01
   28 #define UFS_PORT_CONNECTION       0x00
   29 #define UFS_PORT_ENABLE           0x01
   30 #define UFS_PORT_SUSPEND          0x02
   31 #define UFS_PORT_OVER_CURRENT     0x03
   32 #define UFS_PORT_RESET            0x04
   33 #define UFS_PORT_POWER            0x08
   34 #define UFS_PORT_LOW_SPEED        0x09
   35 #define UFS_C_PORT_CONNECTION     0x10
   36 #define UFS_C_PORT_ENABLE         0x11
   37 #define UFS_C_PORT_SUSPEND        0x12
   38 #define UFS_C_PORT_OVER_CURRENT   0x13
   39 #define UFS_C_PORT_RESET          0x14
   40 #define UFS_PORT_TEST             0x15
   41 #define UFS_PORT_INDICATOR        0x16
   42 
   43 /* HUB class specific descriptors */
   44 #define UDT_HUB               0x29
   45 
   46 /* Usb Class Specific Descriptor: Hub Descriptor */
   47 struct  UsbHubDesc
   48 {
   49     UBYTE bLength;             /* Number of bytes in this descriptor, including this byte */
   50     UBYTE bDescriptorType;     /* Descriptor Type, value:  29H for hub descriptor */
   51     UBYTE bNbrPorts;           /* Number of downstream ports that this hub supports */
   52     UBYTE wHubCharacteristics; /* Hub flags (WORD!) (see below) */
   53     UBYTE wPad0;               /* Due to the wHubCharacteristics being on an ODD address, UWORD would add pad bytes! */
   54     UBYTE bPwrOn2PwrGood;      /* Time (in 2ms intervals) for power-good on port */
   55     UBYTE bHubContrCurrent;    /* Maximum current requirements of the Hub Controller in mA. */
   56     UBYTE DeviceRemovable;     /* Variable Size! Indicates if a port has a removable (0) device attached, Bit n<-> Port n */
   57     UBYTE PortPwrCtrlMask;     /* Variable Size! Obsolete (USB1.0) */
   58 };
   59 
   60 /* Flags for wHubCharacteristics */
   61 #define UHCF_INDIVID_POWER    0x0001 /* Individual port power switching */
   62 #define UHCF_IS_COMPOUND      0x0004 /* Hub is part of a compound device */
   63 #define UHCF_INDIVID_OVP      0x0008 /* Individual port over-current status */
   64 #define UHCF_NO_OVP           0x0010 /* No over-current protection */
   65 #define UHCF_PORT_INDICATORS  0x0080 /* Port indicators are supported */
   66 
   67 #define UHCS_THINK_TIME       13
   68 #define UHCF_THINK_TIME_8     0x0000 /* TT Think Time 8 FS bit times */
   69 #define UHCF_THINK_TIME_16    0x2000 /* TT Think Time 16 FS bit times */
   70 #define UHCF_THINK_TIME_24    0x4000 /* TT Think Time 24 FS bit times */
   71 #define UHCF_THINK_TIME_32    0x6000 /* TT Think Time 32 FS bit times */
   72 #define UHCM_THINK_TIME       0x6000
   73 
   74 /* Structure returned by GetHubStatus() */
   75 
   76 struct UsbHubStatus
   77 {
   78     UWORD wHubStatus;          /* Current status of hub (see below) */
   79     UWORD wHubChange;          /* Changes of status */
   80 };
   81 
   82 /* Flags for wHubStatus and wHubChange */
   83 #define UHSF_LOCAL_POWER_LOST 0x0100
   84 #define UHSF_OVER_CURRENT     0x0200
   85 
   86 /* Structure returned by GetPortStatus() */
   87 struct UsbPortStatus
   88 {
   89     UWORD wPortStatus;         /* Current status of port (see below) */
   90     UWORD wPortChange;         /* Changes of status */
   91 };
   92 
   93 /* Flags for wPortStatus and wPortChange */
   94 #define UPSF_PORT_CONNECTION  0x0100
   95 #define UPSF_PORT_ENABLE      0x0200
   96 #define UPSF_PORT_SUSPEND     0x0400
   97 #define UPSF_PORT_OVER_CURRENT 0x0800
   98 #define UPSF_PORT_RESET       0x1000
   99 #define UPSF_PORT_POWER       0x0001
  100 #define UPSF_PORT_LOW_SPEED   0x0002
  101 #define UPSF_PORT_HIGH_SPEED  0x0004 /* USB 2.0 */
  102 #define UPSF_PORT_TEST_MODE   0x0008 /* USB 2.0 */
  103 #define UPSF_PORT_INDICATOR   0x0010 /* USB 2.0 */
  104 
  105 #if defined(__GNUC__)
  106 # pragma pack()
  107 #endif
  108 
  109 #endif /* DEVICES_USB_HUB_H */