summaryrefslogtreecommitdiffstats
path: root/lib/lufa/Demos/Device/LowLevel/BulkVendor
diff options
context:
space:
mode:
authorJack Humbert <jack.humb@gmail.com>2017-07-07 11:55:23 -0400
committerJack Humbert <jack.humb@gmail.com>2017-07-07 11:55:23 -0400
commit8655d4f4948b2deef7844503c8d690f23ac1a062 (patch)
treeb2c6effc9d6cd5b5b43933a1e53b8bf17e9e82cf /lib/lufa/Demos/Device/LowLevel/BulkVendor
parent1896c76a2928c96f9ab7947bec2ef8dd37623cff (diff)
parent60b30c036397cb5627fa374bb930794b225daa29 (diff)
Merge commit '60b30c036397cb5627fa374bb930794b225daa29' as 'lib/lufa'
Diffstat (limited to 'lib/lufa/Demos/Device/LowLevel/BulkVendor')
-rw-r--r--lib/lufa/Demos/Device/LowLevel/BulkVendor/BulkVendor.c136
-rw-r--r--lib/lufa/Demos/Device/LowLevel/BulkVendor/BulkVendor.h76
-rw-r--r--lib/lufa/Demos/Device/LowLevel/BulkVendor/BulkVendor.txt69
-rw-r--r--lib/lufa/Demos/Device/LowLevel/BulkVendor/Config/LUFAConfig.h126
-rw-r--r--lib/lufa/Demos/Device/LowLevel/BulkVendor/Descriptors.c194
-rw-r--r--lib/lufa/Demos/Device/LowLevel/BulkVendor/Descriptors.h96
-rw-r--r--lib/lufa/Demos/Device/LowLevel/BulkVendor/HostTestApp/test_bulk_vendor.py67
-rw-r--r--lib/lufa/Demos/Device/LowLevel/BulkVendor/WindowsDriver/LUFA_Bulk_Vendor_Demo.infbin0 -> 8150 bytes
-rw-r--r--lib/lufa/Demos/Device/LowLevel/BulkVendor/WindowsDriver/amd64/libusb0.dllbin0 -> 76384 bytes
-rw-r--r--lib/lufa/Demos/Device/LowLevel/BulkVendor/WindowsDriver/amd64/libusb0.sysbin0 -> 52832 bytes
-rw-r--r--lib/lufa/Demos/Device/LowLevel/BulkVendor/WindowsDriver/ia64/libusb0.dllbin0 -> 157792 bytes
-rw-r--r--lib/lufa/Demos/Device/LowLevel/BulkVendor/WindowsDriver/ia64/libusb0.sysbin0 -> 110176 bytes
-rw-r--r--lib/lufa/Demos/Device/LowLevel/BulkVendor/WindowsDriver/installer_x64.exebin0 -> 25088 bytes
-rw-r--r--lib/lufa/Demos/Device/LowLevel/BulkVendor/WindowsDriver/installer_x86.exebin0 -> 23552 bytes
-rw-r--r--lib/lufa/Demos/Device/LowLevel/BulkVendor/WindowsDriver/license/libusb0/installer_license.txt851
-rw-r--r--lib/lufa/Demos/Device/LowLevel/BulkVendor/WindowsDriver/x86/libusb0.sysbin0 -> 42592 bytes
-rw-r--r--lib/lufa/Demos/Device/LowLevel/BulkVendor/WindowsDriver/x86/libusb0_x86.dllbin0 -> 67680 bytes
-rw-r--r--lib/lufa/Demos/Device/LowLevel/BulkVendor/asf.xml61
-rw-r--r--lib/lufa/Demos/Device/LowLevel/BulkVendor/doxyfile2397
-rw-r--r--lib/lufa/Demos/Device/LowLevel/BulkVendor/makefile43
20 files changed, 4116 insertions, 0 deletions
diff --git a/lib/lufa/Demos/Device/LowLevel/BulkVendor/BulkVendor.c b/lib/lufa/Demos/Device/LowLevel/BulkVendor/BulkVendor.c
new file mode 100644
index 0000000000..fe7ad84bbb
--- /dev/null
+++ b/lib/lufa/Demos/Device/LowLevel/BulkVendor/BulkVendor.c
@@ -0,0 +1,136 @@
+/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2017.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.lufa-lib.org
+*/
+
+/*
+ Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that the copyright notice and this
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
+ software without specific, written prior permission.
+
+ The author disclaims all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ in an action of contract, negligence or other tortious action,
+ arising out of or in connection with the use or performance of
+ this software.
+*/
+
+/** \file
+ *
+ * Main source file for the Bulk Vendor demo. This file contains the main tasks of the demo and
+ * is responsible for the initial application hardware configuration.
+ */
+
+#define INCLUDE_FROM_BULKVENDOR_C
+#include "BulkVendor.h"
+
+
+/** Main program entry point. This routine configures the hardware required by the application, then
+ * enters a loop to run the application tasks in sequence.
+ */
+int main(void)
+{
+ SetupHardware();
+
+ LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
+ GlobalInterruptEnable();
+
+ for (;;)
+ {
+ USB_USBTask();
+
+ uint8_t ReceivedData[VENDOR_IO_EPSIZE];
+ memset(ReceivedData, 0x00, sizeof(ReceivedData));
+
+ Endpoint_SelectEndpoint(VENDOR_OUT_EPADDR);
+ if (Endpoint_IsOUTReceived())
+ {
+ Endpoint_Read_Stream_LE(ReceivedData, VENDOR_IO_EPSIZE, NULL);
+ Endpoint_ClearOUT();
+
+ Endpoint_SelectEndpoint(VENDOR_IN_EPADDR);
+ Endpoint_Write_Stream_LE(ReceivedData, VENDOR_IO_EPSIZE, NULL);
+ Endpoint_ClearIN();
+ }
+ }
+}
+
+/** Configures the board hardware and chip peripherals for the demo's functionality. */
+void SetupHardware(void)
+{
+#if (ARCH == ARCH_AVR8)
+ /* Disable watchdog if enabled by bootloader/fuses */
+ MCUSR &= ~(1 << WDRF);
+ wdt_disable();
+
+ /* Disable clock division */
+ clock_prescale_set(clock_div_1);
+#elif (ARCH == ARCH_XMEGA)
+ /* Start the PLL to multiply the 2MHz RC oscillator to 32MHz and switch the CPU core to run from it */
+ XMEGACLK_StartPLL(CLOCK_SRC_INT_RC2MHZ, 2000000, F_CPU);
+ XMEGACLK_SetCPUClockSource(CLOCK_SRC_PLL);
+
+ /* Start the 32MHz internal RC oscillator and start the DFLL to increase it to 48MHz using the USB SOF as a reference */
+ XMEGACLK_StartInternalOscillator(CLOCK_SRC_INT_RC32MHZ);
+ XMEGACLK_StartDFLL(CLOCK_SRC_INT_RC32MHZ, DFLL_REF_INT_USBSOF, F_USB);
+
+ PMIC.CTRL = PMIC_LOLVLEN_bm | PMIC_MEDLVLEN_bm | PMIC_HILVLEN_bm;
+#endif
+
+ /* Hardware Initialization */
+ LEDs_Init();
+ USB_Init();
+}
+
+/** Event handler for the USB_Connect event. This indicates that the device is enumerating via the status LEDs. */
+void EVENT_USB_Device_Connect(void)
+{
+ /* Indicate USB enumerating */
+ LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
+}
+
+/** Event handler for the USB_Disconnect event. This indicates that the device is no longer connected to a host via
+ * the status LEDs.
+ */
+void EVENT_USB_Device_Disconnect(void)
+{
+ /* Indicate USB not ready */
+ LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
+}
+
+/** Event handler for the USB_ConfigurationChanged event. This is fired when the host set the current configuration
+ * of the USB device after enumeration - the device endpoints are configured.
+ */
+void EVENT_USB_Device_ConfigurationChanged(void)
+{
+ bool ConfigSuccess = true;
+
+ /* Setup Vendor Data Endpoints */
+ ConfigSuccess &= Endpoint_ConfigureEndpoint(VENDOR_IN_EPADDR, EP_TYPE_BULK, VENDOR_IO_EPSIZE, 1);
+ ConfigSuccess &= Endpoint_ConfigureEndpoint(VENDOR_OUT_EPADDR, EP_TYPE_BULK, VENDOR_IO_EPSIZE, 1);
+
+ /* Indicate endpoint configuration success or failure */
+ LEDs_SetAllLEDs(ConfigSuccess ? LEDMASK_USB_READY : LEDMASK_USB_ERROR);
+}
+
+/** Event handler for the USB_ControlRequest event. This is used to catch and process control requests sent to
+ * the device from the USB host before passing along unhandled control requests to the library for processing
+ * internally.
+ */
+void EVENT_USB_Device_ControlRequest(void)
+{
+ // Process vendor specific control requests here
+}
diff --git a/lib/lufa/Demos/Device/LowLevel/BulkVendor/BulkVendor.h b/lib/lufa/Demos/Device/LowLevel/BulkVendor/BulkVendor.h
new file mode 100644
index 0000000000..3d74ac001a
--- /dev/null
+++ b/lib/lufa/Demos/Device/LowLevel/BulkVendor/BulkVendor.h
@@ -0,0 +1,76 @@
+/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2017.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.lufa-lib.org
+*/
+
+/*
+ Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that the copyright notice and this
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
+ software without specific, written prior permission.
+
+ The author disclaims all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ in an action of contract, negligence or other tortious action,
+ arising out of or in connection with the use or performance of
+ this software.
+*/
+
+/** \file
+ *
+ * Header file for BulkVendor.c.
+ */
+
+#ifndef _BULK_VENDOR_H_
+#define _BULK_VENDOR_H_
+
+ /* Includes: */
+ #include <avr/io.h>
+ #include <avr/wdt.h>
+ #include <avr/power.h>
+ #include <avr/interrupt.h>
+
+ #include "Descriptors.h"
+
+ #include <LUFA/Drivers/USB/USB.h>
+ #include <LUFA/Drivers/Board/LEDs.h>
+ #include <LUFA/Platform/Platform.h>
+
+ /* Macros: */
+ /** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
+ #define LEDMASK_USB_NOTREADY LEDS_LED1
+
+ /** LED mask for the library LED driver, to indicate that the USB interface is enumerating. */
+ #define LEDMASK_USB_ENUMERATING (LEDS_LED2 | LEDS_LED3)
+
+ /** LED mask for the library LED driver, to indicate that the USB interface is ready. */
+ #define LEDMASK_USB_READY (LEDS_LED2 | LEDS_LED4)
+
+ /** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */
+ #define LEDMASK_USB_ERROR (LEDS_LED1 | LEDS_LED3)
+
+ /** LED mask for the library LED driver, to indicate that the USB interface is busy. */
+ #define LEDMASK_USB_BUSY LEDS_LED2
+
+ /* Function Prototypes: */
+ void SetupHardware(void);
+
+ void EVENT_USB_Device_Connect(void);
+ void EVENT_USB_Device_Disconnect(void);
+ void EVENT_USB_Device_ConfigurationChanged(void);
+ void EVENT_USB_Device_ControlRequest(void);
+
+#endif
+
diff --git a/lib/lufa/Demos/Device/LowLevel/BulkVendor/BulkVendor.txt b/lib/lufa/Demos/Device/LowLevel/BulkVendor/BulkVendor.txt
new file mode 100644
index 0000000000..d6688a9cdf
--- /dev/null
+++ b/lib/lufa/Demos/Device/LowLevel/BulkVendor/BulkVendor.txt
@@ -0,0 +1,69 @@
+/** \file
+ *
+ * This file contains special DoxyGen information for the generation of the main page and other special
+ * documentation pages. It is not a project source file.
+ */
+
+/** \mainpage Bulk Vendor Device Demo
+ *
+ * \section Sec_Compat Demo Compatibility:
+ *
+ * The following list indicates what microcontrollers are compatible with this demo.
+ *
+ * \li Series 7 USB AVRs (AT90USBxxx7)
+ * \li Series 6 USB AVRs (AT90USBxxx6)
+ * \li Series 4 USB AVRs (ATMEGAxxU4)
+ * \li Series 2 USB AVRs (AT90USBxx2, ATMEGAxxU2)
+ * \li Series AU XMEGA AVRs (ATXMEGAxxxAxU)
+ * \li Series B XMEGA AVRs (ATXMEGAxxxBx)
+ * \li Series C XMEGA AVRs (ATXMEGAxxxCx)
+ *
+ * \section Sec_Info USB Information:
+ *
+ * The following table gives a rundown of the USB utilization of this demo.
+ *
+ * <table>
+ * <tr>
+ * <td><b>USB Mode:</b></td>
+ * <td>Device</td>
+ * </tr>
+ * <tr>
+ * <td><b>USB Class:</b></td>
+ * <td>Vendor (no official class)</td>
+ * </tr>
+ * <tr>
+ * <td><b>USB Subclass:</b></td>
+ * <td>Vendor (no official subclass)</td>
+ * </tr>
+ * <tr>
+ * <td><b>Relevant Standards:</b></td>
+ * <td>None</td>
+ * </tr>
+ * <tr>
+ * <td><b>Supported USB Speeds:</b></td>
+ * <td>Full Speed Mode</td>
+ * </tr>
+ * </table>
+ *
+ * \section Sec_Description Project Description:
+ *
+ * Bulk Vendor demonstration application. This gives a simple reference
+ * application for implementing a USB device that contains read/write bulk type
+ * endpoints, for implementing custom USB protocols.
+ *
+ * On start-up the system will automatically enumerate and echo back packets
+ * sent from the host.
+ *
+ * \section Sec_Options Project Options
+ *
+ * The following defines can be found in this demo, which can control the demo behaviour when defined, or changed in value.
+ *
+ * <table>
+ * <tr>
+ * <td>
+ * None
+ * </td>
+ * </tr>
+ * </table>
+ */
+
diff --git a/lib/lufa/Demos/Device/LowLevel/BulkVendor/Config/LUFAConfig.h b/lib/lufa/Demos/Device/LowLevel/BulkVendor/Config/LUFAConfig.h
new file mode 100644
index 0000000000..0ec4635eb0
--- /dev/null
+++ b/lib/lufa/Demos/Device/LowLevel/BulkVendor/Config/LUFAConfig.h
@@ -0,0 +1,126 @@
+/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2017.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.lufa-lib.org
+*/
+
+/*
+ Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that the copyright notice and this
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
+ software without specific, written prior permission.
+
+ The author disclaims all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ in an action of contract, negligence or other tortious action,
+ arising out of or in connection with the use or performance of
+ this software.
+*/
+
+/** \file
+ * \brief LUFA Library Configuration Header File
+ *
+ * This header file is used to configure LUFA's compile time options,
+ * as an alternative to the compile time constants supplied through
+ * a makefile.
+ *
+ * For information on what each token does, refer to the LUFA
+ * manual section "Summary of Compile Tokens".
+ */
+
+#ifndef _LUFA_CONFIG_H_
+#define _LUFA_CONFIG_H_
+
+ #if (ARCH == ARCH_AVR8)
+
+ /* Non-USB Related Configuration Tokens: */
+// #define DISABLE_TERMINAL_CODES
+
+ /* USB Class Driver Related Tokens: */
+// #define HID_HOST_BOOT_PROTOCOL_ONLY
+// #define HID_STATETABLE_STACK_DEPTH {Insert Value Here}
+// #define HID_USAGE_STACK_DEPTH {Insert Value Here}
+// #define HID_MAX_COLLECTIONS {Insert Value Here}
+// #define HID_MAX_REPORTITEMS {Insert Value Here}
+// #define HID_MAX_REPORT_IDS {Insert Value Here}
+// #define NO_CLASS_DRIVER_AUTOFLUSH
+
+ /* General USB Driver Related Tokens: */
+// #define ORDERED_EP_CONFIG
+ #define USE_STATIC_OPTIONS (USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)
+ #define USB_DEVICE_ONLY
+// #define USB_HOST_ONLY
+// #define USB_STREAM_TIMEOUT_MS {Insert Value Here}
+// #define NO_LIMITED_CONTROLLER_CONNECT
+// #define NO_SOF_EVENTS
+
+ /* USB Device Mode Driver Related Tokens: */
+// #define USE_RAM_DESCRIPTORS
+ #define USE_FLASH_DESCRIPTORS
+// #define USE_EEPROM_DESCRIPTORS
+// #define NO_INTERNAL_SERIAL
+ #define FIXED_CONTROL_ENDPOINT_SIZE 8
+// #define DEVICE_STATE_AS_GPIOR {Insert Value Here}
+ #define FIXED_NUM_CONFIGURATIONS 1
+// #define CONTROL_ONLY_DEVICE
+ #define INTERRUPT_CONTROL_ENDPOINT
+// #define NO_DEVICE_REMOTE_WAKEUP
+// #define NO_DEVICE_SELF_POWER
+
+ /* USB Host Mode Driver Related Tokens: */
+// #define HOST_STATE_AS_GPIOR {Insert Value Here}
+// #define USB_HOST_TIMEOUT_MS {Insert Value Here}
+// #define HOST_DEVICE_SETTLE_DELAY_MS {Insert Value Here}
+// #define NO_AUTO_VBUS_MANAGEMENT
+// #define INVERTED_VBUS_ENABLE_LINE
+
+ #elif (ARCH == ARCH_XMEGA)
+
+ /* Non-USB Related Configuration Tokens: */
+// #define DISABLE_TERMINAL_CODES
+
+ /* USB Class Driver Related Tokens: */
+// #define HID_HOST_BOOT_PROTOCOL_ONLY
+// #define HID_STATETABLE_STACK_DEPTH {Insert Value Here}
+// #define HID_USAGE_STACK_DEPTH {Insert Value Here}
+// #define HID_MAX_COLLECTIONS {Insert Value Here}
+// #define HID_MAX_REPORTITEMS {Insert Value Here}
+// #define HID_MAX_REPORT_IDS {Insert Value Here}
+// #define NO_CLASS_DRIVER_AUTOFLUSH
+
+ /* General USB Driver Related Tokens: */
+ #define USE_STATIC_OPTIONS (USB_DEVICE_OPT_FULLSPEED | USB_OPT_RC32MCLKSRC | USB_OPT_BUSEVENT_PRIHIGH)
+// #define USB_STREAM_TIMEOUT_MS {Insert Value Here}
+// #define NO_LIMITED_CONTROLLER_CONNECT
+// #define NO_SOF_EVENTS
+
+ /* USB Device Mode Driver Related Tokens: */
+// #define USE_RAM_DESCRIPTORS
+ #define USE_FLASH_DESCRIPTORS
+// #define USE_EEPROM_DESCRIPTORS
+// #define NO_INTERNAL_SERIAL
+ #define FIXED_CONTROL_ENDPOINT_SIZE 8
+// #define DEVICE_STATE_AS_GPIOR {Insert Value Here}
+ #define FIXED_NUM_CONFIGURATIONS 1
+// #define CONTROL_ONLY_DEVICE
+ #define MAX_ENDPOINT_INDEX 4
+// #define NO_DEVICE_REMOTE_WAKEUP
+// #define NO_DEVICE_SELF_POWER
+
+ #else
+
+ #error Unsupported architecture for this LUFA configuration file.
+
+ #endif
+#endif
diff --git a/lib/lufa/Demos/Device/LowLevel/BulkVendor/Descriptors.c b/lib/lufa/Demos/Device/LowLevel/BulkVendor/Descriptors.c
new file mode 100644
index 0000000000..9a4c2792b5
--- /dev/null
+++ b/lib/lufa/Demos/Device/LowLevel/BulkVendor/Descriptors.c
@@ -0,0 +1,194 @@
+/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2017.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.lufa-lib.org
+*/
+
+/*
+ Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that the copyright notice and this
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
+ software without specific, written prior permission.
+
+ The author disclaims all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ in an action of contract, negligence or other tortious action,
+ arising out of or in connection with the use or performance of
+ this software.
+*/
+
+/** \file
+ *
+ * USB Device Descriptors, for library use when in USB device mode. Descriptors are special
+ * computer-readable structures which the host requests upon device enumeration, to determine
+ * the device's capabilities and functions.
+ */
+
+#include "Descriptors.h"
+
+
+/** Device descriptor structure. This descriptor, located in FLASH memory, describes the overall
+ * device characteristics, including the supported USB version, control endpoint size and the
+ * number of device configurations. The descriptor is read out by the USB host when the enumeration
+ * process begins.
+ */
+const USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
+{
+ .Header = {.Size = sizeof(USB_Descriptor_Device_t), .Type = DTYPE_Device},
+
+ .USBSpecification = VERSION_BCD(1,1,0),
+ .Class = USB_CSCP_NoDeviceClass,
+ .SubClass = USB_CSCP_NoDeviceSubclass,
+ .Protocol = USB_CSCP_NoDeviceProtocol,
+
+ .Endpoint0Size = FIXED_CONTROL_ENDPOINT_SIZE,
+
+ .VendorID = 0x03EB,
+ .ProductID = 0x206C,
+ .ReleaseNumber = VERSION_BCD(0,0,1),
+
+ .ManufacturerStrIndex = STRING_ID_Manufacturer,
+ .ProductStrIndex = STRING_ID_Product,
+ .SerialNumStrIndex = USE_INTERNAL_SERIAL,
+
+ .NumberOfConfigurations = FIXED_NUM_CONFIGURATIONS
+};
+
+/** Configuration descriptor structure. This descriptor, located in FLASH memory, describes the usage
+ * of the device in one of its supported configurations, including information about any device interfaces
+ * and endpoints. The descriptor is read out by the USB host during the enumeration process when selecting
+ * a configuration so that the host may correctly communicate with the USB device.
+ */
+const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
+{
+ .Config =
+ {
+ .Header = {.Size = sizeof(USB_Descriptor_Configuration_Header_t), .Type = DTYPE_Configuration},
+
+ .TotalConfigurationSize = sizeof(USB_Descriptor_Configuration_t),
+ .TotalInterfaces = 1,
+
+ .ConfigurationNumber = 1,
+ .ConfigurationStrIndex = NO_DESCRIPTOR,
+
+ .ConfigAttributes = USB_CONFIG_ATTR_RESERVED,
+
+ .MaxPowerConsumption = USB_CONFIG_POWER_MA(100)
+ },
+
+ .Vendor_Interface =
+ {
+ .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
+
+ .InterfaceNumber = INTERFACE_ID_Vendor,
+ .AlternateSetting = 0,
+
+ .TotalEndpoints = 2,
+
+ .Class = 0xFF,
+ .SubClass = 0xFF,
+ .Protocol = 0xFF,
+
+ .InterfaceStrIndex = NO_DESCRIPTOR
+ },
+
+ .Vendor_DataInEndpoint =
+ {
+ .Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
+
+ .EndpointAddress = VENDOR_IN_EPADDR,
+ .Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
+ .EndpointSize = VENDOR_IO_EPSIZE,
+ .PollingIntervalMS = 0x05
+ },
+
+ .Vendor_DataOutEndpoint =
+ {
+ .Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
+
+ .EndpointAddress = VENDOR_OUT_EPADDR,
+ .Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
+ .EndpointSize = VENDOR_IO_EPSIZE,
+ .PollingIntervalMS = 0x05
+ }
+};
+
+/** Language descriptor structure. This descriptor, located in FLASH memory, is returned when the host requests
+ * the string descriptor with index 0 (the first index). It is actually an array of 16-bit integers, which indicate
+ * via the language ID table available at USB.org what languages the device supports for its string descriptors.
+ */
+const USB_Descriptor_String_t PROGMEM LanguageString = USB_STRING_DESCRIPTOR_ARRAY(LANGUAGE_ID_ENG);
+
+/** Manufacturer descriptor string. This is a Unicode string containing the manufacturer's details in human readable
+ * form, and is read out upon request by the host when the appropriate string ID is requested, listed in the Device
+ * Descriptor.
+ */
+const USB_Descriptor_String_t PROGMEM ManufacturerString = USB_STRING_DESCRIPTOR(L"Dean Camera");
+
+/** Product descriptor string. This is a Unicode string containing the product's details in human readable form,
+ * and is read out upon request by the host when the appropriate string ID is requested, listed in the Device
+ * Descriptor.
+ */
+const USB_Descriptor_String_t PROGMEM ProductString = USB_STRING_DESCRIPTOR(L"LUFA Bulk Vendor Demo");
+
+/** This function is called by the library when in device mode, and must be overridden (see library "USB Descriptors"
+ * documentation) by the application code so that the address and size of a requested descriptor can be given
+ * to the USB library. When the device receives a Get Descriptor request on the control endpoint, this function
+ * is called so that the descriptor details can be passed back and the appropriate descriptor sent back to the
+ * USB host.
+ */
+uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
+ const uint16_t wIndex,
+ const void** const DescriptorAddress)
+{
+ const uint8_t DescriptorType = (wValue >> 8);
+ const uint8_t DescriptorNumber = (wValue & 0xFF);
+
+ const void* Address = NULL;
+ uint16_t Size = NO_DESCRIPTOR;
+
+ switch (DescriptorType)
+ {
+ case DTYPE_Device:
+ Address = &DeviceDescriptor;
+ Size = sizeof(USB_Descriptor_Device_t);
+ break;
+ case DTYPE_Configuration:
+ Address = &ConfigurationDescriptor;
+ Size = sizeof(USB_Descriptor_Configuration_t);
+ break;
+ case DTYPE_String:
+ switch (DescriptorNumber)
+ {
+ case STRING_ID_Language:
+ Address = &LanguageString;
+ Size = pgm_read_byte(&LanguageString.Header.Size);
+ break;
+ case STRING_ID_Manufacturer:
+ Address = &ManufacturerString;
+ Size = pgm_read_byte(&ManufacturerString.Header.Size);
+ break;
+ case STRING_ID_Product:
+ Address = &ProductString;
+ Size = pgm_read_byte(&ProductString.Header.Size);
+ break;
+ }
+
+ break;
+ }
+
+ *DescriptorAddress = Address;
+ return Size;
+}
+
diff --git a/lib/lufa/Demos/Device/LowLevel/BulkVendor/Descriptors.h b/lib/lufa/Demos/Device/LowLevel/BulkVendor/Descriptors.h
new file mode 100644
index 0000000000..939717ea3f
--- /dev/null
+++ b/lib/lufa/Demos/Device/LowLevel/BulkVendor/Descriptors.h
@@ -0,0 +1,96 @@
+/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2017.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.lufa-lib.org
+*/
+
+/*
+ Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that the copyright notice and this
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
+ software without specific, written prior permission.
+
+ The author disclaims all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ in an action of contract, negligence or other tortious action,
+ arising out of or in connection with the use or performance of
+ this software.
+*/
+
+/** \file
+ *
+ * Header file for Descriptors.c.
+ */
+
+#ifndef _DESCRIPTORS_H_
+#define _DESCRIPTORS_H_
+
+ /* Includes: */
+ #include <LUFA/Drivers/USB/USB.h>
+
+ #include <avr/pgmspace.h>
+
+ /* Macros: */
+ /** Endpoint address of the Bulk Vendor device-to-host data IN endpoint. */
+ #define VENDOR_IN_EPADDR (ENDPOINT_DIR_IN | 3)
+
+ /** Endpoint address of the Bulk Vendor host-to-device data OUT endpoint. */
+ #define VENDOR_OUT_EPADDR (ENDPOINT_DIR_OUT | 4)
+
+ /** Size in bytes of the Bulk Vendor data endpoints. */
+ #define VENDOR_IO_EPSIZE 64
+
+ /* Type Defines: */
+ /** Type define for the device configuration descriptor structure. This must be defined in the
+ * application code, as the configuration descriptor contains several sub-descriptors which
+ * vary between devices, and which describe the device's usage to the host.
+ */
+ typedef struct
+ {
+ USB_Descriptor_Configuration_Header_t Config;
+
+ // Vendor Interface
+ USB_Descriptor_Interface_t Vendor_Interface;
+ USB_Descriptor_Endpoint_t Vendor_DataInEndpoint;
+ USB_Descriptor_Endpoint_t Vendor_DataOutEndpoint;
+ } USB_Descriptor_Configuration_t;
+
+ /** Enum for the device interface descriptor IDs within the device. Each interface descriptor
+ * should have a unique ID index associated with it, which can be used to refer to the
+ * interface from other descriptors.
+ */
+ enum InterfaceDescriptors_t
+ {
+ INTERFACE_ID_Vendor = 0, /**< Vendor interface descriptor ID */
+ };
+
+ /** Enum for the device string descriptor IDs within the device. Each string descriptor should
+ * have a unique ID index associated with it, which can be used to refer to the string from
+ * other descriptors.
+ */
+ enum StringDescriptors_t
+ {
+ STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */
+ STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */
+ STRING_ID_Product = 2, /**< Product string ID */
+ };
+
+ /* Function Prototypes: */
+ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
+ const uint16_t wIndex,
+ const void** const DescriptorAddress)
+ ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
+
+#endif
+
diff --git a/lib/lufa/Demos/Device/LowLevel/BulkVendor/HostTestApp/test_bulk_vendor.py b/lib/lufa/Demos/Device/LowLevel/BulkVendor/HostTestApp/test_bulk_vendor.py
new file mode 100644
index 0000000000..fff8ecd780
--- /dev/null
+++ b/lib/lufa/Demos/Device/LowLevel/BulkVendor/HostTestApp/test_bulk_vendor.py
@@ -0,0 +1,67 @@
+"""
+ LUFA Library
+ Copyright (C) Dean Camera, 2017.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.lufa-lib.org
+"""
+
+"""
+ LUFA Bulk Vendor device demo host test script. This script will send and
+ receive a continuous stream of packets to/from to the device, to show
+ bidirectional communications.
+
+ Requires the pyUSB library (http://sourceforge.net/projects/pyusb/).
+"""
+
+import sys
+from time import sleep
+import usb.core
+import usb.util
+
+# Bulk Vendor HID device VID and PID
+device_vid = 0x03EB
+device_pid = 0x206C
+device_in_ep = 3
+device_out_ep = 4
+
+
+def get_vendor_device_handle():
+ dev_handle = usb.core.find(idVendor=device_vid, idProduct=device_pid)
+ return dev_handle
+
+
+def write(device, packet):
+ device.write(usb.util.ENDPOINT_OUT | device_out_ep, packet, 0, 1000)
+ print("Sent Packet: {0}".format(packet))
+
+
+def read(device):
+ packet = device.read(usb.util.ENDPOINT_IN | device_in_ep, 64, 0, 1000)
+ print("Received Packet: {0}".format(''.join([chr(x) for x in packet])))
+ return packet
+
+
+def main():
+ vendor_device = get_vendor_device_handle()
+
+ if vendor_device is None:
+ print("No valid Vendor device found.")
+ sys.exit(1)
+
+ vendor_device.set_configuration()
+
+ print("Connected to device 0x%04X/0x%04X - %s [%s]" %
+ (vendor_device.idVendor, vendor_device.idProduct,
+ usb.util.get_string(vendor_device, 255, vendor_device.iProduct),
+ usb.util.get_string(vendor_device, 255, vendor_device.iManufacturer)))
+
+ x = 0
+ while 1:
+ x = x + 1 % 255
+ write(vendor_device, "TEST PACKET %d" % x)
+ read(vendor_device)
+ sleep(1)
+
+if __name__ == '__main__':
+ main()
diff --git a/lib/lufa/Demos/Device/LowLevel/BulkVendor/WindowsDriver/LUFA_Bulk_Vendor_Demo.inf b/lib/lufa/Demos/Device/LowLevel/BulkVendor/WindowsDriver/LUFA_Bulk_Vendor_Demo.inf
new file mode 100644
index 0000000000..32a29fdc50
--- /dev/null
+++ b/lib/lufa/Demos/Device/LowLevel/BulkVendor/WindowsDriver/LUFA_Bulk_Vendor_Demo.inf
Binary files differ
diff --git a/lib/lufa/Demos/Device/LowLevel/BulkVendor/WindowsDriver/amd64/libusb0.dll b/lib/lufa/Demos/Device/LowLevel/BulkVendor/WindowsDriver/amd64/libusb0.dll
new file mode 100644
index 0000000000..f916b08986
--- /dev/null
+++ b/lib/lufa/Demos/Device/LowLevel/BulkVendor/WindowsDriver/amd64/libusb0.dll
Binary files differ
diff --git a/lib/lufa/Demos/Device/LowLevel/BulkVendor/WindowsDriver/amd64/libusb0.sys b/lib/lufa/Demos/Device/LowLevel/BulkVendor/WindowsDriver/amd64/libusb0.sys
new file mode 100644
index 0000000000..0718dfb7c0
--- /dev/null
+++ b/lib/lufa/Demos/Device/LowLevel/BulkVendor/WindowsDriver/amd64/libusb0.sys
Binary files differ
diff --git a/lib/lufa/Demos/Device/LowLevel/BulkVendor/WindowsDriver/ia64/libusb0.dll b/lib/lufa/Demos/Device/LowLevel/BulkVendor/WindowsDriver/ia64/libusb0.dll
new file mode 100644
index 0000000000..292df27857
--- /dev/null
+++ b/lib/lufa/Demos/Device/LowLevel/BulkVendor/WindowsDriver/ia64/libusb0.dll
Binary files differ
diff --git a/lib/lufa/Demos/Device/LowLevel/BulkVendor/WindowsDriver/ia64/libusb0.sys b/lib/lufa/Demos/Device/LowLevel/BulkVendor/WindowsDriver/ia64/libusb0.sys
new file mode 100644
index 0000000000..f17914b8c4
--- /dev/null
+++ b/lib/lufa/Demos/Device/LowLevel/BulkVendor/WindowsDriver/ia64/libusb0.sys
Binary files differ
diff