OpenCores
URL https://opencores.org/ocsvn/usb_fpga_1_2/usb_fpga_1_2/trunk

Subversion Repositories usb_fpga_1_2

[/] [usb_fpga_1_2/] [trunk/] [libusbJava-src/] [ch/] [ntb/] [usb/] [Usb_Config_Descriptor.java] - Diff between revs 2 and 8

Only display areas with differences | Details | Blame | View Log

Rev 2 Rev 8
/*
/*
 * Java libusb wrapper
 * Java libusb wrapper
 * Copyright (c) 2005-2006 Andreas Schläpfer <spandi at users.sourceforge.net>
 * Copyright (c) 2005-2006 Andreas Schläpfer <spandi at users.sourceforge.net>
 *
 *
 * http://libusbjava.sourceforge.net
 * http://libusbjava.sourceforge.net
 * This library is covered by the LGPL, read LGPL.txt for details.
 * This library is covered by the LGPL, read LGPL.txt for details.
 */
 */
package ch.ntb.usb;
package ch.ntb.usb;
 
 
/**
/**
 * Represents the descriptor of a USB configuration.<br>
 * Represents the descriptor of a USB configuration.<br>
 * A USB device can have several different configuration.<br>
 * A USB device can have several different configuration.<br>
 * <br>
 * <br>
 * The length of the configuration descriptor is
 * The length of the configuration descriptor is
 * {@link ch.ntb.usb.Usb_Descriptor#USB_DT_CONFIG_SIZE} and the type is
 * {@link ch.ntb.usb.Usb_Descriptor#USB_DT_CONFIG_SIZE} and the type is
 * {@link ch.ntb.usb.Usb_Descriptor#USB_DT_CONFIG}.
 * {@link ch.ntb.usb.Usb_Descriptor#USB_DT_CONFIG}.
 *
 *
 */
 */
