#define    KB_HID_REPORT_LENGTH sizeof(KB_HID_REPORT)
#define    MS_HID_REPORT_LENGTH sizeof(MS_HID_REPORT)

#define    USB_VID          0xE6A
#define    USB_PID          0x313
#define    USB_DID          0x101

#define    MF_STRING                             // Supported Manufacture String
#define    PD_STRING                             // Supported Product String
//#define    SN_STRING                             // Supported SerialNumber String


code BYTE KB_HID_REPORT[]=                       // 
  { 0x05,0x01,                                   // Usage Page (Generic Desktop Control)
    0x09,0x06,                                   // Usage (Keyboard)
    0xA1,0x01,                                   // Collection (Application)
        0x05,0x07,                               // Usage Page (Keyboard/Keypad Keys)
        0x19,0xE0,                               // Usage Minimum (224)
        0x29,0xE7,                               // Usage Maximum (231)
        0x15,0x00,                               // Logical Minimum (0)
        0x25,0x01,                               // Logical Maximum (1)
        0x75,0x01,                               // Report Size (1)
        0x95,0x08,                               // Report Count (8)
        0x81,0x02,                               // Input (Data, Variable, Absolute)
        0x95,0x01,                               // Report Count (1)
        0x75,0x08,                               // Report Size (8)
        0x81,0x01,                               // Input (Constant)
        0x95,0x03,                               // Report Count (3)
        0x75,0x01,                               // Report Size (1)
        0x05,0x08,                               // Usage Page (LED)
        0x19,0x01,                               // Usage Minimum (1)
        0x29,0x03,                               // Usage Maximum (3)
        0x91,0x02,                               // Output (Data, Variable, Absolute)
        0x95,0x05,                               // Report Count (5)
        0x75,0x01,                               // Report Size (1)
        0x91,0x01,                               // Output (Constant)
        0x95,0x06,                               // Report Count (6)
        0x75,0x08,                               // Report Size (8)
        0x15,0x00,                               // Logical Minimum (0)
        0x26,0xFF,0x00,                          // Logical Maximum (255)
        0x05,0x07,                               // Usage Page (Keyboard/Keypad Keys)
        0x19,0x00,                               // Usage Minimum (0)
        0x2A,0xFF,0x00,                          // Usage Maximum (255)
        0x81,0x00,                               // Input (Data, Array, Absolute)
        0x09,0x00,                               // Usage Page (Vendor Defined)
        0x95,0x08,                               // Report Count (8 Bytes)
        0x75,0x08,                               // Report Size (8 Bits)
        0xB1,0x00,                               // Feature (Data, Array, Absolute)
    0xC0,                                        // End Collection
  };


code BYTE MS_HID_REPORT[]=                       // 
  { 0x05,0x01,                                   // Usage Page (Generic Desktop Control)
    0x09,0x02,                                   // Usage (Mouse)
    0xA1,0x01,                                   // Collection (Application)
            0x09,0x01,                           // Usage (Pointer)
            0xA1,0x00,                           // Collection (Physical)
                0x05,0x09,                       // Usage (Button)
                0x19,0x01,                       // Usage Minimum (1)
                0x29,0x03,                       // Usage Maximum (3)
                0x15,0x00,                       // Logical Minimum (-0)
                0x25,0x01,                       // Logical Maximum (1)
                0x95,0x03,                       // Report Count (3)
                0x75,0x01,                       // Report Size (1)
                0x81,0x02,                       // Input (Data, Variable, Absolute)
                0x95,0x01,                       // Report Count (1)
                0x75,0x05,                       // Report Size (5)
                0x81,0x03,                       // Input (Constant)
                0x05,0x01,                       // Usage Page (Generic Desktop Control)
                0x09,0x30,                       // Usage (X)
                0x09,0x31,                       // Usage (Y)
                0x09,0x38,                       // Usage (Wheel)
                0x15,0x81,                       // Logical Minimum (-127)
                0x25,0x7F,                       // Logical Maximum (127)
                0x75,0x08,                       // Report Size (8)
                0x95,0x03,                       // Report Count (3)
                0x81,0x06,                       // Input (Data, Array, Absolute)
            0xC0,                                // End Collection
    0xC0,                                        // End Collection
  };


