Package ch.ntb.usb

Class Usb_Endpoint_Descriptor


  • public class Usb_Endpoint_Descriptor
    extends Usb_Descriptor
    Represents the descriptor of an USB endpoint.
    Endpoint descriptors are used to describe endpoints other than endpoint zero. Endpoint zero is always assumed to be a control endpoint and is configured before any descriptors are even requested. The host will use the information returned from these descriptors to determine the bandwidth requirements of the bus.

    The length of the configuration descriptor is Usb_Descriptor.USB_DT_ENDPOINT_SIZE and the type is Usb_Descriptor.USB_DT_ENDPOINT.
    • Field Detail

      • USB_MAXENDPOINTS

        public static final int USB_MAXENDPOINTS
        Maximum number of endpoints
        See Also:
        Constant Field Values
      • USB_ENDPOINT_ADDRESS_MASK

        public static final int USB_ENDPOINT_ADDRESS_MASK
        Endpoint address mask (in bEndpointAddress).
        See Also:
        Constant Field Values
      • USB_ENDPOINT_DIR_MASK

        public static final int USB_ENDPOINT_DIR_MASK
        Endpoint address mask (in bEndpointAddress).
        See Also:
        Constant Field Values
      • USB_ENDPOINT_TYPE_MASK

        public static final int USB_ENDPOINT_TYPE_MASK
        Endpoint type mask (in bmAttributes).
        See Also:
        Constant Field Values
      • USB_ENDPOINT_TYPE_CONTROL

        public static final int USB_ENDPOINT_TYPE_CONTROL
        Possible endpoint types (in bmAttributes).
        See Also:
        Constant Field Values
      • USB_ENDPOINT_TYPE_ISOCHRONOUS

        public static final int USB_ENDPOINT_TYPE_ISOCHRONOUS
        Possible endpoint types (in bmAttributes).
        See Also:
        Constant Field Values
      • USB_ENDPOINT_TYPE_BULK

        public static final int USB_ENDPOINT_TYPE_BULK
        Possible endpoint types (in bmAttributes).
        See Also:
        Constant Field Values
      • USB_ENDPOINT_TYPE_INTERRUPT

        public static final int USB_ENDPOINT_TYPE_INTERRUPT
        Possible endpoint types (in bmAttributes).
        See Also:
        Constant Field Values
    • Constructor Detail

      • Usb_Endpoint_Descriptor

        public Usb_Endpoint_Descriptor()
    • Method Detail

      • getBEndpointAddress

        public byte getBEndpointAddress()
        Returns the endpoint address.

        Bits 3..0: Endpoint number
        Bits 6..4: Reserved. Set to zero
        Bit 7: Direction. 0 = Out, 1 = In (ignored for control endpoints)
        Returns:
        the endpoint address
      • getBInterval

        public byte getBInterval()
        Returns the intervall for polling endpoint data transfers.
        Value in frame counts. Ignored for Bulk & Control eEndpoints. Isochronous endpoints must equal 1 and field may range from 1 to 255 for interrupt endpoints.
        Returns:
        the intervall for polling endpoint data transfers
      • getBmAttributes

        public byte getBmAttributes()
        Returns the attributes of this endpoint.
        Bits 1..0: Transfer Type (see USB_ENDPOINT_TYPE_XXX).
        Bits 7..2: Reserved.
                If isochronous endpoint:
                        Bits 3..2: Synchronisation type
                        00 = No synchronisation
                                01 = Asynchronous
                  10 = Adaptive
                  11 = Synchronous
                Bits 5..4: Usage Type
                00 = Data endpoint
                01 = Feedback endpoint
                10 = Explicit feedback data endpoint
                11 = Reserved
         
        Returns:
        the attributes of this endpoint
      • getBRefresh

        public byte getBRefresh()
      • getBSynchAddress

        public byte getBSynchAddress()
      • getExtra

        public byte[] getExtra()
        Returns the data of extra descriptor(s) if available.
        Returns:
        null or a byte array with the extra descriptor data
      • getExtralen

        public int getExtralen()
        Returns the number of bytes of the extra descriptor.
        Returns:
        the number of bytes of the extra descriptor
      • getWMaxPacketSize

        public short getWMaxPacketSize()
        Returns the maximum packet size of this endpoint is capable of sending or receiving.
        Returns:
        the maximum packet size
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object