summaryrefslogtreecommitdiff
path: root/at91lib
diff options
context:
space:
mode:
Diffstat (limited to 'at91lib')
-rw-r--r--at91lib/usb/device/cdc-serial/CDCDSerialDriver.c300
-rw-r--r--at91lib/usb/device/cdc-serial/CDCDSerialDriver.h117
-rw-r--r--at91lib/usb/device/cdc-serial/CDCDSerialDriverDescriptors.c625
-rw-r--r--at91lib/usb/device/cdc-serial/CDCDSerialDriverDescriptors.h77
4 files changed, 1119 insertions, 0 deletions
diff --git a/at91lib/usb/device/cdc-serial/CDCDSerialDriver.c b/at91lib/usb/device/cdc-serial/CDCDSerialDriver.c
new file mode 100644
index 0000000..3e58592
--- /dev/null
+++ b/at91lib/usb/device/cdc-serial/CDCDSerialDriver.c
@@ -0,0 +1,300 @@
+/* ----------------------------------------------------------------------------
+ * ATMEL Microcontroller Software Support
+ * ----------------------------------------------------------------------------
+ * Copyright (c) 2008, Atmel Corporation
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * - Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the disclaimer below.
+ *
+ * Atmel's name may not be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
+ * DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
+ * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * ----------------------------------------------------------------------------
+ */
+
+/*
+ Title: CDCDSerialDriver implementation
+
+ About: Purpose
+ Implementation of the CDCDSerialDriver class methods.
+*/
+
+//------------------------------------------------------------------------------
+// Headers
+//------------------------------------------------------------------------------
+
+#include "CDCDSerialDriver.h"
+#include "CDCDSerialDriverDescriptors.h"
+#include <utility/trace.h>
+#include <utility/assert.h>
+#include <usb/device/core/USBDDriver.h>
+#include <usb/common/cdc/CDCLineCoding.h>
+#include <usb/common/cdc/CDCGenericRequest.h>
+#include <usb/common/cdc/CDCSetControlLineStateRequest.h>
+
+//------------------------------------------------------------------------------
+// Types
+//------------------------------------------------------------------------------
+
+//------------------------------------------------------------------------------
+/// USB driver for a CDC class implementing a virtual COM serial connection.
+//------------------------------------------------------------------------------
+typedef struct {
+
+ /// Standard USBDDriver instance.
+ USBDDriver usbdDriver;
+ /// Current line coding (baudrate, parity, stop bits).
+ CDCLineCoding lineCoding;
+ /// Indicates if the RS232 carrier is active.
+ unsigned char isCarrierActivated;
+ /// Current serial port states
+ unsigned short serialState;
+
+} CDCDSerialDriver;
+
+//------------------------------------------------------------------------------
+// Internal variables
+//------------------------------------------------------------------------------
+
+/// Static instance of the CDC serial driver.
+static CDCDSerialDriver cdcdSerialDriver;
+
+//------------------------------------------------------------------------------
+// Internal functions
+//------------------------------------------------------------------------------
+
+//------------------------------------------------------------------------------
+/// Callback function which should be invoked after the data of a
+/// SetLineCoding request has been retrieved. Sends a zero-length packet
+/// to the host for acknowledging the request.
+//------------------------------------------------------------------------------
+static void CDCDSerialDriver_SetLineCodingCallback()
+{
+ USBD_Write(0, 0, 0, 0, 0);
+}
+
+//------------------------------------------------------------------------------
+/// Receives new line coding information from the USB host.
+//------------------------------------------------------------------------------
+static void CDCDSerialDriver_SetLineCoding()
+{
+ TRACE_INFO_WP("sLineCoding ");
+
+ USBD_Read(0,
+ (void *) &(cdcdSerialDriver.lineCoding),
+ sizeof(CDCLineCoding),
+ (TransferCallback) CDCDSerialDriver_SetLineCodingCallback,
+ 0);
+}
+
+//------------------------------------------------------------------------------
+/// Sends the current line coding information to the host through Control
+/// endpoint 0.
+//------------------------------------------------------------------------------
+static void CDCDSerialDriver_GetLineCoding()
+{
+ TRACE_INFO_WP("gLineCoding ");
+
+ USBD_Write(0,
+ (void *) &(cdcdSerialDriver.lineCoding),
+ sizeof(CDCLineCoding),
+ 0,
+ 0);
+}
+
+//------------------------------------------------------------------------------
+/// Changes the state of the serial driver according to the information
+/// sent by the host via a SetControlLineState request, and acknowledges
+/// the request with a zero-length packet.
+//------------------------------------------------------------------------------
+static void CDCDSerialDriver_SetControlLineState(unsigned char activateCarrier,
+ unsigned char isDTEPresent)
+{
+ TRACE_INFO_WP(
+ "sControlLineState(%d, %d) ",
+ activateCarrier,
+ isDTEPresent);
+
+ cdcdSerialDriver.isCarrierActivated = activateCarrier;
+ USBD_Write(0, 0, 0, 0, 0);
+}
+
+//------------------------------------------------------------------------------
+// Optional RequestReceived() callback re-implementation
+//------------------------------------------------------------------------------
+#if !defined(NOAUTOCALLBACK)
+
+//------------------------------------------------------------------------------
+/// Re-implemented callback, invoked when a new USB Request is received.
+//------------------------------------------------------------------------------
+void USBDCallbacks_RequestReceived(const USBGenericRequest *request)
+{
+ CDCDSerialDriver_RequestHandler(request);
+}
+
+#endif
+
+//------------------------------------------------------------------------------
+// Exported functions
+//------------------------------------------------------------------------------
+
+//------------------------------------------------------------------------------
+/// Initializes the USB Device CDC serial driver & USBD Driver.
+//------------------------------------------------------------------------------
+void CDCDSerialDriver_Initialize()
+{
+ TRACE_INFO("CDCDSerialDriver_Initialize\n\r");
+
+ // Initialize Abstract Control Model attributes
+ CDCLineCoding_Initialize(&(cdcdSerialDriver.lineCoding),
+ 115200,
+ CDCLineCoding_ONESTOPBIT,
+ CDCLineCoding_NOPARITY,
+ 8);
+ cdcdSerialDriver.isCarrierActivated = 0;
+ cdcdSerialDriver.serialState = 0;
+
+ // Initialize the standard driver
+ USBDDriver_Initialize(&(cdcdSerialDriver.usbdDriver),
+ &cdcdSerialDriverDescriptors,
+ 0); // Multiple settings for interfaces not supported
+
+ // Initialize the USB driver
+ USBD_Init();
+}
+
+//------------------------------------------------------------------------------
+/// Handles CDC-specific SETUP requests. Should be called from a
+/// re-implementation of USBDCallbacks_RequestReceived() method.
+/// \param Pointer to a USBGenericRequest instance.
+//------------------------------------------------------------------------------
+void CDCDSerialDriver_RequestHandler(const USBGenericRequest *request)
+{
+ TRACE_INFO_WP("NewReq ");
+
+ // Handle the request
+ switch (USBGenericRequest_GetRequest(request)) {
+
+ case CDCGenericRequest_SETLINECODING:
+
+ CDCDSerialDriver_SetLineCoding();
+ break;
+
+ case CDCGenericRequest_GETLINECODING:
+
+ CDCDSerialDriver_GetLineCoding();
+ break;
+
+ case CDCGenericRequest_SETCONTROLLINESTATE:
+
+ CDCDSerialDriver_SetControlLineState(
+ CDCSetControlLineStateRequest_ActivateCarrier(request),
+ CDCSetControlLineStateRequest_IsDtePresent(request));
+
+ break;
+
+ default:
+
+ USBDDriver_RequestHandler(&(cdcdSerialDriver.usbdDriver), request);
+ break;
+ }
+}
+
+//------------------------------------------------------------------------------
+/// Receives data from the host through the virtual COM port created by
+/// the CDC device serial driver. This function behaves like USBD_Read.
+/// \param data Pointer to the data buffer to put received data.
+/// \param size Size of the data buffer in bytes.
+/// \param callback Optional callback function to invoke when the transfer
+/// finishes.
+/// \param argument Optional argument to the callback function.
+/// \return USBD_STATUS_SUCCESS if the read operation has been started normally;
+/// otherwise, the corresponding error code.
+//------------------------------------------------------------------------------
+unsigned char CDCDSerialDriver_Read(void *data,
+ unsigned int size,
+ TransferCallback callback,
+ void *argument)
+{
+ return USBD_Read(CDCDSerialDriverDescriptors_DATAOUT,
+ data,
+ size,
+ callback,
+ argument);
+}
+
+//------------------------------------------------------------------------------
+/// Sends a data buffer through the virtual COM port created by the CDC
+/// device serial driver. This function behaves exactly like USBD_Write.
+/// \param data Pointer to the data buffer to send.
+/// \param size Size of the data buffer in bytes.
+/// \param callback Optional callback function to invoke when the transfer
+/// finishes.
+/// \param argument Optional argument to the callback function.
+/// \return USBD_STATUS_SUCCESS if the read operation has been started normally;
+/// otherwise, the corresponding error code.
+//------------------------------------------------------------------------------
+unsigned char CDCDSerialDriver_Write(void *data,
+ unsigned int size,
+ TransferCallback callback,
+ void *argument)
+{
+ return USBD_Write(CDCDSerialDriverDescriptors_DATAIN,
+ data,
+ size,
+ callback,
+ argument);
+}
+
+//------------------------------------------------------------------------------
+/// Returns the current status of the RS-232 line.
+//------------------------------------------------------------------------------
+unsigned short CDCDSerialDriver_GetSerialState()
+{
+ return cdcdSerialDriver.serialState;
+}
+
+//------------------------------------------------------------------------------
+/// Sets the current serial state of the device to the given value.
+/// \param serialState New device state.
+//------------------------------------------------------------------------------
+void CDCDSerialDriver_SetSerialState(unsigned short serialState)
+{
+ ASSERT((serialState & 0xFF80) == 0,
+ "CDCDSerialDriver_SetSerialState: Bits D7-D15 are reserved\n\r");
+
+ // If new state is different from previous one, send a notification to the
+ // host
+ if (cdcdSerialDriver.serialState != serialState) {
+
+ cdcdSerialDriver.serialState = serialState;
+ USBD_Write(CDCDSerialDriverDescriptors_NOTIFICATION,
+ &(cdcdSerialDriver.serialState),
+ 2,
+ 0,
+ 0);
+
+ // Reset one-time flags
+ cdcdSerialDriver.serialState &= ~(CDCDSerialDriver_STATE_OVERRUN
+ | CDCDSerialDriver_STATE_PARITY
+ | CDCDSerialDriver_STATE_FRAMING
+ | CDCDSerialDriver_STATE_RINGSIGNAL
+ | CDCDSerialDriver_STATE_BREAK);
+ }
+}
+
diff --git a/at91lib/usb/device/cdc-serial/CDCDSerialDriver.h b/at91lib/usb/device/cdc-serial/CDCDSerialDriver.h
new file mode 100644
index 0000000..5ccc901
--- /dev/null
+++ b/at91lib/usb/device/cdc-serial/CDCDSerialDriver.h
@@ -0,0 +1,117 @@
+/* ----------------------------------------------------------------------------
+ * ATMEL Microcontroller Software Support
+ * ----------------------------------------------------------------------------
+ * Copyright (c) 2008, Atmel Corporation
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * - Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the disclaimer below.
+ *
+ * Atmel's name may not be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
+ * DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
+ * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * ----------------------------------------------------------------------------
+ */
+
+/**
+ \unit
+
+ !!!Purpose
+
+ Definition of a class for implementing a USB device CDC serial driver.
+
+ !!!Usage
+
+ -# Re-implement the USBDCallbacks_RequestReceived method to pass
+ received requests to CDCDSerialDriver_RequestHandler. *This is
+ automatically done unless the NOAUTOCALLBACK symbol is defined*.
+ -# Initialize the CDC serial and USB drivers using
+ CDCDSerialDriver_Initialize.
+ -# Logically connect the device to the host using USBD_Connect.
+ -# Send serial data to the USB host using CDCDSerialDriver_Write.
+ -# Receive serial data from the USB host using CDCDSerialDriver_Read.
+*/
+
+#ifndef CDCDSERIALDRIVER_H
+#define CDCDSERIALDRIVER_H
+
+//------------------------------------------------------------------------------
+// Headers
+//------------------------------------------------------------------------------
+
+#include <usb/common/core/USBGenericRequest.h>
+#include <usb/device/core/USBD.h>
+
+//------------------------------------------------------------------------------
+// Definitions
+//------------------------------------------------------------------------------
+
+//------------------------------------------------------------------------------
+/// \page "CDC Serial Port States"
+/// This page lists the bit map for CDC Serial Port States.
+///
+/// !BitMaps
+/// - CDCDSerialDriver_STATE_RXDRIVER
+/// - CDCDSerialDriver_STATE_TXCARRIER
+/// - CDCDSerialDriver_STATE_BREAK
+/// - CDCDSerialDriver_STATE_RINGSIGNAL
+/// - CDCDSerialDriver_STATE_FRAMING
+/// - CDCDSerialDriver_STATE_PARITY
+/// - CDCDSerialDriver_STATE_OVERRUN
+
+/// Indicates the receiver carrier signal is present.
+#define CDCDSerialDriver_STATE_RXDRIVER (1 << 0)
+/// Indicates the transmission carrier signal is present.
+#define CDCDSerialDriver_STATE_TXCARRIER (1 << 1)
+/// Indicates a break has been detected.
+#define CDCDSerialDriver_STATE_BREAK (1 << 2)
+/// Indicates a ring signal has been detected.
+#define CDCDSerialDriver_STATE_RINGSIGNAL (1 << 3)
+/// Indicates a framing error has occured.
+#define CDCDSerialDriver_STATE_FRAMING (1 << 4)
+/// Indicates a parity error has occured.
+#define CDCDSerialDriver_STATE_PARITY (1 << 5)
+/// Indicates a data overrun error has occured.
+#define CDCDSerialDriver_STATE_OVERRUN (1 << 6)
+//------------------------------------------------------------------------------
+
+//------------------------------------------------------------------------------
+// Exported functions
+//------------------------------------------------------------------------------
+
+extern void CDCDSerialDriver_Initialize();
+
+extern void CDCDSerialDriver_RequestHandler(const USBGenericRequest *request);
+
+extern unsigned char CDCDSerialDriver_Write(
+ void *data,
+ unsigned int size,
+ TransferCallback callback,
+ void *argument);
+
+extern unsigned char CDCDSerialDriver_Read(
+ void *data,
+ unsigned int size,
+ TransferCallback callback,
+ void *argument);
+
+extern unsigned short CDCDSerialDriver_GetSerialState();
+
+extern void CDCDSerialDriver_SetSerialState(unsigned short serialState);
+
+#endif //#ifndef CDCSERIALDRIVER_H
+
diff --git a/at91lib/usb/device/cdc-serial/CDCDSerialDriverDescriptors.c b/at91lib/usb/device/cdc-serial/CDCDSerialDriverDescriptors.c
new file mode 100644
index 0000000..0c900e1
--- /dev/null
+++ b/at91lib/usb/device/cdc-serial/CDCDSerialDriverDescriptors.c
@@ -0,0 +1,625 @@
+/* ----------------------------------------------------------------------------
+ * ATMEL Microcontroller Software Support
+ * ----------------------------------------------------------------------------
+ * Copyright (c) 2008, Atmel Corporation
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * - Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the disclaimer below.
+ *
+ * Atmel's name may not be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
+ * DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
+ * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * ----------------------------------------------------------------------------
+ */
+
+//------------------------------------------------------------------------------
+// Headers
+//------------------------------------------------------------------------------
+
+#include "CDCDSerialDriverDescriptors.h"
+#include <board.h>
+#include <usb/common/core/USBGenericDescriptor.h>
+#include <usb/common/core/USBConfigurationDescriptor.h>
+#include <usb/common/core/USBEndpointDescriptor.h>
+#include <usb/common/core/USBStringDescriptor.h>
+#include <usb/common/core/USBGenericRequest.h>
+#include <usb/common/cdc/CDCGenericDescriptor.h>
+#include <usb/common/cdc/CDCDeviceDescriptor.h>
+#include <usb/common/cdc/CDCCommunicationInterfaceDescriptor.h>
+#include <usb/common/cdc/CDCDataInterfaceDescriptor.h>
+#include <usb/common/cdc/CDCHeaderDescriptor.h>
+#include <usb/common/cdc/CDCCallManagementDescriptor.h>
+#include <usb/common/cdc/CDCAbstractControlManagementDescriptor.h>
+#include <usb/common/cdc/CDCUnionDescriptor.h>
+
+//------------------------------------------------------------------------------
+// Definitions
+//------------------------------------------------------------------------------
+
+//------------------------------------------------------------------------------
+/// \page "CDC Serial Device IDs"
+/// This page lists the IDs used in the CDC Serial Device Descriptor.
+///
+/// !IDs
+/// - CDCDSerialDriverDescriptors_PRODUCTID
+/// - CDCDSerialDriverDescriptors_VENDORID
+/// - CDCDSerialDriverDescriptors_RELEASE
+
+/// Device product ID.
+#define CDCDSerialDriverDescriptors_PRODUCTID 0x6119
+/// Device vendor ID (Atmel).
+#define CDCDSerialDriverDescriptors_VENDORID 0x03EB
+/// Device release number.
+#define CDCDSerialDriverDescriptors_RELEASE 0x0100
+//------------------------------------------------------------------------------
+
+//------------------------------------------------------------------------------
+// Macros
+//------------------------------------------------------------------------------
+
+/// Returns the minimum between two values.
+#define MIN(a, b) ((a < b) ? a : b)
+
+//------------------------------------------------------------------------------
+// Internal structures
+//------------------------------------------------------------------------------
+
+//------------------------------------------------------------------------------
+/// Configuration descriptor list for a device implementing a CDC serial driver.
+//------------------------------------------------------------------------------
+typedef struct {
+
+ /// Standard configuration descriptor.
+ USBConfigurationDescriptor configuration;
+ /// Communication interface descriptor.
+ USBInterfaceDescriptor communication;
+ /// CDC header functional descriptor.
+ CDCHeaderDescriptor header;
+ /// CDC call management functional descriptor.
+ CDCCallManagementDescriptor callManagement;
+ /// CDC abstract control management functional descriptor.
+ CDCAbstractControlManagementDescriptor abstractControlManagement;
+ /// CDC union functional descriptor (with one slave interface).
+ CDCUnionDescriptor union1;
+ /// Notification endpoint descriptor.
+ USBEndpointDescriptor notification;
+ /// Data interface descriptor.
+ USBInterfaceDescriptor data;
+ /// Data OUT endpoint descriptor.
+ USBEndpointDescriptor dataOut;
+ /// Data IN endpoint descriptor.
+ USBEndpointDescriptor dataIn;
+
+} __attribute__ ((packed)) CDCDSerialDriverConfigurationDescriptors;
+
+//------------------------------------------------------------------------------
+// Exported variables
+//------------------------------------------------------------------------------
+
+/// Standard USB device descriptor for the CDC serial driver
+const USBDeviceDescriptor deviceDescriptor = {
+
+ sizeof(USBDeviceDescriptor),
+ USBGenericDescriptor_DEVICE,
+ USBDeviceDescriptor_USB2_00,
+ CDCDeviceDescriptor_CLASS,
+ CDCDeviceDescriptor_SUBCLASS,
+ CDCDeviceDescriptor_PROTOCOL,
+ BOARD_USB_ENDPOINTS_MAXPACKETSIZE(0),
+ CDCDSerialDriverDescriptors_VENDORID,
+ CDCDSerialDriverDescriptors_PRODUCTID,
+ CDCDSerialDriverDescriptors_RELEASE,
+ 0, // No string descriptor for manufacturer
+ 1, // Index of product string descriptor is #1
+ 0, // No string descriptor for serial number
+ 1 // Device has 1 possible configuration
+};
+
+#if defined(BOARD_USB_UDPHS)
+
+/// USB device qualifier descriptor.
+const USBDeviceQualifierDescriptor qualifierDescriptor = {
+
+ sizeof(USBDeviceQualifierDescriptor),
+ USBGenericDescriptor_DEVICEQUALIFIER,
+ USBDeviceDescriptor_USB2_00,
+ CDCDeviceDescriptor_CLASS,
+ CDCDeviceDescriptor_SUBCLASS,
+ CDCDeviceDescriptor_PROTOCOL,
+ BOARD_USB_ENDPOINTS_MAXPACKETSIZE(0),
+ 1, // Device has one possible configuration
+ 0 // Reserved
+};
+
+#endif
+
+/// Standard USB configuration descriptor for the CDC serial driver
+const CDCDSerialDriverConfigurationDescriptors configurationDescriptors = {
+
+ // Standard configuration descriptor
+ {
+ sizeof(USBConfigurationDescriptor),
+ USBGenericDescriptor_CONFIGURATION,
+ sizeof(CDCDSerialDriverConfigurationDescriptors),
+ 2, // There are two interfaces in this configuration
+ 1, // This is configuration #1
+ 0, // No string descriptor for this configuration
+ BOARD_USB_BMATTRIBUTES,
+ USBConfigurationDescriptor_POWER(100)
+ },
+ // Communication class interface standard descriptor
+ {
+ sizeof(USBInterfaceDescriptor),
+ USBGenericDescriptor_INTERFACE,
+ 0, // This is interface #0
+ 0, // This is alternate setting #0 for this interface
+ 1, // This interface uses 1 endpoint
+ CDCCommunicationInterfaceDescriptor_CLASS,
+ CDCCommunicationInterfaceDescriptor_ABSTRACTCONTROLMODEL,
+ CDCCommunicationInterfaceDescriptor_NOPROTOCOL,
+ 0 // No string descriptor for this interface
+ },
+ // Class-specific header functional descriptor
+ {
+ sizeof(CDCHeaderDescriptor),
+ CDCGenericDescriptor_INTERFACE,
+ CDCGenericDescriptor_HEADER,
+ CDCGenericDescriptor_CDC1_10
+ },
+ // Class-specific call management functional descriptor
+ {
+ sizeof(CDCCallManagementDescriptor),
+ CDCGenericDescriptor_INTERFACE,
+ CDCGenericDescriptor_CALLMANAGEMENT,
+ CDCCallManagementDescriptor_SELFCALLMANAGEMENT,
+ 0 // No associated data interface
+ },
+ // Class-specific abstract control management functional descriptor
+ {
+ sizeof(CDCAbstractControlManagementDescriptor),
+ CDCGenericDescriptor_INTERFACE,
+ CDCGenericDescriptor_ABSTRACTCONTROLMANAGEMENT,
+ CDCAbstractControlManagementDescriptor_LINE
+ },
+ // Class-specific union functional descriptor with one slave interface
+ {
+ sizeof(CDCUnionDescriptor),
+ CDCGenericDescriptor_INTERFACE,
+ CDCGenericDescriptor_UNION,
+ 0, // Number of master interface is #0
+ 1 // First slave interface is #1
+ },
+ // Notification endpoint standard descriptor
+ {
+ sizeof(USBEndpointDescriptor),
+ USBGenericDescriptor_ENDPOINT,
+ USBEndpointDescriptor_ADDRESS(USBEndpointDescriptor_IN,
+ CDCDSerialDriverDescriptors_NOTIFICATION),
+ USBEndpointDescriptor_INTERRUPT,
+ MIN(BOARD_USB_ENDPOINTS_MAXPACKETSIZE(CDCDSerialDriverDescriptors_NOTIFICATION),
+ USBEndpointDescriptor_MAXINTERRUPTSIZE_FS),
+ 10 // Endpoint is polled every 10ms
+ },
+ // Data class interface standard descriptor
+ {
+ sizeof(USBInterfaceDescriptor),
+ USBGenericDescriptor_INTERFACE,
+ 1, // This is interface #1
+ 0, // This is alternate setting #0 for this interface
+ 2, // This interface uses 2 endpoints
+ CDCDataInterfaceDescriptor_CLASS,
+ CDCDataInterfaceDescriptor_SUBCLASS,
+ CDCDataInterfaceDescriptor_NOPROTOCOL,
+ 0 // No string descriptor for this interface
+ },
+ // Bulk-OUT endpoint standard descriptor
+ {
+ sizeof(USBEndpointDescriptor),
+ USBGenericDescriptor_ENDPOINT,
+ USBEndpointDescriptor_ADDRESS(USBEndpointDescriptor_OUT,
+ CDCDSerialDriverDescriptors_DATAOUT),
+ USBEndpointDescriptor_BULK,
+ MIN(BOARD_USB_ENDPOINTS_MAXPACKETSIZE(CDCDSerialDriverDescriptors_DATAOUT),
+ USBEndpointDescriptor_MAXBULKSIZE_FS),
+ 0 // Must be 0 for full-speed bulk endpoints
+ },
+ // Bulk-IN endpoint descriptor
+ {
+ sizeof(USBEndpointDescriptor),
+ USBGenericDescriptor_ENDPOINT,
+ USBEndpointDescriptor_ADDRESS(USBEndpointDescriptor_IN,
+ CDCDSerialDriverDescriptors_DATAIN),
+ USBEndpointDescriptor_BULK,
+ MIN(BOARD_USB_ENDPOINTS_MAXPACKETSIZE(CDCDSerialDriverDescriptors_DATAIN),
+ USBEndpointDescriptor_MAXBULKSIZE_FS),
+ 0 // Must be 0 for full-speed bulk endpoints
+ },
+};
+
+/// Language ID string descriptor
+const unsigned char languageIdStringDescriptor[] = {
+
+ USBStringDescriptor_LENGTH(1),
+ USBGenericDescriptor_STRING,
+ USBStringDescriptor_ENGLISH_US
+};
+
+#if defined(BOARD_USB_UDPHS)
+/// Other-speed configuration descriptor (when in full-speed).
+const CDCDSerialDriverConfigurationDescriptors otherSpeedDescriptorsFS = {
+
+ // Standard configuration descriptor
+ {
+ sizeof(USBConfigurationDescriptor),
+ USBGenericDescriptor_OTHERSPEEDCONFIGURATION,
+ sizeof(CDCDSerialDriverConfigurationDescriptors),
+ 2, // There are two interfaces in this configuration
+ 1, // This is configuration #1
+ 0, // No string descriptor for this configuration
+ BOARD_USB_BMATTRIBUTES,
+ USBConfigurationDescriptor_POWER(100)
+ },
+ // Communication class interface standard descriptor
+ {
+ sizeof(USBInterfaceDescriptor),
+ USBGenericDescriptor_INTERFACE,
+ 0, // This is interface #0
+ 0, // This is alternate setting #0 for this interface
+ 1, // This interface uses 1 endpoint
+ CDCCommunicationInterfaceDescriptor_CLASS,
+ CDCCommunicationInterfaceDescriptor_ABSTRACTCONTROLMODEL,
+ CDCCommunicationInterfaceDescriptor_NOPROTOCOL,
+ 0 // No string descriptor for this interface
+ },
+ // Class-specific header functional descriptor
+ {
+ sizeof(CDCHeaderDescriptor),
+ CDCGenericDescriptor_INTERFACE,
+ CDCGenericDescriptor_HEADER,
+ CDCGenericDescriptor_CDC1_10
+ },
+ // Class-specific call management functional descriptor
+ {
+ sizeof(CDCCallManagementDescriptor),
+ CDCGenericDescriptor_INTERFACE,
+ CDCGenericDescriptor_CALLMANAGEMENT,
+ CDCCallManagementDescriptor_SELFCALLMANAGEMENT,
+ 0 // No associated data interface
+ },
+ // Class-specific abstract control management functional descriptor
+ {
+ sizeof(CDCAbstractControlManagementDescriptor),
+ CDCGenericDescriptor_INTERFACE,
+ CDCGenericDescriptor_ABSTRACTCONTROLMANAGEMENT,
+ CDCAbstractControlManagementDescriptor_LINE
+ },
+ // Class-specific union functional descriptor with one slave interface
+ {
+ sizeof(CDCUnionDescriptor),
+ CDCGenericDescriptor_INTERFACE,
+ CDCGenericDescriptor_UNION,
+ 0, // Number of master interface is #0
+ 1 // First slave interface is #1
+ },
+ // Notification endpoint standard descriptor
+ {
+ sizeof(USBEndpointDescriptor),
+ USBGenericDescriptor_ENDPOINT,
+ USBEndpointDescriptor_ADDRESS(USBEndpointDescriptor_IN,
+ CDCDSerialDriverDescriptors_NOTIFICATION),
+ USBEndpointDescriptor_INTERRUPT,
+ MIN(BOARD_USB_ENDPOINTS_MAXPACKETSIZE(CDCDSerialDriverDescriptors_NOTIFICATION),
+ USBEndpointDescriptor_MAXINTERRUPTSIZE_HS),
+ 10 // Endpoint is polled every 10ms
+ },
+ // Data class interface standard descriptor
+ {
+ sizeof(USBInterfaceDescriptor),
+ USBGenericDescriptor_INTERFACE,
+ 1, // This is interface #1
+ 0, // This is alternate setting #0 for this interface
+ 2, // This interface uses 2 endpoints
+ CDCDataInterfaceDescriptor_CLASS,
+ CDCDataInterfaceDescriptor_SUBCLASS,
+ CDCDataInterfaceDescriptor_NOPROTOCOL,
+ 0 // No string descriptor for this interface
+ },
+ // Bulk-OUT endpoint standard descriptor
+ {
+ sizeof(USBEndpointDescriptor),
+ USBGenericDescriptor_ENDPOINT,
+ USBEndpointDescriptor_ADDRESS(USBEndpointDescriptor_OUT,
+ CDCDSerialDriverDescriptors_DATAOUT),
+ USBEndpointDescriptor_BULK,
+ MIN(BOARD_USB_ENDPOINTS_MAXPACKETSIZE(CDCDSerialDriverDescriptors_DATAOUT),
+ USBEndpointDescriptor_MAXBULKSIZE_HS),
+ 0 // Must be 0 for full-speed bulk endpoints
+ },
+ // Bulk-IN endpoint descriptor
+ {
+ sizeof(USBEndpointDescriptor),
+ USBGenericDescriptor_ENDPOINT,
+ USBEndpointDescriptor_ADDRESS(USBEndpointDescriptor_IN,
+ CDCDSerialDriverDescriptors_DATAIN),
+ USBEndpointDescriptor_BULK,
+ MIN(BOARD_USB_ENDPOINTS_MAXPACKETSIZE(CDCDSerialDriverDescriptors_DATAIN),
+ USBEndpointDescriptor_MAXBULKSIZE_HS),
+ 0 // Must be 0 for full-speed bulk endpoints
+ },
+};
+
+
+/// Configuration descriptor (when in high-speed).
+const CDCDSerialDriverConfigurationDescriptors configurationDescriptorsHS = {
+
+ // Standard configuration descriptor
+ {
+ sizeof(USBConfigurationDescriptor),
+ USBGenericDescriptor_CONFIGURATION,
+ sizeof(CDCDSerialDriverConfigurationDescriptors),
+ 2, // There are two interfaces in this configuration
+ 1, // This is configuration #1
+ 0, // No string descriptor for this configuration
+ BOARD_USB_BMATTRIBUTES,
+ USBConfigurationDescriptor_POWER(100)
+ },
+ // Communication class interface standard descriptor
+ {
+ sizeof(USBInterfaceDescriptor),
+ USBGenericDescriptor_INTERFACE,
+ 0, // This is interface #0
+ 0, // This is alternate setting #0 for this interface
+ 1, // This interface uses 1 endpoint
+ CDCCommunicationInterfaceDescriptor_CLASS,
+ CDCCommunicationInterfaceDescriptor_ABSTRACTCONTROLMODEL,
+ CDCCommunicationInterfaceDescriptor_NOPROTOCOL,
+ 0 // No string descriptor for this interface
+ },
+ // Class-specific header functional descriptor
+ {
+ sizeof(CDCHeaderDescriptor),
+ CDCGenericDescriptor_INTERFACE,
+ CDCGenericDescriptor_HEADER,
+ CDCGenericDescriptor_CDC1_10
+ },
+ // Class-specific call management functional descriptor
+ {
+ sizeof(CDCCallManagementDescriptor),
+ CDCGenericDescriptor_INTERFACE,
+ CDCGenericDescriptor_CALLMANAGEMENT,
+ CDCCallManagementDescriptor_SELFCALLMANAGEMENT,
+ 0 // No associated data interface
+ },
+ // Class-specific abstract control management functional descriptor
+ {
+ sizeof(CDCAbstractControlManagementDescriptor),
+ CDCGenericDescriptor_INTERFACE,
+ CDCGenericDescriptor_ABSTRACTCONTROLMANAGEMENT,
+ CDCAbstractControlManagementDescriptor_LINE
+ },
+ // Class-specific union functional descriptor with one slave interface
+ {
+ sizeof(CDCUnionDescriptor),
+ CDCGenericDescriptor_INTERFACE,
+ CDCGenericDescriptor_UNION,
+ 0, // Number of master interface is #0
+ 1 // First slave interface is #1
+ },
+ // Notification endpoint standard descriptor
+ {
+ sizeof(USBEndpointDescriptor),
+ USBGenericDescriptor_ENDPOINT,
+ USBEndpointDescriptor_ADDRESS(USBEndpointDescriptor_IN,
+ CDCDSerialDriverDescriptors_NOTIFICATION),
+ USBEndpointDescriptor_INTERRUPT,
+ MIN(BOARD_USB_ENDPOINTS_MAXPACKETSIZE(CDCDSerialDriverDescriptors_NOTIFICATION),
+ USBEndpointDescriptor_MAXINTERRUPTSIZE_HS),
+ 10 // Endpoint is polled every 10ms
+ },
+ // Data class interface standard descriptor
+ {
+ sizeof(USBInterfaceDescriptor),
+ USBGenericDescriptor_INTERFACE,
+ 1, // This is interface #1
+ 0, // This is alternate setting #0 for this interface
+ 2, // This interface uses 2 endpoints
+ CDCDataInterfaceDescriptor_CLASS,
+ CDCDataInterfaceDescriptor_SUBCLASS,
+ CDCDataInterfaceDescriptor_NOPROTOCOL,
+ 0 // No string descriptor for this interface
+ },
+ // Bulk-OUT endpoint standard descriptor
+ {
+ sizeof(USBEndpointDescriptor),
+ USBGenericDescriptor_ENDPOINT,
+ USBEndpointDescriptor_ADDRESS(USBEndpointDescriptor_OUT,
+ CDCDSerialDriverDescriptors_DATAOUT),
+ USBEndpointDescriptor_BULK,
+ MIN(BOARD_USB_ENDPOINTS_MAXPACKETSIZE(CDCDSerialDriverDescriptors_DATAOUT),
+ USBEndpointDescriptor_MAXBULKSIZE_HS),
+ 0 // Must be 0 for full-speed bulk endpoints
+ },
+ // Bulk-IN endpoint descriptor
+ {
+ sizeof(USBEndpointDescriptor),
+ USBGenericDescriptor_ENDPOINT,
+ USBEndpointDescriptor_ADDRESS(USBEndpointDescriptor_IN,
+ CDCDSerialDriverDescriptors_DATAIN),
+ USBEndpointDescriptor_BULK,
+ MIN(BOARD_USB_ENDPOINTS_MAXPACKETSIZE(CDCDSerialDriverDescriptors_DATAIN),
+ USBEndpointDescriptor_MAXBULKSIZE_HS),
+ 0 // Must be 0 for full-speed bulk endpoints
+ },
+};
+
+/// Other-speed configuration descriptor (when in high-speed).
+const CDCDSerialDriverConfigurationDescriptors otherSpeedDescriptorsHS = {
+
+ // Standard configuration descriptor
+ {
+ sizeof(USBConfigurationDescriptor),
+ USBGenericDescriptor_OTHERSPEEDCONFIGURATION,
+ sizeof(CDCDSerialDriverConfigurationDescriptors),
+ 2, // There are two interfaces in this configuration
+ 1, // This is configuration #1
+ 0, // No string descriptor for this configuration
+ BOARD_USB_BMATTRIBUTES,
+ USBConfigurationDescriptor_POWER(100)
+ },
+ // Communication class interface standard descriptor
+ {
+ sizeof(USBInterfaceDescriptor),
+ USBGenericDescriptor_INTERFACE,
+ 0, // This is interface #0
+ 0, // This is alternate setting #0 for this interface
+ 1, // This interface uses 1 endpoint
+ CDCCommunicationInterfaceDescriptor_CLASS,
+ CDCCommunicationInterfaceDescriptor_ABSTRACTCONTROLMODEL,
+ CDCCommunicationInterfaceDescriptor_NOPROTOCOL,
+ 0 // No string descriptor for this interface
+ },
+ // Class-specific header functional descriptor
+ {
+ sizeof(CDCHeaderDescriptor),
+ CDCGenericDescriptor_INTERFACE,
+ CDCGenericDescriptor_HEADER,
+ CDCGenericDescriptor_CDC1_10
+ },
+ // Class-specific call management functional descriptor
+ {
+ sizeof(CDCCallManagementDescriptor),
+ CDCGenericDescriptor_INTERFACE,
+ CDCGenericDescriptor_CALLMANAGEMENT,
+ CDCCallManagementDescriptor_SELFCALLMANAGEMENT,
+ 0 // No associated data interface
+ },
+ // Class-specific abstract control management functional descriptor
+ {
+ sizeof(CDCAbstractControlManagementDescriptor),
+ CDCGenericDescriptor_INTERFACE,
+ CDCGenericDescriptor_ABSTRACTCONTROLMANAGEMENT,
+ CDCAbstractControlManagementDescriptor_LINE
+ },
+ // Class-specific union functional descriptor with one slave interface
+ {
+ sizeof(CDCUnionDescriptor),
+ CDCGenericDescriptor_INTERFACE,
+ CDCGenericDescriptor_UNION,
+ 0, // Number of master interface is #0
+ 1 // First slave interface is #1
+ },
+ // Notification endpoint standard descriptor
+ {
+ sizeof(USBEndpointDescriptor),
+ USBGenericDescriptor_ENDPOINT,
+ USBEndpointDescriptor_ADDRESS(USBEndpointDescriptor_IN,
+ CDCDSerialDriverDescriptors_NOTIFICATION),
+ USBEndpointDescriptor_INTERRUPT,
+ MIN(BOARD_USB_ENDPOINTS_MAXPACKETSIZE(CDCDSerialDriverDescriptors_NOTIFICATION),
+ USBEndpointDescriptor_MAXINTERRUPTSIZE_FS),
+ 10 // Endpoint is polled every 10ms
+ },
+ // Data class interface standard descriptor
+ {
+ sizeof(USBInterfaceDescriptor),
+ USBGenericDescriptor_INTERFACE,
+ 1, // This is interface #1
+ 0, // This is alternate setting #0 for this interface
+ 2, // This interface uses 2 endpoints
+ CDCDataInterfaceDescriptor_CLASS,
+ CDCDataInterfaceDescriptor_SUBCLASS,
+ CDCDataInterfaceDescriptor_NOPROTOCOL,
+ 0 // No string descriptor for this interface
+ },
+ // Bulk-OUT endpoint standard descriptor
+ {
+ sizeof(USBEndpointDescriptor),
+ USBGenericDescriptor_ENDPOINT,
+ USBEndpointDescriptor_ADDRESS(USBEndpointDescriptor_OUT,
+ CDCDSerialDriverDescriptors_DATAOUT),
+ USBEndpointDescriptor_BULK,
+ MIN(BOARD_USB_ENDPOINTS_MAXPACKETSIZE(CDCDSerialDriverDescriptors_DATAOUT),
+ USBEndpointDescriptor_MAXBULKSIZE_FS),
+ 0 // Must be 0 for full-speed bulk endpoints
+ },
+ // Bulk-IN endpoint descriptor
+ {
+ sizeof(USBEndpointDescriptor),
+ USBGenericDescriptor_ENDPOINT,
+ USBEndpointDescriptor_ADDRESS(USBEndpointDescriptor_IN,
+ CDCDSerialDriverDescriptors_DATAIN),
+ USBEndpointDescriptor_BULK,
+ MIN(BOARD_USB_ENDPOINTS_MAXPACKETSIZE(CDCDSerialDriverDescriptors_DATAIN),
+ USBEndpointDescriptor_MAXBULKSIZE_FS),
+ 0 // Must be 0 for full-speed bulk endpoints
+ },
+};
+#endif
+
+/// Product string descriptor
+const unsigned char productStringDescriptor[] = {
+
+ USBStringDescriptor_LENGTH(13),
+ USBGenericDescriptor_STRING,
+ USBStringDescriptor_UNICODE('A'),
+ USBStringDescriptor_UNICODE('T'),
+ USBStringDescriptor_UNICODE('9'),
+ USBStringDescriptor_UNICODE('1'),
+ USBStringDescriptor_UNICODE('U'),
+ USBStringDescriptor_UNICODE('S'),
+ USBStringDescriptor_UNICODE('B'),
+ USBStringDescriptor_UNICODE('S'),
+ USBStringDescriptor_UNICODE('e'),
+ USBStringDescriptor_UNICODE('r'),
+ USBStringDescriptor_UNICODE('i'),
+ USBStringDescriptor_UNICODE('a'),
+ USBStringDescriptor_UNICODE('l')
+};
+
+/// List of string descriptors used by the device
+const unsigned char *stringDescriptors[] = {
+
+ languageIdStringDescriptor,
+ productStringDescriptor,
+};
+
+/// List of standard descriptors for the serial driver.
+USBDDriverDescriptors cdcdSerialDriverDescriptors = {
+
+ &deviceDescriptor,
+ (USBConfigurationDescriptor *) &(configurationDescriptors),
+#ifdef BOARD_USB_UDPHS
+ &qualifierDescriptor,
+ (USBConfigurationDescriptor *) &(otherSpeedDescriptorsFS),
+ &deviceDescriptor,
+ (USBConfigurationDescriptor *) &(configurationDescriptorsHS),
+ &qualifierDescriptor,
+ (USBConfigurationDescriptor *) &(otherSpeedDescriptorsHS),
+#else
+ 0, // No full-speed device qualifier descriptor
+ 0, // No full-speed other speed configuration
+ 0, // No high-speed device descriptor
+ 0, // No high-speed configuration descriptor
+ 0, // No high-speed device qualifier descriptor
+ 0, // No high-speed other speed configuration descriptor
+
+#endif
+ stringDescriptors,
+ 2 // 2 string descriptors in list
+};
+
diff --git a/at91lib/usb/device/cdc-serial/CDCDSerialDriverDescriptors.h b/at91lib/usb/device/cdc-serial/CDCDSerialDriverDescriptors.h
new file mode 100644
index 0000000..8ab4edf
--- /dev/null
+++ b/at91lib/usb/device/cdc-serial/CDCDSerialDriverDescriptors.h
@@ -0,0 +1,77 @@
+/* ----------------------------------------------------------------------------
+ * ATMEL Microcontroller Software Support
+ * ----------------------------------------------------------------------------
+ * Copyright (c) 2008, Atmel Corporation
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * - Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the disclaimer below.
+ *
+ * Atmel's name may not be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
+ * DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
+ * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * ----------------------------------------------------------------------------
+ */
+
+/**
+ \unit
+
+ !!!Purpose
+
+ Definition of the USB descriptors required by a CDC device serial
+ driver.
+*/
+
+#ifndef CDCDSERIALDRIVERDESCRIPTORS_H
+#define CDCDSERIALDRIVERDESCRIPTORS_H
+
+//------------------------------------------------------------------------------
+// Headers
+//------------------------------------------------------------------------------
+
+#include <usb/device/core/USBDDriverDescriptors.h>
+
+//------------------------------------------------------------------------------
+// Definitions
+//------------------------------------------------------------------------------
+
+//------------------------------------------------------------------------------
+/// \page "CDC Serial Endpoints"
+/// This page lists the endpoints used in CDC Serial Device.
+///
+/// !Endpoints
+/// - CDCDSerialDriverDescriptors_DATAOUT
+/// - CDCDSerialDriverDescriptors_DATAIN
+/// - CDCDSerialDriverDescriptors_NOTIFICATION
+
+/// Data OUT endpoint number.
+#define CDCDSerialDriverDescriptors_DATAOUT 1
+/// Data IN endpoint number.
+#define CDCDSerialDriverDescriptors_DATAIN 2
+/// Notification endpoint number.
+#define CDCDSerialDriverDescriptors_NOTIFICATION 3
+//------------------------------------------------------------------------------
+
+//------------------------------------------------------------------------------
+// Exported variables
+//------------------------------------------------------------------------------
+
+/// List of descriptors for a CDC device serial driver.
+extern USBDDriverDescriptors cdcdSerialDriverDescriptors;
+
+#endif //#ifndef CDCDDRIVERDESCRIPTORS_H
+
personal git repositories of Harald Welte. Your mileage may vary