//-----Device Descriptor-----//
code BYTE DEVICE_DESCRIPTOR[]=
  { 0x12,                                        // 0:  bLength
    0x01,                                        // 1:  bDescriptorType (Device)
    0x10,                                        // 2:  bcdUSB(LSB)
    0x01,                                        //     bcdUSB(MSB)
    0x00,                                        // 4:  bDeviceClass
    0x00,                                        // 5:  bDevice SubClass
    0x00,                                        // 6:  bDeviceProtocol
    EP0_MAX,                                     // 7:  bMaxPacketSize
    LOBYTE( USB_VID ),                           // 8:  idVendor(LSB)
    HIBYTE( USB_VID ),                           //     idVendor(MSB)
    LOBYTE( USB_PID ),                           // 10: idProduct(LSB)
    HIBYTE( USB_PID ),                           //     idProduct(MSB)
    LOBYTE( USB_DID ),                           // 12: bcdDevice(LSB)
    HIBYTE( USB_DID ),                           //     bcdDevice(MSB)
#ifdef MF_STRING
    0x01,                                        // 14: iManufacture (String Index)
#endif
#ifndef MF_STRING
    0x00,                                        // 14: iManufacture (String Index)
#endif
#ifdef PD_STRING
    0x02,                                        // 15: iProduct     (String Index)
#endif
#ifndef PD_STRING
    0x00,                                        // 15: iProduct     (String Index)
#endif
#ifdef SN_STRING    
    0x03,                                        // 16: iSerialNumber(String Index)
#endif
#ifndef SN_STRING    
    0x00,                                        // 16: iSerialNumber(String Index)
#endif
    0x01                                         // 17: bNumConfigurations
  };


//-----Configuration Descriptor-----//
code BYTE CONGFIGURATION_DESCRIPTOR[]=
  { 0x09,                                        // 0:  bLength
    0x02,                                        // 1:  bDescriptorType
    0x11,                                        // 2:  wTotalLength(LSB)(All Descriptor ,
    0x01,                                        // 3:  wTotalLength(MSB)(Exclude "String")
    0x05,                                        // 4:  bNumInterface
    0x01,                                        // 5:  bConfigurationValue
    0x00,                                        // 6:  iConfiguration (String Index)
#ifdef SELF_POWER
    0xE0,                                        // 7:  bmAttributes (Bus power & Remote wakeup)
                                                 //     D7:      Reserved (Set to one)
                                                 //     D6:      Self Powered
                                                 //     D5:      Remote Wakeup
                                                 //     D4..0:   Reserved (Reset to 0)
    0x32                                         // 8:  Power    (100mA)
#endif
#ifdef BUS_POWER_500MA
    0xA0,                                        // 7:  bmAttributes (Bus power & Remote wakeup)
                                                 //     D7:      Reserved (Set to one)
                                                 //     D6:      Self Powered
                                                 //     D5:      Remote Wakeup
                                                 //     D4..0:   Reserved (Reset to 0)
    0xFA                                         // 8:  Power    (500mA)
#endif
#ifdef BUS_POWER_100MA
    0xA0,                                        // 7:  bmAttributes (Bus power & Remote wakeup)
                                                 //     D7:      Reserved (Set to one)
                                                 //     D6:      Self Powered
                                                 //     D5:      Remote Wakeup
                                                 //     D4..0:   Reserved (Reset to 0)
    0x32                                         // 8:  Power    (100mA)
#endif
  };


//-----Interface Descriptor-----//
code BYTE KB_INTERFACE_DESCRIPTOR[]=
  { 0x09,                                        // 0:  bLength
    0x04,                                        // 1:  bDescriptorType
    0x00,                                        // 2:  bInterfaceNumber
    0x00,                                        // 3:  bAlternateSetting
    0x01,                                        // 4:  bNumEndpoints
    0x03,                                        // 5:  bInterfaceClass
    0x01,                                        // 6:  bInterfaceSubClass
    0x01,                                        // 7:  bInterfaceProtocol
    0x00                                         // 8:  iInterface         (String Index)
  };
  

//-----HID Descriptor-----//
code BYTE KB_HID_DESCRIPTOR[]=
  { 0x09,                                        // 0:  bLength
    0x21,                                        // 1:  bDescriptorType
    0x10,                                        // 2:  bcdHIDClassL
    0x01,                                        // 3:  bcdHIDClassH
    0x00,                                        // 4:  Hardware Target Country
    0x01,                                        // 5:  Number of HID class descriptor to follow
    0x22,                                        // 6:  Report descriptor type
    KB_HID_REPORT_LENGTH,                        // 7:  Total length of Report descriptor L
    0x00                                         // 8:  Total length of Report descriptor H
  };


code BYTE KB_INTERRUPT_IN_ENDPOINT_DESCRIPTOR[]=
  { 0x07,           				 // 0:  bLength
    0x05,       				 // 1:  bDescriptorType
    0x81,       				 // 2:  bEndpointerAddress
               					 //      D7:     Direction(0:OUT, 1:IN)
               					 //      D6..4:  Reserved (reset to 0)
                				 //      D3..0:  Endpoint Number(0000-1111)
    0x03,       				 // 3:  bmAttributes
                				 //      D7..2:  Reserved (reset to 0)
                				 //      D1..0:  Transfer Type(00:Control,01:Bulk,02:Iso,03:Int)
    0x08,       				 // 4:  wPacketSize(LSB)
    0x00,       				 //     wPacketSize(MSB)
    0x0A        				 // 6:  bInterval (Unit 1ms)
                				 //      Isochronous Endpoint: 01
                				 //      Interrupt Endpoint: 01-ff
  };
          

