[tuxdroid-svn] r1153 - in firmware/fuxusb/trunk: . src
Status: Beta
Brought to you by:
ks156
From: Paul_R <c2m...@c2...> - 2008-05-15 13:58:18
|
Author: Paul_R Date: 2008-05-15 15:58:10 +0200 (Thu, 15 May 2008) New Revision: 1153 Added: firmware/fuxusb/trunk/src/usb_desc.c firmware/fuxusb/trunk/src/usb_desc.h Modified: firmware/fuxusb/trunk/fuxusb.Opt firmware/fuxusb/trunk/fuxusb.Uv2 firmware/fuxusb/trunk/src/usb_enum.c firmware/fuxusb/trunk/src/usb_enum.h Log: * Moved the descriptor structures to a specific file (usb_desc.[ch]) * Added mime-type "application/octet-stream" on fuxusb.Uv2 and fuxusb.Opt Modified: firmware/fuxusb/trunk/fuxusb.Opt =================================================================== (Binary files differ) Property changes on: firmware/fuxusb/trunk/fuxusb.Opt ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Modified: firmware/fuxusb/trunk/fuxusb.Uv2 =================================================================== (Binary files differ) Property changes on: firmware/fuxusb/trunk/fuxusb.Uv2 ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: firmware/fuxusb/trunk/src/usb_desc.c =================================================================== --- firmware/fuxusb/trunk/src/usb_desc.c (rev 0) +++ firmware/fuxusb/trunk/src/usb_desc.c 2008-05-15 13:58:10 UTC (rev 1153) @@ -0,0 +1,607 @@ +/* + * FUXUSB - Firmware for the USB CPU of tuxdroid + * Copyright (C) 2008 C2ME S.A. <tux...@c2...> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* $Id$ */ + +#include "config.h" +#include "usb_desc.h" + + +code struct usb_st_device_descriptor usb_device_descriptor = +{ + sizeof(usb_device_descriptor), DEVICE, USB_SPECIFICATION, DEVICE_CLASS, + DEVICE_SUB_CLASS, DEVICE_PROTOCOL, EP_CONTROL_LENGTH, VENDOR_ID, PRODUCT_ID, + ((uint16_t)RELEASE_NUMBER), MAN_STRING_INDEX, PROD_STRING_INDEX, + SN_STRING_INDEX, NB_CONFIGURATION +}; + +code struct usb_st_manufacturer usb_manufacturer = +{ sizeof(usb_manufacturer), STRING, USB_MANUFACTURER_NAME }; + +code struct usb_st_product usb_product = +{ sizeof(usb_product), STRING, USB_PRODUCT_NAME }; + +code struct usb_st_serial_number usb_serial_number = +{ sizeof(usb_serial_number), STRING, USB_SERIAL_NUMBER }; + +code struct usb_st_language_descriptor usb_language = +{ sizeof(usb_language), STRING, LANGUAGE_ID }; + +code struct usb_st_config usb_config = +{ sizeof(usb_config), STRING, USB_CONFIG_NAME }; + +code struct usb_st_micro_descriptor usb_audio_micro = +{ sizeof(usb_audio_micro), STRING, AUDIO_MICRO_NAME }; + +code struct usb_st_speaker_descriptor usb_audio_speaker = +{ sizeof(usb_audio_speaker), STRING, AUDIO_SPEAKER_NAME }; + +code struct usb_st_tts_descriptor usb_audio_tts = +{ sizeof(usb_audio_tts), STRING, AUDIO_TTS_NAME }; + +code struct usb_st_audio_descriptor usb_audio_normal = +{ sizeof(usb_audio_normal), STRING, AUDIO_NORMAL_NAME }; + +/* +code struct +{ + struct usb_st_configuration_descriptor cfg; + //------------------------------------------------------------------------- + // Audio + //------------------------------------------------------------------------- + // Interface 0 :: Audio Control + //------------------------------------------------------------------------- + struct usb_Audio_st_ACinterface_descriptor StandardACInterfaceDescriptor_1; + struct usb_Audio_cs_ACinterface_descriptor SpecificACInterfaceDescriptor; + struct usb_Audio_InputTerminal_descriptor MicInputTerminal1Descriptor; + struct usb_Audio_InputTerminal_descriptor SpkInputTerminalDescriptor; + struct usb_Audio_OutputTerminal_descriptor MicOutputTerminal1Descriptor; + struct usb_Audio_OutputTerminal_descriptor SpkOutputTerminalDescriptor; + + // Interface 1 :: Audio Stream Microphone + //------------------------------------------------------------------------- + struct usb_Audio_st_ASinterface_descriptor MicStandardAlt0ASInterfaceDescriptor; + struct usb_Audio_st_ASinterface_descriptor MicStandardAlt1ASInterfaceDescriptor; + struct usb_Audio_cs_ASinterface_descriptor MicSpecificASInterfaceDescriptor; + struct usb_Audio_TYPEI_FormatType_descriptor MicFormatTypeDescriptor; + struct usb_Audio_st_endpoint_descriptor MicStandardEndpointDescriptor; + struct usb_Audio_cs_ASendpoint_descriptor MicEndpointDescriptor; + + // Interface 2 :: Audio Stream Speaker + //------------------------------------------------------------------------- + struct usb_Audio_st_ASinterface_descriptor SpkStandardAlt0ASInterfaceDescriptor; + struct usb_Audio_st_ASinterface_descriptor SpkStandardAlt1ASInterfaceDescriptor; + struct usb_Audio_cs_ASinterface_descriptor SpkSpecificASInterfaceDescriptor; + struct usb_Audio_TYPEI_FormatType_descriptor SpkFormatTypeDescriptor; + struct usb_Audio_st_endpoint_descriptor SpkStandardEndpointDescriptor; + struct usb_Audio_cs_ASendpoint_descriptor SpkEndpointDescriptor; + + //------------------------------------------------------------------------- + // "HID" + //------------------------------------------------------------------------- + // Interface 3 :: Command / Status Interface + //------------------------------------------------------------------------- + struct usb_st_interface_descriptor HIDInterfaceDescriptor; + struct usb_hid_descriptor HIDStandardDescriptor; + struct usb_st_endpoint_descriptor HID_InEndpointDescriptor; + struct usb_st_endpoint_descriptor HID_OutEndpointDescriptor; + +#ifdef TTS_INTERFACE_ENABLED + // Interface 4 :: Audio Control + //------------------------------------------------------------------------- + struct usb_Audio_st_ACinterface_descriptor StandardACInterfaceDescriptor_TTS; + struct usb_Audio_cs_ACinterface_descriptor_NbCol1 SpecificACInterfaceDescriptor_TTS; + struct usb_Audio_InputTerminal_descriptor SpkInputTerminalDescriptor_TTS; + struct usb_Audio_OutputTerminal_descriptor SpkOutputTerminalDescriptor_TTS; + + // Interface 5 :: Audio Stream + //------------------------------------------------------------------------- + struct usb_Audio_st_ASinterface_descriptor SpkStandardAlt0ASInterfaceDescriptor_TTS; + struct usb_Audio_st_ASinterface_descriptor SpkStandardAlt1ASInterfaceDescriptor_TTS; + struct usb_Audio_cs_ASinterface_descriptor SpkSpecificASInterfaceDescriptor_TTS; + struct usb_Audio_TYPEI_FormatType_descriptor SpkFormatTypeDescriptor_TTS; + struct usb_Audio_st_endpoint_descriptor SpkStandardEndpointDescriptor_TTS; + struct usb_Audio_cs_ASendpoint_descriptor SpkEndpointDescriptor_TTS; +#endif + + // Report descriptor + //------------------------------------------------------------------------- + uint8_t rep[SIZE_OF_REPORT]; +} +*/ +code struct usb_configuration_s usb_configuration = +{ + { 9, CONFIGURATION, CONF_LENGTH, NB_INTERFACE, CONF_NB, + CONFIG_STRING_INDEX, CONF_ATTRIBUTES, MAX_POWER}, + + //------------------------------------------------------------------------- + // Audio + //------------------------------------------------------------------------- + // Interface 0 :: Audio Control + //------------------------------------------------------------------------- + // StandardACInterfaceDescriptor_1[] = + //------------------------------------- + { + 0x09, // length of descriptor (9 bytes) + 0x04, // descriptor type (INTERFACE) + 0x00, // interface number (0) + 0x00, // alternate setting (0) + 0x00, // number of endpoints (0) + 0x01, // interface class AUDIO + 0x01, // interface sub-class AUDIO_CONTROL + 0x00, // interface protocol UNUSED + 0x08 // interface string index UNUSED + }, + + // SpecificACInterfaceDescriptor[] = + //------------------------------------- + { + 0x0A, // length of descriptor (10 bytes) + 0x24, // descriptor type (CS_INTERFACE) + 0x01, // HEADER subtype + 0x0001, // bcdADC Revision of class specification 1.0 + 0x3400, // wTotal Lenght Total size of class specific descriptors + 0x02, // blnCollection Number of streaming interfaces + 0x01, // baInterfaceNr + 0x02 // baInterfaceNr + }, + + // IT Microphone Part : Hardware + // MicInputTerminal1Descriptor[] = + //------------------------------------- + { + 0x0C, // length of descriptor (12 bytes) + 0x24, // bdescriptor type (CS_INTERFACE) + 0x02, // bdescriptor Subtype INPUT_TERMINAL subtype + 0x01, // bTerminalID ID of this Input Terminal + 0x0102, // Terminal is Microphone + 0x00, // bAssocTerminal No Association + 0x01, // bNrChannels One channel + 0x0000, // wChannelConfig Mono Sets no posistion bits + 0x00, // iChannelNames Unused + 0x06 // iTerminal Unused + }, + + // IT Speaker Part : USB + // SpkInputTerminalDescriptor[] = + //------------------------------------- + { + 0x0C, // length of descriptor (12 bytes) + 0x24, // bdescriptor type (CS_INTERFACE) + 0x02, // bdescriptor Subtype INPUT_TERMINAL subtype + 0x02, // bTerminalID ID of this Input Terminal + 0x0101, // Terminal is USB + 0x00, // bAssocTerminal No Association + 0x01, // bNrChannels One channel + 0x0000, // wChannelConfig Mono Sets no posistion bits + 0x05, // iChannelNames Unused + 0 // iTerminal Unused + }, + + // OT Microphone Part : Software + // MicOutputTerminal1Descriptor[] = + //------------------------------------- + { + 0x09, // length of descriptor (9 bytes) + 0x24, // descriptor type (CS_INTERFACE) + 0x03, // bdescriptor subtype OUTPUT_TERMINAL + 0x03, // bTerminalID ID of this Output Terminal + 0x0101, // 0x0101 USB Streaming + 0x00, // bAssocTerminal No association + 0x01, // bSourceID From Input Termianl + 0x06 // iTerminal Unused + }, + + // OT Speaker Part : Software + // SpkOutputTerminalDescriptor[] = + //------------------------------------- + { + 0x09, // length of descriptor (9 bytes) + 0x24, // descriptor type (CS_INTERFACE) + 0x03, // bdescriptor subtype OUTPUT_TERMINAL + 0x04, // bTerminalID ID of this Output Terminal + 0x0103, // 0x0301 Speaker + 0x00, // bAssocTerminal No association + 0x02, // bSourceID From Input Termianl + 0x05 // iTerminal Unused + }, + + //------------------------------------------------------------------------- + // Microphone + //------------------------------------------------------------------------- + // Interface 1 :: Audio Stream + //------------------------------------------------------------------------- + // MicStandardAlt0ASInterfaceDescriptor[] = + //------------------------------------- + { + 0x09, // length of descriptor (9 bytes) + 0x04, // descriptor type (INTERFACE) + 0x01, // interface number Index of this interface + 0x00, // alternate setting Index of this alternate setting + 0x00, // number of endpoints (0) + 0x01, // interface class AUDIO + 0x02, // interface sub-class AUDIO_STREAMING + 0x00, // interface protocol UNUSED + 0x06 // interface string index UNUSED + }, + + // MicStandardAlt1ASInterfaceDescriptor[] = + //------------------------------------- + { + 0x09, // length of descriptor (9 bytes) + 0x04, // descriptor type (INTERFACE) + 0x01, // interface number Index of this interface + 0x01, // alternate setting Index of this alternate setting + 0x01, // number of endpoints (1) + 0x01, // interface class AUDIO + 0x02, // interface sub-class AUDIO_STREAMING + 0x00, // interface protocol UNUSED + 0x06 // interface string index UNUSED + }, + + // MicSpecificASInterfaceDescriptor[] = + //------------------------------------- + { + 0x07, // length of descriptor (7 bytes) + 0x24, // descriptor type (CS_INTERFACE) + 0x01, // GENERAL + 0x03, // wTerminalLink Unit ID of the Output Terminal + 0x01, // Interface Delay + 0x0200 // wFormatTag PCM8 + }, + + // MicFormatTypeDescriptor[] = + //------------------------------------- + { + 0x0B, // length of descriptor (11 bytes) + 0x24, // descriptor type (CS_INTERFACE) + 0x02, // descriptor subtype FORMAT TYPE subType + 0x01, // bFormatype FORMAT TYPE I + 0x01, // bNrChannels One Channel + 0x01, // bSubFrameSize 1 Bytes per Audio Subframe + 0x08, // BitResolution 8 bits per Sample + 0x01, // SampleFreqType One Frequency supported + 0x40,0x1F,0x00 // SamFreq 8000Hz + }, + + // MicStandardEndpointDescriptor[] = + //------------------------------------- + { + 0x09, // descriptor length (9 bytes) + 0x05, // descriptor type (ENDPOINT) + IN_ENDPOINT1, // endpoint address (IN endpoint, endpoint 1) + 0x01, // endpoint attributes (Isochronous) + 0x0800, // maximum packet size (8 bytes) + 0x01, // polling interval (1ms) + 0x00, // brefresh + 0x00 // Unused + }, + + // MicEndpointDescriptor[] = + //------------------------------------- + { + 0x07, // descriptor length (7 bytes) + 0x25, // descriptor type (CS_ENDPOINT) + 0x01, // DescriptorSubType GENERAL subtype + 0x00, // bMAttributes bit 7 :: max paket + 0x00, // bLockDelayUnits Unused + 0x0000 // LockDelay + }, + + //------------------------------------------------------------------------- + // Speaker + //------------------------------------------------------------------------- + // Interface 2 :: Audio Stream + //------------------------------------------------------------------------- + + // SpkStandardAlt0ASInterfaceDescriptor[] = + //------------------------------------- + { + 0x09, // length of descriptor (9 bytes) + 0x04, // descriptor type (INTERFACE) + 0x02, // interface number Index of this interface + 0x00, // alternate setting Index of this alternate setting + 0x00, // number of endpoints (0) + 0x01, // interface class AUDIO + 0x02, // interface sub-class AUDIO_STREAMING + 0x00, // interface protocol UNUSED + 0x05 // interface string index UNUSED + }, + + // SpkStandardAlt1ASInterfaceDescriptor[] = + //------------------------------------- + + { + 0x09, // length of descriptor (9 bytes) + 0x04, // descriptor type (INTERFACE) + 0x02, // interface number Index of this interface + 0x01, // alternate setting Index of this alternate setting + 0x01, // number of endpoints (1) + 0x01, // interface class AUDIO + 0x02, // interface sub-class AUDIO_STREAMING + 0x00, // interface protocol UNUSED + 0x05 // interface string index UNUSED + }, + + // SpkSpecificASInterfaceDescriptor[] = + //------------------------------------- + { + 0x07, // length of descriptor (7 bytes) + 0x24, // descriptor type (CS_INTERFACE) + 0x01, // GENERAL + 0x02, // wTerminalLink Unit ID of the Output Terminal + 0x01, // Interface Delay + 0x0200 // wFormatTag PCM 8 + }, + + // SpkFormatTypeDescriptor[] = + //------------------------------------- + { + 0x0B, // length of descriptor (11 bytes) + 0x24, // descriptor type (CS_INTERFACE) + 0x02, // descriptor subtype FORMAT TYPE subType + 0x01, // bFormatype FORMAT TYPE I + 0x01, // bNrChannels One Channel + 0x01, // bSubFrameSize 1 Bytes per Audio Subframe + 0x08, // BitResolution 8 bits per Sample + 0x01, // SampleFreqType One Frequency supported + 0x40,0x1F,0x00 // SamFreq 8000Hz + }, + + // SpkStandardEndpointDescriptor[] = + //------------------------------------- + { + 0x09, // descriptor length (9 bytes) + 0x05, // descriptor type (ENDPOINT) + OUT_ENDPOINT2, // endpoint address (OUT endpoint, endpoint 2) + 0x01, // endpoint attributes (Isochronous) + 0x0800, // maximum packet size (8 bytes) + 0x01, // polling interval (1ms) + 0x00, // brefresh + 0x00 // Unused + }, + + // SpkEndpointDescriptor[] = + //------------------------------------- + { + 0x07, // descriptor length (7 bytes) + 0x25, // descriptor type (CS_ENDPOINT) + 0x01, // DescriptorSubType GENERAL subtype + 0x00, // bMAttributes bit 7 :: max paket + 0x00, // bLockDelayUnits Unused + 0x0000 // LockDelay + }, + + //------------------------------------------------------------------------- + // "HID" LIB USB + //------------------------------------------------------------------------- + // Interface 3 :: Command / Status Interface + //------------------------------------------------------------------------- + { // Interface Descriptor + 0x09, // Descriptor size + 0x04, // Descriptor type (Interface) + 0x03, // Interface number + 0x00, // Alternate setting number + 0x02, // Number of endpoints in this interface + 0x03, // Interface class (HID) + 0x00, // Interface sub-class (vendor-specific) + 0x00, // Interface protocol (vendor-specific) + 0x00 // Interface string index + }, + + { // HID Descriptor + 0x09, // Descriptor size + 0x21, // Descriptor type (HID) + 0x1001, // HID Spec (1.1) + 0x00, // Country code (undef) + 0x01, // Number of subordinate class descriptors + 0x22, // Descriptor type (report) + 0x2200 // Report descriptor size + }, + + { // Endpoint Descriptor + 0x07, // Descriptor size + 0x05, // Descriptor type (Endpoint) + IN_ENDPOINT4, // Endpoint nb and direction + 0x03, // Endpoint type + 0x4000, // Maximum packet size + 0x01 // Polling interval + }, + + { // Endpoint Descriptor + 0x07, // Descriptor size + 0x05, // Descriptor type (Endpoint) + OUT_ENDPOINT5, // Endpoint nb and direction + 0x03, // Endpoint type + 0x4000, // Maximum packet size + 0x01 // Polling interval + }, +#ifdef TTS_INTERFACE_ENABLED + //------------------------------------------------------------------------- + // Audio + //------------------------------------------------------------------------- + // Interface 4 :: Audio Control + //------------------------------------------------------------------------- + // StandardACInterfaceDescriptor_1[] = + //------------------------------------- + { + 0x09, // length of descriptor (9 bytes) + 0x04, // descriptor type (INTERFACE) + 0x04, // interface number (4) + 0x00, // alternate setting (0) + 0x00, // number of endpoints (0) + 0x01, // interface class AUDIO + 0x01, // interface sub-class AUDIO_CONTROL + 0x00, // interface protocol UNUSED + 0x07 // interface string index UNUSED + }, + + // SpecificACInterfaceDescriptor[] = + //------------------------------------- + { + 0x09, // length of descriptor (9 bytes) + 0x24, // descriptor type (CS_INTERFACE) + 0x01, // HEADER subtype + 0x0001, // bcdADC Revision of class specification 1.0 + 0x1E00, // wTotal Lenght Total size of class specific descriptors + 0x01, // blnCollection Number of streaming interfaces + 0x05 // baInterfaceNr + }, + + // IT Speaker Part : USB + // SpkInputTerminalDescriptor[] = + //------------------------------------- + { + 0x0C, // length of descriptor (12 bytes) + 0x24, // bdescriptor type (CS_INTERFACE) + 0x02, // bdescriptor Subtype INPUT_TERMINAL subtype + 0x07, // bTerminalID ID of this Input Terminal + 0x0101, // Terminal is USB + 0x00, // bAssocTerminal No Association + 0x01, // bNrChannels One channel + 0x0000, // wChannelConfig Mono Sets no posistion bits + 0x00, // iChannelNames Unused + 0x07 // iTerminal Unused + }, + + // OT Speaker Part : Software + // SpkOutputTerminalDescriptor[] = + //------------------------------------- + { + 0x09, // length of descriptor (9 bytes) + 0x24, // descriptor type (CS_INTERFACE) + 0x03, // bdescriptor subtype OUTPUT_TERMINAL + 0x08, // bTerminalID ID of this Output Terminal + 0x0103, // 0x0301 Speaker + 0x00, // bAssocTerminal No association + 0x07, // bSourceID From Input Termianl + 0x07 // iTerminal Unused + }, + + //------------------------------------------------------------------------- + // Speaker + //------------------------------------------------------------------------- + // Interface 5 :: Audio Stream + //------------------------------------------------------------------------- + + // SpkStandardAlt0ASInterfaceDescriptor[] = + //------------------------------------- + { + 0x09, // length of descriptor (9 bytes) + 0x04, // descriptor type (INTERFACE) + 0x05, // interface number Index of this interface + 0x00, // alternate setting Index of this alternate setting + 0x00, // number of endpoints (0) + 0x01, // interface class AUDIO + 0x02, // interface sub-class AUDIO_STREAMING + 0x00, // interface protocol UNUSED + 0x07 // interface string index UNUSED + }, + + // SpkStandardAlt1ASInterfaceDescriptor[] = + //------------------------------------- + + { + 0x09, // length of descriptor (9 bytes) + 0x04, // descriptor type (INTERFACE) + 0x05, // interface number Index of this interface + 0x01, // alternate setting Index of this alternate setting + 0x01, // number of endpoints (1) + 0x01, // interface class AUDIO + 0x02, // interface sub-class AUDIO_STREAMING + 0x00, // interface protocol UNUSED + 0x07 // interface string index UNUSED + }, + + // SpkSpecificASInterfaceDescriptor[] = + //------------------------------------- + { + 0x07, // length of descriptor (7 bytes) + 0x24, // descriptor type (CS_INTERFACE) + 0x01, // GENERAL + 0x07, // wTerminalLink Unit ID of the Output Terminal + 0x01, // Interface Delay + 0x0200 // wFormatTag PCM8 + }, + + // SpkFormatTypeDescriptor[] = + //------------------------------------- + { + 0x0B, // length of descriptor (11 bytes) + 0x24, // descriptor type (CS_INTERFACE) + 0x02, // descriptor subtype FORMAT TYPE subType + 0x01, // bFormatype FORMAT TYPE I + 0x01, // bNrChannels One Channel + 0x01, // bSubFrameSize 1 Bytes per Audio Subframe + 0x08, // BitResolution 8 bits per Sample + 0x01, // SampleFreqType One Frequency supported + 0x40,0x1F,0x00 // SamFreq 8000Hz + }, + + // SpkStandardEndpointDescriptor[] = + //------------------------------------- + { + 0x09, // descriptor length (9 bytes) + 0x05, // descriptor type (ENDPOINT) + OUT_ENDPOINT3, // endpoint address (OUT endpoint, endpoint 2) + 0x01, // endpoint attributes (Isochronous) + 0x0800, // maximum packet size (8 bytes) + 0x01, // polling interval (1ms) + 0x00, // brefresh + 0x00 // Unused + }, + + // SpkEndpointDescriptor[] = + //------------------------------------- + { + 0x07, // descriptor length (7 bytes) + 0x25, // descriptor type (CS_ENDPOINT) + 0x01, // DescriptorSubType GENERAL subtype + 0x00, // bMAttributes bit 7 :: max paket + 0x00, // bLockDelayUnits Unused + 0x0000 // LockDelay + }, +#endif + //------------------------------------------------------------------------- + // HID Report descriptor + //------------------------------------------------------------------------- + // This descriptor defines the HID device. + //------------------------------------------------------------------------- + { // Report descriptor + 0x06, 0x00, 0xFF, // Usage page (vendor-defined) + 0x09, 0x01, // Usage (Vendor-defined) + 0xA1, 0x01, // Collection (Application) + + 0x09, 0x03, // Usage (vendor defined) + 0x15, 0x00, // Logical Minimum (0) + 0x26, 0xFF, 0x00, // Logical maximum (255) + 0x95, 0x40, // Report count (64) + 0x75, 0x08, // Report size (8 bits) + 0x81, 0x02, // input (data, variable, absolute) + + 0x09, 0x04, // Usage (vendor defined) + 0x15, 0x00, // Logical Minimum (0) + 0x26, 0xFF, 0x00, // Logical maximum (255) + 0x95, 0x40, // Report count (64) + 0x75, 0x08, // Report size (8 bits) + 0x91, 0x02, // output (data, variable, absolute) + + 0xC0 // End collection + } +}; Property changes on: firmware/fuxusb/trunk/src/usb_desc.c ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:keywords + Id Name: svn:eol-style + native Added: firmware/fuxusb/trunk/src/usb_desc.h =================================================================== --- firmware/fuxusb/trunk/src/usb_desc.h (rev 0) +++ firmware/fuxusb/trunk/src/usb_desc.h 2008-05-15 13:58:10 UTC (rev 1153) @@ -0,0 +1,447 @@ +/* + * FUXUSB - Firmware for the USB CPU of tuxdroid + * Copyright (C) 2008 C2ME S.A. <tux...@c2...> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* $Id$ */ + +#ifndef _USB_DESC_H_ +#define _USB_DESC_H_ + +#include "config.h" +#include "version.h" + + +/* USB descriptor type */ +#define DEVICE 0x01 +#define CONFIGURATION 0x02 +#define STRING 0x03 +#define INTERFACE 0x04 +#define ENDPOINT 0x05 + +/* Standard features*/ +#define DEVICE_REMOTE_WAKEUP_FEATURE 0x01 +#define ENDPOINT_HALT_FEATURE 0x00 + +/* Device status */ +#define SELF_POWERED 1 + +/* Device state */ +#define ATTACHED 0 +#define POWERED 1 +#define DEFAULT 2 +#define ADDRESSED 3 +#define CONFIGURED 4 +#define SUSPENDED 5 + +#define USB_CONFIG_BUSPOWERED 0x80 +#define USB_CONFIG_SELFPOWERED 0x40 +#define USB_CONFIG_REMOTEWAKEUP 0x20 + +/* Endpoints */ +#define OUT_ENDPOINT1 0x01 +#define OUT_ENDPOINT2 0x02 +#define OUT_ENDPOINT3 0x03 +#define OUT_ENDPOINT4 0x04 +#define OUT_ENDPOINT5 0x05 +#define OUT_ENDPOINT6 0x06 + +#define IN_ENDPOINT1 0x81 +#define IN_ENDPOINT2 0x82 +#define IN_ENDPOINT3 0x83 +#define IN_ENDPOINT4 0x84 +#define IN_ENDPOINT5 0x85 +#define IN_ENDPOINT6 0x86 + +/* Descriptors structures */ +struct Endpoint_information_st +{ + uint16_t fifo_size ; /* size of the endpoint FIFO */ + uint16_t fifo_left ; +}; + +struct USB_request_st +{ + uint8_t bmRequestType; /* Characteristics of the request */ + uint8_t bRequest; /* Specific request */ + uint16_t wValue; /* field that varies according to request */ + uint16_t wIndex; /* field that varies according to request */ + uint16_t wLength; /* Number of bytes to transfer if Data */ +}; + +struct usb_st_device_descriptor +{ + uint8_t bLength; /* Size of this descriptor in bytes */ + uint8_t bDescriptorType; /* DEVICE descriptor type */ + uint16_t bscUSB; /* Binay Coded Decimal Spec. release */ + uint8_t bDeviceClass; /* Class code assigned by the USB */ + uint8_t bDeviceSubClass; /* Sub-class code assigned by the USB */ + uint8_t bDeviceProtocol; /* Protocol code assigned by the USB */ + uint8_t bMaxPacketSize0; /* Max packet size for EP0 */ + uint16_t idVendor; /* Vendor ID. ATMEL = 0x03EB */ + uint16_t idProduct; /* Product ID assigned by the manufacturer */ + uint16_t bcdDevice; /* Device release number */ + uint8_t iManufacturer; /* Index of manu. string descriptor */ + uint8_t iProduct; /* Index of prod. string descriptor */ + uint8_t iSerialNumber; /* Index of S.N. string descriptor */ + uint8_t bNumConfigurations; /* Number of possible configurations */ +}; + +struct usb_st_configuration_descriptor +{ + uint8_t bLength; /* size of this descriptor in bytes */ + uint8_t bDescriptorType; /* CONFIGURATION descriptor type */ + uint16_t wTotalLength; /* total length of data returned */ + uint8_t bNumInterfaces; /* number of interfaces for this conf. */ + uint8_t bConfigurationValue; /* value for SetConfiguration resquest */ + uint8_t iConfiguration; /* index of string descriptor */ + uint8_t bmAttibutes; /* Configuration characteristics */ + uint8_t MaxPower; /* maximum power consumption */ +}; + +struct usb_hid_descriptor +{ + uint8_t bLength; /* size of this descriptor in bytes */ + uint8_t bDescriptorType; /* INTERFACE descriptor type */ + uint16_t bcdHID; /* HID spec. */ + uint8_t bCountryCode; /* Country code value*/ + uint8_t bNumDescriptors; /* Number of reports descriptor */ + uint8_t bDescriptorTypeRep; /* Type of the class-specific descriptor */ + uint16_t wDescriptorLength; /* Size of the report descriptor */ +}; + +struct usb_st_interface_descriptor +{ + uint8_t bLength; /* size of this descriptor in bytes */ + uint8_t bDescriptorType; /* INTERFACE descriptor type */ + uint8_t bInterfaceNumber; /* Number of interface */ + uint8_t bAlternateSetting; /* value to select alternate setting */ + uint8_t bNumEndpoints; /* Number of EP except EP 0 */ + uint8_t bInterfaceClass; /* Class code assigned by the USB */ + uint8_t bInterfaceSubClass; /* Sub-class code assigned by the USB */ + uint8_t bInterfaceProtocol; /* Protocol code assigned by the USB */ + uint8_t iInterface; /* Index of string descriptor */ +}; + +struct usb_st_endpoint_descriptor +{ + uint8_t bLength; /* Size of this descriptor in bytes */ + uint8_t bDescriptorType; /* ENDPOINT descriptor type */ + uint8_t bEndpointAddress; /* Address of the endpoint */ + uint8_t bmAttributes; /* Endpoint's attributes */ + uint16_t wMaxPacketSize; /* Maximum packet size for this EP */ + uint8_t bInterval; /* Interval for polling EP in ms */ +}; + +struct usb_st_manufacturer +{ + uint8_t bLength; /* size of this descriptor in bytes */ + uint8_t bDescriptorType; /* STRING descriptor type */ + uint16_t wstring[USB_MN_LENGTH];/* unicode characters */ +}; + +struct usb_st_product +{ + uint8_t bLength; /* size of this descriptor in bytes */ + uint8_t bDescriptorType; /* STRING descriptor type */ + uint16_t wstring[USB_PN_LENGTH];/* unicode characters */ +}; + +struct usb_st_serial_number +{ + uint8_t bLength; /* size of this descriptor in bytes */ + uint8_t bDescriptorType; /* STRING descriptor type */ + uint16_t wstring[USB_SN_LENGTH];/* unicode characters */ +}; + +struct usb_st_config +{ + uint8_t bLength; /* size of this descriptor in bytes */ + uint8_t bDescriptorType; /* STRING descriptor type */ + uint16_t wstring[USB_CONFIG_LENGTH];/* unicode characters */ +}; + +struct usb_st_language_descriptor +{ + uint8_t bLength; /* size of this descriptor in bytes */ + uint8_t bDescriptorType; /* STRING descriptor type */ + uint16_t wstring[USB_CONFIG_LENGTH]; /* language id */ +}; + +struct usb_st_speaker_descriptor +{ + uint8_t bLength; /* size of this descriptor in bytes */ + uint8_t bDescriptorType; /* STRING descriptor type */ + uint16_t wstring[AUDIO_SPEAKER_LENGTH]; /* language id */ +}; + +struct usb_st_micro_descriptor +{ + uint8_t bLength; /* size of this descriptor in bytes */ + uint8_t bDescriptorType; /* STRING descriptor type */ + uint16_t wstring[AUDIO_MICRO_LENGTH]; /* language id */ +}; + +struct usb_st_tts_descriptor +{ + uint8_t bLength; /* size of this descriptor in bytes */ + uint8_t bDescriptorType; /* STRING descriptor type */ + uint16_t wstring[AUDIO_TTS_LENGTH]; /* language id */ +}; + + +struct usb_st_audio_descriptor +{ + uint8_t bLength; /* size of this descriptor in bytes */ + uint8_t bDescriptorType; /* STRING descriptor type */ + uint16_t wstring[AUDIO_NORMAL_LENGTH]; /* language id */ +}; + + +/* HID specific */ +struct usb_st_hid_descriptor +{ + uint8_t bLength; /* Size of this descriptor in bytes */ + uint8_t bDescriptorType; /* HID descriptor type */ + uint16_t bscHID; /* Binay Coded Decimal Spec. release */ + uint8_t bCountryCode; /* Hardware target country */ + uint8_t bNumDescriptors; /* Number of HID class descriptors to follow */ + uint8_t bRDescriptorType; /* Report descriptor type */ + uint16_t wDescriptorLength; /* Total length of Report descriptor */ +}; + +/* Audio Class specific */ +struct usb_Audio_st_ACinterface_descriptor +{ + uint8_t bLength; /* size of this descriptor in bytes */ + uint8_t bDescriptorType; /* INTERFACE descriptor type */ + uint8_t bInterfaceNumber; /* Number of interface */ + uint8_t bAlternateSetting; /* value to select alternate setting */ + uint8_t bNumEndpoints; /* Number of EP except EP 0 */ + uint8_t bInterfaceClass; /* Class code assigned by the USB */ + uint8_t bInterfaceSubClass; /* Sub-class code assigned by the USB */ + uint8_t bInterfaceProtocol; /* Protocol code assigned by the USB */ + uint8_t iInterface; /* Index of string descriptor */ +}; + +struct usb_Audio_cs_ACinterface_descriptor +{ + uint8_t bLength; /* size of this descriptor in bytes */ + uint8_t bDescriptorType; /* INTERFACE descriptor type */ + uint8_t bDescriptorSubtype; /* HEADER descriptor subtype.*/ + uint16_t bcdADC; /* Audio Device Class Specification Release Number in Binary-Coded Decimal */ + uint16_t wTotalLength; /* Total number of bytes returned for the class-specific AudioControl interface descriptor */ + uint8_t bInCollection; /* Number of EP except EP 0 */ + uint8_t baInterfaceNr[2]; /* Class code assigned by the USB */ +}; + +struct usb_Audio_cs_ACinterface_descriptor_NbCol1 +{ + uint8_t bLength; /* size of this descriptor in bytes */ + uint8_t bDescriptorType; /* INTERFACE descriptor type */ + uint8_t bDescriptorSubtype; /* HEADER descriptor subtype.*/ + uint16_t bcdADC; /* Audio Device Class Specification Release Number in Binary-Coded Decimal */ + uint16_t wTotalLength; /* Total number of bytes returned for the class-specific AudioControl interface descriptor */ + uint8_t bInCollection; /* Number of EP except EP 0 */ + uint8_t baInterfaceNr[1]; /* Class code assigned by the USB */ +}; + +/*_____ U S B I N P U T T E R M I N A L D E S C R I P T O R ___________________________*/ +struct usb_Audio_InputTerminal_descriptor +{ + uint8_t bLength; /* size of this descriptor in bytes */ + uint8_t bDescriptorType; /* INTERFACE descriptor type */ + uint8_t bDescriptorSubtype; /* HEADER descriptor subtype.*/ + uint8_t bTerminalID; /* CConstant characterizing the type of Termina*/ + uint16_t wTerminalType; /* Constant characterizing the type of Terminal.*/ + uint8_t bAssocTerminal; /* ID of the Output Terminal to which this Input Terminal is associated */ + uint8_t bNrChannels; /* Number of logical output channels in the Terminals output audio channel cluster. */ + uint16_t wChannelConfig; /* Describes the spatial location of the logical channels.*/ + uint8_t iChannelNames; /*Index of a string descriptor, describing the name of the first logical channel */ + uint8_t iTerminal; /*Index of a string descriptor, describing the Input Terminal. */ +}; + +/*_____ U S B O U T P U T T E R M I N A L D E S C R I P T O R ___________________________*/ +struct usb_Audio_OutputTerminal_descriptor +{ + uint8_t bLength; /* size of this descriptor in bytes */ + uint8_t bDescriptorType; /* INTERFACE descriptor type */ + uint8_t bDescriptorSubtype; /* HEADER descriptor subtype.*/ + uint8_t bTerminalID; /* CConstant characterizing the type of Termina*/ + uint16_t wTerminalType; /* Constant characterizing the type of Terminal.*/ + uint8_t bAssocTerminal; /* ID of the Output Terminal to which this Input Terminal is associated */ + uint8_t bSourceID; /*ID of the Unit or Terminal to which this Terminal is connected */ + uint8_t iTerminal; /*Index of a string descriptor, describing the Input Terminal. */ +}; + +/*_____ U S B F E A T U R E U N I T D E S C R I P T O R ___________________________*/ +struct usb_Audio_FeatureUnit_descriptor +{ + uint8_t bLength; /* size of this descriptor in bytes */ + uint8_t bDescriptorType; /* INTERFACE descriptor type */ + uint8_t bDescriptorSubtype; /* HEADER descriptor subtype.*/ + uint8_t bUnitID; /* Constant uniquely identifying the Unit within the audio function.*/ + uint8_t bSourceID; /* Constant characterizing the type of Terminal.*/ + uint8_t bControlSize; /* Size in bytes of an element of the bmaControls() array: n*/ + uint8_t bmaControls[2]; /*ID of the Unit or Terminal to which this Terminal is connected */ + uint8_t iFeature; /*Index of a string descriptor, describing this Feature Unit.. */ +}; + +/*_____ U S B S T D AUDIO STREAM I N T E R F A C E D E S C R I P T O R _____________________*/ +struct usb_Audio_st_ASinterface_descriptor +{ + uint8_t bLength; /* size of this descriptor in bytes */ + uint8_t bDescriptorType; /* INTERFACE descriptor type */ + uint8_t bInterfaceNumber; /* Number of interface */ + uint8_t bAlternateSetting; /* value to select alternate setting */ + uint8_t bNumEndpoints; /* Number of EP except EP 0 */ + uint8_t bInterfaceClass; /* Class code assigned by the USB */ + uint8_t bInterfaceSubClass; /* Sub-class code assigned by the USB */ + uint8_t bInterfaceProtocol; /* Protocol code assigned by the USB */ + uint8_t iInterface; /* Index of string descriptor */ +}; + +/*_____ U S B C S AUDIO STREAM I N T E R F A C E D E S C R I P T O R _____________________*/ +struct usb_Audio_cs_ASinterface_descriptor +{ + uint8_t bLength; /* size of this descriptor in bytes */ + uint8_t bDescriptorType; /* INTERFACE descriptor type */ + uint8_t bDescriptorSubtype; /* AS_GENERAL descriptor subtype.*/ + uint8_t bTerminalLink; /* The Terminal ID of the Terminal to which the endpoint of this interface is connected.*/ + uint8_t bDelay; /* Delay (d) introduced by the data path */ + uint16_t wFormatTag; /* Class code assigned by the USB */ +}; + +/*_____ U S B AUDIO ST E N D P O I N T D E S C R I P T O R _______________________*/ +struct usb_Audio_st_endpoint_descriptor +{ + uint8_t bLength; /* Size of this descriptor in bytes */ + uint8_t bDescriptorType; /* ENDPOINT descriptor type */ + uint8_t bEndpointAddress; /* Address of the endpoint */ + uint8_t bmAttributes; /* Endpoint's attributes */ + uint16_t wMaxPacketSize; /* Maximum packet size for this EP */ + uint8_t bInterval; /* Interval for polling EP in ms */ + uint8_t bRefresh; /* Reset to 0.*/ + uint8_t bSynchAddress; /* The address of the endpoint used to communicate synchronization information if required by this endpoint..*/ +}; + +/*_____ U S B AUDIO S T E N D P O I N T D E S C R I P T O R _______________________*/ +struct usb_Audio_cs_ASendpoint_descriptor +{ + uint8_t bLength; /* Size of this descriptor in bytes */ + uint8_t bDescriptorType; /* ENDPOINT descriptor type */ + uint8_t bDescriptorSubtype; /* EP_GENERAL descriptor subtype. */ + uint8_t bmAttributes; /* Endpoint's attributes */ + uint8_t bLockDelayUnits; /*Indicates the units used for the wLockDelay field:*/ + uint16_t wLockDelay; /* Reset to 0.*/ +}; + +/*_____ U S B AUDIO S T E N D P O I N T D E S C R I P T O R _______________________*/ +struct usb_Audio_TYPEI_FormatType_descriptor +{ + uint8_t bLength; /* Size of this descriptor in bytes */ + uint8_t bDescriptorType; /* ENDPOINT descriptor type */ + uint8_t bDescriptorSubtype; /* EP_GENERAL descriptor subtype. */ + uint8_t bFormatType; /* FORMAT_TYPE_I. Constant identifying the Format Type the AudioStreaming interface is using.*/ + uint8_t bNrChannels; /*Indicates the number of physical channels in the audio data stream.:*/ + uint8_t bSubframeSize; /* The number of bytes occupied by one audio subframe. Can be 1, 2, 3 or 4.*/ + uint8_t bBitResolution; /* The number of effectively used bits from the available bits in an audio subframe.*/ + uint8_t bSamFreqType; /*Indicates how the sampling frequency can be programmed */ + uint8_t bSamFreqTbl[3]; /*See sampling frequency tables*/ +}; + +struct usb_configuration_s +{ + struct usb_st_configuration_descriptor cfg; + //------------------------------------------------------------------------- + // Audio + //------------------------------------------------------------------------- + // Interface 0 :: Audio Control + //------------------------------------------------------------------------- + struct usb_Audio_st_ACinterface_descriptor StandardACInterfaceDescriptor_1; + struct usb_Audio_cs_ACinterface_descriptor SpecificACInterfaceDescriptor; + struct usb_Audio_InputTerminal_descriptor MicInputTerminal1Descriptor; + struct usb_Audio_InputTerminal_descriptor SpkInputTerminalDescriptor; + struct usb_Audio_OutputTerminal_descriptor MicOutputTerminal1Descriptor; + struct usb_Audio_OutputTerminal_descriptor SpkOutputTerminalDescriptor; + + // Interface 1 :: Audio Stream Microphone + //------------------------------------------------------------------------- + struct usb_Audio_st_ASinterface_descriptor MicStandardAlt0ASInterfaceDescriptor; + struct usb_Audio_st_ASinterface_descriptor MicStandardAlt1ASInterfaceDescriptor; + struct usb_Audio_cs_ASinterface_descriptor MicSpecificASInterfaceDescriptor; + struct usb_Audio_TYPEI_FormatType_descriptor MicFormatTypeDescriptor; + struct usb_Audio_st_endpoint_descriptor MicStandardEndpointDescriptor; + struct usb_Audio_cs_ASendpoint_descriptor MicEndpointDescriptor; + + // Interface 2 :: Audio Stream Speaker + //------------------------------------------------------------------------- + struct usb_Audio_st_ASinterface_descriptor SpkStandardAlt0ASInterfaceDescriptor; + struct usb_Audio_st_ASinterface_descriptor SpkStandardAlt1ASInterfaceDescriptor; + struct usb_Audio_cs_ASinterface_descriptor SpkSpecificASInterfaceDescriptor; + struct usb_Audio_TYPEI_FormatType_descriptor SpkFormatTypeDescriptor; + struct usb_Audio_st_endpoint_descriptor SpkStandardEndpointDescriptor; + struct usb_Audio_cs_ASendpoint_descriptor SpkEndpointDescriptor; + + //------------------------------------------------------------------------- + // "HID" + //------------------------------------------------------------------------- + // Interface 3 :: Command / Status Interface + //------------------------------------------------------------------------- + struct usb_st_interface_descriptor HIDInterfaceDescriptor; + struct usb_hid_descriptor HIDStandardDescriptor; + struct usb_st_endpoint_descriptor HID_InEndpointDescriptor; + struct usb_st_endpoint_descriptor HID_OutEndpointDescriptor; + +#ifdef TTS_INTERFACE_ENABLED + // Interface 4 :: Audio Control + //------------------------------------------------------------------------- + struct usb_Audio_st_ACinterface_descriptor StandardACInterfaceDescriptor_TTS; + struct usb_Audio_cs_ACinterface_descriptor_NbCol1 SpecificACInterfaceDescriptor_TTS; + struct usb_Audio_InputTerminal_descriptor SpkInputTerminalDescriptor_TTS; + struct usb_Audio_OutputTerminal_descriptor SpkOutputTerminalDescriptor_TTS; + + // Interface 5 :: Audio Stream + //------------------------------------------------------------------------- + struct usb_Audio_st_ASinterface_descriptor SpkStandardAlt0ASInterfaceDescriptor_TTS; + struct usb_Audio_st_ASinterface_descriptor SpkStandardAlt1ASInterfaceDescriptor_TTS; + struct usb_Audio_cs_ASinterface_descriptor SpkSpecificASInterfaceDescriptor_TTS; + struct usb_Audio_TYPEI_FormatType_descriptor SpkFormatTypeDescriptor_TTS; + struct usb_Audio_st_endpoint_descriptor SpkStandardEndpointDescriptor_TTS; + struct usb_Audio_cs_ASendpoint_descriptor SpkEndpointDescriptor_TTS; +#endif + + // Report descriptor + //------------------------------------------------------------------------- + uint8_t rep[SIZE_OF_REPORT]; +}; + + +extern code struct usb_st_device_descriptor usb_device_descriptor; +extern code struct usb_configuration_s usb_configuration; + +extern code struct usb_st_manufacturer usb_manufacturer; +extern code struct usb_st_product usb_product; +extern code struct usb_st_serial_number usb_serial_number; +extern code struct usb_st_language_descriptor usb_language; +extern code struct usb_st_config usb_config; +extern code struct usb_st_micro_descriptor usb_audio_micro; +extern code struct usb_st_speaker_descriptor usb_audio_speaker; +extern code struct usb_st_tts_descriptor usb_audio_tts; +extern code struct usb_st_audio_descriptor usb_audio_normal; + +#endif // _USB_DESC_H_ Property changes on: firmware/fuxusb/trunk/src/usb_desc.h ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:keywords + Id Name: svn:eol-style + native Modified: firmware/fuxusb/trunk/src/usb_enum.c =================================================================== --- firmware/fuxusb/trunk/src/usb_enum.c 2008-05-15 13:15:44 UTC (rev 1152) +++ firmware/fuxusb/trunk/src/usb_enum.c 2008-05-15 13:58:10 UTC (rev 1153) @@ -23,6 +23,7 @@ #include "global.h" #include "version.h" #include "usb_enum.h" +#include "usb_desc.h" #include "usb_ep.h" #include "spi_task.h" #include "fifo_stt.h" @@ -33,590 +34,6 @@ /*_____ M A C R O S _________________________________________________________*/ -/*_____ D E F I N I T I O N _________________________________________________*/ - - -code struct usb_st_device_descriptor usb_device_descriptor = -{ - sizeof(usb_device_descriptor), DEVICE, USB_SPECIFICATION, DEVICE_CLASS, - DEVICE_SUB_CLASS, DEVICE_PROTOCOL, EP_CONTROL_LENGTH, VENDOR_ID, PRODUCT_ID, - ((uint16_t)RELEASE_NUMBER), MAN_STRING_INDEX, PROD_STRING_INDEX, - SN_STRING_INDEX, NB_CONFIGURATION -}; - -code struct usb_st_manufacturer usb_manufacturer = -{ sizeof(usb_manufacturer), STRING, USB_MANUFACTURER_NAME }; - -code struct usb_st_product usb_product = -{ sizeof(usb_product), STRING, USB_PRODUCT_NAME }; - -code struct usb_st_serial_number usb_serial_number = -{ sizeof(usb_serial_number), STRING, USB_SERIAL_NUMBER }; - -code struct usb_st_language_descriptor usb_language = -{ sizeof(usb_language), STRING, LANGUAGE_ID }; - -code struct usb_st_config usb_config = -{ sizeof(usb_config), STRING, USB_CONFIG_NAME }; - -code struct usb_st_micro_descriptor usb_audio_micro = -{ sizeof(usb_audio_micro), STRING, AUDIO_MICRO_NAME }; - -code struct usb_st_speaker_descriptor usb_audio_speaker = -{ sizeof(usb_audio_speaker), STRING, AUDIO_SPEAKER_NAME }; - -code struct usb_st_tts_descriptor usb_audio_tts = -{ sizeof(usb_audio_tts), STRING, AUDIO_TTS_NAME }; - -code struct usb_st_audio_descriptor usb_audio_normal = -{ sizeof(usb_audio_normal), STRING, AUDIO_NORMAL_NAME }; - - -code struct -{ struct usb_st_configuration_descriptor cfg; - //------------------------------------------------------------------------- - // Audio - //------------------------------------------------------------------------- - // Interface 0 :: Audio Control - //------------------------------------------------------------------------- - struct usb_Audio_st_ACinterface_descriptor StandardACInterfaceDescriptor_1; - struct usb_Audio_cs_ACinterface_descriptor SpecificACInterfaceDescriptor; - struct usb_Audio_InputTerminal_descriptor MicInputTerminal1Descriptor; - struct usb_Audio_InputTerminal_descriptor SpkInputTerminalDescriptor; - struct usb_Audio_OutputTerminal_descriptor MicOutputTerminal1Descriptor; - struct usb_Audio_OutputTerminal_descriptor SpkOutputTerminalDescriptor; - - // Interface 1 :: Audio Stream Microphone - //------------------------------------------------------------------------- - struct usb_Audio_st_ASinterface_descriptor MicStandardAlt0ASInterfaceDescriptor; - struct usb_Audio_st_ASinterface_descriptor MicStandardAlt1ASInterfaceDescriptor; - struct usb_Audio_cs_ASinterface_descriptor MicSpecificASInterfaceDescriptor; - struct usb_Audio_TYPEI_FormatType_descriptor MicFormatTypeDescriptor; - struct usb_Audio_st_endpoint_descriptor MicStandardEndpointDescriptor; - struct usb_Audio_cs_ASendpoint_descriptor MicEndpointDescriptor; - - // Interface 2 :: Audio Stream Speaker - //------------------------------------------------------------------------- - struct usb_Audio_st_ASinterface_descriptor SpkStandardAlt0ASInterfaceDescriptor; - struct usb_Audio_st_ASinterface_descriptor SpkStandardAlt1ASInterfaceDescriptor; - struct usb_Audio_cs_ASinterface_descriptor SpkSpecificASInterfaceDescriptor; - struct usb_Audio_TYPEI_FormatType_descriptor SpkFormatTypeDescriptor; - struct usb_Audio_st_endpoint_descriptor SpkStandardEndpointDescriptor; - struct usb_Audio_cs_ASendpoint_descriptor SpkEndpointDescriptor; - - //------------------------------------------------------------------------- - // "HID" - //------------------------------------------------------------------------- - // Interface 3 :: Command / Status Interface - //------------------------------------------------------------------------- - struct usb_st_interface_descriptor HIDInterfaceDescriptor; - struct usb_hid_descriptor HIDStandardDescriptor; - struct usb_st_endpoint_descriptor HID_InEndpointDescriptor; - struct usb_st_endpoint_descriptor HID_OutEndpointDescriptor; - -#ifdef TTS_INTERFACE_ENABLED - // Interface 4 :: Audio Control - //------------------------------------------------------------------------- - struct usb_Audio_st_ACinterface_descriptor StandardACInterfaceDescriptor_TTS; - struct usb_Audio_cs_ACinterface_descriptor_NbCol1 SpecificACInterfaceDescriptor_TTS; - struct usb_Audio_InputTerminal_descriptor SpkInputTerminalDescriptor_TTS; - struct usb_Audio_OutputTerminal_descriptor SpkOutputTerminalDescriptor_TTS; - - // Interface 5 :: Audio Stream - //------------------------------------------------------------------------- - struct usb_Audio_st_ASinterface_descriptor SpkStandardAlt0ASInterfaceDescriptor_TTS; - struct usb_Audio_st_ASinterface_descriptor SpkStandardAlt1ASInterfaceDescriptor_TTS; - struct usb_Audio_cs_ASinterface_descriptor SpkSpecificASInterfaceDescriptor_TTS; - struct usb_Audio_TYPEI_FormatType_descriptor SpkFormatTypeDescriptor_TTS; - struct usb_Audio_st_endpoint_descriptor SpkStandardEndpointDescriptor_TTS; - struct usb_Audio_cs_ASendpoint_descriptor SpkEndpointDescriptor_TTS; -#endif - - // Report descriptor - //------------------------------------------------------------------------- - uint8_t rep[SIZE_OF_REPORT]; -} -usb_configuration = -{ - { 9, CONFIGURATION, CONF_LENGTH, NB_INTERFACE, CONF_NB, - CONFIG_STRING_INDEX, CONF_ATTRIBUTES, MAX_POWER}, - - //------------------------------------------------------------------------- - // Audio - //------------------------------------------------------------------------- - // Interface 0 :: Audio Control - //------------------------------------------------------------------------- - // StandardACInterfaceDescriptor_1[] = - //------------------------------------- - { - 0x09, // length of descriptor (9 bytes) - 0x04, // descriptor type (INTERFACE) - 0x00, // interface number (0) - 0x00, // alternate setting (0) - 0x00, // number of endpoints (0) - 0x01, // interface class AUDIO - 0x01, // interface sub-class AUDIO_CONTROL - 0x00, // interface protocol UNUSED - 0x08 // interface string index UNUSED - }, - - // SpecificACInterfaceDescriptor[] = - //------------------------------------- - { - 0x0A, // length of descriptor (10 bytes) - 0x24, // descriptor type (CS_INTERFACE) - 0x01, // HEADER subtype - 0x0001, // bcdADC Revision of class specification 1.0 - 0x3400, // wTotal Lenght Total size of class specific descriptors - 0x02, // blnCollection Number of streaming interfaces - 0x01, // baInterfaceNr - 0x02 // baInterfaceNr - }, - - // IT Microphone Part : Hardware - // MicInputTerminal1Descriptor[] = - //------------------------------------- - { - 0x0C, // length of descriptor (12 bytes) - 0x24, // bdescriptor type (CS_INTERFACE) - 0x02, // bdescriptor Subtype INPUT_TERMINAL subtype - 0x01, // bTerminalID ID of this Input Terminal - 0x0102, // Terminal is Microphone - 0x00, // bAssocTerminal No Association - 0x01, // bNrChannels One channel - 0x0000, // wChannelConfig Mono Sets no posistion bits - 0x00, // iChannelNames Unused - 0x06 // iTerminal Unused - }, - - // IT Speaker Part : USB - // SpkInputTerminalDescriptor[] = - //------------------------------------- - { - 0x0C, // length of descriptor (12 bytes) - 0x24, // bdescriptor type (CS_INTERFACE) - 0x02, // bdescriptor Subtype INPUT_TERMINAL subtype - 0x02, // bTerminalID ID of this Input Terminal - 0x0101, // Terminal is USB - 0x00, // bAssocTerminal No Association - 0x01, // bNrChannels One channel - 0x0000, // wChannelConfig Mono Sets no posistion bits - 0x05, // iChannelNames Unused - 0 // iTerminal Unused - }, - - // OT Microphone Part : Software - // MicOutputTerminal1Descriptor[] = - //------------------------------------- - { - 0x09, // length of descriptor (9 bytes) - 0x24, // descriptor type (CS_INTERFACE) - 0x03, // bdescriptor subtype OUTPUT_TERMINAL - 0x03, // bTerminalID ID of this Output Terminal - 0x0101, // 0x0101 USB Streaming - 0x00, // bAssocTerminal No association - 0x01, // bSourceID From Input Termianl - 0x06 // iTerminal Unused - }, - - // OT Speaker Part : Software - // SpkOutputTerminalDescriptor[] = - //------------------------------------- - { - 0x09, // length of descriptor (9 bytes) - 0x24, // descriptor type (CS_INTERFACE) - 0x03, // bdescriptor subtype OUTPUT_TERMINAL - 0x04, // bTerminalID ID of this Output Terminal - 0x0103, // 0x0301 Speaker - 0x00, // bAssocTerminal No association - 0x02, // bSourceID From Input Termianl - 0x05 // iTerminal Unused - }, - - //------------------------------------------------------------------------- - // Microphone - //------------------------------------------------------------------------- - // Interface 1 :: Audio Stream - //------------------------------------------------------------------------- - // MicStandardAlt0ASInterfaceDescriptor[] = - //------------------------------------- - { - 0x09, // length of descriptor (9 bytes) - 0x04, // descriptor type (INTERFACE) - 0x01, // interface number Index of this interface - 0x00, // alternate setting Index of this alternate setting - 0x00, // number of endpoints (0) - 0x01, // interface class AUDIO - 0x02, // interface sub-class AUDIO_STREAMING - 0x00, // interface protocol UNUSED - 0x06 // interface string index UNUSED - }, - - // MicStandardAlt1ASInterfaceDescriptor[] = - //------------------------------------- - { - 0x09, // length of descriptor (9 bytes) - 0x04, // descriptor type (INTERFACE) - 0x01, // interface number Index of this interface - 0x01, // alternate setting Index of this alternate setting - 0x01, // number of endpoints (1) - 0x01, // interface class AUDIO - 0x02, // interface sub-class AUDIO_STREAMING - 0x00, // interface protocol UNUSED - 0x06 // interface string index UNUSED - }, - - // MicSpecificASInterfaceDescriptor[] = - //------------------------------------- - { - 0x07, // length of descriptor (7 bytes) - 0x24, // descriptor type (CS_INTERFACE) - ... [truncated message content] |