From 044ad7c3987460ede48ff27afd6bdb0ca05a0432 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Mon, 4 Jul 2011 20:52:54 +0200 Subject: import at91lib from at91lib_20100901_softpack_1_9_v_1_0_svn_v15011 it's sad to see that atmel doesn't publish their svn repo or has a centralized location or even puts proper version/release info into the library itself --- usb/device/cdc-serial/CDCDSerialDriver.c | 300 ++++++++++ usb/device/cdc-serial/CDCDSerialDriver.h | 117 ++++ .../cdc-serial/CDCDSerialDriverDescriptors.c | 661 +++++++++++++++++++++ .../cdc-serial/CDCDSerialDriverDescriptors.h | 77 +++ usb/device/cdc-serial/CDCarchitecture.png | Bin 0 -> 28223 bytes usb/device/cdc-serial/USB-SerialConverter.png | Bin 0 -> 10177 bytes usb/device/cdc-serial/cdc-serial.dir | 646 ++++++++++++++++++++ usb/device/cdc-serial/drv/6119.inf | 45 ++ usb/device/cdc-serial/drv/drv.dir | 41 ++ 9 files changed, 1887 insertions(+) create mode 100644 usb/device/cdc-serial/CDCDSerialDriver.c create mode 100644 usb/device/cdc-serial/CDCDSerialDriver.h create mode 100644 usb/device/cdc-serial/CDCDSerialDriverDescriptors.c create mode 100644 usb/device/cdc-serial/CDCDSerialDriverDescriptors.h create mode 100644 usb/device/cdc-serial/CDCarchitecture.png create mode 100644 usb/device/cdc-serial/USB-SerialConverter.png create mode 100644 usb/device/cdc-serial/cdc-serial.dir create mode 100644 usb/device/cdc-serial/drv/6119.inf create mode 100644 usb/device/cdc-serial/drv/drv.dir (limited to 'usb/device/cdc-serial') diff --git a/usb/device/cdc-serial/CDCDSerialDriver.c b/usb/device/cdc-serial/CDCDSerialDriver.c new file mode 100644 index 0000000..3e58592 --- /dev/null +++ b/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 +#include +#include +#include +#include +#include + +//------------------------------------------------------------------------------ +// 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/usb/device/cdc-serial/CDCDSerialDriver.h b/usb/device/cdc-serial/CDCDSerialDriver.h new file mode 100644 index 0000000..5ccc901 --- /dev/null +++ b/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 +#include + +//------------------------------------------------------------------------------ +// 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/usb/device/cdc-serial/CDCDSerialDriverDescriptors.c b/usb/device/cdc-serial/CDCDSerialDriverDescriptors.c new file mode 100644 index 0000000..8864451 --- /dev/null +++ b/usb/device/cdc-serial/CDCDSerialDriverDescriptors.c @@ -0,0 +1,661 @@ +/* ---------------------------------------------------------------------------- + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +//------------------------------------------------------------------------------ +// 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; +#if defined(CHIP_USB_OTGHS) + // OTG descriptor + USBOtgDescriptor otgDescriptor; +#endif + /// 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, + CHIP_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(CHIP_USB_UDPHS) || defined(CHIP_USB_OTGHS) + +/// USB device qualifier descriptor. +const USBDeviceQualifierDescriptor qualifierDescriptor = { + + sizeof(USBDeviceQualifierDescriptor), + USBGenericDescriptor_DEVICEQUALIFIER, + USBDeviceDescriptor_USB2_00, + CDCDeviceDescriptor_CLASS, + CDCDeviceDescriptor_SUBCLASS, + CDCDeviceDescriptor_PROTOCOL, + CHIP_USB_ENDPOINTS_MAXPACKETSIZE(0), + 1, // Device has one possible configuration + 0 // Reserved +}; + +#endif + +/// Standard USB configuration descriptor for the CDC serial driver +const CDCDSerialDriverConfigurationDescriptors configurationDescriptorsFS = { + + // 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) + }, +#if defined(CHIP_USB_OTGHS) + // OTG descriptor + { + sizeof(USBOtgDescriptor), + USBGenericDescriptor_OTG, + USBOTGDescriptor_HNP_SRP + }, +#endif + // 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(CHIP_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(CHIP_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(CHIP_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(CHIP_USB_UDPHS) || defined(CHIP_USB_OTGHS) +/// 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) + }, +#if defined(CHIP_USB_OTGHS) + // OTG descriptor + { + sizeof(USBOtgDescriptor), + USBGenericDescriptor_OTG, + USBOTGDescriptor_HNP_SRP + }, +#endif + // 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(CHIP_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(CHIP_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(CHIP_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) + }, +#if defined(CHIP_USB_OTGHS) + // OTG descriptor + { + sizeof(USBOtgDescriptor), + USBGenericDescriptor_OTG, + USBOTGDescriptor_HNP_SRP + }, +#endif + // 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(CHIP_USB_ENDPOINTS_MAXPACKETSIZE(CDCDSerialDriverDescriptors_NOTIFICATION), + USBEndpointDescriptor_MAXINTERRUPTSIZE_HS), + 8 // Endpoint is polled every 16ms + }, + // 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(CHIP_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(CHIP_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) + }, +#if defined(CHIP_USB_OTGHS) + // OTG descriptor + { + sizeof(USBOtgDescriptor), + USBGenericDescriptor_OTG, + USBOTGDescriptor_HNP_SRP + }, +#endif + // 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(CHIP_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(CHIP_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(CHIP_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 *) &(configurationDescriptorsFS), +#if defined(CHIP_USB_UDPHS) || defined(CHIP_USB_OTGHS) + &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/usb/device/cdc-serial/CDCDSerialDriverDescriptors.h b/usb/device/cdc-serial/CDCDSerialDriverDescriptors.h new file mode 100644 index 0000000..8ab4edf --- /dev/null +++ b/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 + +//------------------------------------------------------------------------------ +// 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 + diff --git a/usb/device/cdc-serial/CDCarchitecture.png b/usb/device/cdc-serial/CDCarchitecture.png new file mode 100644 index 0000000..9d0e924 Binary files /dev/null and b/usb/device/cdc-serial/CDCarchitecture.png differ diff --git a/usb/device/cdc-serial/USB-SerialConverter.png b/usb/device/cdc-serial/USB-SerialConverter.png new file mode 100644 index 0000000..bc05c1f Binary files /dev/null and b/usb/device/cdc-serial/USB-SerialConverter.png differ diff --git a/usb/device/cdc-serial/cdc-serial.dir b/usb/device/cdc-serial/cdc-serial.dir new file mode 100644 index 0000000..ff18ab0 --- /dev/null +++ b/usb/device/cdc-serial/cdc-serial.dir @@ -0,0 +1,646 @@ +/* ---------------------------------------------------------------------------- + * 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. + * ---------------------------------------------------------------------------- + */ + +//------------------------------------------------------------------------------ +/// \dir +/// +/// !!!Purpose +/// +/// This directory provides definitions, structs and functions for a USB CDC +/// %device - USB CDC Serial Converter demo, to implement an USB Serial COM port +/// driver. +/// +/// !!!Contents +/// +/// There are two things for the implement of the USB CDC Serial %device driver: +/// - Implement the CDC Serial driver structs and functions for the %device, +/// to initialize, to handle CDC-specific requests and dispach +/// standard requests in USBD callbacks, to read/write through assigned USB +/// endpoints, +/// - Create the CDC Serial device's descriptors that should be passed to +/// the USBDDriver instance on initialization, so that the host can +/// recognize the %device as a USB CDC Serial COM port %device. +/// +/// For more information about what a particular group contains, please refer to +/// "USB CDC Serial Device". +//------------------------------------------------------------------------------ + +/** + \page "USB CDC Serial Device" + This page describes how to use the USB framework to produce a USB CDC Serial + Device driver, which appears as a virtual COM port on host. + + !!!References + - "AT91 USB device framework" + - "USB Device Enumeration" + - + Universal Serial Bus Revision 2.0 specification + (.zip file format, size 9.80 MB) + - + Communication Device Class Documents (.zip file format) + - Abstract Control Model Serial Emulation (USB Class Definitions for + Communication Devices, section 3.6.2.1). + + !!!Communication Device Class + + You can get some basic information about the Communication Device Class. + + !!Purpose + + CDC is used to connect communication devices, such as modems (digital or + analog), telephones or networking devices. Its generic framework supports a + wide variety of physical layers (xDSL, ATM, etc.) and protocols. + + In this document, CDC is used to implement a USB to a serial data converter. + A USB to serial converter can be used in this case to bridge a legacy RS-232 + interface with a USB port. + + !!Architecture + ... + + !Communication Class Interface + The #Communication Class Interface# is used for %device management. It + includes requests to manage the %device state, its responses, as well as + event notifications. This interface can also be optionally used for call + management, i.e., setting up and terminating calls as well as managing + their parameters. + + The interface requires at least one endpoint (#Default EP0#) to used for + %device management. Optionally, another endpoint can be dedicated to + event notification. This will usually be an #Interrupt IN# endpoint. + + !Data Class Interface + The #Data Class Interface# is used for generic data transmissions. It provides + a means for a communication %device to actually transfer data to and from the + host. In addition, it also enables the multiplexing of data and commands on + the same interface, through the use of wrappers. + + %Endpoints for this interface must exist in pairs of the same type. This is + necessary to allow both IN and OUT communication. Only the #Bulk# and + #Isochronous# types can be used for these %endpoints. + + \image CDCArchitecture.png "CDC Class Driver Architecture" + + !Models + To account for the wide variety of existing communication devices, several + #models# have been defined, for more details you can refer to CDC spec. 1.1. + - POTS (Plain Old Telephone Service) + - Direct Line Control Model + - Datapump Model + - Abstract Control Model (ACM) + - Telephone + - Telephone Control Model + - ISDN + - Multi-Channel Model + - USB CAPI Model + - Networking + - Ethernet Networking Model + - ATM Networking Control Model + + !Class-specific Descriptors + CDC-specific information is described using Functional Descriptors. They + define various parameters of an interface, such as how the %device handles + call management, or model-specific attributes. + + Since the CDC specification defines quite a number of functional descriptors, + they are not detailed here. Instead, they are presented in the various case + studies of this document in which they are used. + + !!Host Drivers + Most Operating Systems (OS) now include generic drivers for a wide variety of + USB classes. This makes developing a %device simpler, since the host complexity + is now handled by the OS. Manufacturers can thus concentrate on the %device + itself, not on developing specific host drivers. + + Here is a brief list of the various CDC implementations supported by several + OS: + - Windows + - Abstract Control Model + - Remote NDIS + - Linux + - Abstract Control Model + - Ethernet Model + + !!!USB to Serial Converter + This section describes the implementation of the USB to serial converter using + the CDC class and the AT91 USB Device Framework. + + !!Bridging a Legacy Device and a Host with USB-Serial Converter + \image USB-SerialConverter.png + + !!Model + The CDC specification defines a model which suits this application perfectly: + the #Abstract Control Model (ACM)#. It implements the requests and + notifications necessary to communicate with an RS-232 interface. + + The Abstract Control Model requires two interfaces, one #Communication Class + Interface# and one #Data Class Interface#. Each of them must have two + associated endpoints. The former shall have one endpoint dedicated to %device + management (default Control endpoint 0) and one for events notification + (additional Interrupt IN endpoint). + + The Data Class Interface needs two endpoints through which to carry data to + and from the host. Depending on the application, these endpoints can either + be Bulk or Isochronous. In the case of a USB to serial converter, using Bulk + endpoints is probably more appropriate, since the reliability of the + transmission is important and the data transfers are not time-critical. + + !!Descriptors + The descriptors are modtly standard ones. The following code examples thus + use the structures described in the "AT91 USB device framework". + + For CDC-specific descriptors, some new types are defined: + - CDCHeaderDescriptor + - CDCCallManagementDescriptor + - CDCAbstractControlManagementDescriptor + - CDCUnionDescriptor + + All the descriptors can be found in CDCDSerialDriverDescriptors.c. + + !Device Descriptor + \code +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 +}; + \endcode + The Vendor ID and Product ID fields are used to determine which driver to use + when the %device is enumerated. The Vendor ID is provided by the USB-IF + organization after registration; the product ID is completely vendor-specific. + In the example implementation provided with this document, the Atmel vendor ID + (03EBh) is used along with a custom product ID (6119h). + + The configuration descriptor is followed by interface, endpoint and class- + specific descriptors. +\code +const CDCDSerialDriverConfigurationDescriptors configurationDescriptors[]; +\endcode + + !Configuration Descriptor +\code + { + 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) + }, +\endcode + + !Communication Class Interface Descriptor + The bInterfaceClass should be set to 0x02 and bInterfaceSubClass should be set + to 0x02. +\code + { + 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 + }, +\endcode + + !Functional - Header Descriptor +\code + { + sizeof(CDCHeaderDescriptor), + CDCGenericDescriptor_INTERFACE, + CDCGenericDescriptor_HEADER, + CDCGenericDescriptor_CDC1_10 + }, +\endcode + + !Functional - Call Management Descriptor +\code + { + sizeof(CDCCallManagementDescriptor), + CDCGenericDescriptor_INTERFACE, + CDCGenericDescriptor_CALLMANAGEMENT, + CDCCallManagementDescriptor_SELFCALLMANAGEMENT, + 0 // No associated data interface + }, +\endcode + + !Functional - Abstract Control Management Descriptor +\code + { + sizeof(CDCAbstractControlManagementDescriptor), + CDCGenericDescriptor_INTERFACE, + CDCGenericDescriptor_ABSTRACTCONTROLMANAGEMENT, + CDCAbstractControlManagementDescriptor_LINE + }, +\endcode + + !Functional - Union Descriptor +\code + { + sizeof(CDCUnionDescriptor), + CDCGenericDescriptor_INTERFACE, + CDCGenericDescriptor_UNION, + 0, // Number of master interface is #0 + 1 // First slave interface is #1 + }, +\endcode + + !Notification Endpoint Descriptor + The EP is defined as CDCDSerialDriverDescriptors_NOTIFICATION. +\code + { + 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 + }, +\endcode + + !Data Class Interface Descriptor +\code + { + 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 + }, +\endcode + + !Data Endpoint Descriptors + The EPs are defined as CDCDSerialDriverDescriptors_DATAOUT & + CDCDSerialDriverDescriptors_DATAIN. +\code + // 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 + }, +\endcode + + !String Descriptors + Several descriptors (device, configuration, interface, etc.) can specify the + index of a string descriptor to comment their use. + + The actual string code is defined: + productStringDescriptor. + + !!Class-specific Requests + The CDC specification defines a set of #class-specific requests# for devices + implementing the ACM. This section details these requests. Please refer to + section 3.6.2.1 of the CDC spec. 1.1 for more information. + + !SetLineCoding, GetLineCoding + These requests are sent by the host to modify or retrieve the configuration of + the serial line, which includes: + - Baudrate + - Number of stop bits + - Parity check + - Number of data bits + + When the terminal application (such as HyperTerminal) on the host (PC) side + changes the setting of the COM port, a SetLineCoding request is sent with the + new parameters. The host may also retrieve the current setting using + GetLineCoding, not modifying them if they are correct. + + When a SET_LINE_CODING request is received, the %device should read the new + parameters. Then program the new parameters in the USART. A callback must be + provided to the USBD_Read function. + See CDCDSerialDriver_SetLineCoding. + + The code handling GET_LINE_CODING shall simply invoke the USBD_Write function + to send the current settings of the USART to the host. + See CDCDSerialDriver_GetLineCoding. + + !SetControlLineState + This request is sent by the host to notify the %device of two state changes. + The first bit (D0) of the wValue field of the request indicates whether or not + a terminal is connected to the virtual COM port. Bit D1 indicates that the + USART should enable/disable its carrier signal to start/stop receiving and + transmitting data. + + In practice, the USB to serial converter should operate only when those two + bits are set. Otherwise, it should not transmit or receive data. + + Since the SET_CONTROL_LINE_STATE request does not have a data payload, the + %device only has to acknowledge the request by sending a ZLP (zero-length + packet), using the USBD_Write method. + See CDCDSerialDriver_SetControlLineState. + + Before that, the wValue field should be parsed to retrieve the new control + line state. A single boolean variable can be used to keep track of the + connection state. If both the D0 and D1 bits are set, then the converter + should operate normally, i.e., forward data between the USART and the USB + host. Otherwise, it should stop its activity. + + !!Notifications + Notifications are sent by the %device when an event, such as a serial line + state change, has occurred. In this example, they are transmitted through a + dedicated Interrupt IN endpoint. A special header must precede the data + payload of each notification. This header has the same format of a SETUP + request, so the USBGenericRequest structure defined in the + "AT91 USB device framework" can be used. + + Note that the %device should only send a notification when there is a state + change, and not continuously. This does not really matter in practice, but + only sending notifications sporadically will reduce the stress on the %device. + + When the serial state is changed by CDCDSerialDriver_SetSerialState, the + notification is sent to the host. + + !!!CDC Serial Driver API + - CDCDSerialDriver_Initialize + - CDCDSerialDriver_RequestHandler + - CDCDSerialDriver_Read + - CDCDSerialDriver_Write + - CDCDSerialDriver_GetSerialState + - CDCDSerialDriver_SetSerialState + + !!!Main Application + The job of the main application is to bridge the USART and the USB. This means + that data read from one end must be forwarded to the other end. This section + describes several possibilities to do this. + + !!USB Operation + Reading data coming from the host is done using the CDCDSerialDriver_Read. + Since this is an asynchronous function, it does not block the execution flow. + This means that other actions (like reading data from the USART) can be + performed while the transfer is going on. Whenever some data is sent by the + host, the transfer terminates and the associated callback function is invoked. + This callback (UsbDataReceived) can be programmed to forward the received data + through the USART. + + Likewise, the CDCDSerialDriver_Write function can be called as soon as there + is data to transmit, again without block the program flow. However, there + cannot be two write operations at the same time, so the program must check + whether or not the last transfer is complete. This can be done by checking the + result code of the CDCDSerialDriver_Write method. If USB_STATUS_LOCKED is + returned, then there is already another operation in progress. The %device + will have to buffer the data retrieved from the USART until the endpoint + becomes free again. + + !!USART Operation + The USART peripheral present on AT91 chips can be used in two different ways. + The classic way is to read and write one byte at a time in the correct + registers to send and receive data. + + A more powerful method is available on AT91SAM chips, by using the embedded + Peripheral DMA Controller (PDC). The PDC can take care of transfers between + the processor, memory and %peripherals, thus freeing the processor to perform + other tasks. Since the PDC interrupt happens on the buffer full, Some timer + can be used to check if there is any data frags input from the USART. + + !!!Using a Generic Host Driver + See "USB CDC Serial Host Driver". + + !!!Add two or more ports in one USB device + See "USB Dual Port CDC Serial Device". + +*/ + +/** + \page "USB CDC Serial Host Driver" + Both Microsoft Windows and Linux offer a generic driver for using a USB to + serial converter %device. This page details the steps required to make use + of them. + + !!!Windows + On Microsoft Windows, the standard USB serial driver is named usbser.sys and + is part of the standard set of drivers. It has been available since Windows + 98SE. However, conversely to other generic driver such as the one for Mass + Storage Devices (MSD), usbser.sys is not automatically loaded when a CDC + %device is plugged in. + + !!Writing a Windows Driver File + For Windows to recognize the %device correctly, it is necessary to write a + .inf file. The Windows Driver Development Kit (DDK) contains information on + this topic. A basic driver, named 6119.inf in the example software provided, + will now be described. The driver file is made up of several sections. + + The first section of the .inf file must be the #[Version]# section. It + contains information about the driver version, provider, release data, and so + on. +\code +[Version] +Signature="$Chicago$" +Class=Ports +ClassGuid={4D36E978-E325-11CE-BFC1-08002BE10318} +Provider=%ATMEL% +DriverVer=09/12/2006,1.1.1.1 +\endcode + + The Signature attribute is mandatory and can be either "$Windows 95$", + "$Windows NT$" or "$Chicago$", depending on which Windows version(s) the + driver supports. "$Chicago$" is used to notify that every Windows version is + supported. Since in this example, the USB to serial converter is a virtual COM + port, the Class attribute should be equal to "Ports". The value of ClassGuid + depends on which class the %device uses. The Provider value indicates that the + string descriptor for the driver provider will be defined further, under the + tag ATMEL. Finally, the last tag show the driver version and release date. For + the version number, each digit is optional (except the first one), but must + not be null if present. + + Next come two sections, #[SourceDisksNames]# and #[SourceDisksFiles]#. They + are used to specify the installation disks required and the location of each + needed files on these disks. But they are not implemented because the file + is offered by windows or its install disk automatically. +\code +;[SourceDisksNames] +;1="Windows Install CD" +;[SourceDisksFiles] +;usbser.sys=1 +\endcode + + The driver file must now specify where copied files will be stored, using the + #[DestinationDirs]# section. +\code +[DestinationDirs] +DefaultDestDir=12 +\endcode + The target directory must be identified by its ID, which is system-defined. + The ID for the drivers directory is 12. + + The #[Manufacturer]# section lists the possible manufacturers for all devices + supported by this driver. In this case, the only supported %device is an ATMEL + one, so this will be the only value. +\code +[Manufacturer] +%ATMEL%=AtmelMfg +\endcode + + The attribute must be a string tag; its value must be the name of the Models + section in which all supported devices from this manufacturer will be listed. + In this case, it will be named AtmelMfg, which is the next section. + + Each Models section must list the hardware ID of each supported %device. For + USB devices, the hardware ID is made up of the Vendor ID, the Product ID and + (optionally) the Device Release Number. Those values are extracted from the + %device descriptor provided during the enumeration phase. +\code +[AtmelMfg] +%USBtoSerialConverter%=USBtoSer.Install,USB\VID_03EB&PID_6119 +\endcode + + The attribute name is again a string tag, which will be used to describe the + %device. The value is comprised of both the %device install section name + (USBtoSer.Install) and the hardware ID. The hardware ID is the same as the one + defined in "CDC Serial Device IDs". + + Now, the .inf file must detail the install section of each %device previously + listed. In this example, there is only one install section, named + #[USBtoSer.Install]#: +\code +[USBtoSer.Install] +CopyFiles=USBtoSer.CopyFiles +AddReg=USBtoSer.AddReg + +[USBtoSer.CopyFiles] +usbser.sys,,,0x00000002 + +[USBtoSer.AddReg] +HKR,,DevLoader,,*ntkern +HKR,,NTMPDriver,,usbser.sys + +[USBtoSer.Install.Services] +AddService=usbser,0x00000002,USBtoSer.AddService + +[USBtoSer.AddService] +DisplayName=%USBSer% +ServiceType=1r +StartType=3 +ServiceBinary=%12%\usbser.sys +\endcode + + The install section is actually divided in five. In the first section, two + other section names are specified: one for the list of files to copy, and one + for the keys to add to the Windows registry. There is only one file to copy, + usbser.sys; a flag (0x00000002) is used to specify that the user cannot skip + copying it. The registry keys are needed to install the driver on older + versions of Windows (such as Windows 98). For newer versions, the + #[USBtoSer.Install.Services]# registers the needed kernel services; each + service is actually listed in a section on its own. + + Finally, the last section, [Strings], defines all the string constants used + through this file: +\code +[Strings] +ATMEL="ATMEL Corp." +USBtoSerialConverter="AT91 USB to Serial Converter" +USBSer="USB Serial Driver" +\endcode + + !!Using the Driver + When a new %device is plugged in for the first time, Windows looks for an + appropriate specific or generic driver to use it. If it does not find one, the + user is asked what to do. + + This is the case with the USB to serial converter, since there is no generic + driver for it. To install the custom driver given in the previous section, + Windows must be told where to look for it. This can be done by selecting the + second option, "Install from a list or specific location", when the driver + installation wizards pops up. It will then ask for the directory where the + driver is located. After that, it should recognize the "AT91 USB to Serial + Converter" driver as an appropriate one and display it in the list. + + During the installation, the wizard asks for the location of the usbser.sys + file. If it is already installed on the system, it can be found in + "C:\Windows\System32\Drivers\". Otherwise, it is present on the Windows + installation CD. + + Once the driver is installed properly, a new COM port is added to the system + and can be used with HyperTerminal, for example. + + !!!Linux + Linux has two different generic drivers which are appropriate for a USB to + serial converter. The first one is an Abstract Control Model driver designed + for modem devices, and is simply named #acm#. The other one is a generic USB + to serial driver named #usbserial#. + + If the support for the #acm# driver has been compiled in the kernel, Linux + will automatically load it. A new terminal %device will be created under + /dev/ttyACMx. + + The usbserial driver must be loaded manually by using the modprobe command + with the vendor ID and product ID values used by the %device: +\code + modprobe usbserial vendor=0x03EB product=0x6119 +\endcode + + Once the driver is loaded, a new terminal entry appears and should be named + /dev/ttyUSBx. +*/ + +/** + \page "USB Dual Port CDC Serial Device" + +*/ diff --git a/usb/device/cdc-serial/drv/6119.inf b/usb/device/cdc-serial/drv/6119.inf new file mode 100644 index 0000000..14bd8d3 --- /dev/null +++ b/usb/device/cdc-serial/drv/6119.inf @@ -0,0 +1,45 @@ +; $Id: 6119.inf,v 1.1.2.1 2006/12/05 08:33:25 danielru Exp $ + +[Version] ; Version section +Signature="$Chicago$" ; All Windows versions +Class=Ports ; This is a serial port driver +ClassGuid={4D36E978-E325-11CE-BFC1-08002BE10318} ; Associated GUID +Provider=%ATMEL% ; Driver is provided by ATMEL +DriverVer=09/12/2006,1.1.1.5 ; Driver version 1.1.1.5 published on 23 February 2007 + +[DestinationDirs] ; DestinationDirs section +DefaultDestDir=12 ; Default install directory is \drivers or \IOSubSys + +[Manufacturer] ; Manufacturer section +%ATMEL%=AtmelMfg ; Only one manufacturer (ATMEL), models section is named + ; AtmelMfg + +[AtmelMfg] ; Models section corresponding to ATMEL +%USBtoSerialConverter%=USBtoSer.Install,USB\VID_03EB&PID_6119 ; Identifies a device with ATMEL Vendor ID (03EBh) and + ; Product ID equal to 6119h. Corresponding Install section + ; is named USBtoSer.Install + +[USBtoSer.Install] ; Install section +include=mdmcpq.inf +CopyFiles=FakeModemCopyFileSection +AddReg=USBtoSer.AddReg ; Registry keys to add are listed in USBtoSer.AddReg + +[USBtoSer.AddReg] ; AddReg section +HKR,,DevLoader,,*ntkern ; +HKR,,NTMPDriver,,usbser.sys +HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider" + +[USBtoSer.Install.Services] ; Services section +AddService=usbser,0x00000002,USBtoSer.AddService ; Assign usbser as the PnP driver for the device + +[USBtoSer.AddService] ; Service install section +DisplayName=%USBSer% ; Name of the serial driver +ServiceType=1 ; Service kernel driver +StartType=3 ; Driver is started by the PnP manager +ErrorControl=1 ; Warn about errors +ServiceBinary=%12%\usbser.sys ; Driver filename + +[Strings] ; Strings section +ATMEL="ATMEL Corp." ; String value for the ATMEL symbol +USBtoSerialConverter="AT91 USB to Serial Converter" ; String value for the USBtoSerialConverter symbol +USBSer="USB Serial Driver" ; String value for the USBSer symbol \ No newline at end of file diff --git a/usb/device/cdc-serial/drv/drv.dir b/usb/device/cdc-serial/drv/drv.dir new file mode 100644 index 0000000..a2ff78a --- /dev/null +++ b/usb/device/cdc-serial/drv/drv.dir @@ -0,0 +1,41 @@ +/* ---------------------------------------------------------------------------- + * 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. + * ---------------------------------------------------------------------------- + */ + +//------------------------------------------------------------------------------ +/// \dir +/// +/// !!!Purpose +/// +/// This directory provides install file for a CDC serial port %device. +/// +/// !!!Contents +/// +/// 6119.inf +/// +//------------------------------------------------------------------------------ -- cgit v1.2.3