//-----Standard AC Interface Descriptor-----//
code BYTE STD_AC_INTERFACE_DESCRIPTOR[]=
  { 0x09,                                        // 0:  bLength
    0x04,                                        // 1:  bDescriptorType
    0x01,                                        // 2:  bInterfaceNumber
    0x00,                                        // 3:  bAlternateSetting
    0x00,                                        // 4:  bNumEndpoints
    0x01,                                        // 5:  bInterfaceClass    (AUDIO)
    0x01,                                        // 6:  bInterfaceSubClass (AUDIO-CONTROL)
    0x00,                                        // 7:  bInterfaceProtocol (Unused)
    0x00                                         // 8:  iInterface         (String Index)
  };


//-----Class_Specific AC Interface Descriptor-----//
code BYTE CS_AC_INTERFACE_DESCRIPTOR[]=
  { 0x0A,                                        // 0:  bLength
    0x24,                                        // 1:  bDescriptorType    (CS_INTERFACE)
    0x01,                                        // 2:  bDescriptorSubType (HEADER)
    0x00,                                        // 3:  bcdADC(LSB)
    0x01,                                        //     bcdADC(MSB)    
    0x65,                                        // 5:  wTotalLength(LSB)  [H+I+F+M+O]
    0x00,                                        // 6:  wTotalLength(MSB)
    0x02,                                        // 7:  bInCollection,Number Of Streaming Interface
    0x02,                                        // 8:  bInterfaceNr
    0x03                                         // 8:  bInterfaceNr
  };


//-----Input Terminal Descriptor-----//
code BYTE INPUT_TERMINAL_USB_DESCRIPTOR[]=
  { 0x0C,                                        // 0:  bLength
    0x24,                                        // 1:  bDescriptorType    (CS_INTERFACE)
    0x02,                                        // 2:  bDescriptorSubType (INPUT_TERMINAL)
    0x01,                                        // 3:  bTerminalID
    0x01,                                        // 4:  bTerminalType(LSB) (USB Streaming)
    0x01,                                        // 5:  bTerminalType(MSB)
    0x00,                                        // 6:  bAssocTerminal     (No association)
    0x02,                                        // 7:  bNrChannels        (Two Channel)
    0x03,                                        // 8:  wChannelConfig(LSB)(Left , Right)
    0x00,                                        // 9:  wChannelConfig(MSB)
    0x00,                                        // A:  iChannelName       (Unused)
    0x00                                         // B:  iTerminal          (Unused)
  };

//-----Input Terminal Descriptor-----//
code BYTE INPUT_TERMINAL_MICROPHONE_DESCRIPTOR[]=
  { 0x0C,                                        // 0:  bLength
    0x24,                                        // 1:  bDescriptorType    (CS_INTERFACE)
    0x02,                                        // 2:  bDescriptorSubType (INPUT_TERMINAL)
    0x02,                                        // 3:  bTerminalID
    0x01,                                        // 4:  bTerminalType(LSB) (Microphone Streaming)
    0x02,                                        // 5:  bTerminalType(MSB)
    0x00,                                        // 6:  bAssocTerminal     (No association)
    0x01,                                        // 7:  bNrChannels        (One Channel)
    0x00,                                        // 8:  wChannelConfig(LSB)(Mono set)
    0x00,                                        // 9:  wChannelConfig(MSB)
    0x00,                                        // A:  iChannelName       (Unused)
    0x00                                         // B:  iTerminal          (Unused)
  };

//-----Output Terminal Descriptor-----//
code BYTE OUTPUT_TERMINAL_SPEAKER_DESCRIPTOR[]=
  { 0x09,                                        // 0:  bLength
    0x24,                                        // 1:  bDescriptorType    (CS_INTERFACE)
    0x03,                                        // 2:  bDescriptorSubType (OUTPUT_TERMINAL)
    0x03,                                        // 3:  bTerminalID
    0x01,                                        // 4:  bTerminalType(LSB) (Desktop SPEAKER)
    0x03,                                        // 5:  bTerminalType(MSB)
    0x00,                                        // 6:  bAssocTerminal     (No association)
    0x06,                                        // 7:  bSourceID          (bInputTerminalID)
    0x00                                         // 8:  iTerminal          (Unused)
  };
  
//-----Output Terminal Descriptor-----//
code BYTE OUTPUT_TERMINAL_USB_DESCRIPTOR[]=
  { 0x09,                                        // 0:  bLength
    0x24,                                        // 1:  bDescriptorType    (CS_INTERFACE)
    0x03,                                        // 2:  bDescriptorSubType (OUTPUT_TERMINAL)
    0x04,                                        // 3:  bTerminalID
    0x01,                                        // 4:  bTerminalType(LSB) (USB Streaming)
    0x01,                                        // 5:  bTerminalType(MSB)
    0x00,                                        // 6:  bAssocTerminal     (No association)
    0x05,                                        // 7:  bSourceID          (bInputTerminalID)
    0x00                                         // 8:  iTerminal          (Unused)
  };

//-----Selector Unit Descriptor-----//
code BYTE SELECTOR_UNIT_DESCRIPTOR[]=
  { 0x07,                                        // 0:  bLength
    0x24,                                        // 1:  bDescriptorType    (CS_ENDPOINT)
    0x05,                                        // 2:  bDescriptorSubType (Selector Unit)
    0x05,                                        // 3:  bUnitID
    0x01,                                        // 4:  bNrInPins
    0x07,                                        // 5:  baSourceID[1]
    0x00                                         // 6:  iSelector
  };

