Mercurial > ecos
changeset 2577:de43e04cf3a5
* cdl/usbs_serial.cdl:
* src/usbs_serial.c (usb_configuration): Add to enumeration if the
device is bus powered or self powered, and what power it will
draw
| author | asl |
|---|---|
| date | Mon, 03 Nov 2008 08:43:17 +0000 |
| parents | 4e10fbeb81fd |
| children | 96280a58fefb |
| files | packages/io/usb/serial/slave/current/ChangeLog packages/io/usb/serial/slave/current/cdl/usbs_serial.cdl packages/io/usb/serial/slave/current/src/usbs_serial.c |
| diffstat | 3 files changed, 38 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/packages/io/usb/serial/slave/current/ChangeLog +++ b/packages/io/usb/serial/slave/current/ChangeLog @@ -1,3 +1,10 @@ +2008-11-03 Gabor Toeroek <tgabor84@gmail.com> + + * cdl/usbs_serial.cdl: + * src/usbs_serial.c (usb_configuration): Add to enumeration if the + device is bus powered or self powered, and what power it will + draw. + 2008-08-09 Frank Pagliughi <fpagliughi@mindspring.com> * host/linux/ecos_usbserial.c (ecos_usbserial_probe): fix compiling
--- a/packages/io/usb/serial/slave/current/cdl/usbs_serial.cdl +++ b/packages/io/usb/serial/slave/current/cdl/usbs_serial.cdl @@ -191,6 +191,32 @@ cdl_package CYGPKG_IO_USB_SLAVE_SERIAL { is first plugged into the host." } + cdl_option CYGOPT_IO_USB_SLAVE_SERIAL_BUSPOWERED { + display "The Device is bus powered" + default_value 0 + flavor bool + description " + Tells the host whether the Device is a bus powered + device or a self powered device." + } + cdl_option CYGNUM_IO_USB_SLAVE_SERIAL_CURRENTDRAW { + display "Maximum current (in mA) drawn from USB bus" + flavor data + default_value 100 + legal_values 1 to 500 + requires { (CYGNUM_IO_USB_SLAVE_SERIAL_CURRENTDRAW > 100) + implies CYGBLD_IO_USB_SLAVE_SERIAL_BUSPOWERED } + description " + The maximum current drawn by the Device from the USB bus. + It should report the peak value. A self powered device + can draw up to 100mA, a bus powered device can draw up to + 500mA. (If it is sometimes below 100mA and sometimes over, + then a tranition could be done at runtime between self and + bus powered modes, but that would be complicated and the + device would have to return from configured to addressed + state. For details, see the USB specification.)" + } + cdl_option CYGBLD_IO_USB_SLAVE_SERIAL_DEBUG { display "Enable debug output from the driver" default_value 0
--- a/packages/io/usb/serial/slave/current/src/usbs_serial.c +++ b/packages/io/usb/serial/slave/current/src/usbs_serial.c @@ -126,9 +126,13 @@ static const usb_configuration_descripto number_interfaces: USBS_SERIAL_NUM_IFACE, configuration_id: 1, configuration_str: 0, +#ifdef CYGOPT_IO_USB_SLAVE_SERIAL_BUSPOWERED + attributes: (USB_CONFIGURATION_DESCRIPTOR_ATTR_REQUIRED), +#else attributes: (USB_CONFIGURATION_DESCRIPTOR_ATTR_REQUIRED | USB_CONFIGURATION_DESCRIPTOR_ATTR_SELF_POWERED), - max_power: 50 +#endif + max_power: (CYGNUM_IO_USB_SLAVE_SERIAL_CURRENTDRAW+1)/2 }; // ----- Interface Descriptor -----