public class Usb_Config_Descriptor extends Usb_Descriptor {
public class Usb_Config_Descriptor extends Usb_Descriptor {
 
 
        /**
        /**
         * Maximum number of configurations per device
         * Maximum number of configurations per device
         */
         */
        public static final int USB_MAXCONFIG = 8;
        public static final int USB_MAXCONFIG = 8;
 
 
        private short wTotalLength;
        private short wTotalLength;
 
 
        private byte bNumInterfaces;
        private byte bNumInterfaces;
 
 
        private byte bConfigurationValue;
        private byte bConfigurationValue;
 
 
        private byte iConfiguration;
        private byte iConfiguration;
 
 
        private byte bmAttributes;
        private byte bmAttributes;
 
 
        private byte MaxPower;
        private byte MaxPower;
 
 
        private Usb_Interface[] interface_;
        private Usb_Interface[] interface_;
 
 
        private byte[] extra; /* Extra descriptors */
        private byte[] extra; /* Extra descriptors */
 
 
        private int extralen;
        private int extralen;
 
 
        /**
        /**
         * Returns the value to use as an argument to select this configuration ({@link LibusbJava#usb_set_configuration(int, int)}).
         * Returns the value to use as an argument to select this configuration ({@link LibusbJava#usb_set_configuration(long, int)}).
         *
         *
         * @return the value to use as an argument to select this configuration
         * @return the value to use as an argument to select this configuration
         */
         */
        public byte getBConfigurationValue() {
        public byte getBConfigurationValue() {
                return bConfigurationValue;
                return bConfigurationValue;
        }
        }
 
 
        /**
        /**
         * Returns the power parameters for this configuration.<br>
         * Returns the power parameters for this configuration.<br>
         * <br>
         * <br>
         * Bit 7: Reserved, set to 1 (USB 1.0 Bus Powered)<br>
         * Bit 7: Reserved, set to 1 (USB 1.0 Bus Powered)<br>
         * Bit 6: Self Powered<br>
         * Bit 6: Self Powered<br>
         * Bit 5: Remote Wakeup<br>
         * Bit 5: Remote Wakeup<br>
         * Bit 4..0: Reserved, set to 0
         * Bit 4..0: Reserved, set to 0
         *
         *
         * @return the power parameters for this configuration
         * @return the power parameters for this configuration
         */
         */
        public byte getBmAttributes() {
        public byte getBmAttributes() {
                return bmAttributes;
                return bmAttributes;
        }
        }
 
 
        /**
        /**
         * Returns the number of interfaces.<br>
         * Returns the number of interfaces.<br>
         *
         *
         * @return the number of interfaces
         * @return the number of interfaces
         */
         */
        public byte getBNumInterfaces() {
        public byte getBNumInterfaces() {
                return bNumInterfaces;
                return bNumInterfaces;
        }
        }
 
 
        /**
        /**
         * Returns the data of extra descriptor(s) if available.<br>
         * Returns the data of extra descriptor(s) if available.<br>
         *
         *
         * @return null or a byte array with the extra descriptor data
         * @return null or a byte array with the extra descriptor data
         */
         */
        public byte[] getExtra() {
        public byte[] getExtra() {
                return extra;
                return extra;
        }
        }
 
 
        /**
        /**
         * Returns the number of bytes of the extra descriptor.<br>
         * Returns the number of bytes of the extra descriptor.<br>
         *
         *
         * @return the number of bytes of the extra descriptor
         * @return the number of bytes of the extra descriptor
         */
         */
        public int getExtralen() {
        public int getExtralen() {
                return extralen;
                return extralen;
        }
        }
 
 
        /**
        /**
         * Returns the index of the String descriptor describing this configuration.<br>
         * Returns the index of the String descriptor describing this configuration.<br>
         *
         *
         * @return the index of the String descriptor
         * @return the index of the String descriptor
         */
         */
        public byte getIConfiguration() {
        public byte getIConfiguration() {
                return iConfiguration;
                return iConfiguration;
        }
        }
 
 
        /**
        /**
         * Returns the USB interface descriptors.<br>
         * Returns the USB interface descriptors.<br>
         *
         *
         * @return the USB interface descriptors
         * @return the USB interface descriptors
         */
         */
        public Usb_Interface[] getInterface() {
        public Usb_Interface[] getInterface() {
                return interface_;
                return interface_;
        }
        }
 
 
        /**
        /**
         * Returns the maximum power consumption in 2mA units.<br>
         * Returns the maximum power consumption in 2mA units.<br>
         *
         *
         * @return the maximum power consumption in 2mA units
         * @return the maximum power consumption in 2mA units
         */
         */
        public byte getMaxPower() {
        public byte getMaxPower() {
                return MaxPower;
                return MaxPower;
        }
        }
 
 
        /**
        /**
         * Returns the total length in bytes of all descriptors.<br>
         * Returns the total length in bytes of all descriptors.<br>
         * When the configuration descriptor is read, it returns the entire
         * When the configuration descriptor is read, it returns the entire
         * configuration hierarchy which includes all related interface and endpoint
         * configuration hierarchy which includes all related interface and endpoint
         * descriptors. The <code>wTotalLength</code> field reflects the number of
         * descriptors. The <code>wTotalLength</code> field reflects the number of
         * bytes in the hierarchy.
         * bytes in the hierarchy.
         *
         *
         * @return the total length in bytes of all descriptors
         * @return the total length in bytes of all descriptors
         */
         */
        public short getWTotalLength() {
        public short getWTotalLength() {
                return wTotalLength;
                return wTotalLength;
        }
        }
 
 
        @Override
        @Override
        public String toString() {
        public String toString() {
                return "Usb_Config_Descriptor bNumInterfaces: 0x"
                return "Usb_Config_Descriptor bNumInterfaces: 0x"
                                + Integer.toHexString(bNumInterfaces);
                                + Integer.toHexString(bNumInterfaces);
        }
        }
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.