//-----Feature Unit Descriptor-----//
code BYTE Feature_Unit6_DESCRIPTOR[]=
  { 0x0D,                                        // 0:  bLength
    0x24,                                        // 1:  bDescriptorType    (CS_INTERFACE)
    0x06,                                        // 2:  bDescriptorSubType (FEATURE_UNIT)
    0x06,                                        // 3:  bUnitID
    0x09,                                        // 4:  bSourceID          (bInputTerminalID)
    0x02,                                        // 5:  bControlSize       (2 Byte)
    0x01,                                        // 6:  bmaControls/Master (Mute)
    0x00,                                        // 7:  Bass Boost
    0x02,                                        // 8:  bmaControls/Logical0(Volume)
    0x00,
    0x02,                                        // A:  bmaControls/Logical1(Volume)
    0x00,
    0x00                                         // C:  iFeature           (String Index)
  };

//-----Feature Unit Descriptor-----//
code BYTE Feature_Unit7_DESCRIPTOR[]=
  { 0x08,                                        // 0:  bLength
    0x24,                                        // 1:  bDescriptorType    (CS_INTERFACE)
    0x06,                                        // 2:  bDescriptorSubType (FEATURE_UNIT)
    0x07,                                        // 3:  bUnitID
    0x02,                                        // 4:  bSourceID          (bInputTerminalID)
    0x01,                                        // 5:  bControlSize       (1 Byte)
    0x03,                                        // 6:  bmaControls/Master (Mute/Volume)
    0x00                                         // C:  iFeature           (String Index)
  };

//-----Feature Unit Descriptor-----//
code BYTE Feature_Unit8_DESCRIPTOR[]=
  { 0x08,                                        // 0:  bLength
    0x24,                                        // 1:  bDescriptorType    (CS_INTERFACE)
    0x06,                                        // 2:  bDescriptorSubType (FEATURE_UNIT)
    0x08,                                        // 3:  bUnitID
    0x02,                                        // 4:  bSourceID          (bInputTerminalID)
    0x01,                                        // 5:  bControlSize       (1 Byte)
    0x03,                                        // 6:  bmaControls/Master (Mute/Volume)
    0x00                                         // C:  iFeature           (String Index)
  };

//-----Mixer Unit Descriptor-----//
code BYTE Mixer_Unit_DESCRIPTOR[]=
  { 0x0D,                                        // 0:  bLength
    0x24,                                        // 1:  bDescriptorType    (CS_INTERFACE)
    0x04,                                        // 2:  bDescriptorSubType (MIXER_UNIT)
    0x09,                                        // 3:  bUnitID
    0x02,                                        // 4:  bNrInputPins
    0x01,                                        // 5:  bSourceID[1]
    0x08,                                        // 6:  bSourceID[2]
    0x02,                                        // 7:  bNrChannels        (Two Channel)
    0x03,                                        // 8:  wChannelConfig(LSB)(Left , Right)
    0x00,                                        // 9:  wChannelConfig(MSB)
    0x00,                                        // A:  iChannelName       (Unused)
    0x00,                                        // B:  bmaControls        (Non-programmable)
    0x00                                         // C:  iMixer             (String Index)
  };
  
//-----Standard AS Interface Descriptor-----//
code BYTE OUT_STD_AS_INTERFACE_DESCRIPTOR[]=
  { 0x09,                                        // 0:  bLength
    0x04,                                        // 1:  bDescriptorType
    0x02,                                        // 2:  bInterfaceNumber
    0x00,                                        // 3:  bAlternateSetting
    0x00,                                        // 4:  bNumEndpoints
    0x01,                                        // 5:  bInterfaceClass    (AUDIO)
    0x02,                                        // 6:  bInterfaceSubClass (AUDIO-STREAMING)
    0x00,                                        // 7:  bInterfaceProtocol (Unused)
    0x00                                         // 8:  iInterface         (Unused)
  };


//-----Standard AS Alternate Interface Descriptor-----//
code BYTE OUT_STD_AS_ALT_INTERFACE_DESCRIPTOR[]=
  { 0x09,                                        // 0:  bLength
    0x04,                                        // 1:  bDescriptorType
    0x02,                                        // 2:  bInterfaceNumber
    0x01,                                        // 3:  bAlternateSetting
    0x01,                                        // 4:  bNumEndpoints
    0x01,                                        // 5:  bInterfaceClass    (AUDIO)
    0x02,                                        // 6:  bInterfaceSubClass (AUDIO-STREAMING)
    0x00,                                        // 7:  bInterfaceProtocol (Unused)
    0x00                                         // 8:  iInterface         (Unused)
  };


