Documentation improvements - put driver example code into its own section, fix incorr...
[pub/USBasp.git] / Demos / Device / LowLevel / MIDI / Descriptors.c
index 5640c67..e556f07 100644 (file)
@@ -3,7 +3,7 @@
      Copyright (C) Dean Camera, 2010.
 
   dean [at] fourwalledcubicle [dot] com
-      www.fourwalledcubicle.com
+           www.lufa-lib.org
 */
 
 /*
@@ -47,9 +47,9 @@ USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
        .Header                 = {.Size = sizeof(USB_Descriptor_Device_t), .Type = DTYPE_Device},
 
        .USBSpecification       = VERSION_BCD(01.10),
-       .Class                  = 0x00,
-       .SubClass               = 0x00,
-       .Protocol               = 0x00,
+       .Class                  = USB_CSCP_NoDeviceClass,
+       .SubClass               = USB_CSCP_NoDeviceSubclass,
+       .Protocol               = USB_CSCP_NoDeviceProtocol,
 
        .Endpoint0Size          = FIXED_CONTROL_ENDPOINT_SIZE,
 
@@ -95,23 +95,23 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
 
                        .TotalEndpoints           = 0,
 
-                       .Class                    = 0x01,
-                       .SubClass                 = 0x01,
-                       .Protocol                 = 0x00,
+                       .Class                    = AUDIO_CSCP_AudioClass,
+                       .SubClass                 = AUDIO_CSCP_ControlSubclass,
+                       .Protocol                 = AUDIO_CSCP_ControlProtocol,
 
                        .InterfaceStrIndex        = NO_DESCRIPTOR
                },
 
        .Audio_ControlInterface_SPC =
                {
-                       .Header                   = {.Size = sizeof(USB_Audio_Interface_AC_t), .Type = DTYPE_CSInterface},
-                       .Subtype                  = DSUBTYPE_AudioHeader,
+                       .Header                   = {.Size = sizeof(USB_Audio_Descriptor_Interface_AC_t), .Type = DTYPE_CSInterface},
+                       .Subtype                  = AUDIO_DSUBTYPE_CSInterface_Header,
 
-                       .AudioSpecification       = VERSION_BCD(01.00),
-                       .TotalLength              = sizeof(USB_Audio_Interface_AC_t),
+                       .ACSpecification          = VERSION_BCD(01.00),
+                       .TotalLength              = sizeof(USB_Audio_Descriptor_Interface_AC_t),
 
                        .InCollection             = 1,
-                       .InterfaceNumbers         = {1},
+                       .InterfaceNumber          = 1,
                },
 
        .Audio_StreamInterface =
@@ -123,17 +123,17 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
 
                        .TotalEndpoints           = 2,
 
-                       .Class                    = 0x01,
-                       .SubClass                 = 0x03,
-                       .Protocol                 = 0x00,
+                       .Class                    = AUDIO_CSCP_AudioClass,
+                       .SubClass                 = AUDIO_CSCP_MIDIStreamingSubclass,
+                       .Protocol                 = AUDIO_CSCP_StreamingProtocol,
 
                        .InterfaceStrIndex        = NO_DESCRIPTOR
                },
 
        .Audio_StreamInterface_SPC =
                {
-                       .Header                   = {.Size = sizeof(USB_Audio_Interface_MIDI_AS_t), .Type = DTYPE_CSInterface},
-                       .Subtype                  = DSUBTYPE_General,
+                       .Header                   = {.Size = sizeof(USB_MIDI_Descriptor_AudioInterface_AS_t), .Type = DTYPE_CSInterface},
+                       .Subtype                  = AUDIO_DSUBTYPE_CSInterface_General,
 
                        .AudioSpecification       = VERSION_BCD(01.00),
 
@@ -143,10 +143,10 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
 
        .MIDI_In_Jack_Emb =
                {
-                       .Header                   = {.Size = sizeof(USB_MIDI_In_Jack_t), .Type = DTYPE_CSInterface},
-                       .Subtype                  = DSUBTYPE_InputJack,
+                       .Header                   = {.Size = sizeof(USB_MIDI_Descriptor_InputJack_t), .Type = DTYPE_CSInterface},
+                       .Subtype                  = AUDIO_DSUBTYPE_CSInterface_InputTerminal,
 
-                       .JackType                 = JACKTYPE_EMBEDDED,
+                       .JackType                 = MIDI_JACKTYPE_Embedded,
                        .JackID                   = 0x01,
 
                        .JackStrIndex             = NO_DESCRIPTOR
@@ -154,10 +154,10 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
 
        .MIDI_In_Jack_Ext =
                {
-                       .Header                   = {.Size = sizeof(USB_MIDI_In_Jack_t), .Type = DTYPE_CSInterface},
-                       .Subtype                  = DSUBTYPE_InputJack,
+                       .Header                   = {.Size = sizeof(USB_MIDI_Descriptor_InputJack_t), .Type = DTYPE_CSInterface},
+                       .Subtype                  = AUDIO_DSUBTYPE_CSInterface_InputTerminal,
 
-                       .JackType                 = JACKTYPE_EXTERNAL,
+                       .JackType                 = MIDI_JACKTYPE_External,
                        .JackID                   = 0x02,
 
                        .JackStrIndex             = NO_DESCRIPTOR
@@ -165,10 +165,10 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
 
        .MIDI_Out_Jack_Emb =
                {
-                       .Header                   = {.Size = sizeof(USB_MIDI_Out_Jack_t), .Type = DTYPE_CSInterface},
-                       .Subtype                  = DSUBTYPE_OutputJack,
+                       .Header                   = {.Size = sizeof(USB_MIDI_Descriptor_OutputJack_t), .Type = DTYPE_CSInterface},
+                       .Subtype                  = AUDIO_DSUBTYPE_CSInterface_OutputTerminal,
 
-                       .JackType                 = JACKTYPE_EMBEDDED,
+                       .JackType                 = MIDI_JACKTYPE_Embedded,
                        .JackID                   = 0x03,
 
                        .NumberOfPins             = 1,
@@ -180,10 +180,10 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
 
        .MIDI_Out_Jack_Ext =
                {
-                       .Header                   = {.Size = sizeof(USB_MIDI_Out_Jack_t), .Type = DTYPE_CSInterface},
-                       .Subtype                  = DSUBTYPE_OutputJack,
+                       .Header                   = {.Size = sizeof(USB_MIDI_Descriptor_OutputJack_t), .Type = DTYPE_CSInterface},
+                       .Subtype                  = AUDIO_DSUBTYPE_CSInterface_OutputTerminal,
 
-                       .JackType                 = JACKTYPE_EXTERNAL,
+                       .JackType                 = MIDI_JACKTYPE_External,
                        .JackID                   = 0x04,
 
                        .NumberOfPins             = 1,
@@ -197,12 +197,12 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
                {
                        .Endpoint =
                                {
-                                       .Header              = {.Size = sizeof(USB_Audio_StreamEndpoint_Std_t), .Type = DTYPE_Endpoint},
+                                       .Header              = {.Size = sizeof(USB_Audio_Descriptor_StreamEndpoint_Std_t), .Type = DTYPE_Endpoint},
 
                                        .EndpointAddress     = (ENDPOINT_DESCRIPTOR_DIR_OUT | MIDI_STREAM_OUT_EPNUM),
                                        .Attributes          = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
                                        .EndpointSize        = MIDI_STREAM_EPSIZE,
-                                       .PollingIntervalMS   = 0
+                                       .PollingIntervalMS   = 0x01
                                },
 
                        .Refresh                  = 0,
@@ -211,8 +211,8 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
 
        .MIDI_In_Jack_Endpoint_SPC =
                {
-                       .Header                   = {.Size = sizeof(USB_MIDI_Jack_Endpoint_t), .Type = DTYPE_CSEndpoint},
-                       .Subtype                  = DSUBTYPE_General,
+                       .Header                   = {.Size = sizeof(USB_MIDI_Descriptor_Jack_Endpoint_t), .Type = DTYPE_CSEndpoint},
+                       .Subtype                  = AUDIO_DSUBTYPE_CSEndpoint_General,
 
                        .TotalEmbeddedJacks       = 0x01,
                        .AssociatedJackID         = {0x01}
@@ -222,12 +222,12 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
                {
                        .Endpoint =
                                {
-                                       .Header              = {.Size = sizeof(USB_Audio_StreamEndpoint_Std_t), .Type = DTYPE_Endpoint},
+                                       .Header              = {.Size = sizeof(USB_Audio_Descriptor_StreamEndpoint_Std_t), .Type = DTYPE_Endpoint},
 
                                        .EndpointAddress     = (ENDPOINT_DESCRIPTOR_DIR_IN | MIDI_STREAM_IN_EPNUM),
                                        .Attributes          = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
                                        .EndpointSize        = MIDI_STREAM_EPSIZE,
-                                       .PollingIntervalMS   = 0
+                                       .PollingIntervalMS   = 0x01
                                },
 
                        .Refresh                  = 0,
@@ -236,8 +236,8 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
 
        .MIDI_Out_Jack_Endpoint_SPC =
                {
-                       .Header                   = {.Size = sizeof(USB_MIDI_Jack_Endpoint_t), .Type = DTYPE_CSEndpoint},
-                       .Subtype                  = DSUBTYPE_General,
+                       .Header                   = {.Size = sizeof(USB_MIDI_Descriptor_Jack_Endpoint_t), .Type = DTYPE_CSEndpoint},
+                       .Subtype                  = AUDIO_DSUBTYPE_CSEndpoint_General,
 
                        .TotalEmbeddedJacks       = 0x01,
                        .AssociatedJackID         = {0x03}