[tuxdroid-svn] r1054 - in firmware/fuxusb/branches/HID/modules: usb usb_enum
Status: Beta
Brought to you by:
ks156
From: Paul_R <c2m...@c2...> - 2008-04-30 15:18:22
|
Author: Paul_R Date: 2008-04-30 17:18:24 +0200 (Wed, 30 Apr 2008) New Revision: 1054 Modified: firmware/fuxusb/branches/HID/modules/usb/usb_task.c firmware/fuxusb/branches/HID/modules/usb_enum/usb_enum.c Log: * Typo : fixed the max width for usb_enum.c and usb_task.c at 80col. Modified: firmware/fuxusb/branches/HID/modules/usb/usb_task.c =================================================================== --- firmware/fuxusb/branches/HID/modules/usb/usb_task.c 2008-04-30 15:03:49 UTC (rev 1053) +++ firmware/fuxusb/branches/HID/modules/usb/usb_task.c 2008-04-30 15:18:24 UTC (rev 1054) @@ -33,22 +33,22 @@ /*_____ D E F I N I T I O N ________________________________________________*/ -#define PONG_CHECK 0 /* count the pongs here */ -#define STATUS_CHECK 0 /* check validity of status bytes */ +#define PONG_CHECK 0 /* count the pongs here */ +#define STATUS_CHECK 0 /* check validity of status bytes */ void data_to_send(void); /*_____ D E C L A R A T I O N ______________________________________________*/ #if (PONG_CHECK) -unsigned char pong_received; /* value of the pong received from the sound cpu */ +unsigned char pong_received; /* value of the pong received from the sound cpu */ unsigned char pong_missed; /* counting the pong missed on the SPI */ #endif -bit EP_AUDIOIN_Loaded = 0; -bit i2c_bootloading_Flag = 0; /* bootloader mode */ +bit EP_AUDIOIN_Loaded = 0; +bit i2c_bootloading_Flag = 0; /* bootloader mode */ uint16_t address_tracking; -bit ReadStatus_USBRequest_Flag = 0; -bit Cpu_reset = 0; -bit Speaker_TTS_Select_Flag = 0; +bit ReadStatus_USBRequest_Flag = 0; +bit Cpu_reset = 0; +bit Speaker_TTS_Select_Flag = 0; fifo_t statusBuf; fifo_t *statusFifo = &statusBuf; @@ -56,7 +56,8 @@ data unsigned char received_status[4]; data unsigned char received_data[34]; data unsigned char Sample8; -data unsigned char Spi_Overflow_Ctr; +data unsigned char Spi_Overflow_Ctr; + /*F************************************************************************** * NAME: usb_task_init *---------------------------------------------------------------------------- @@ -104,7 +105,7 @@ P1_0 = 0; spi_task_on_Flag = 0; - RF_Status = 0; + RF_Status = 0; RF_OFFLine_Back = 0; Speaker_TTS_Select_Flag = 0; USB_ParserProcess_Permit_Flag = TRUE; @@ -162,7 +163,6 @@ if((USB_Status_NewCmd_Flag) && (CMD_IN_Bank_Nb < 2)) { - // &&(!(spi_master_config & RF_2FRAMES_HDR)) && (USB_StatusProcess_Permit_Flag) /* * If the bank number == 2, that means that both banks has been filled. */ @@ -294,6 +294,7 @@ if (USBCommand_ForDongle[0] == 0x01) { if (USBCommand_ForDongle[1] == 0x00) + { if(USBCommand_ForDongle[2] == 0x00) { @@ -305,15 +306,14 @@ USB_Status_NewCmd_Flag = TRUE; //DEBUG_2 = 0; } - // Complete reset - //////////////////////////////////////// - if(USBCommand_ForDongle[3] == 0xfe) + // Complete reset + //////////////////////////////////////// + if(USBCommand_ForDongle[3] == 0xfe) { - //--------------------------- - IEN0 = 0; - IEN1 = 0; - SPCON = 0x14; - tc=10000; + IEN0 = 0; + IEN1 = 0; + SPCON = 0x14; + tc=10000; Usb_detach(); while(tc) tc --; //tempo(TIMER_5_MS); Usb_attach(); @@ -326,10 +326,9 @@ if(USBCommand_ForDongle[3] == 0xff) { //--------------------------- - IEN0 = 0; - IEN1 = 0; - SPCON = 0x14; - + IEN0 = 0; + IEN1 = 0; + SPCON = 0x14; __api_clr_BLJB(); __api_wr_SBV (0xF4); tc=10000; @@ -342,14 +341,15 @@ WDTRST = 0xE1; while(1); } - } + } + } } - //-------------------------------------------------------------------------- + //------------------------------------------------------------------------- // Text To Speech // // USBCommand_ForDongle[1] == 0x01 Text To Speech Selected // USBCommand_ForDongle[1] == 0x00 Text To Speech UnSelected - //-------------------------------------------------------------------------- + //------------------------------------------------------------------------- if (USBCommand_ForDongle[0] == 0x02) { if (USBCommand_ForDongle[1] == 0x01) @@ -417,9 +417,6 @@ -void usb_task(void) -{ - data Uchar i; /*F************************************************************************** * NAME: usb_task *---------------------------------------------------------------------------- @@ -428,6 +425,9 @@ *---------------------------------------------------------------------------- * NOTE: *****************************************************************************/ +void usb_task(void) +{ + data Uchar i; if (!usb_connected_Flag) { if (Usb_resume()) @@ -440,9 +440,9 @@ Usb_clear_suspend(); Usb_clear_resume(); Usb_clear_sof(); - // FIFO_SPK_init(); - // FIFO_MIC_init(); - // spi_task_init(); + //FIFO_SPK_init(); + //FIFO_MIC_init(); + //spi_task_init(); } } else @@ -498,11 +498,11 @@ if (Usb_sof()) { Usb_clear_sof(); - usb_sof_counter ++; // == 0xFF == 250ms + usb_sof_counter ++; // == 0xFF == 250ms if(spi_watchdog_ctr) { - spi_watchdog_ctr--; // Decrement Watchdog + spi_watchdog_ctr--; // Decrement Watchdog } //--------------------------------------------------------- // Reset SPI Transfer @@ -510,10 +510,10 @@ else if (!i2c_bootloading_Flag) { //Led_1_on(); - spi_slave = HEADERS; // Set state machine + spi_slave = HEADERS; // Set state machine spi_master = HEADERM; - spi_enable = 1; // Communication Authorized - SPI_CSn = 1; // Chip select + spi_enable = 1; // Communication Authorized + SPI_CSn = 1; // Chip select spi_Start_Flag = 0; spi_ready = 0; } @@ -523,7 +523,6 @@ //-------------------------------------------------------------------------- if (i2c_wait_counter) i2c_wait_counter--; - //-------------------------------------------------------------------------- // Led Behavior //-------------------------------------------------------------------------- @@ -531,7 +530,6 @@ { if(RF_OFFLINE) { - if(RF_OFFLine_Back == 0) { Configure_led(0,LED_PORT_2MA); @@ -542,12 +540,12 @@ Led_0_off(); if (usb_sof_counter == 0x2FF) Led_0_on(); - if (usb_sof_counter == 0x3FF) // 0x0400 ==> Time Base = 1sec + if (usb_sof_counter == 0x3FF) //==> Time Base = 1sec usb_sof_counter = 0xFFFE; } - else // RF ON Line + else // RF ON Line { if(RF_OFFLine_Back == 1) { @@ -560,7 +558,7 @@ Led_0_off(); if (usb_sof_counter == 0x10) Led_0_on(); - if (usb_sof_counter == 0x20) // 0x0400 ==> Time Base = 1sec + if (usb_sof_counter == 0x20) //Time Base = 1sec usb_sof_counter = 0xFFFE; } } @@ -573,7 +571,7 @@ // //-------------------------------------------------------------------------- usb_Satus_command_process_task(); - usb_Bootloader_command_process_task(); + usb_Bootloader_command_process_task(); //-------------------------------------------------------------------------- // @@ -660,7 +658,8 @@ i=8; do { - FIFO_SPK_put(Usb_read_byte());// Use Only one Call to Get 8 Bytes + // Use Only one Call to Get 8 Bytes + FIFO_SPK_put(Usb_read_byte()); i--; }while(i); } @@ -686,13 +685,12 @@ i=8; do { - FIFO_SPK_put(Usb_read_byte()); // Use Only one Call to Get 8 Bytes - i--; + // Use Only one Call to Get 8 Bytes + FIFO_SPK_put(Usb_read_byte()); i--; }while(i); } - Usb_clear_rx(); - //DEBUG_1 = 0; + //DEBUG_1 = 0; } //-------------------------------------------------------------------------- @@ -709,8 +707,8 @@ if(Usb_tx_complete()) { Usb_clear_tx_complete(); - EP_AUDIOIN_Loaded = 0; // -> Enable a new Loading of the FIFO - } + // -> Enable a new Loading of the FIFO + EP_AUDIOIN_Loaded = 0; } } @@ -724,11 +722,9 @@ { if(Usb_test_it_ep(EP_CMD_OUT)) { - #ifdef FIFO_DEBUG printf("CMD OUT\n"); #endif - if(!USBCommand_NewRequest_Flag) { //DEBUG_2 = 1; @@ -736,9 +732,10 @@ //DEBUG_2 = 0; if(Usb_rx_complete()) { - USBCommand_Ctr = usb_get_nb_byte(); // Capture the number of Byte in USB FIFO - USBCommand_Header = Usb_read_byte(); // Read the Header - + // Capture the number of Byte in USB FIFO + USBCommand_Ctr = usb_get_nb_byte(); + // Read the Header + USBCommand_Header = Usb_read_byte(); //-------------------------------------------------------------------------- // // TUX CMD HEADER received @@ -749,12 +746,11 @@ //-------------------------------------------------------------------------- if(USBCommand_Header == LIBUSB_TUX_CMD_HDR) { - // printf (" LIBUSB_TUX_CMD_HDR \n"); if (!RF_OFFLINE) - USBCommand_NewRequest_Flag = 1; // to inform SPI_task that a new command is arrived - for(i=0;i<(USBCommand_Ctr-1);i++) + USBCommand_NewRequest_Flag = 1; for(i=0;i<(USBCommand_Ctr-1);i++) USBCommand_ForRF[i] = Usb_read_byte(); - tux_command_parser(USBCommand_ForRF, USBCommand_Ctr); + tux_command_parser(USBCommand_ForRF, \ + USBCommand_Ctr); } /* @@ -763,7 +759,7 @@ else if(USBCommand_Header == LIBUSB_DONGLE_CMD_HDR) { for(i=0;i<(USBCommand_Ctr-1);i++) - USBCommand_ForDongle[i] = Usb_read_byte(); + USBCommand_ForDongle[i] = Usb_read_byte(); #ifdef FIFO_DEBUG printf("usb command parser\n"); #endif @@ -1039,19 +1035,17 @@ //-------------------------------------------------------------------------- if ((SPI_START) && (spi_enable)) // Wait start { - spi_watchdog_ctr = SPI_WATCHDOG_MAX; - spi_ready = 0; - spi_count = 0; // Reset spi counter - spi_slave = HEADERS; // Set state machine - spi_master = HEADERM; - spi_enable = 0; // Communication in progress + spi_watchdog_ctr = SPI_WATCHDOG_MAX; + spi_ready = 0; + spi_count = 0; // Reset spi counter + spi_slave = HEADERS; // Set state machine + spi_master = HEADERM; + spi_enable = 0; // Communication in progress - SPI_CSn = 0; // Chip select - spi_Start_Flag = 1; - USB_ParserProcess_Permit_Flag = FALSE; - USB_StatusProcess_Permit_Flag = FALSE; - - + SPI_CSn = 0; // Chip select + spi_Start_Flag = 1; + USB_ParserProcess_Permit_Flag = FALSE; + USB_StatusProcess_Permit_Flag = FALSE; } //-------------------------------------------------------------------------- @@ -1061,12 +1055,11 @@ //-------------------------------------------------------------------------- if(spi_Start_Flag) { - //-------------------------------------------------------------------------- // // Excecute When RF Module is Ready // -// Falling Edge on spi_ready +// Falling Edge on spi_ready // //-------------------------------------------------------------------------- if(spi_ready) @@ -1084,23 +1077,25 @@ { if (USBCommand_NewRequest_Flag) // { - spi_slave_config = RF_AUDIO_HDR | RF_CMD_HDR; // Config byte + spi_slave_config = RF_AUDIO_HDR | + RF_CMD_HDR; // Config byte SPDAT = spi_slave_config; // Header byte - // printf ("CMD For RF \n"); } else { - spi_slave_config = RF_AUDIO_HDR; // Config byte - SPDAT = spi_slave_config; // Header byte - } + // Config byte + spi_slave_config = RF_AUDIO_HDR; + // Header byte + SPDAT = spi_slave_config; } } else { - if (USBCommand_NewRequest_Flag) // + if (USBCommand_NewRequest_Flag) { - - spi_slave_config = RF_CMD_HDR; // Config byte - SPDAT = spi_slave_config; // Header byte + // Config byte + spi_slave_config = RF_CMD_HDR; + // Header byte + SPDAT = spi_slave_config; #ifdef FIFO_DEBUG printf ("CMD For RF \n"); #endif @@ -1119,7 +1114,7 @@ spi_slave = PUT_COMMAND; // Next state if (spi_slave_config & RF_AUDIO_HDR) { - SPDAT = FIFO_SPK_get (); // Get data from FIFO + SPDAT = FIFO_SPK_get(); // Get data from FIFO } else SPDAT = 0x00; // No data to transmit @@ -1138,8 +1133,7 @@ } if (spi_slave_config & RF_CMD_HDR) { - SPDAT =USBCommand_ForRF[spi_count-18]; //0x00; // Get command from buffer - // printf (" %BX ", USBCommand_ForRF[spi_count-18]); + SPDAT =USBCommand_ForRF[spi_count-18]; } else SPDAT = 0x00; // No command to transmit @@ -1177,23 +1171,20 @@ if (spi_master_config & RF_AUDIO_HDR) { P1_0 = 1; - received_data[spi_count-2] = SPDAT; //FIFO_MIC_put(SPDAT); - } - + received_data[spi_count-2] = SPDAT; } if (spi_count == (spi_lenght_data + 1)) - spi_master = READ_COMMAND; // Go to the next state - } + // Go to the next state + spi_master = READ_COMMAND; } else if (spi_master == READ_COMMAND) { - while (!(SPSTA == 0x80)) // Wait SPI response + while (!(SPSTA == 0x80)) // Wait SPI response if(RF_OFFLINE) return; if (spi_master_config & RF_CMD_HDR) { - - if (spi_count <= spi_lenght_data + 5) - received_status[spi_count - spi_lenght_data - 2] = SPDAT; + received_status[spi_count - \ + spi_lenght_data - 2] = SPDAT; if (spi_count == spi_lenght_data + 6) { @@ -1214,7 +1205,9 @@ // // Store Sound Data in the FIFO MIC // - if (spi_master_config & (RF_2FRAMES_HDR|RF_AUDIO_HDR)) // Double frame + // Double frame + if (spi_master_config & (RF_2FRAMES_HDR | \ + RF_AUDIO_HDR)) { //Led_0_off(); i = 0; @@ -1222,16 +1215,16 @@ { FIFO_MIC_put(received_data[i]); i++; - }while(i<spi_lenght_data); + } while(i<spi_lenght_data); //Led_0_on(); } // // Store STATUS in the FIFO // - if (spi_master_config & RF_CMD_HDR) // Double frame + if (spi_master_config & RF_CMD_HDR) { if(received_status[0]) - { + { //Led_0_off(); i = 0; do{ Modified: firmware/fuxusb/branches/HID/modules/usb_enum/usb_enum.c =================================================================== --- firmware/fuxusb/branches/HID/modules/usb_enum/usb_enum.c 2008-04-30 15:03:49 UTC (rev 1053) +++ firmware/fuxusb/branches/HID/modules/usb_enum/usb_enum.c 2008-04-30 15:18:24 UTC (rev 1054) @@ -13,7 +13,7 @@ * $Id: usb_enum.c 481 2007-03-09 14:36:33Z raphael $ *****************************************************************************/ -/*_____ I N C L U D E S ____________________________________________________*/ +/*_____ I N C L U D E S _____________________________________________________*/ #include "config.h" #include "global.h" @@ -27,10 +27,10 @@ #include "modules\fifo_stt\fifo_stt.h" #include "modules\spi\spi_task.h" -/*_____ M A C R O S ________________________________________________________*/ +/*_____ M A C R O S _________________________________________________________*/ -/*_____ D E F I N I T I O N ________________________________________________*/ +/*_____ D E F I N I T I O N _________________________________________________*/ #define SIZE_OF_REPORT 0x22 @@ -40,7 +40,8 @@ { sizeof(usb_device_descriptor), DEVICE, USB_SPECIFICATION, DEVICE_CLASS, DEVICE_SUB_CLASS, DEVICE_PROTOCOL, EP_CONTROL_LENGTH, VENDOR_ID, PRODUCT_ID, - ((unsigned int)RELEASE_NUMBER), MAN_STRING_INDEX, PROD_STRING_INDEX, SN_STRING_INDEX, NB_CONFIGURATION + ((unsigned int)RELEASE_NUMBER), MAN_STRING_INDEX, PROD_STRING_INDEX, + SN_STRING_INDEX, NB_CONFIGURATION }; code struct usb_st_manufacturer usb_manufacturer = @@ -73,11 +74,11 @@ 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; @@ -86,7 +87,7 @@ 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; @@ -95,7 +96,7 @@ 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; @@ -103,11 +104,11 @@ 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; @@ -115,14 +116,14 @@ #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; @@ -140,81 +141,81 @@ { 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 + 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 + 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 + 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 + 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 + 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 }, @@ -222,445 +223,442 @@ // 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 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + 0x07, // descriptor length (7 bytes) + 0x25, // descriptor type (CS_END... [truncated message content] |