//-----Class_Specific AS Interface Descriptor-----//
code BYTE OUT_CS_AS_INTERFACE_DESCRIPTOR[]=
  { 0x07,                                        // 0:  bLength
    0x24,                                        // 1:  bDescriptorType    (CS_INTERFACE)
    0x01,                                        // 2:  bDescriptorSubType (AS_GENERAL)
    0x01,                                        // 3:  bTerminalLink      (INPUT Terminal ID)
    0x01,                                        // 4:  bDelay(ms)
    0x01,                                        // 5:  wFormatTag(LSB)    (PCM Format)
    0x00                                         // 6:  wFormatTag(MSB)
  };


//-----Format Type Descriptor-----//
code BYTE OUT_FORMAT_TYPE_DESCRIPTOR[]=
  { 0x0B,                                        // 0:  bLength
    0x24,                                        // 1:  bDescriptorType    (CS_INTERFACE)
    0x02,                                        // 2:  bDescriptorSubType (FORMAT_TYPE)
    0x01,                                        // 3:  bFormatType        (FORMAT_TYPE_I)
#ifdef SD_SO    
    0x02,                                        // 4:  bNrChannels        (Two Channel)
#endif
#ifdef SD_MO    
    0x01,                                        // 4:  bNrChannels        (One Channel)
#endif
    0x02,                                        // 5:  SubFrameSize       (Two Byte)
    0x10,                                        // 6:  bBitResolution     (16 bits)
    0x01,                                        // 7:  bSamFreqType       (One Sampling Freq.)
#ifdef SF_48K    
    0x80,                                        // 8:  tSamFreq(LSB)
    0xBB,                                        // 9:  tSamFreq(MSB)
    0x00                                         // A:  tSamFreq(HSB)
#endif
#ifdef SF_32K    
    0x00,                                        // 8:  tSamFreq(LSB)
    0x7D,                                        // 9:  tSamFreq(MSB)
    0x00                                         // A:  tSamFreq(HSB)
#endif
#ifdef SF_24K    
    0xC0,                                        // 8:  tSamFreq(LSB)
    0x5D,                                        // 9:  tSamFreq(MSB)
    0x00                                         // A:  tSamFreq(HSB)
#endif
#ifdef SF_16K    
    0x80,                                        // 8:  tSamFreq(LSB)
    0x3E,                                        // 9:  tSamFreq(MSB)
    0x00                                         // A:  tSamFreq(HSB)
#endif
#ifdef SF_12K    
    0xE0,                                        // 8:  tSamFreq(LSB)
    0x2E,                                        // 9:  tSamFreq(MSB)
    0x00                                         // A:  tSamFreq(HSB)
#endif
#ifdef SF_8K    
    0x40,                                        // 8:  tSamFreq(LSB)
    0x1F,                                        // 9:  tSamFreq(MSB)
    0x00                                         // A:  tSamFreq(HSB)
#endif
#ifdef SF_44_1K    
    0x44,                                        // 8:  tSamFreq(LSB)
    0xAC,                                        // 9:  tSamFreq(MSB)
    0x00                                         // A:  tSamFreq(HSB)
#endif
#ifdef SF_22_05K    
    0x22,                                        // 8:  tSamFreq(LSB)
    0x56,                                        // 9:  tSamFreq(MSB)
    0x00                                         // A:  tSamFreq(HSB)
#endif
  };


//-----Standard Data Endpoints Descriptor-----//
code BYTE OUT_STD_DATA_ENDPOINT4_DESCRIPTOR[]=
  { 0x09,                                        // 0:  bLength
    0x05,                                        // 1:  bDescriptorType
    0x04,                                        // 2:  bEndpointerAddress
                                                 //      D7:     Direction (0:OUT, 1:IN)
                                                 //      D6..4:  Reserved  (reset to 0)
                                                 //      D3..0:  Endpoint Number(0000-1111)
    0x09,                                        // 3:  bmAttributes
                                                 //      D7..2:  Reserved (reset to 0)
                                                 //      D3..2:  Synchronization Type (01:Asynchronous,10:Adaptive,11:Synchronous)
                                                 //      D1..0:  Transfer Type (00:Control,01:Iso,02:Bulk,03:Int)
#ifdef SD_SO
  #ifdef SF_48K
    0xC0,                                        // 4:  wPacketSize(LSB)   (192Bytes)
  #endif
  #ifdef SF_32K
    0x80,                                        // 4:  wPacketSize(LSB)   (128Bytes)
  #endif 
  #ifdef SF_24K
    0x60,                                        // 4:  wPacketSize(LSB)   (96Bytes)
  #endif 
  #ifdef SF_16K
    0x40,                                        // 4:  wPacketSize(LSB)   (64Bytes)
  #endif 
  #ifdef SF_12K
    0x30,                                        // 4:  wPacketSize(LSB)   (48Bytes)
  #endif 
  #ifdef SF_8K
    0x20,                                        // 4:  wPacketSize(LSB)   (32Bytes)
  #endif 
  #ifdef SF_44_1K
    0xB4,                                        // 4:  wPacketSize(LSB)   (180Bytes)
  #endif 
  #ifdef SF_22_05K
    0x5C,                                        // 4:  wPacketSize(LSB)   (92Bytes)
  #endif
#endif
#ifdef SD_MO
  #ifdef SF_48K
    0x60,                                        // 4:  wPacketSize(LSB)   (96Bytes)
  #endif
  #ifdef SF_32K
    0x40,                                        // 4:  wPacketSize(LSB)   (64Bytes)
  #endif
  #ifdef SF_24K
    0x30,                                        // 4:  wPacketSize(LSB)   (48Bytes)
  #endif
  #ifdef SF_16K
    0x20,                                        // 4:  wPacketSize(LSB)   (32Bytes)
  #endif
  #ifdef SF_12K
    0x18,                                        // 4:  wPacketSize(LSB)   (24Bytes)
  #endif
  #ifdef SF_8K
    0x10,                                        // 4:  wPacketSize(LSB)   (16Bytes)
  #endif
  #ifdef SF_44_1K
    0x5A,                                        // 4:  wPacketSize(LSB)   (90Bytes)
  #endif
  #ifdef SF_22_05K
    0x2E,                                        // 4:  wPacketSize(LSB)   (46Bytes)
  #endif
#endif
    0x00,                                        //     wPacketSize(MSB)
    0x01,                                        // 6:  bInterval (Unit 1ms)
                                                 //      Isochronous Endpoint: 01
                                                 //      Interrupt Endpoint: 01-ff
    0x00,                                        // 7:  bRefresh           (Unused)
    0x00                                         // 8:  bSynchAddress      (Unused)
  };


//-----Class_Specific Data Endpoints Descriptor-----//
code BYTE OUT_CS_DATA_ENDPOINT4_DESCRIPTOR[]=
  { 0x07,                                        // 0:  bLength
    0x25,                                        // 1:  bDescriptorType    (CS_ENDPOINT)
    0x01,                                        // 2:  bDescriptorSubType (AS_GENERAL)
    0x01,                                        // 3:  bmAttributes
    0x01,                                        // 4:  bLockDelayUnits(0:Undefined,1:Milliseconds,2:Decoded PCM samples)
    0x01,                                        // 5:  wLockDelay(LSB)
    0x00                                         // 6:  wLockDelay(MSB)
  };


//-----Standard AS Interface Descriptor-----//
code BYTE IN_STD_AS_INTERFACE_DESCRIPTOR[]=
  { 0x09,                                        // 0:  bLength
    0x04,                                        // 1:  bDescriptorType
    0x03,                                        // 2:  bInterfaceNumber
    0x00,                                        // 3:  bAlternateSetting
    0x00,                                        // 4:  bNumEndpoints
    0x01,                                        // 5:  bInterfaceClass    (AUDIO)
    0x02,                                        // 6:  bInterfaceSubClass (AUDIO-STREAMING)
    0x00,                                        // 7:  bInterfaceProtocol (Unused)
    0x00                                         // 8:  iInterface         (Unused)
  };


//-----Standard AS Alternate Interface Descriptor-----//
code BYTE IN_STD_AS_ALT_INTERFACE_DESCRIPTOR[]=
  { 0x09,                                        // 0:  bLength
    0x04,                                        // 1:  bDescriptorType
    0x03,                                        // 2:  bInterfaceNumber
    0x01,                                        // 3:  bAlternateSetting
    0x01,                                        // 4:  bNumEndpoints
    0x01,                                        // 5:  bInterfaceClass    (AUDIO)
    0x02,                                        // 6:  bInterfaceSubClass (AUDIO-STREAMING)
    0x00,                                        // 7:  bInterfaceProtocol (Unused)
    0x00                                         // 8:  iInterface         (Unused)
  };


//-----Class_Specific AS Interface Descriptor-----//
code BYTE IN_CS_AS_INTERFACE_DESCRIPTOR[]=
  { 0x07,                                        // 0:  bLength
    0x24,                                        // 1:  bDescriptorType    (CS_INTERFACE)
    0x01,                                        // 2:  bDescriptorSubType (AS_GENERAL)
    0x04,                                        // 3:  bTerminalLink      (OUTPUT Terminal ID)
    0x01,                                        // 4:  bDelay(ms)
    0x01,                                        // 5:  wFormatTag(LSB)    (PCM Format)
    0x00                                         // 6:  wFormatTag(MSB)
  };


//-----Format Type Descriptor-----//
code BYTE IN_FORMAT_TYPE_DESCRIPTOR[]=
  { 0x0B,                                        // 0:  bLength
    0x24,                                        // 1:  bDescriptorType    (CS_INTERFACE)
    0x02,                                        // 2:  bDescriptorSubType (FORMAT_TYPE)
    0x01,                                        // 3:  bFormatType        (FORMAT_TYPE_I)
#ifdef SD_SI    
    0x02,                                        // 4:  bNrChannels        (Two Channel)
#endif
#ifdef SD_MI    
    0x01,                                        // 4:  bNrChannels        (One Channel)
#endif
    0x02,                                        // 5:  SubFrameSize       (Two Byte)
    0x10,                                        // 6:  bBitResolution     (16 bits)
    0x01,                                        // 7:  bSamFreqType       (One Sampling Freq.)
#ifdef SF_48K    
    0x80,                                        // 8:  tSamFreq(LSB)
    0xBB,                                        // 9:  tSamFreq(MSB)
    0x00                                         // A:  tSamFreq(HSB)
#endif
#ifdef SF_32K    
    0x00,                                        // 8:  tSamFreq(LSB)
    0x7D,                                        // 9:  tSamFreq(MSB)
    0x00                                         // A:  tSamFreq(HSB)
#endif
#ifdef SF_24K    
    0xC0,                                        // 8:  tSamFreq(LSB)
    0x5D,                                        // 9:  tSamFreq(MSB)
    0x00                                         // A:  tSamFreq(HSB)
#endif
#ifdef SF_16K    
    0x80,                                        // 8:  tSamFreq(LSB)
    0x3E,                                        // 9:  tSamFreq(MSB)
    0x00                                         // A:  tSamFreq(HSB)
#endif
#ifdef SF_12K    
    0xE0,                                        // 8:  tSamFreq(LSB)
    0x2E,                                        // 9:  tSamFreq(MSB)
    0x00                                         // A:  tSamFreq(HSB)
#endif
#ifdef SF_8K    
    0x40,                                        // 8:  tSamFreq(LSB)
    0x1F,                                        // 9:  tSamFreq(MSB)
    0x00                                         // A:  tSamFreq(HSB)
#endif
#ifdef SF_44_1K    
    0x44,                                        // 8:  tSamFreq(LSB)
    0xAC,                                        // 9:  tSamFreq(MSB)
    0x00                                         // A:  tSamFreq(HSB)
#endif
#ifdef SF_22_05K    
    0x22,                                        // 8:  tSamFreq(LSB)
    0x56,                                        // 9:  tSamFreq(MSB)
    0x00                                         // A:  tSamFreq(HSB)
#endif
  };


//-----Standard Data Endpoints Descriptor-----//
code BYTE IN_STD_DATA_ENDPOINT5_DESCRIPTOR[]=
  { 0x09,                                        // 0:  bLength
    0x05,                                        // 1:  bDescriptorType
    0x85,                                        // 2:  bEndpointerAddress
                                                 //      D7:     Direction (0:OUT, 1:IN)
                                                 //      D6..4:  Reserved  (reset to 0)
                                                 //      D3..0:  Endpoint Number(0000-1111)
    0x05,                                        // 3:  bmAttributes
                                                 //      D7..2:  Reserved (reset to 0)
                                                 //      D3..2:  Synchronization Type (01:Asynchronous,10:Adaptive,11:Synchronous)
                                                 //      D1..0:  Transfer Type (00:Control,01:Iso,02:Bulk,03:Int)
#ifdef SD_SI
  #ifdef SF_48K
    0xC0,                                        // 4:  wPacketSize(LSB)   (192Bytes)
  #endif
  #ifdef SF_32K
    0x80,                                        // 4:  wPacketSize(LSB)   (128Bytes)
  #endif 
  #ifdef SF_24K
    0x60,                                        // 4:  wPacketSize(LSB)   (96Bytes)
  #endif 
  #ifdef SF_16K
    0x40,                                        // 4:  wPacketSize(LSB)   (64Bytes)
  #endif 
  #ifdef SF_12K
    0x30,                                        // 4:  wPacketSize(LSB)   (48Bytes)
  #endif 
  #ifdef SF_8K
    0x20,                                        // 4:  wPacketSize(LSB)   (32Bytes)
  #endif 
  #ifdef SF_44_1K
    0xB4,                                        // 4:  wPacketSize(LSB)   (180Bytes)
  #endif 
  #ifdef SF_22_05K
    0x5C,                                        // 4:  wPacketSize(LSB)   (92Bytes)
  #endif
#endif
#ifdef SD_MI
  #ifdef SF_48K
    0x60,                                        // 4:  wPacketSize(LSB)   (96Bytes)
  #endif
  #ifdef SF_32K
    0x40,                                        // 4:  wPacketSize(LSB)   (64Bytes)
  #endif
  #ifdef SF_24K
    0x30,                                        // 4:  wPacketSize(LSB)   (48Bytes)
  #endif
  #ifdef SF_16K
    0x20,                                        // 4:  wPacketSize(LSB)   (32Bytes)
  #endif
  #ifdef SF_12K
    0x18,                                        // 4:  wPacketSize(LSB)   (24Bytes)
  #endif
  #ifdef SF_8K
    0x10,                                        // 4:  wPacketSize(LSB)   (16Bytes)
  #endif
  #ifdef SF_44_1K
    0x5A,                                        // 4:  wPacketSize(LSB)   (90Bytes)
  #endif
  #ifdef SF_22_05K
    0x2E,                                        // 4:  wPacketSize(LSB)   (46Bytes)
  #endif
#endif

    0x00,                                        //     wPacketSize(MSB)
    0x01,                                        // 6:  bInterval (Unit 1ms)
                                                 //      Isochronous Endpoint: 01
                                                 //      Interrupt Endpoint: 01-ff
    0x00,                                        // 7:  bRefresh           (Unused)
    0x00                                         // 8:  bSynchAddress      (Unused)
  };


//-----Class_Specific Data Endpoints Descriptor-----//
code BYTE IN_CS_DATA_ENDPOINT5_DESCRIPTOR[]=
  { 0x07,                                        // 0:  bLength
    0x25,                                        // 1:  bDescriptorType    (CS_ENDPOINT)
    0x01,                                        // 2:  bDescriptorSubType (AS_GENERAL)
    0x01,                                        // 3:  bmAttributes
    0x00,                                        // 4:  bLockDelayUnits(0:Undefined,1:Milliseconds,2:Decoded PCM samples)
    0x00,                                        // 5:  wLockDelay(LSB)
    0x00                                         // 6:  wLockDelay(MSB)
  };


//-----Interface Descriptor-----//
code BYTE MS_INTERFACE_DESCRIPTOR[]=
  { 0x09,                                        // 0:  bLength
    0x04,                                        // 1:  bDescriptorType
    0x04,                                        // 2:  bInterfaceNumber
    0x00,                                        // 3:  bAlternateSetting
    0x01,                                        // 4:  bNumEndpoints
    0x03,                                        // 5:  bInterfaceClass
    0x01,                                        // 6:  bInterfaceSubClass
    0x02,                                        // 7:  bInterfaceProtocol
    0x00                                         // 8:  iInterface         (String Index)
  };
  

//-----HID Descriptor-----//
code BYTE MS_HID_DESCRIPTOR[]=
  { 0x09,                                        // 0:  bLength
    0x21,                                        // 1:  bDescriptorType
    0x10,                                        // 2:  bcdHIDClassL
    0x01,                                        // 3:  bcdHIDClassH
    0x00,                                        // 4:  Hardware Target Country
    0x01,                                        // 5:  Number of HID class descriptor to follow
    0x22,                                        // 6:  Report descriptor type
    MS_HID_REPORT_LENGTH,                        // 7:  Total length of Report descriptor L
    0x00                                         // 8:  Total length of Report descriptor H
  };


code BYTE MS_INTERRUPT_IN_ENDPOINT_DESCRIPTOR[]=
  { 0x07,           				 // 0:  bLength
    0x05,       				 // 1:  bDescriptorType
    0x82,       				 // 2:  bEndpointerAddress
               					 //      D7:     Direction(0:OUT, 1:IN)
               					 //      D6..4:  Reserved (reset to 0)
                				 //      D3..0:  Endpoint Number(0000-1111)
    0x03,       				 // 3:  bmAttributes
                				 //      D7..2:  Reserved (reset to 0)
                				 //      D1..0:  Transfer Type(00:Control,01:Bulk,02:Iso,03:Int)
    0x08,       				 // 4:  wPacketSize(LSB)
    0x00,       				 //     wPacketSize(MSB)
    0x02        				 // 6:  bInterval (Unit 1ms)
                				 //      Isochronous Endpoint: 01
                				 //      Interrupt Endpoint: 01-ff
  };


code BYTE LANGUAGEID_DESCRIPTOR[]=
  { 0x04,					 // Computed by subtraction two from the value of the first byte of the descriptor
    0x03, 					 // Descriptor Type
    0x09,
    0x04
  };


#define MFS_LEN sizeof("Megawin Technology Inc.")*2
//-----MANUFACTURER(UNICODE) in String Descriptor-----//
code BYTE MANUFACTURER_DESCRIPTOR[]=
  { MFS_LEN,
    0x03,                                        // Descriptor Type
    'M',0x00,
    'e',0x00,
    'g',0x00,
    'a',0x00,
    'w',0x00,
    'i',0x00,
    'n',0x00,
    ' ',0x00,
    'T',0x00,
    'e',0x00,
    'c',0x00,
    'h',0x00,
    'n',0x00,
    'o',0x00,
    'l',0x00,
    'o',0x00,
    'g',0x00,
    'y',0x00,
    ' ',0x00,
    'I',0x00,
    'n',0x00,
    'c',0x00,
    '.',0x00
  };


#define PDS_LEN sizeof("Media Keyboard")*2
//-----PRODUCT(UNICODE) in String Descriptor-----//
code BYTE PRODUCT_DESCRIPTOR[]=
  { PDS_LEN,
    0x03,                                        // Descriptor Type
    'M',0x00,
    'e',0x00,
    'd',0x00,
    'i',0x00,
    'a',0x00,
    ' ',0x00,
    'K',0x00,
    'e',0x00,
    'y',0x00,
    'b',0x00,
    'o',0x00,
    'a',0x00,
    'r',0x00,
    'd',0x00
  };


#define SNS_LEN sizeof("621031")*2
//-----Serial Number in String Descriptor-----//
code BYTE SERIALNUMBER_DESCRIPTOR[]=
  { SNS_LEN,
    0x03,                                        // Descriptor Type
    '6',0x00,
    '2',0x00,
    '1',0x00,
    '0',0x00,
    '3',0x00,
    '1',0x00
  };


