forked from mfulz_github/qmk_firmware
Reduce struct name pollution - group typedef struct names by class driver name where appropriate.
This commit is contained in:
parent
7366f590f5
commit
3cbdcd3686
|
@ -104,13 +104,13 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
|
|||
|
||||
.AudioControlInterface_SPC =
|
||||
{
|
||||
.Header = {.Size = sizeof(USB_AudioInterface_AC_t), .Type = DTYPE_AudioInterface},
|
||||
.Header = {.Size = sizeof(USB_Audio_Interface_AC_t), .Type = DTYPE_AudioInterface},
|
||||
.Subtype = DSUBTYPE_Header,
|
||||
|
||||
.ACSpecification = VERSION_BCD(01.00),
|
||||
.TotalLength = (sizeof(USB_AudioInterface_AC_t) +
|
||||
sizeof(USB_AudioInputTerminal_t) +
|
||||
sizeof(USB_AudioOutputTerminal_t)),
|
||||
.TotalLength = (sizeof(USB_Audio_Interface_AC_t) +
|
||||
sizeof(USB_Audio_InputTerminal_t) +
|
||||
sizeof(USB_Audio_OutputTerminal_t)),
|
||||
|
||||
.InCollection = 1,
|
||||
.InterfaceNumbers = {1},
|
||||
|
@ -118,7 +118,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
|
|||
|
||||
.InputTerminal =
|
||||
{
|
||||
.Header = {.Size = sizeof(USB_AudioInputTerminal_t), .Type = DTYPE_AudioInterface},
|
||||
.Header = {.Size = sizeof(USB_Audio_InputTerminal_t), .Type = DTYPE_AudioInterface},
|
||||
.Subtype = DSUBTYPE_InputTerminal,
|
||||
|
||||
.TerminalID = 0x01,
|
||||
|
@ -134,7 +134,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
|
|||
|
||||
.OutputTerminal =
|
||||
{
|
||||
.Header = {.Size = sizeof(USB_AudioOutputTerminal_t), .Type = DTYPE_AudioInterface},
|
||||
.Header = {.Size = sizeof(USB_Audio_OutputTerminal_t), .Type = DTYPE_AudioInterface},
|
||||
.Subtype = DSUBTYPE_OutputTerminal,
|
||||
|
||||
.TerminalID = 0x02,
|
||||
|
@ -180,7 +180,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
|
|||
|
||||
.AudioStreamInterface_SPC =
|
||||
{
|
||||
.Header = {.Size = sizeof(USB_AudioInterface_AS_t), .Type = DTYPE_AudioInterface},
|
||||
.Header = {.Size = sizeof(USB_Audio_Interface_AS_t), .Type = DTYPE_AudioInterface},
|
||||
.Subtype = DSUBTYPE_General,
|
||||
|
||||
.TerminalLink = 0x02,
|
||||
|
@ -191,7 +191,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
|
|||
|
||||
.AudioFormat =
|
||||
{
|
||||
.Header = {.Size = sizeof(USB_AudioFormat_t), .Type = DTYPE_AudioInterface},
|
||||
.Header = {.Size = sizeof(USB_Audio_Format_t), .Type = DTYPE_AudioInterface},
|
||||
.Subtype = DSUBTYPE_Format,
|
||||
|
||||
.FormatType = 0x01,
|
||||
|
@ -199,7 +199,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
|
|||
|
||||
.SubFrameSize = 0x02,
|
||||
.BitResolution = 16,
|
||||
.SampleFrequencyType = (sizeof(ConfigurationDescriptor.AudioFormat.SampleFrequencies) / sizeof(AudioSampleFreq_t)),
|
||||
.SampleFrequencyType = (AUDIO_TOTAL_SAMPLE_RATES * sizeof(USB_Audio_SampleFreq_t)),
|
||||
|
||||
.SampleFrequencies = {AUDIO_SAMPLE_FREQ(AUDIO_SAMPLE_FREQUENCY)}
|
||||
},
|
||||
|
@ -208,7 +208,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
|
|||
{
|
||||
.Endpoint =
|
||||
{
|
||||
.Header = {.Size = sizeof(USB_AudioStreamEndpoint_Std_t), .Type = DTYPE_Endpoint},
|
||||
.Header = {.Size = sizeof(USB_Audio_StreamEndpoint_Std_t), .Type = DTYPE_Endpoint},
|
||||
|
||||
.EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_IN | AUDIO_STREAM_EPNUM),
|
||||
.Attributes = (EP_TYPE_ISOCHRONOUS | ENDPOINT_ATTR_SYNC | ENDPOINT_USAGE_DATA),
|
||||
|
@ -222,7 +222,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
|
|||
|
||||
.AudioEndpoint_SPC =
|
||||
{
|
||||
.Header = {.Size = sizeof(USB_AudioStreamEndpoint_Spc_t), .Type = DTYPE_AudioEndpoint},
|
||||
.Header = {.Size = sizeof(USB_Audio_StreamEndpoint_Spc_t), .Type = DTYPE_AudioEndpoint},
|
||||
.Subtype = DSUBTYPE_General,
|
||||
|
||||
.Attributes = 0x00,
|
||||
|
|
|
@ -68,15 +68,15 @@
|
|||
{
|
||||
USB_Descriptor_Configuration_Header_t Config;
|
||||
USB_Descriptor_Interface_t AudioControlInterface;
|
||||
USB_AudioInterface_AC_t AudioControlInterface_SPC;
|
||||
USB_AudioInputTerminal_t InputTerminal;
|
||||
USB_AudioOutputTerminal_t OutputTerminal;
|
||||
USB_Audio_Interface_AC_t AudioControlInterface_SPC;
|
||||
USB_Audio_InputTerminal_t InputTerminal;
|
||||
USB_Audio_OutputTerminal_t OutputTerminal;
|
||||
USB_Descriptor_Interface_t AudioStreamInterface_Alt0;
|
||||
USB_Descriptor_Interface_t AudioStreamInterface_Alt1;
|
||||
USB_AudioInterface_AS_t AudioStreamInterface_SPC;
|
||||
USB_AudioFormat_t AudioFormat;
|
||||
USB_AudioStreamEndpoint_Std_t AudioEndpoint;
|
||||
USB_AudioStreamEndpoint_Spc_t AudioEndpoint_SPC;
|
||||
USB_Audio_Interface_AS_t AudioStreamInterface_SPC;
|
||||
USB_Audio_Format_t AudioFormat;
|
||||
USB_Audio_StreamEndpoint_Std_t AudioEndpoint;
|
||||
USB_Audio_StreamEndpoint_Spc_t AudioEndpoint_SPC;
|
||||
} USB_Descriptor_Configuration_t;
|
||||
|
||||
/* Function Prototypes: */
|
||||
|
|
|
@ -104,13 +104,13 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
|
|||
|
||||
.AudioControlInterface_SPC =
|
||||
{
|
||||
.Header = {.Size = sizeof(USB_AudioInterface_AC_t), .Type = DTYPE_AudioInterface},
|
||||
.Header = {.Size = sizeof(USB_Audio_Interface_AC_t), .Type = DTYPE_AudioInterface},
|
||||
.Subtype = DSUBTYPE_Header,
|
||||
|
||||
.ACSpecification = VERSION_BCD(01.00),
|
||||
.TotalLength = (sizeof(USB_AudioInterface_AC_t) +
|
||||
sizeof(USB_AudioInputTerminal_t) +
|
||||
sizeof(USB_AudioOutputTerminal_t)),
|
||||
.TotalLength = (sizeof(USB_Audio_Interface_AC_t) +
|
||||
sizeof(USB_Audio_InputTerminal_t) +
|
||||
sizeof(USB_Audio_OutputTerminal_t)),
|
||||
|
||||
.InCollection = 1,
|
||||
.InterfaceNumbers = {1},
|
||||
|
@ -118,7 +118,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
|
|||
|
||||
.InputTerminal =
|
||||
{
|
||||
.Header = {.Size = sizeof(USB_AudioInputTerminal_t), .Type = DTYPE_AudioInterface},
|
||||
.Header = {.Size = sizeof(USB_Audio_InputTerminal_t), .Type = DTYPE_AudioInterface},
|
||||
.Subtype = DSUBTYPE_InputTerminal,
|
||||
|
||||
.TerminalID = 0x01,
|
||||
|
@ -134,7 +134,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
|
|||
|
||||
.OutputTerminal =
|
||||
{
|
||||
.Header = {.Size = sizeof(USB_AudioOutputTerminal_t), .Type = DTYPE_AudioInterface},
|
||||
.Header = {.Size = sizeof(USB_Audio_OutputTerminal_t), .Type = DTYPE_AudioInterface},
|
||||
.Subtype = DSUBTYPE_OutputTerminal,
|
||||
|
||||
.TerminalID = 0x02,
|
||||
|
@ -180,7 +180,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
|
|||
|
||||
.AudioStreamInterface_SPC =
|
||||
{
|
||||
.Header = {.Size = sizeof(USB_AudioInterface_AS_t), .Type = DTYPE_AudioInterface},
|
||||
.Header = {.Size = sizeof(USB_Audio_Interface_AS_t), .Type = DTYPE_AudioInterface},
|
||||
.Subtype = DSUBTYPE_General,
|
||||
|
||||
.TerminalLink = 0x01,
|
||||
|
@ -191,7 +191,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
|
|||
|
||||
.AudioFormat =
|
||||
{
|
||||
.Header = {.Size = sizeof(USB_AudioFormat_t), .Type = DTYPE_AudioInterface},
|
||||
.Header = {.Size = sizeof(USB_Audio_Format_t), .Type = DTYPE_AudioInterface},
|
||||
.Subtype = DSUBTYPE_Format,
|
||||
|
||||
.FormatType = 0x01,
|
||||
|
@ -200,7 +200,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
|
|||
.SubFrameSize = 0x02,
|
||||
.BitResolution = 16,
|
||||
|
||||
.SampleFrequencyType = (sizeof(ConfigurationDescriptor.AudioFormat.SampleFrequencies) / sizeof(AudioSampleFreq_t)),
|
||||
.SampleFrequencyType = (AUDIO_TOTAL_SAMPLE_RATES * sizeof(USB_Audio_SampleFreq_t)),
|
||||
.SampleFrequencies = {AUDIO_SAMPLE_FREQ(AUDIO_SAMPLE_FREQUENCY)}
|
||||
},
|
||||
|
||||
|
@ -208,7 +208,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
|
|||
{
|
||||
.Endpoint =
|
||||
{
|
||||
.Header = {.Size = sizeof(USB_AudioStreamEndpoint_Std_t), .Type = DTYPE_Endpoint},
|
||||
.Header = {.Size = sizeof(USB_Audio_StreamEndpoint_Std_t), .Type = DTYPE_Endpoint},
|
||||
|
||||
.EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_OUT | AUDIO_STREAM_EPNUM),
|
||||
.Attributes = (EP_TYPE_ISOCHRONOUS | ENDPOINT_ATTR_SYNC | ENDPOINT_USAGE_DATA),
|
||||
|
@ -222,7 +222,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
|
|||
|
||||
.AudioEndpoint_SPC =
|
||||
{
|
||||
.Header = {.Size = sizeof(USB_AudioStreamEndpoint_Spc_t), .Type = DTYPE_AudioEndpoint},
|
||||
.Header = {.Size = sizeof(USB_Audio_StreamEndpoint_Spc_t), .Type = DTYPE_AudioEndpoint},
|
||||
.Subtype = DSUBTYPE_General,
|
||||
|
||||
.Attributes = EP_ACCEPTS_SMALL_PACKETS,
|
||||
|
|
|
@ -68,15 +68,15 @@
|
|||
{
|
||||
USB_Descriptor_Configuration_Header_t Config;
|
||||
USB_Descriptor_Interface_t AudioControlInterface;
|
||||
USB_AudioInterface_AC_t AudioControlInterface_SPC;
|
||||
USB_AudioInputTerminal_t InputTerminal;
|
||||
USB_AudioOutputTerminal_t OutputTerminal;
|
||||
USB_Audio_Interface_AC_t AudioControlInterface_SPC;
|
||||
USB_Audio_InputTerminal_t InputTerminal;
|
||||
USB_Audio_OutputTerminal_t OutputTerminal;
|
||||
USB_Descriptor_Interface_t AudioStreamInterface_Alt0;
|
||||
USB_Descriptor_Interface_t AudioStreamInterface_Alt1;
|
||||
USB_AudioInterface_AS_t AudioStreamInterface_SPC;
|
||||
USB_AudioFormat_t AudioFormat;
|
||||
USB_AudioStreamEndpoint_Std_t AudioEndpoint;
|
||||
USB_AudioStreamEndpoint_Spc_t AudioEndpoint_SPC;
|
||||
USB_Audio_Interface_AS_t AudioStreamInterface_SPC;
|
||||
USB_Audio_Format_t AudioFormat;
|
||||
USB_Audio_StreamEndpoint_Std_t AudioEndpoint;
|
||||
USB_Audio_StreamEndpoint_Spc_t AudioEndpoint_SPC;
|
||||
} USB_Descriptor_Configuration_t;
|
||||
|
||||
/* Function Prototypes: */
|
||||
|
|
|
@ -130,7 +130,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
|
|||
|
||||
.GenericHID =
|
||||
{
|
||||
.Header = {.Size = sizeof(USB_Descriptor_HID_t), .Type = DTYPE_HID},
|
||||
.Header = {.Size = sizeof(USB_HID_Descriptor_t), .Type = DTYPE_HID},
|
||||
|
||||
.HIDSpec = VERSION_BCD(01.11),
|
||||
.CountryCode = 0x00,
|
||||
|
@ -227,7 +227,7 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex,
|
|||
break;
|
||||
case DTYPE_HID:
|
||||
Address = (void*)&ConfigurationDescriptor.GenericHID;
|
||||
Size = sizeof(USB_Descriptor_HID_t);
|
||||
Size = sizeof(USB_HID_Descriptor_t);
|
||||
break;
|
||||
case DTYPE_Report:
|
||||
Address = (void*)&GenericReport;
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
{
|
||||
USB_Descriptor_Configuration_Header_t Config;
|
||||
USB_Descriptor_Interface_t Interface;
|
||||
USB_Descriptor_HID_t GenericHID;
|
||||
USB_HID_Descriptor_t GenericHID;
|
||||
USB_Descriptor_Endpoint_t GenericINEndpoint;
|
||||
} USB_Descriptor_Configuration_t;
|
||||
|
||||
|
|
|
@ -140,7 +140,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
|
|||
|
||||
.JoystickHID =
|
||||
{
|
||||
.Header = {.Size = sizeof(USB_Descriptor_HID_t), .Type = DTYPE_HID},
|
||||
.Header = {.Size = sizeof(USB_HID_Descriptor_t), .Type = DTYPE_HID},
|
||||
|
||||
.HIDSpec = VERSION_BCD(01.11),
|
||||
.CountryCode = 0x00,
|
||||
|
@ -237,7 +237,7 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex,
|
|||
break;
|
||||
case DTYPE_HID:
|
||||
Address = (void*)&ConfigurationDescriptor.JoystickHID;
|
||||
Size = sizeof(USB_Descriptor_HID_t);
|
||||
Size = sizeof(USB_HID_Descriptor_t);
|
||||
break;
|
||||
case DTYPE_Report:
|
||||
Address = (void*)&JoystickReport;
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
{
|
||||
USB_Descriptor_Configuration_Header_t Config;
|
||||
USB_Descriptor_Interface_t Interface;
|
||||
USB_Descriptor_HID_t JoystickHID;
|
||||
USB_HID_Descriptor_t JoystickHID;
|
||||
USB_Descriptor_Endpoint_t JoystickEndpoint;
|
||||
} USB_Descriptor_Configuration_t;
|
||||
|
||||
|
|
|
@ -147,7 +147,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
|
|||
|
||||
.KeyboardHID =
|
||||
{
|
||||
.Header = {.Size = sizeof(USB_Descriptor_HID_t), .Type = DTYPE_HID},
|
||||
.Header = {.Size = sizeof(USB_HID_Descriptor_t), .Type = DTYPE_HID},
|
||||
|
||||
.HIDSpec = VERSION_BCD(01.11),
|
||||
.CountryCode = 0x00,
|
||||
|
@ -244,7 +244,7 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex,
|
|||
break;
|
||||
case DTYPE_HID:
|
||||
Address = (void*)&ConfigurationDescriptor.KeyboardHID;
|
||||
Size = sizeof(USB_Descriptor_HID_t);
|
||||
Size = sizeof(USB_HID_Descriptor_t);
|
||||
break;
|
||||
case DTYPE_Report:
|
||||
Address = (void*)&KeyboardReport;
|
||||
|
|
|
@ -52,7 +52,7 @@
|
|||
{
|
||||
USB_Descriptor_Configuration_Header_t Config;
|
||||
USB_Descriptor_Interface_t Interface;
|
||||
USB_Descriptor_HID_t KeyboardHID;
|
||||
USB_HID_Descriptor_t KeyboardHID;
|
||||
USB_Descriptor_Endpoint_t KeyboardEndpoint;
|
||||
} USB_Descriptor_Configuration_t;
|
||||
|
||||
|
|
|
@ -180,7 +180,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
|
|||
|
||||
.KeyboardHID =
|
||||
{
|
||||
.Header = {.Size = sizeof(USB_Descriptor_HID_t), .Type = DTYPE_HID},
|
||||
.Header = {.Size = sizeof(USB_HID_Descriptor_t), .Type = DTYPE_HID},
|
||||
|
||||
.HIDSpec = VERSION_BCD(01.11),
|
||||
.CountryCode = 0x00,
|
||||
|
@ -217,7 +217,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
|
|||
|
||||
.MouseHID =
|
||||
{
|
||||
.Header = {.Size = sizeof(USB_Descriptor_HID_t), .Type = DTYPE_HID},
|
||||
.Header = {.Size = sizeof(USB_HID_Descriptor_t), .Type = DTYPE_HID},
|
||||
|
||||
.HIDSpec = VERSION_BCD(01.11),
|
||||
.CountryCode = 0x00,
|
||||
|
@ -316,12 +316,12 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex,
|
|||
if (!(wIndex))
|
||||
{
|
||||
Address = (void*)&ConfigurationDescriptor.KeyboardHID;
|
||||
Size = sizeof(USB_Descriptor_HID_t);
|
||||
Size = sizeof(USB_HID_Descriptor_t);
|
||||
}
|
||||
else
|
||||
{
|
||||
Address = (void*)&ConfigurationDescriptor.MouseHID;
|
||||
Size = sizeof(USB_Descriptor_HID_t);
|
||||
Size = sizeof(USB_HID_Descriptor_t);
|
||||
}
|
||||
break;
|
||||
case DTYPE_Report:
|
||||
|
|
|
@ -52,10 +52,10 @@
|
|||
{
|
||||
USB_Descriptor_Configuration_Header_t Config;
|
||||
USB_Descriptor_Interface_t KeyboardInterface;
|
||||
USB_Descriptor_HID_t KeyboardHID;
|
||||
USB_HID_Descriptor_t KeyboardHID;
|
||||
USB_Descriptor_Endpoint_t KeyboardInEndpoint;
|
||||
USB_Descriptor_Interface_t MouseInterface;
|
||||
USB_Descriptor_HID_t MouseHID;
|
||||
USB_HID_Descriptor_t MouseHID;
|
||||
USB_Descriptor_Endpoint_t MouseInEndpoint;
|
||||
} USB_Descriptor_Configuration_t;
|
||||
|
||||
|
|
|
@ -104,11 +104,11 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
|
|||
|
||||
.AudioControlInterface_SPC =
|
||||
{
|
||||
.Header = {.Size = sizeof(USB_AudioInterface_AC_t), .Type = DTYPE_AudioInterface},
|
||||
.Header = {.Size = sizeof(USB_Audio_Interface_AC_t), .Type = DTYPE_AudioInterface},
|
||||
.Subtype = DSUBTYPE_Header,
|
||||
|
||||
.ACSpecification = VERSION_BCD(01.00),
|
||||
.TotalLength = sizeof(USB_AudioInterface_AC_t),
|
||||
.TotalLength = sizeof(USB_Audio_Interface_AC_t),
|
||||
|
||||
.InCollection = 1,
|
||||
.InterfaceNumbers = {1},
|
||||
|
@ -132,7 +132,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
|
|||
|
||||
.AudioStreamInterface_SPC =
|
||||
{
|
||||
.Header = {.Size = sizeof(USB_AudioInterface_MIDI_AS_t), .Type = DTYPE_AudioInterface},
|
||||
.Header = {.Size = sizeof(USB_MIDI_AudioInterface_AS_t), .Type = DTYPE_AudioInterface},
|
||||
.Subtype = DSUBTYPE_General,
|
||||
|
||||
.AudioSpecification = VERSION_BCD(01.00),
|
||||
|
@ -196,7 +196,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
|
|||
{
|
||||
.Endpoint =
|
||||
{
|
||||
.Header = {.Size = sizeof(USB_AudioStreamEndpoint_Std_t), .Type = DTYPE_Endpoint},
|
||||
.Header = {.Size = sizeof(USB_Audio_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),
|
||||
|
@ -221,7 +221,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
|
|||
{
|
||||
.Endpoint =
|
||||
{
|
||||
.Header = {.Size = sizeof(USB_AudioStreamEndpoint_Std_t), .Type = DTYPE_Endpoint},
|
||||
.Header = {.Size = sizeof(USB_Audio_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),
|
||||
|
|
|
@ -61,16 +61,16 @@
|
|||
{
|
||||
USB_Descriptor_Configuration_Header_t Config;
|
||||
USB_Descriptor_Interface_t AudioControlInterface;
|
||||
USB_AudioInterface_AC_t AudioControlInterface_SPC;
|
||||
USB_Audio_Interface_AC_t AudioControlInterface_SPC;
|
||||
USB_Descriptor_Interface_t AudioStreamInterface;
|
||||
USB_AudioInterface_MIDI_AS_t AudioStreamInterface_SPC;
|
||||
USB_MIDI_AudioInterface_AS_t AudioStreamInterface_SPC;
|
||||
USB_MIDI_In_Jack_t MIDI_In_Jack_Emb;
|
||||
USB_MIDI_In_Jack_t MIDI_In_Jack_Ext;
|
||||
USB_MIDI_Out_Jack_t MIDI_Out_Jack_Emb;
|
||||
USB_MIDI_Out_Jack_t MIDI_Out_Jack_Ext;
|
||||
USB_AudioStreamEndpoint_Std_t MIDI_In_Jack_Endpoint;
|
||||
USB_Audio_StreamEndpoint_Std_t MIDI_In_Jack_Endpoint;
|
||||
USB_MIDI_Jack_Endpoint_t MIDI_In_Jack_Endpoint_SPC;
|
||||
USB_AudioStreamEndpoint_Std_t MIDI_Out_Jack_Endpoint;
|
||||
USB_Audio_StreamEndpoint_Std_t MIDI_Out_Jack_Endpoint;
|
||||
USB_MIDI_Jack_Endpoint_t MIDI_Out_Jack_Endpoint_SPC;
|
||||
} USB_Descriptor_Configuration_t;
|
||||
|
||||
|
|
|
@ -72,7 +72,7 @@ int main(void)
|
|||
{
|
||||
CheckJoystickMovement();
|
||||
|
||||
USB_MIDI_EventPacket_t DummyMIDIEvent;
|
||||
MIDI_EventPacket_t DummyMIDIEvent;
|
||||
MIDI_Device_ReceiveEventPacket(&Keyboard_MIDI_Interface, &DummyMIDIEvent);
|
||||
|
||||
MIDI_Device_USBTask(&Keyboard_MIDI_Interface);
|
||||
|
@ -144,7 +144,7 @@ void CheckJoystickMovement(void)
|
|||
|
||||
if (MIDICommand)
|
||||
{
|
||||
USB_MIDI_EventPacket_t MIDIEvent = (USB_MIDI_EventPacket_t)
|
||||
MIDI_EventPacket_t MIDIEvent = (MIDI_EventPacket_t)
|
||||
{
|
||||
.CableNumber = 0,
|
||||
.Command = (MIDICommand >> 4),
|
||||
|
|
|
@ -140,7 +140,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
|
|||
|
||||
.MouseHID =
|
||||
{
|
||||
.Header = {.Size = sizeof(USB_Descriptor_HID_t), .Type = DTYPE_HID},
|
||||
.Header = {.Size = sizeof(USB_HID_Descriptor_t), .Type = DTYPE_HID},
|
||||
|
||||
.HIDSpec = VERSION_BCD(01.11),
|
||||
.CountryCode = 0x00,
|
||||
|
@ -237,7 +237,7 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex,
|
|||
break;
|
||||
case DTYPE_HID:
|
||||
Address = (void*)&ConfigurationDescriptor.MouseHID;
|
||||
Size = sizeof(USB_Descriptor_HID_t);
|
||||
Size = sizeof(USB_HID_Descriptor_t);
|
||||
break;
|
||||
case DTYPE_Report:
|
||||
Address = (void*)&MouseReport;
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
{
|
||||
USB_Descriptor_Configuration_Header_t Config;
|
||||
USB_Descriptor_Interface_t Interface;
|
||||
USB_Descriptor_HID_t MouseHID;
|
||||
USB_HID_Descriptor_t MouseHID;
|
||||
USB_Descriptor_Endpoint_t MouseEndpoint;
|
||||
} USB_Descriptor_Configuration_t;
|
||||
|
||||
|
|
|
@ -104,13 +104,13 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
|
|||
|
||||
.AudioControlInterface_SPC =
|
||||
{
|
||||
.Header = {.Size = sizeof(USB_AudioInterface_AC_t), .Type = DTYPE_AudioInterface},
|
||||
.Header = {.Size = sizeof(USB_Audio_Interface_AC_t), .Type = DTYPE_AudioInterface},
|
||||
.Subtype = DSUBTYPE_Header,
|
||||
|
||||
.ACSpecification = VERSION_BCD(01.00),
|
||||
.TotalLength = (sizeof(USB_AudioInterface_AC_t) +
|
||||
sizeof(USB_AudioInputTerminal_t) +
|
||||
sizeof(USB_AudioOutputTerminal_t)),
|
||||
.TotalLength = (sizeof(USB_Audio_Interface_AC_t) +
|
||||
sizeof(USB_Audio_InputTerminal_t) +
|
||||
sizeof(USB_Audio_OutputTerminal_t)),
|
||||
|
||||
.InCollection = 1,
|
||||
.InterfaceNumbers = {1},
|
||||
|
@ -118,7 +118,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
|
|||
|
||||
.InputTerminal =
|
||||
{
|
||||
.Header = {.Size = sizeof(USB_AudioInputTerminal_t), .Type = DTYPE_AudioInterface},
|
||||
.Header = {.Size = sizeof(USB_Audio_InputTerminal_t), .Type = DTYPE_AudioInterface},
|
||||
.Subtype = DSUBTYPE_InputTerminal,
|
||||
|
||||
.TerminalID = 0x01,
|
||||
|
@ -134,7 +134,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
|
|||
|
||||
.OutputTerminal =
|
||||
{
|
||||
.Header = {.Size = sizeof(USB_AudioOutputTerminal_t), .Type = DTYPE_AudioInterface},
|
||||
.Header = {.Size = sizeof(USB_Audio_OutputTerminal_t), .Type = DTYPE_AudioInterface},
|
||||
.Subtype = DSUBTYPE_OutputTerminal,
|
||||
|
||||
.TerminalID = 0x02,
|
||||
|
@ -180,7 +180,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
|
|||
|
||||
.AudioStreamInterface_SPC =
|
||||
{
|
||||
.Header = {.Size = sizeof(USB_AudioInterface_AS_t), .Type = DTYPE_AudioInterface},
|
||||
.Header = {.Size = sizeof(USB_Audio_Interface_AS_t), .Type = DTYPE_AudioInterface},
|
||||
.Subtype = DSUBTYPE_General,
|
||||
|
||||
.TerminalLink = 0x02,
|
||||
|
@ -191,7 +191,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
|
|||
|
||||
.AudioFormat =
|
||||
{
|
||||
.Header = {.Size = sizeof(USB_AudioFormat_t), .Type = DTYPE_AudioInterface},
|
||||
.Header = {.Size = sizeof(USB_Audio_Format_t), .Type = DTYPE_AudioInterface},
|
||||
.Subtype = DSUBTYPE_Format,
|
||||
|
||||
.FormatType = 0x01,
|
||||
|
@ -199,7 +199,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
|
|||
|
||||
.SubFrameSize = 0x02,
|
||||
.BitResolution = 16,
|
||||
.SampleFrequencyType = (sizeof(ConfigurationDescriptor.AudioFormat.SampleFrequencies) / sizeof(AudioSampleFreq_t)),
|
||||
.SampleFrequencyType = (sizeof(ConfigurationDescriptor.AudioFormat.SampleFrequencies) / sizeof(Audio_SampleFreq_t)),
|
||||
|
||||
.SampleFrequencies = {SAMPLE_FREQ(AUDIO_SAMPLE_FREQUENCY)}
|
||||
},
|
||||
|
@ -208,7 +208,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
|
|||
{
|
||||
.Endpoint =
|
||||
{
|
||||
.Header = {.Size = sizeof(USB_AudioStreamEndpoint_Std_t), .Type = DTYPE_Endpoint},
|
||||
.Header = {.Size = sizeof(USB_Audio_StreamEndpoint_Std_t), .Type = DTYPE_Endpoint},
|
||||
|
||||
.EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_IN | AUDIO_STREAM_EPNUM),
|
||||
.Attributes = (EP_TYPE_ISOCHRONOUS | ENDPOINT_ATTR_SYNC | ENDPOINT_USAGE_DATA),
|
||||
|
@ -222,7 +222,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
|
|||
|
||||
.AudioEndpoint_SPC =
|
||||
{
|
||||
.Header = {.Size = sizeof(USB_AudioStreamEndpoint_Spc_t), .Type = DTYPE_AudioEndpoint},
|
||||
.Header = {.Size = sizeof(USB_Audio_StreamEndpoint_Spc_t), .Type = DTYPE_AudioEndpoint},
|
||||
.Subtype = DSUBTYPE_General,
|
||||
|
||||
.Attributes = 0x00,
|
||||
|
|
|
@ -168,7 +168,7 @@
|
|||
|
||||
uint8_t InCollection; /**< Total number of audio class interfaces within this device */
|
||||
uint8_t InterfaceNumbers[1]; /**< Interface numbers of each audio interface */
|
||||
} USB_AudioInterface_AC_t;
|
||||
} USB_Audio_Interface_AC_t;
|
||||
|
||||
/** Type define for an Audio class specific Feature Unit descriptor. This indicates to the host what features
|
||||
* are present in the device's audio stream for basic control, such as per-channel volume. See the USB Audio
|
||||
|
@ -186,7 +186,7 @@
|
|||
uint8_t ChannelControls[3]; /**< Feature masks for the control channel, and each separate audio channel */
|
||||
|
||||
uint8_t FeatureUnitStrIndex; /**< Index of a string descriptor describing this descriptor within the device */
|
||||
} USB_AudioFeatureUnit_t;
|
||||
} USB_Audio_FeatureUnit_t;
|
||||
|
||||
/** Type define for an Audio class specific input terminal descriptor. This indicates to the host that the device
|
||||
* contains an input audio source, either from a physical terminal on the device, or a logical terminal (for example,
|
||||
|
@ -207,7 +207,7 @@
|
|||
|
||||
uint8_t ChannelStrIndex; /**< Index of a string descriptor describing this channel within the device */
|
||||
uint8_t TerminalStrIndex; /**< Index of a string descriptor describing this descriptor within the device */
|
||||
} USB_AudioInputTerminal_t;
|
||||
} USB_Audio_InputTerminal_t;
|
||||
|
||||
/** Type define for an Audio class specific output terminal descriptor. This indicates to the host that the device
|
||||
* contains an output audio sink, either to a physical terminal on the device, or a logical terminal (for example,
|
||||
|
@ -226,7 +226,7 @@
|
|||
uint8_t SourceID; /**< ID value of the unit this terminal's audio is sourced from */
|
||||
|
||||
uint8_t TerminalStrIndex; /**< Index of a string descriptor describing this descriptor within the device */
|
||||
} USB_AudioOutputTerminal_t;
|
||||
} USB_Audio_OutputTerminal_t;
|
||||
|
||||
/** Type define for an Audio class specific streaming interface descriptor. This indicates to the host
|
||||
* how audio streams within the device are formatted. See the USB Audio specification for more details.
|
||||
|
@ -240,7 +240,7 @@
|
|||
|
||||
uint8_t FrameDelay; /**< Delay in frames resulting from the complete sample processing from input to output */
|
||||
uint16_t AudioFormat; /**< Format of the audio stream, see Audio Device Formats specification */
|
||||
} USB_AudioInterface_AS_t;
|
||||
} USB_Audio_Interface_AS_t;
|
||||
|
||||
/** Type define for a 24bit audio sample frequency structure. GCC does not contain a built in 24bit datatype,
|
||||
* this this structure is used to build up the value instead. Fill this structure with the SAMPLE_FREQ() macro.
|
||||
|
@ -249,7 +249,7 @@
|
|||
{
|
||||
uint16_t LowWord; /**< Low 16 bits of the 24-bit value */
|
||||
uint8_t HighByte; /**< Upper 8 bits of the 24-bit value */
|
||||
} AudioSampleFreq_t;
|
||||
} Audio_SampleFreq_t;
|
||||
|
||||
/** Type define for an Audio class specific audio format descriptor. This is used to give the host full details
|
||||
* about the number of channels, the sample resolution, acceptable sample frequencies and encoding method used
|
||||
|
@ -267,8 +267,8 @@
|
|||
uint8_t BitResolution; /**< Bits of resolution of each channel's samples in the stream */
|
||||
|
||||
uint8_t SampleFrequencyType; /**< Total number of sample frequencies supported by the device */
|
||||
AudioSampleFreq_t SampleFrequencies[1]; /**< Sample frequencies supported by the device */
|
||||
} USB_AudioFormat_t;
|
||||
Audio_SampleFreq_t SampleFrequencies[1]; /**< Sample frequencies supported by the device */
|
||||
} USB_Audio_Format_t;
|
||||
|
||||
/** Type define for an Audio class specific endpoint descriptor. This contains a regular endpoint
|
||||
* descriptor with a few Audio-class specific extensions. See the USB Audio specification for more details.
|
||||
|
@ -279,7 +279,7 @@
|
|||
|
||||
uint8_t Refresh; /**< Always set to zero */
|
||||
uint8_t SyncEndpointNumber; /**< Endpoint address to send synchronisation information to, if needed (zero otherwise) */
|
||||
} USB_AudioStreamEndpoint_Std_t;
|
||||
} USB_Audio_StreamEndpoint_Std_t;
|
||||
|
||||
/** Type define for an Audio class specific extended endpoint descriptor. This contains extra information
|
||||
* on the usage of endpoints used to stream audio in and out of the USB Audio device, and follows an Audio
|
||||
|
@ -294,7 +294,7 @@
|
|||
|
||||
uint8_t LockDelayUnits; /**< Units used for the LockDelay field, see Audio class specification */
|
||||
uint16_t LockDelay; /**< Time required to internally lock endpoint's internal clock recovery circuitry */
|
||||
} USB_AudioStreamEndpoint_Spc_t;
|
||||
} USB_Audio_StreamEndpoint_Spc_t;
|
||||
|
||||
/** Type define for the device configuration descriptor structure. This must be defined in the
|
||||
* application code, as the configuration descriptor contains several sub-descriptors which
|
||||
|
@ -304,15 +304,15 @@
|
|||
{
|
||||
USB_Descriptor_Configuration_Header_t Config;
|
||||
USB_Descriptor_Interface_t AudioControlInterface;
|
||||
USB_AudioInterface_AC_t AudioControlInterface_SPC;
|
||||
USB_AudioInputTerminal_t InputTerminal;
|
||||
USB_AudioOutputTerminal_t OutputTerminal;
|
||||
USB_Audio_Interface_AC_t AudioControlInterface_SPC;
|
||||
USB_Audio_InputTerminal_t InputTerminal;
|
||||
USB_Audio_OutputTerminal_t OutputTerminal;
|
||||
USB_Descriptor_Interface_t AudioStreamInterface_Alt0;
|
||||
USB_Descriptor_Interface_t AudioStreamInterface_Alt1;
|
||||
USB_AudioInterface_AS_t AudioStreamInterface_SPC;
|
||||
USB_AudioFormat_t AudioFormat;
|
||||
USB_AudioStreamEndpoint_Std_t AudioEndpoint;
|
||||
USB_AudioStreamEndpoint_Spc_t AudioEndpoint_SPC;
|
||||
USB_Audio_Interface_AS_t AudioStreamInterface_SPC;
|
||||
USB_Audio_Format_t AudioFormat;
|
||||
USB_Audio_StreamEndpoint_Std_t AudioEndpoint;
|
||||
USB_Audio_StreamEndpoint_Spc_t AudioEndpoint_SPC;
|
||||
} USB_Descriptor_Configuration_t;
|
||||
|
||||
/* Function Prototypes: */
|
||||
|
|
|
@ -104,13 +104,13 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
|
|||
|
||||
.AudioControlInterface_SPC =
|
||||
{
|
||||
.Header = {.Size = sizeof(USB_AudioInterface_AC_t), .Type = DTYPE_AudioInterface},
|
||||
.Header = {.Size = sizeof(USB_Audio_Interface_AC_t), .Type = DTYPE_AudioInterface},
|
||||
.Subtype = DSUBTYPE_Header,
|
||||
|
||||
.ACSpecification = VERSION_BCD(01.00),
|
||||
.TotalLength = (sizeof(USB_AudioInterface_AC_t) +
|
||||
sizeof(USB_AudioInputTerminal_t) +
|
||||
sizeof(USB_AudioOutputTerminal_t)),
|
||||
.TotalLength = (sizeof(USB_Audio_Interface_AC_t) +
|
||||
sizeof(USB_Audio_InputTerminal_t) +
|
||||
sizeof(USB_Audio_OutputTerminal_t)),
|
||||
|
||||
.InCollection = 1,
|
||||
.InterfaceNumbers = {1},
|
||||
|
@ -118,7 +118,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
|
|||
|
||||
.InputTerminal =
|
||||
{
|
||||
.Header = {.Size = sizeof(USB_AudioInputTerminal_t), .Type = DTYPE_AudioInterface},
|
||||
.Header = {.Size = sizeof(USB_Audio_InputTerminal_t), .Type = DTYPE_AudioInterface},
|
||||
.Subtype = DSUBTYPE_InputTerminal,
|
||||
|
||||
.TerminalID = 0x01,
|
||||
|
@ -134,7 +134,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
|
|||
|
||||
.OutputTerminal =
|
||||
{
|
||||
.Header = {.Size = sizeof(USB_AudioOutputTerminal_t), .Type = DTYPE_AudioInterface},
|
||||
.Header = {.Size = sizeof(USB_Audio_OutputTerminal_t), .Type = DTYPE_AudioInterface},
|
||||
.Subtype = DSUBTYPE_OutputTerminal,
|
||||
|
||||
.TerminalID = 0x02,
|
||||
|
@ -180,7 +180,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
|
|||
|
||||
.AudioStreamInterface_SPC =
|
||||
{
|
||||
.Header = {.Size = sizeof(USB_AudioInterface_AS_t), .Type = DTYPE_AudioInterface},
|
||||
.Header = {.Size = sizeof(USB_Audio_Interface_AS_t), .Type = DTYPE_AudioInterface},
|
||||
.Subtype = DSUBTYPE_General,
|
||||
|
||||
.TerminalLink = 0x01,
|
||||
|
@ -191,7 +191,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
|
|||
|
||||
.AudioFormat =
|
||||
{
|
||||
.Header = {.Size = sizeof(USB_AudioFormat_t), .Type = DTYPE_AudioInterface},
|
||||
.Header = {.Size = sizeof(USB_Audio_Format_t), .Type = DTYPE_AudioInterface},
|
||||
.Subtype = DSUBTYPE_Format,
|
||||
|
||||
.FormatType = 0x01,
|
||||
|
@ -200,7 +200,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
|
|||
.SubFrameSize = 0x02,
|
||||
.BitResolution = 16,
|
||||
|
||||
.SampleFrequencyType = (sizeof(ConfigurationDescriptor.AudioFormat.SampleFrequencies) / sizeof(AudioSampleFreq_t)),
|
||||
.SampleFrequencyType = (sizeof(ConfigurationDescriptor.AudioFormat.SampleFrequencies) / sizeof(Audio_SampleFreq_t)),
|
||||
.SampleFrequencies = {SAMPLE_FREQ(AUDIO_SAMPLE_FREQUENCY)}
|
||||
},
|
||||
|
||||
|
@ -208,7 +208,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
|
|||
{
|
||||
.Endpoint =
|
||||
{
|
||||
.Header = {.Size = sizeof(USB_AudioStreamEndpoint_Std_t), .Type = DTYPE_Endpoint},
|
||||
.Header = {.Size = sizeof(USB_Audio_StreamEndpoint_Std_t), .Type = DTYPE_Endpoint},
|
||||
|
||||
.EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_OUT | AUDIO_STREAM_EPNUM),
|
||||
.Attributes = (EP_TYPE_ISOCHRONOUS | ENDPOINT_ATTR_SYNC | ENDPOINT_USAGE_DATA),
|
||||
|
@ -222,7 +222,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
|
|||
|
||||
.AudioEndpoint_SPC =
|
||||
{
|
||||
.Header = {.Size = sizeof(USB_AudioStreamEndpoint_Spc_t), .Type = DTYPE_AudioEndpoint},
|
||||
.Header = {.Size = sizeof(USB_Audio_StreamEndpoint_Spc_t), .Type = DTYPE_AudioEndpoint},
|
||||
.Subtype = DSUBTYPE_General,
|
||||
|
||||
.Attributes = EP_ACCEPTS_SMALL_PACKETS,
|
||||
|
|
|
@ -168,7 +168,7 @@
|
|||
|
||||
uint8_t InCollection; /**< Total number of audio class interfaces within this device */
|
||||
uint8_t InterfaceNumbers[1]; /**< Interface numbers of each audio interface */
|
||||
} USB_AudioInterface_AC_t;
|
||||
} USB_Audio_Interface_AC_t;
|
||||
|
||||
/** Type define for an Audio class specific Feature Unit descriptor. This indicates to the host what features
|
||||
* are present in the device's audio stream for basic control, such as per-channel volume. See the USB Audio
|
||||
|
@ -186,7 +186,7 @@
|
|||
uint8_t ChannelControls[3]; /**< Feature masks for the control channel, and each separate audio channel */
|
||||
|
||||
uint8_t FeatureUnitStrIndex; /**< Index of a string descriptor describing this descriptor within the device */
|
||||
} USB_AudioFeatureUnit_t;
|
||||
} USB_Audio_FeatureUnit_t;
|
||||
|
||||
/** Type define for an Audio class specific input terminal descriptor. This indicates to the host that the device
|
||||
* contains an input audio source, either from a physical terminal on the device, or a logical terminal (for example,
|
||||
|
@ -207,7 +207,7 @@
|
|||
|
||||
uint8_t ChannelStrIndex; /**< Index of a string descriptor describing this channel within the device */
|
||||
uint8_t TerminalStrIndex; /**< Index of a string descriptor describing this descriptor within the device */
|
||||
} USB_AudioInputTerminal_t;
|
||||
} USB_Audio_InputTerminal_t;
|
||||
|
||||
/** Type define for an Audio class specific output terminal descriptor. This indicates to the host that the device
|
||||
* contains an output audio sink, either to a physical terminal on the device, or a logical terminal (for example,
|
||||
|
@ -226,7 +226,7 @@
|
|||
uint8_t SourceID; /**< ID value of the unit this terminal's audio is sourced from */
|
||||
|
||||
uint8_t TerminalStrIndex; /**< Index of a string descriptor describing this descriptor within the device */
|
||||
} USB_AudioOutputTerminal_t;
|
||||
} USB_Audio_OutputTerminal_t;
|
||||
|
||||
/** Type define for an Audio class specific streaming interface descriptor. This indicates to the host
|
||||
* how audio streams within the device are formatted. See the USB Audio specification for more details.
|
||||
|
@ -240,7 +240,7 @@
|
|||
|
||||
uint8_t FrameDelay; /**< Delay in frames resulting from the complete sample processing from input to output */
|
||||
uint16_t AudioFormat; /**< Format of the audio stream, see Audio Device Formats specification */
|
||||
} USB_AudioInterface_AS_t;
|
||||
} USB_Audio_Interface_AS_t;
|
||||
|
||||
/** Type define for a 24bit audio sample frequency structure. GCC does not contain a built in 24bit datatype,
|
||||
* this this structure is used to build up the value instead. Fill this structure with the SAMPLE_FREQ() macro.
|
||||
|
@ -249,7 +249,7 @@
|
|||
{
|
||||
uint16_t LowWord; /**< Low 16 bits of the 24-bit value */
|
||||
uint8_t HighByte; /**< Upper 8 bits of the 24-bit value */
|
||||
} AudioSampleFreq_t;
|
||||
} Audio_SampleFreq_t;
|
||||
|
||||
/** Type define for an Audio class specific audio format descriptor. This is used to give the host full details
|
||||
* about the number of channels, the sample resolution, acceptable sample frequencies and encoding method used
|
||||
|
@ -267,8 +267,8 @@
|
|||
uint8_t BitResolution; /**< Bits of resolution of each channel's samples in the stream */
|
||||
|
||||
uint8_t SampleFrequencyType; /**< Total number of sample frequencies supported by the device */
|
||||
AudioSampleFreq_t SampleFrequencies[1]; /**< Sample frequencies supported by the device */
|
||||
} USB_AudioFormat_t;
|
||||
Audio_SampleFreq_t SampleFrequencies[1]; /**< Sample frequencies supported by the device */
|
||||
} USB_Audio_Format_t;
|
||||
|
||||
/** Type define for an Audio class specific endpoint descriptor. This contains a regular endpoint
|
||||
* descriptor with a few Audio-class specific extensions. See the USB Audio specification for more details.
|
||||
|
@ -279,7 +279,7 @@
|
|||
|
||||
uint8_t Refresh; /**< Always set to zero */
|
||||
uint8_t SyncEndpointNumber; /**< Endpoint address to send synchronisation information to, if needed (zero otherwise) */
|
||||
} USB_AudioStreamEndpoint_Std_t;
|
||||
} USB_Audio_StreamEndpoint_Std_t;
|
||||
|
||||
/** Type define for an Audio class specific extended endpoint descriptor. This contains extra information
|
||||
* on the usage of endpoints used to stream audio in and out of the USB Audio device, and follows an Audio
|
||||
|
@ -294,7 +294,7 @@
|
|||
|
||||
uint8_t LockDelayUnits; /**< Units used for the LockDelay field, see Audio class specification */
|
||||
uint16_t LockDelay; /**< Time required to internally lock endpoint's internal clock recovery circuitry */
|
||||
} USB_AudioStreamEndpoint_Spc_t;
|
||||
} USB_Audio_StreamEndpoint_Spc_t;
|
||||
|
||||
/** Type define for the device configuration descriptor structure. This must be defined in the
|
||||
* application code, as the configuration descriptor contains several sub-descriptors which
|
||||
|
@ -304,15 +304,15 @@
|
|||
{
|
||||
USB_Descriptor_Configuration_Header_t Config;
|
||||
USB_Descriptor_Interface_t AudioControlInterface;
|
||||
USB_AudioInterface_AC_t AudioControlInterface_SPC;
|
||||
USB_AudioInputTerminal_t InputTerminal;
|
||||
USB_AudioOutputTerminal_t OutputTerminal;
|
||||
USB_Audio_Interface_AC_t AudioControlInterface_SPC;
|
||||
USB_Audio_InputTerminal_t InputTerminal;
|
||||
USB_Audio_OutputTerminal_t OutputTerminal;
|
||||
USB_Descriptor_Interface_t AudioStreamInterface_Alt0;
|
||||
USB_Descriptor_Interface_t AudioStreamInterface_Alt1;
|
||||
USB_AudioInterface_AS_t AudioStreamInterface_SPC;
|
||||
USB_AudioFormat_t AudioFormat;
|
||||
USB_AudioStreamEndpoint_Std_t AudioEndpoint;
|
||||
USB_AudioStreamEndpoint_Spc_t AudioEndpoint_SPC;
|
||||
USB_Audio_Interface_AS_t AudioStreamInterface_SPC;
|
||||
USB_Audio_Format_t AudioFormat;
|
||||
USB_Audio_StreamEndpoint_Std_t AudioEndpoint;
|
||||
USB_Audio_StreamEndpoint_Spc_t AudioEndpoint_SPC;
|
||||
} USB_Descriptor_Configuration_t;
|
||||
|
||||
/* Function Prototypes: */
|
||||
|
|
|
@ -104,11 +104,11 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
|
|||
|
||||
.AudioControlInterface_SPC =
|
||||
{
|
||||
.Header = {.Size = sizeof(USB_AudioInterface_AC_t), .Type = DTYPE_AudioInterface},
|
||||
.Header = {.Size = sizeof(USB_Audio_Interface_AC_t), .Type = DTYPE_AudioInterface},
|
||||
.Subtype = DSUBTYPE_Header,
|
||||
|
||||
.ACSpecification = VERSION_BCD(01.00),
|
||||
.TotalLength = sizeof(USB_AudioInterface_AC_t),
|
||||
.TotalLength = sizeof(USB_Audio_Interface_AC_t),
|
||||
|
||||
.InCollection = 1,
|
||||
.InterfaceNumbers = {1},
|
||||
|
@ -132,7 +132,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
|
|||
|
||||
.AudioStreamInterface_SPC =
|
||||
{
|
||||
.Header = {.Size = sizeof(USB_AudioInterface_MIDI_AS_t), .Type = DTYPE_AudioInterface},
|
||||
.Header = {.Size = sizeof(USB_Audio_Interface_MIDI_AS_t), .Type = DTYPE_AudioInterface},
|
||||
.Subtype = DSUBTYPE_General,
|
||||
|
||||
.AudioSpecification = VERSION_BCD(01.00),
|
||||
|
@ -196,7 +196,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
|
|||
{
|
||||
.Endpoint =
|
||||
{
|
||||
.Header = {.Size = sizeof(USB_AudioStreamEndpoint_Std_t), .Type = DTYPE_Endpoint},
|
||||
.Header = {.Size = sizeof(USB_Audio_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),
|
||||
|
@ -221,7 +221,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
|
|||
{
|
||||
.Endpoint =
|
||||
{
|
||||
.Header = {.Size = sizeof(USB_AudioStreamEndpoint_Std_t), .Type = DTYPE_Endpoint},
|
||||
.Header = {.Size = sizeof(USB_Audio_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),
|
||||
|
|
|
@ -90,7 +90,7 @@
|
|||
|
||||
uint8_t InCollection; /** Total number of audio class interfaces within this device */
|
||||
uint8_t InterfaceNumbers[1]; /** Interface numbers of each audio interface */
|
||||
} USB_AudioInterface_AC_t;
|
||||
} USB_Audio_Interface_AC_t;
|
||||
|
||||
/** Type define for an Audio class specific MIDI streaming interface descriptor. This indicates to the host
|
||||
* how MIDI the specification compliance of the device and the total length of the Audio class specific descriptors.
|
||||
|
@ -103,7 +103,7 @@
|
|||
|
||||
uint16_t AudioSpecification; /**< Binary coded decimal value, indicating the supported Audio Class specification version */
|
||||
uint16_t TotalLength; /**< Total length of the Audio class specific descriptors, including this descriptor */
|
||||
} USB_AudioInterface_MIDI_AS_t;
|
||||
} USB_Audio_Interface_MIDI_AS_t;
|
||||
|
||||
/** Type define for an Audio class specific endpoint descriptor. This contains a regular endpoint
|
||||
* descriptor with a few Audio-class specific extensions. See the USB Audio specification for more details.
|
||||
|
@ -114,7 +114,7 @@
|
|||
|
||||
uint8_t Refresh; /**< Always set to zero */
|
||||
uint8_t SyncEndpointNumber; /**< Endpoint address to send synchronisation information to, if needed (zero otherwise) */
|
||||
} USB_AudioStreamEndpoint_Std_t;
|
||||
} USB_Audio_StreamEndpoint_Std_t;
|
||||
|
||||
/** Type define for an Audio class specific MIDI IN jack. This gives information to the host on a MIDI input, either
|
||||
* a physical input jack, or a logical jack (receiving input data internally, or from the host via an endpoint).
|
||||
|
@ -169,16 +169,16 @@
|
|||
{
|
||||
USB_Descriptor_Configuration_Header_t Config;
|
||||
USB_Descriptor_Interface_t AudioControlInterface;
|
||||
USB_AudioInterface_AC_t AudioControlInterface_SPC;
|
||||
USB_Audio_Interface_AC_t AudioControlInterface_SPC;
|
||||
USB_Descriptor_Interface_t AudioStreamInterface;
|
||||
USB_AudioInterface_MIDI_AS_t AudioStreamInterface_SPC;
|
||||
USB_Audio_Interface_MIDI_AS_t AudioStreamInterface_SPC;
|
||||
USB_MIDI_In_Jack_t MIDI_In_Jack_Emb;
|
||||
USB_MIDI_In_Jack_t MIDI_In_Jack_Ext;
|
||||
USB_MIDI_Out_Jack_t MIDI_Out_Jack_Emb;
|
||||
USB_MIDI_Out_Jack_t MIDI_Out_Jack_Ext;
|
||||
USB_AudioStreamEndpoint_Std_t MIDI_In_Jack_Endpoint;
|
||||
USB_Audio_StreamEndpoint_Std_t MIDI_In_Jack_Endpoint;
|
||||
USB_MIDI_Jack_Endpoint_t MIDI_In_Jack_Endpoint_SPC;
|
||||
USB_AudioStreamEndpoint_Std_t MIDI_Out_Jack_Endpoint;
|
||||
USB_Audio_StreamEndpoint_Std_t MIDI_Out_Jack_Endpoint;
|
||||
USB_MIDI_Jack_Endpoint_t MIDI_Out_Jack_Endpoint_SPC;
|
||||
} USB_Descriptor_Configuration_t;
|
||||
|
||||
|
|
|
@ -269,7 +269,7 @@ SUBGROUPING = YES
|
|||
# be useful for C code in case the coding convention dictates that all compound
|
||||
# types are typedef'ed and only the typedef is referenced, never the tag name.
|
||||
|
||||
TYPEDEF_HIDES_STRUCT = NO
|
||||
TYPEDEF_HIDES_STRUCT = YES
|
||||
|
||||
# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to
|
||||
# determine which symbols to keep in memory and which to flush to disk.
|
||||
|
|
|
@ -46,6 +46,13 @@
|
|||
#endif
|
||||
|
||||
/* Macros: */
|
||||
#if !defined(AUDIO_TOTAL_SAMPLE_RATES) || defined(__DOXYGEN__)
|
||||
/** Total number of discrete audio sample rates supported by the device. This value can be overridden by defining this
|
||||
* token in the project makefile to the desired value, and passing it to the compiler via the -D switch.
|
||||
*/
|
||||
#define AUDIO_TOTAL_SAMPLE_RATES 1
|
||||
#endif
|
||||
|
||||
/** Descriptor header constant to indicate a Audio class interface descriptor. */
|
||||
#define DTYPE_AudioInterface 0x24
|
||||
|
||||
|
@ -223,7 +230,7 @@
|
|||
|
||||
uint8_t InCollection; /**< Total number of audio class interfaces within this device */
|
||||
uint8_t InterfaceNumbers[1]; /**< Interface numbers of each audio interface */
|
||||
} USB_AudioInterface_AC_t;
|
||||
} USB_Audio_Interface_AC_t;
|
||||
|
||||
/** Type define for an Audio class specific Feature Unit descriptor. This indicates to the host what features
|
||||
* are present in the device's audio stream for basic control, such as per-channel volume. See the USB Audio
|
||||
|
@ -241,7 +248,7 @@
|
|||
uint8_t ChannelControls[3]; /**< Feature masks for the control channel, and each separate audio channel */
|
||||
|
||||
uint8_t FeatureUnitStrIndex; /**< Index of a string descriptor describing this descriptor within the device */
|
||||
} USB_AudioFeatureUnit_t;
|
||||
} USB_Audio_FeatureUnit_t;
|
||||
|
||||
/** Type define for an Audio class specific input terminal descriptor. This indicates to the host that the device
|
||||
* contains an input audio source, either from a physical terminal on the device, or a logical terminal (for example,
|
||||
|
@ -262,7 +269,7 @@
|
|||
|
||||
uint8_t ChannelStrIndex; /**< Index of a string descriptor describing this channel within the device */
|
||||
uint8_t TerminalStrIndex; /**< Index of a string descriptor describing this descriptor within the device */
|
||||
} USB_AudioInputTerminal_t;
|
||||
} USB_Audio_InputTerminal_t;
|
||||
|
||||
/** Type define for an Audio class specific output terminal descriptor. This indicates to the host that the device
|
||||
* contains an output audio sink, either to a physical terminal on the device, or a logical terminal (for example,
|
||||
|
@ -281,7 +288,7 @@
|
|||
uint8_t SourceID; /**< ID value of the unit this terminal's audio is sourced from */
|
||||
|
||||
uint8_t TerminalStrIndex; /**< Index of a string descriptor describing this descriptor within the device */
|
||||
} USB_AudioOutputTerminal_t;
|
||||
} USB_Audio_OutputTerminal_t;
|
||||
|
||||
/** Type define for an Audio class specific streaming interface descriptor. This indicates to the host
|
||||
* how audio streams within the device are formatted. See the USB Audio specification for more details.
|
||||
|
@ -295,7 +302,7 @@
|
|||
|
||||
uint8_t FrameDelay; /**< Delay in frames resulting from the complete sample processing from input to output */
|
||||
uint16_t AudioFormat; /**< Format of the audio stream, see Audio Device Formats specification */
|
||||
} USB_AudioInterface_AS_t;
|
||||
} USB_Audio_Interface_AS_t;
|
||||
|
||||
/** Type define for a 24bit audio sample frequency structure. GCC does not contain a built in 24bit datatype,
|
||||
* this this structure is used to build up the value instead. Fill this structure with the SAMPLE_FREQ() macro.
|
||||
|
@ -304,7 +311,7 @@
|
|||
{
|
||||
uint16_t LowWord; /**< Low 16 bits of the 24-bit value */
|
||||
uint8_t HighByte; /**< Upper 8 bits of the 24-bit value */
|
||||
} AudioSampleFreq_t;
|
||||
} USB_Audio_SampleFreq_t;
|
||||
|
||||
/** Type define for an Audio class specific audio format descriptor. This is used to give the host full details
|
||||
* about the number of channels, the sample resolution, acceptable sample frequencies and encoding method used
|
||||
|
@ -322,8 +329,8 @@
|
|||
uint8_t BitResolution; /**< Bits of resolution of each channel's samples in the stream */
|
||||
|
||||
uint8_t SampleFrequencyType; /**< Total number of sample frequencies supported by the device */
|
||||
AudioSampleFreq_t SampleFrequencies[1]; /**< Sample frequencies supported by the device */
|
||||
} USB_AudioFormat_t;
|
||||
USB_Audio_SampleFreq_t SampleFrequencies[AUDIO_TOTAL_SAMPLE_RATES]; /**< Sample frequencies supported by the device */
|
||||
} USB_Audio_Format_t;
|
||||
|
||||
/** Type define for an Audio class specific endpoint descriptor. This contains a regular endpoint
|
||||
* descriptor with a few Audio-class specific extensions. See the USB Audio specification for more details.
|
||||
|
@ -334,7 +341,7 @@
|
|||
|
||||
uint8_t Refresh; /**< Always set to zero */
|
||||
uint8_t SyncEndpointNumber; /**< Endpoint address to send synchronisation information to, if needed (zero otherwise) */
|
||||
} USB_AudioStreamEndpoint_Std_t;
|
||||
} USB_Audio_StreamEndpoint_Std_t;
|
||||
|
||||
/** Type define for an Audio class specific extended endpoint descriptor. This contains extra information
|
||||
* on the usage of endpoints used to stream audio in and out of the USB Audio device, and follows an Audio
|
||||
|
@ -349,7 +356,7 @@
|
|||
|
||||
uint8_t LockDelayUnits; /**< Units used for the LockDelay field, see Audio class specification */
|
||||
uint16_t LockDelay; /**< Time required to internally lock endpoint's internal clock recovery circuitry */
|
||||
} USB_AudioStreamEndpoint_Spc_t;
|
||||
} USB_Audio_StreamEndpoint_Spc_t;
|
||||
|
||||
/* Disable C linkage for C++ Compilers: */
|
||||
#if defined(__cplusplus)
|
||||
|
|
|
@ -80,7 +80,7 @@
|
|||
|
||||
uint8_t HIDReportType;
|
||||
uint16_t HIDReportLength;
|
||||
} USB_Descriptor_HID_t;
|
||||
} USB_HID_Descriptor_t;
|
||||
|
||||
/** Type define for the data type used to store HID report descriptor elements. */
|
||||
typedef uint8_t USB_Descriptor_HIDReport_Datatype_t;
|
||||
|
|
|
@ -87,7 +87,7 @@
|
|||
|
||||
uint16_t AudioSpecification; /**< Binary coded decimal value, indicating the supported Audio Class specification version */
|
||||
uint16_t TotalLength; /**< Total length of the Audio class specific descriptors, including this descriptor */
|
||||
} USB_AudioInterface_MIDI_AS_t;
|
||||
} USB_MIDI_AudioInterface_AS_t;
|
||||
|
||||
/** Type define for an Audio class specific MIDI IN jack. This gives information to the host on a MIDI input, either
|
||||
* a physical input jack, or a logical jack (receiving input data internally, or from the host via an endpoint).
|
||||
|
@ -143,7 +143,7 @@
|
|||
uint8_t Data1; /**< First byte of data in the MIDI event */
|
||||
uint8_t Data2; /**< Second byte of data in the MIDI event */
|
||||
uint8_t Data3; /**< Third byte of data in the MIDI event */
|
||||
} USB_MIDI_EventPacket_t;
|
||||
} MIDI_EventPacket_t;
|
||||
|
||||
/* Disable C linkage for C++ Compilers: */
|
||||
#if defined(__cplusplus)
|
||||
|
|
|
@ -75,7 +75,7 @@
|
|||
uint8_t LUN; /**< Logical Unit number this command is issued to */
|
||||
uint8_t SCSICommandLength; /**< Length of the issued SCSI command within the SCSI command data array */
|
||||
uint8_t SCSICommandData[16]; /**< Issued SCSI command in the Command Block */
|
||||
} CommandBlockWrapper_t;
|
||||
} MS_CommandBlockWrapper_t;
|
||||
|
||||
/** Type define for a Command Status Wrapper, used in the Mass Storage Bulk-Only Transport protocol. */
|
||||
typedef struct
|
||||
|
@ -84,7 +84,7 @@
|
|||
uint32_t Tag; /**< Unique command ID value, to associate a command block wrapper with its command status wrapper */
|
||||
uint32_t DataTransferResidue; /**< Number of bytes of data not processed in the SCSI command */
|
||||
uint8_t Status; /**< Status code of the issued command - a value from the MassStorage_CommandStatusCodes_t enum */
|
||||
} CommandStatusWrapper_t;
|
||||
} MS_CommandStatusWrapper_t;
|
||||
|
||||
/* Enums: */
|
||||
/** Enum for the possible command status wrapper return status codes. */
|
||||
|
|
|
@ -93,13 +93,6 @@
|
|||
uint8_t Octets[6]; /**< Individual bytes of a MAC address */
|
||||
} MAC_Address_t;
|
||||
|
||||
/** Type define for a RNDIS message header, sent before RNDIS messages */
|
||||
typedef struct
|
||||
{
|
||||
uint32_t MessageType; /**< RNDIS message type, a REMOTE_NDIS_*_MSG constant */
|
||||
uint32_t MessageLength; /**< Total length of the RNDIS message, in bytes */
|
||||
} RNDIS_Message_Header_t;
|
||||
|
||||
/** Type define for an Ethernet frame buffer. */
|
||||
typedef struct
|
||||
{
|
||||
|
@ -108,6 +101,13 @@
|
|||
bool FrameInBuffer; /**< Indicates if a frame is currently stored in the buffer */
|
||||
} Ethernet_Frame_Info_t;
|
||||
|
||||
/** Type define for a RNDIS message header, sent before RNDIS messages */
|
||||
typedef struct
|
||||
{
|
||||
uint32_t MessageType; /**< RNDIS message type, a REMOTE_NDIS_*_MSG constant */
|
||||
uint32_t MessageLength; /**< Total length of the RNDIS message, in bytes */
|
||||
} RNDIS_Message_Header_t;
|
||||
|
||||
/** Type define for a RNDIS packet message, used to encapsulate Ethernet packets sent to and from the adapter */
|
||||
typedef struct
|
||||
{
|
||||
|
|
|
@ -52,55 +52,44 @@
|
|||
#endif
|
||||
|
||||
/* Public Interface - May be used in end-application: */
|
||||
/* Type Defines: */
|
||||
/** Configuration information structure for \ref USB_ClassInfo_Audio_Device_t Audio device interface structures. */
|
||||
typedef struct
|
||||
{
|
||||
uint8_t StreamingInterfaceNumber; /**< Index of the Audio Streaming interface within the device this
|
||||
* structure controls.
|
||||
*/
|
||||
|
||||
uint8_t DataINEndpointNumber; /**< Endpoint number of the incomming Audio Streaming data, if available
|
||||
* (zero if unused).
|
||||
*/
|
||||
uint16_t DataINEndpointSize; /**< Size in bytes of the incomming Audio Streaming data endpoint, if available
|
||||
* (zero if unused).
|
||||
*/
|
||||
|
||||
uint8_t DataOUTEndpointNumber; /**< Endpoint number of the outgoing Audio Streaming data, if available
|
||||
* (zero if unused).
|
||||
*/
|
||||
uint16_t DataOUTEndpointSize; /**< Size in bytes of the outgoing Audio Streaming data endpoint, if available
|
||||
* (zero if unused).
|
||||
*/
|
||||
} USB_ClassInfo_Audio_Device_Config_t;
|
||||
|
||||
/** Current State information structure for \ref USB_ClassInfo_Audio_Device_t Audio device interface structures. */
|
||||
typedef struct
|
||||
{
|
||||
bool InterfaceEnabled; /**< Set and cleared by the class driver to indicate if the host has enabled the streaming endpoints
|
||||
* of the Audio Streaming interface.
|
||||
*/
|
||||
} USB_ClassInfo_Audio_Device_State_t;
|
||||
|
||||
/* Type Defines: */
|
||||
/** Class state structure. An instance of this structure should be made for each Audio interface
|
||||
* within the user application, and passed to each of the Audio class driver functions as the
|
||||
* AudioInterfaceInfo parameter. This stores each Audio interface's configuration and state information.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
const USB_ClassInfo_Audio_Device_Config_t Config; /**< Config data for the USB class interface within
|
||||
* the device. All elements in this section
|
||||
* <b>must</b> be set or the interface will fail
|
||||
* to enumerate and operate correctly.
|
||||
*/
|
||||
|
||||
USB_ClassInfo_Audio_Device_State_t State; /**< State data for the USB class interface within
|
||||
* the device. All elements in this section
|
||||
* <b>may</b> be set to initial values, but may
|
||||
* also be ignored to default to sane values when
|
||||
* the interface is enumerated.
|
||||
*/
|
||||
const struct
|
||||
{
|
||||
uint8_t StreamingInterfaceNumber; /**< Index of the Audio Streaming interface within the device this
|
||||
* structure controls.
|
||||
*/
|
||||
|
||||
uint8_t DataINEndpointNumber; /**< Endpoint number of the incomming Audio Streaming data, if available
|
||||
* (zero if unused).
|
||||
*/
|
||||
uint16_t DataINEndpointSize; /**< Size in bytes of the incomming Audio Streaming data endpoint, if available
|
||||
* (zero if unused).
|
||||
*/
|
||||
|
||||
uint8_t DataOUTEndpointNumber; /**< Endpoint number of the outgoing Audio Streaming data, if available
|
||||
* (zero if unused).
|
||||
*/
|
||||
uint16_t DataOUTEndpointSize; /**< Size in bytes of the outgoing Audio Streaming data endpoint, if available
|
||||
* (zero if unused).
|
||||
*/
|
||||
} Config; /**< Config data for the USB class interface within the device. All elements in this section
|
||||
* <b>must</b> be set or the interface will fail to enumerate and operate correctly.
|
||||
*/
|
||||
struct
|
||||
{
|
||||
bool InterfaceEnabled; /**< Set and cleared by the class driver to indicate if the host has enabled the streaming endpoints
|
||||
* of the Audio Streaming interface.
|
||||
*/
|
||||
} State; /**< State data for the USB class interface within the device. All elements in this section
|
||||
* <b>may</b> be set to initial values, but may also be ignored to default to sane values when
|
||||
* the interface is enumerated.
|
||||
*/
|
||||
} USB_ClassInfo_Audio_Device_t;
|
||||
|
||||
/* Function Prototypes: */
|
||||
|
|
|
@ -53,65 +53,54 @@
|
|||
|
||||
/* Public Interface - May be used in end-application: */
|
||||
/* Type Defines: */
|
||||
/** Configuration information structure for \ref USB_ClassInfo_CDC_Device_t CDC device interface structures. */
|
||||
typedef struct
|
||||
{
|
||||
uint8_t ControlInterfaceNumber; /**< Interface number of the CDC control interface within the device */
|
||||
|
||||
uint8_t DataINEndpointNumber; /**< Endpoint number of the CDC interface's IN data endpoint */
|
||||
uint16_t DataINEndpointSize; /**< Size in bytes of the CDC interface's IN data endpoint */
|
||||
|
||||
uint8_t DataOUTEndpointNumber; /**< Endpoint number of the CDC interface's OUT data endpoint */
|
||||
uint16_t DataOUTEndpointSize; /**< Size in bytes of the CDC interface's OUT data endpoint */
|
||||
|
||||
uint8_t NotificationEndpointNumber; /**< Endpoint number of the CDC interface's IN notification endpoint, if used */
|
||||
uint16_t NotificationEndpointSize; /**< Size in bytes of the CDC interface's IN notification endpoint, if used */
|
||||
} USB_ClassInfo_CDC_Device_Config_t;
|
||||
|
||||
/** Current State information structure for \ref USB_ClassInfo_CDC_Device_t CDC device interface structures. */
|
||||
typedef struct
|
||||
{
|
||||
struct
|
||||
{
|
||||
uint8_t HostToDevice; /**< Control line states from the host to device, as a set of CDC_CONTROL_LINE_OUT_*
|
||||
* masks.
|
||||
*/
|
||||
uint8_t DeviceToHost; /**< Control line states from the device to host, as a set of CDC_CONTROL_LINE_IN_*
|
||||
* masks.
|
||||
*/
|
||||
} ControlLineStates;
|
||||
|
||||
struct
|
||||
{
|
||||
uint32_t BaudRateBPS; /**< Baud rate of the virtual serial port, in bits per second */
|
||||
uint8_t CharFormat; /**< Character format of the virtual serial port, a value from the
|
||||
* CDCDevice_CDC_LineCodingFormats_t enum
|
||||
*/
|
||||
uint8_t ParityType; /**< Parity setting of the virtual serial port, a value from the
|
||||
* CDCDevice_LineCodingParity_t enum
|
||||
*/
|
||||
uint8_t DataBits; /**< Bits of data per character of the virtual serial port */
|
||||
} LineEncoding;
|
||||
} USB_ClassInfo_CDC_Device_State_t;
|
||||
|
||||
/** Class state structure. An instance of this structure should be made for each CDC interface
|
||||
* within the user application, and passed to each of the CDC class driver functions as the
|
||||
* CDCInterfaceInfo parameter. This stores each CDC interface's configuration and state information.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
const USB_ClassInfo_CDC_Device_Config_t Config; /**< Config data for the USB class interface within
|
||||
* the device. All elements in this section
|
||||
* <b>must</b> be set or the interface will fail
|
||||
* to enumerate and operate correctly.
|
||||
*/
|
||||
|
||||
USB_ClassInfo_CDC_Device_State_t State; /**< State data for the USB class interface within
|
||||
* the device. All elements in this section
|
||||
* <b>may</b> be set to initial values, but may
|
||||
* also be ignored to default to sane values when
|
||||
* the interface is enumerated.
|
||||
*/
|
||||
const struct
|
||||
{
|
||||
uint8_t ControlInterfaceNumber; /**< Interface number of the CDC control interface within the device */
|
||||
|
||||
uint8_t DataINEndpointNumber; /**< Endpoint number of the CDC interface's IN data endpoint */
|
||||
uint16_t DataINEndpointSize; /**< Size in bytes of the CDC interface's IN data endpoint */
|
||||
|
||||
uint8_t DataOUTEndpointNumber; /**< Endpoint number of the CDC interface's OUT data endpoint */
|
||||
uint16_t DataOUTEndpointSize; /**< Size in bytes of the CDC interface's OUT data endpoint */
|
||||
|
||||
uint8_t NotificationEndpointNumber; /**< Endpoint number of the CDC interface's IN notification endpoint, if used */
|
||||
uint16_t NotificationEndpointSize; /**< Size in bytes of the CDC interface's IN notification endpoint, if used */
|
||||
} Config; /**< Config data for the USB class interface within the device. All elements in this section
|
||||
* <b>must</b> be set or the interface will fail to enumerate and operate correctly.
|
||||
*/
|
||||
struct
|
||||
{
|
||||
struct
|
||||
{
|
||||
uint8_t HostToDevice; /**< Control line states from the host to device, as a set of CDC_CONTROL_LINE_OUT_*
|
||||
* masks.
|
||||
*/
|
||||
uint8_t DeviceToHost; /**< Control line states from the device to host, as a set of CDC_CONTROL_LINE_IN_*
|
||||
* masks.
|
||||
*/
|
||||
} ControlLineStates;
|
||||
|
||||
struct
|
||||
{
|
||||
uint32_t BaudRateBPS; /**< Baud rate of the virtual serial port, in bits per second */
|
||||
uint8_t CharFormat; /**< Character format of the virtual serial port, a value from the
|
||||
* CDCDevice_CDC_LineCodingFormats_t enum
|
||||
*/
|
||||
uint8_t ParityType; /**< Parity setting of the virtual serial port, a value from the
|
||||
* CDCDevice_LineCodingParity_t enum
|
||||
*/
|
||||
uint8_t DataBits; /**< Bits of data per character of the virtual serial port */
|
||||
} LineEncoding;
|
||||
} State; /**< State data for the USB class interface within the device. All elements in this section
|
||||
* <b>may</b> be set to initial values, but may also be ignored to default to sane values when
|
||||
* the interface is enumerated.
|
||||
*/
|
||||
} USB_ClassInfo_CDC_Device_t;
|
||||
|
||||
/* Function Prototypes: */
|
||||
|
|
|
@ -53,46 +53,35 @@
|
|||
|
||||
/* Public Interface - May be used in end-application: */
|
||||
/* Type Defines: */
|
||||
/** Configuration information structure for \ref USB_ClassInfo_HID_Device_t HID device interface structures. */
|
||||
typedef struct
|
||||
{
|
||||
uint8_t InterfaceNumber; /**< Interface number of the HID interface within the device */
|
||||
|
||||
uint8_t ReportINEndpointNumber; /**< Endpoint number of the HID interface's IN report endpoint */
|
||||
uint16_t ReportINEndpointSize; /**< Size in bytes of the HID interface's IN report endpoint */
|
||||
|
||||
uint8_t ReportINBufferSize; /**< Size of the largest possible report to send to the host, for
|
||||
* buffer allocation purposes
|
||||
*/
|
||||
} USB_ClassInfo_HID_Device_Config_t;
|
||||
|
||||
/** Current State information structure for \ref USB_ClassInfo_HID_Device_t HID device interface structures. */
|
||||
typedef struct
|
||||
{
|
||||
bool UsingReportProtocol; /**< Indicates if the HID interface is set to Boot or Report protocol mode */
|
||||
uint16_t IdleCount; /**< Report idle period, in ms, set by the host */
|
||||
uint16_t IdleMSRemaining; /**< Total number of ms remaining before the idle period elapsed - this should be
|
||||
* decremented by the user application if non-zero each millisecond */
|
||||
} USB_ClassInfo_HID_Device_State_t;
|
||||
|
||||
/** Class state structure. An instance of this structure should be made for each HID interface
|
||||
* within the user application, and passed to each of the HID class driver functions as the
|
||||
* HIDInterfaceInfo parameter. This stores each HID interface's configuration and state information.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
const USB_ClassInfo_HID_Device_Config_t Config; /**< Config data for the USB class interface within
|
||||
* the device. All elements in this section
|
||||
* <b>must</b> be set or the interface will fail
|
||||
* to enumerate and operate correctly.
|
||||
*/
|
||||
|
||||
USB_ClassInfo_HID_Device_State_t State; /**< State data for the USB class interface within
|
||||
* the device. All elements in this section
|
||||
* <b>may</b> be set to initial values, but may
|
||||
* also be ignored to default to sane values when
|
||||
* the interface is enumerated.
|
||||
*/
|
||||
const struct
|
||||
{
|
||||
uint8_t InterfaceNumber; /**< Interface number of the HID interface within the device */
|
||||
|
||||
uint8_t ReportINEndpointNumber; /**< Endpoint number of the HID interface's IN report endpoint */
|
||||
uint16_t ReportINEndpointSize; /**< Size in bytes of the HID interface's IN report endpoint */
|
||||
|
||||
uint8_t ReportINBufferSize; /**< Size of the largest possible report to send to the host, for
|
||||
* buffer allocation purposes
|
||||
*/
|
||||
} Config; /**< Config data for the USB class interface within the device. All elements in this section
|
||||
* <b>must</b> be set or the interface will fail to enumerate and operate correctly.
|
||||
*/
|
||||
struct
|
||||
{
|
||||
bool UsingReportProtocol; /**< Indicates if the HID interface is set to Boot or Report protocol mode */
|
||||
uint16_t IdleCount; /**< Report idle period, in ms, set by the host */
|
||||
uint16_t IdleMSRemaining; /**< Total number of ms remaining before the idle period elapsed - this should be
|
||||
* decremented by the user application if non-zero each millisecond */
|
||||
} State; /**< State data for the USB class interface within the device. All elements in this section
|
||||
* <b>may</b> be set to initial values, but may also be ignored to default to sane values when
|
||||
* the interface is enumerated.
|
||||
*/
|
||||
} USB_ClassInfo_HID_Device_t;
|
||||
|
||||
/* Function Prototypes: */
|
||||
|
|
|
@ -68,7 +68,7 @@ void MIDI_Device_USBTask(USB_ClassInfo_MIDI_Device_t* MIDIInterfaceInfo)
|
|||
|
||||
}
|
||||
|
||||
void MIDI_Device_SendEventPacket(USB_ClassInfo_MIDI_Device_t* MIDIInterfaceInfo, USB_MIDI_EventPacket_t* Event)
|
||||
void MIDI_Device_SendEventPacket(USB_ClassInfo_MIDI_Device_t* MIDIInterfaceInfo, MIDI_EventPacket_t* Event)
|
||||
{
|
||||
if (!(USB_IsConnected))
|
||||
return;
|
||||
|
@ -77,12 +77,12 @@ void MIDI_Device_SendEventPacket(USB_ClassInfo_MIDI_Device_t* MIDIInterfaceInfo,
|
|||
|
||||
if (Endpoint_IsReadWriteAllowed());
|
||||
{
|
||||
Endpoint_Write_Stream_LE(Event, sizeof(USB_MIDI_EventPacket_t), NO_STREAM_CALLBACK);
|
||||
Endpoint_Write_Stream_LE(Event, sizeof(MIDI_EventPacket_t), NO_STREAM_CALLBACK);
|
||||
Endpoint_ClearIN();
|
||||
}
|
||||
}
|
||||
|
||||
bool MIDI_Device_ReceiveEventPacket(USB_ClassInfo_MIDI_Device_t* MIDIInterfaceInfo, USB_MIDI_EventPacket_t* Event)
|
||||
bool MIDI_Device_ReceiveEventPacket(USB_ClassInfo_MIDI_Device_t* MIDIInterfaceInfo, MIDI_EventPacket_t* Event)
|
||||
{
|
||||
if (!(USB_IsConnected))
|
||||
return false;
|
||||
|
@ -92,7 +92,7 @@ bool MIDI_Device_ReceiveEventPacket(USB_ClassInfo_MIDI_Device_t* MIDIInterfaceIn
|
|||
if (!(Endpoint_IsReadWriteAllowed()))
|
||||
return false;
|
||||
|
||||
Endpoint_Read_Stream_LE(Event, sizeof(USB_MIDI_EventPacket_t), NO_STREAM_CALLBACK);
|
||||
Endpoint_Read_Stream_LE(Event, sizeof(MIDI_EventPacket_t), NO_STREAM_CALLBACK);
|
||||
Endpoint_ClearOUT();
|
||||
|
||||
return true;
|
||||
|
|
|
@ -55,22 +55,10 @@
|
|||
/* Public Interface - May be used in end-application: */
|
||||
/* Type Define: */
|
||||
/** Configuration information structure for \ref USB_ClassInfo_MIDI_Device_t MIDI device interface structures. */
|
||||
typedef struct
|
||||
{
|
||||
uint8_t StreamingInterfaceNumber; /**< Index of the Audio Streaming interface within the device this structure controls */
|
||||
|
||||
uint8_t DataINEndpointNumber; /**< Endpoint number of the incomming MIDI data, if available (zero if unused) */
|
||||
uint16_t DataINEndpointSize; /**< Size in bytes of the incomming MIDI data endpoint, if available (zero if unused) */
|
||||
|
||||
uint8_t DataOUTEndpointNumber; /**< Endpoint number of the outgoing MIDI data, if available (zero if unused) */
|
||||
uint16_t DataOUTEndpointSize; /**< Size in bytes of the outgoing MIDI data endpoint, if available (zero if unused) */
|
||||
} USB_ClassInfo_MIDI_Device_Config_t;
|
||||
typedef USB_ClassInfo_MIDI_Device_Config_t;
|
||||
|
||||
/** Current State information structure for \ref USB_ClassInfo_MIDI_Device_t MIDI device interface structures. */
|
||||
typedef struct
|
||||
{
|
||||
// No state information for this class yet
|
||||
} USB_ClassInfo_MIDI_Device_State_t;
|
||||
typedef USB_ClassInfo_MIDI_Device_State_t;
|
||||
|
||||
/** Class state structure. An instance of this structure should be made for each MIDI interface
|
||||
* within the user application, and passed to each of the MIDI class driver functions as the
|
||||
|
@ -78,18 +66,25 @@
|
|||
*/
|
||||
typedef struct
|
||||
{
|
||||
const USB_ClassInfo_MIDI_Device_Config_t Config; /**< Config data for the USB class interface within
|
||||
* the device. All elements in this section
|
||||
* <b>must</b> be set or the interface will fail
|
||||
* to enumerate and operate correctly.
|
||||
*/
|
||||
|
||||
USB_ClassInfo_MIDI_Device_State_t State; /**< State data for the USB class interface within
|
||||
* the device. All elements in this section
|
||||
* <b>may</b> be set to initial values, but may
|
||||
* also be ignored to default to sane values when
|
||||
* the interface is enumerated.
|
||||
*/
|
||||
const struct
|
||||
{
|
||||
uint8_t StreamingInterfaceNumber; /**< Index of the Audio Streaming interface within the device this structure controls */
|
||||
|
||||
uint8_t DataINEndpointNumber; /**< Endpoint number of the incomming MIDI data, if available (zero if unused) */
|
||||
uint16_t DataINEndpointSize; /**< Size in bytes of the incomming MIDI data endpoint, if available (zero if unused) */
|
||||
|
||||
uint8_t DataOUTEndpointNumber; /**< Endpoint number of the outgoing MIDI data, if available (zero if unused) */
|
||||
uint16_t DataOUTEndpointSize; /**< Size in bytes of the outgoing MIDI data endpoint, if available (zero if unused) */
|
||||
} Config; /**< Config data for the USB class interface within the device. All elements in this section
|
||||
* <b>must</b> be set or the interface will fail to enumerate and operate correctly.
|
||||
*/
|
||||
struct
|
||||
{
|
||||
// No state information for this class yet
|
||||
} State; /**< State data for the USB class interface within the device. All elements in this section
|
||||
* <b>may</b> be set to initial values, but may also be ignored to default to sane values when
|
||||
* the interface is enumerated.
|
||||
*/
|
||||
} USB_ClassInfo_MIDI_Device_t;
|
||||
|
||||
/* Function Prototypes: */
|
||||
|
@ -122,7 +117,7 @@
|
|||
* \param MIDIInterfaceInfo Pointer to a structure containing a MIDI Class configuration and state.
|
||||
* \param Event Pointer to a populated USB_MIDI_EventPacket_t structure containing the MIDI event to send
|
||||
*/
|
||||
void MIDI_Device_SendEventPacket(USB_ClassInfo_MIDI_Device_t* MIDIInterfaceInfo, USB_MIDI_EventPacket_t* Event);
|
||||
void MIDI_Device_SendEventPacket(USB_ClassInfo_MIDI_Device_t* MIDIInterfaceInfo, MIDI_EventPacket_t* Event);
|
||||
|
||||
/** Receives a MIDI event packet from the host.
|
||||
*
|
||||
|
@ -131,7 +126,7 @@
|
|||
*
|
||||
* \return Boolean true if a MIDI event packet was received, false otherwise
|
||||
*/
|
||||
bool MIDI_Device_ReceiveEventPacket(USB_ClassInfo_MIDI_Device_t* MIDIInterfaceInfo, USB_MIDI_EventPacket_t* Event);
|
||||
bool MIDI_Device_ReceiveEventPacket(USB_ClassInfo_MIDI_Device_t* MIDIInterfaceInfo, MIDI_EventPacket_t* Event);
|
||||
|
||||
/* Disable C linkage for C++ Compilers: */
|
||||
#if defined(__cplusplus)
|
||||
|
|
|
@ -144,7 +144,7 @@ static bool MS_Device_ReadInCommandBlock(USB_ClassInfo_MS_Device_t* MSInterfaceI
|
|||
|
||||
CallbackMSInterfaceInfo = MSInterfaceInfo;
|
||||
Endpoint_Read_Stream_LE(&MSInterfaceInfo->State.CommandBlock,
|
||||
(sizeof(CommandBlockWrapper_t) - 16),
|
||||
(sizeof(MS_CommandBlockWrapper_t) - 16),
|
||||
StreamCallback_MS_Device_AbortOnMassStoreReset);
|
||||
|
||||
if ((MSInterfaceInfo->State.CommandBlock.Signature != MS_CBW_SIGNATURE) ||
|
||||
|
@ -194,7 +194,7 @@ static void MS_Device_ReturnCommandStatus(USB_ClassInfo_MS_Device_t* MSInterface
|
|||
}
|
||||
|
||||
CallbackMSInterfaceInfo = MSInterfaceInfo;
|
||||
Endpoint_Write_Stream_LE(&MSInterfaceInfo->State.CommandStatus, sizeof(CommandStatusWrapper_t),
|
||||
Endpoint_Write_Stream_LE(&MSInterfaceInfo->State.CommandStatus, sizeof(MS_CommandStatusWrapper_t),
|
||||
StreamCallback_MS_Device_AbortOnMassStoreReset);
|
||||
|
||||
Endpoint_ClearIN();
|
||||
|
|
|
@ -52,54 +52,42 @@
|
|||
#endif
|
||||
|
||||
/* Public Interface - May be used in end-application: */
|
||||
/* Type Defines: */
|
||||
/** Configuration information structure for \ref USB_ClassInfo_MS_Device_t Mass Storage device interface structures. */
|
||||
typedef struct
|
||||
{
|
||||
uint8_t InterfaceNumber; /**< Interface number of the Mass Storage interface within the device */
|
||||
|
||||
uint8_t DataINEndpointNumber; /**< Endpoint number of the Mass Storage interface's IN data endpoint */
|
||||
uint16_t DataINEndpointSize; /**< Size in bytes of the Mass Storage interface's IN data endpoint */
|
||||
|
||||
uint8_t DataOUTEndpointNumber; /**< Endpoint number of the Mass Storage interface's OUT data endpoint */
|
||||
uint16_t DataOUTEndpointSize; /**< Size in bytes of the Mass Storage interface's OUT data endpoint */
|
||||
|
||||
uint8_t TotalLUNs; /**< Total number of logical drives in the Mass Storage interface */
|
||||
} USB_ClassInfo_MS_Device_Config_t;
|
||||
|
||||
/** Current State information structure for \ref USB_ClassInfo_MS_Device_t Mass Storage device interface structures. */
|
||||
typedef struct
|
||||
{
|
||||
CommandBlockWrapper_t CommandBlock; /**< Mass Storage class command block structure, stores the received SCSI
|
||||
* command from the host which is to be processed
|
||||
*/
|
||||
CommandStatusWrapper_t CommandStatus; /**< Mass Storage class command status structure, set elements to indicate
|
||||
* the issued command's success or failure to the host
|
||||
*/
|
||||
|
||||
bool IsMassStoreReset; /**< Flag indicating that the host has requested that the Mass Storage interface be reset
|
||||
* and that all current Mass Storage operations should immediately abort
|
||||
*/
|
||||
} USB_ClassInfo_MS_Device_State_t;
|
||||
|
||||
/* Type Defines: */
|
||||
/** Class state structure. An instance of this structure should be made for each Mass Storage interface
|
||||
* within the user application, and passed to each of the Mass Storage class driver functions as the
|
||||
* MSInterfaceInfo parameter. This stores each Mass Storage interface's configuration and state information.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
const USB_ClassInfo_MS_Device_Config_t Config; /**< Config data for the USB class interface within
|
||||
* the device. All elements in this section
|
||||
* <b>must</b> be set or the interface will fail
|
||||
* to enumerate and operate correctly.
|
||||
*/
|
||||
|
||||
USB_ClassInfo_MS_Device_State_t State; /**< State data for the USB class interface within
|
||||
* the device. All elements in this section
|
||||
* <b>may</b> be set to initial values, but may
|
||||
* also be ignored to default to sane values when
|
||||
* the interface is enumerated.
|
||||
*/
|
||||
const struct
|
||||
{
|
||||
uint8_t InterfaceNumber; /**< Interface number of the Mass Storage interface within the device */
|
||||
|
||||
uint8_t DataINEndpointNumber; /**< Endpoint number of the Mass Storage interface's IN data endpoint */
|
||||
uint16_t DataINEndpointSize; /**< Size in bytes of the Mass Storage interface's IN data endpoint */
|
||||
|
||||
uint8_t DataOUTEndpointNumber; /**< Endpoint number of the Mass Storage interface's OUT data endpoint */
|
||||
uint16_t DataOUTEndpointSize; /**< Size in bytes of the Mass Storage interface's OUT data endpoint */
|
||||
|
||||
uint8_t TotalLUNs; /**< Total number of logical drives in the Mass Storage interface */
|
||||
} Config; /**< Config data for the USB class interface within the device. All elements in this section
|
||||
* <b>must</b> be set or the interface will fail to enumerate and operate correctly.
|
||||
*/
|
||||
struct
|
||||
{
|
||||
MS_CommandBlockWrapper_t CommandBlock; /**< Mass Storage class command block structure, stores the received SCSI
|
||||
* command from the host which is to be processed
|
||||
*/
|
||||
MS_CommandStatusWrapper_t CommandStatus; /**< Mass Storage class command status structure, set elements to indicate
|
||||
* the issued command's success or failure to the host
|
||||
*/
|
||||
bool IsMassStoreReset; /**< Flag indicating that the host has requested that the Mass Storage interface be reset
|
||||
* and that all current Mass Storage operations should immediately abort
|
||||
*/
|
||||
} State; /**< State data for the USB class interface within the device. All elements in this section
|
||||
* <b>may</b> be set to initial values, but may also be ignored to default to sane values when
|
||||
* the interface is enumerated.
|
||||
*/
|
||||
} USB_ClassInfo_MS_Device_t;
|
||||
|
||||
/* Function Prototypes: */
|
||||
|
|
|
@ -53,60 +53,49 @@
|
|||
#endif
|
||||
|
||||
/* Public Interface - May be used in end-application: */
|
||||
/* Type Defines: */
|
||||
/** Configuration information structure for \ref USB_ClassInfo_RNDIS_Device_t RNDIS device interface structures. */
|
||||
typedef struct
|
||||
{
|
||||
uint8_t ControlInterfaceNumber; /**< Interface number of the CDC control interface within the device */
|
||||
|
||||
uint8_t DataINEndpointNumber; /**< Endpoint number of the CDC interface's IN data endpoint */
|
||||
uint16_t DataINEndpointSize; /**< Size in bytes of the CDC interface's IN data endpoint */
|
||||
|
||||
uint8_t DataOUTEndpointNumber; /**< Endpoint number of the CDC interface's OUT data endpoint */
|
||||
uint16_t DataOUTEndpointSize; /**< Size in bytes of the CDC interface's OUT data endpoint */
|
||||
|
||||
uint8_t NotificationEndpointNumber; /**< Endpoint number of the CDC interface's IN notification endpoint, if used */
|
||||
uint16_t NotificationEndpointSize; /**< Size in bytes of the CDC interface's IN notification endpoint, if used */
|
||||
|
||||
char* AdapterVendorDescription; /**< String description of the adapter vendor */
|
||||
MAC_Address_t AdapterMACAddress; /**< MAC address of the adapter */
|
||||
} USB_ClassInfo_MS_Device_Config_t;
|
||||
|
||||
/** Current State information structure for \ref USB_ClassInfo_RNDIS_Device_t RNDIS device interface structures. */
|
||||
typedef struct
|
||||
{
|
||||
uint8_t RNDISMessageBuffer[RNDIS_MESSAGE_BUFFER_SIZE]; /**< Buffer to hold RNDIS messages to and from the host,
|
||||
* managed by the class driver
|
||||
*/
|
||||
bool ResponseReady; /**< Internal flag indicating if a RNDIS message is waiting to be returned to the host */
|
||||
uint8_t CurrRNDISState; /**< Current RNDIS state of the adapter, a value from the RNDIS_States_t enum */
|
||||
uint32_t CurrPacketFilter; /**< Current packet filter mode, used internally by the class driver */
|
||||
Ethernet_Frame_Info_t FrameIN; /**< Structure holding the last received Ethernet frame from the host, for user
|
||||
* processing
|
||||
*/
|
||||
Ethernet_Frame_Info_t FrameOUT; /**< Structure holding the next Ethernet frame to send to the host, populated by the
|
||||
* user application
|
||||
*/
|
||||
} USB_ClassInfo_MS_Device_State_t;
|
||||
|
||||
/* Type Defines: */
|
||||
/** Class state structure. An instance of this structure should be made for each RNDIS interface
|
||||
* within the user application, and passed to each of the RNDIS class driver functions as the
|
||||
* RNDISInterfaceInfo parameter. This stores each RNDIS interface's configuration and state information.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
const USB_ClassInfo_MS_Device_Config_t Config; /**< Config data for the USB class interface within
|
||||
* the device. All elements in this section
|
||||
* <b>must</b> be set or the interface will fail
|
||||
* to enumerate and operate correctly.
|
||||
*/
|
||||
|
||||
USB_ClassInfo_MS_Device_State_t State; /**< State data for the USB class interface within
|
||||
* the device. All elements in this section
|
||||
* <b>may</b> be set to initial values, but may
|
||||
* also be ignored to default to sane values when
|
||||
* the interface is enumerated.
|
||||
*/
|
||||
const struct
|
||||
{
|
||||
uint8_t ControlInterfaceNumber; /**< Interface number of the CDC control interface within the device */
|
||||
|
||||
uint8_t DataINEndpointNumber; /**< Endpoint number of the CDC interface's IN data endpoint */
|
||||
uint16_t DataINEndpointSize; /**< Size in bytes of the CDC interface's IN data endpoint */
|
||||
|
||||
uint8_t DataOUTEndpointNumber; /**< Endpoint number of the CDC interface's OUT data endpoint */
|
||||
uint16_t DataOUTEndpointSize; /**< Size in bytes of the CDC interface's OUT data endpoint */
|
||||
|
||||
uint8_t NotificationEndpointNumber; /**< Endpoint number of the CDC interface's IN notification endpoint, if used */
|
||||
uint16_t NotificationEndpointSize; /**< Size in bytes of the CDC interface's IN notification endpoint, if used */
|
||||
|
||||
char* AdapterVendorDescription; /**< String description of the adapter vendor */
|
||||
MAC_Address_t AdapterMACAddress; /**< MAC address of the adapter */
|
||||
} Config; /**< Config data for the USB class interface within the device. All elements in this section
|
||||
* <b>must</b> be set or the interface will fail to enumerate and operate correctly.
|
||||
*/
|
||||
struct
|
||||
{
|
||||
uint8_t RNDISMessageBuffer[RNDIS_MESSAGE_BUFFER_SIZE]; /**< Buffer to hold RNDIS messages to and from the host,
|
||||
* managed by the class driver
|
||||
*/
|
||||
bool ResponseReady; /**< Internal flag indicating if a RNDIS message is waiting to be returned to the host */
|
||||
uint8_t CurrRNDISState; /**< Current RNDIS state of the adapter, a value from the RNDIS_States_t enum */
|
||||
uint32_t CurrPacketFilter; /**< Current packet filter mode, used internally by the class driver */
|
||||
Ethernet_Frame_Info_t FrameIN; /**< Structure holding the last received Ethernet frame from the host, for user
|
||||
* processing
|
||||
*/
|
||||
Ethernet_Frame_Info_t FrameOUT; /**< Structure holding the next Ethernet frame to send to the host, populated by the
|
||||
* user application
|
||||
*/
|
||||
} State; /**< State data for the USB class interface within the device. All elements in this section
|
||||
* <b>may</b> be set to initial values, but may also be ignored to default to sane values when
|
||||
* the interface is enumerated.
|
||||
*/
|
||||
} USB_ClassInfo_RNDIS_Device_t;
|
||||
|
||||
/* Function Prototypes: */
|
||||
|
|
|
@ -50,67 +50,56 @@
|
|||
#endif
|
||||
|
||||
/* Public Interface - May be used in end-application: */
|
||||
/* Type Defines: */
|
||||
/** Configuration information structure for \ref USB_ClassInfo_CDC_Host_t CDC host interface structures. */
|
||||
typedef struct
|
||||
{
|
||||
uint8_t DataINPipeNumber; /**< Pipe number of the CDC interface's IN data pipe */
|
||||
uint8_t DataOUTPipeNumber; /**< Pipe number of the CDC interface's OUT data pipe */
|
||||
uint8_t NotificationPipeNumber; /**< Pipe number of the CDC interface's IN notification endpoint, if used */
|
||||
} USB_ClassInfo_CDC_Host_Config_t;
|
||||
|
||||
/** Current State information structure for \ref USB_ClassInfo_CDC_Host_t CDC host interface structures. */
|
||||
typedef struct
|
||||
{
|
||||
uint8_t ControlInterfaceNumber; /**< Interface number of the CDC control interface within the device */
|
||||
|
||||
uint16_t DataINPipeSize; /**< Size in bytes of the CDC interface's IN data pipe */
|
||||
uint16_t DataOUTPipeSize; /**< Size in bytes of the CDC interface's OUT data pipe */
|
||||
uint16_t NotificationPipeSize; /**< Size in bytes of the CDC interface's IN notification endpoint, if used */
|
||||
|
||||
struct
|
||||
{
|
||||
uint8_t HostToDevice; /**< Control line states from the host to device, as a set of CDC_CONTROL_LINE_OUT_*
|
||||
* masks.
|
||||
*/
|
||||
uint8_t DeviceToHost; /**< Control line states from the device to host, as a set of CDC_CONTROL_LINE_IN_*
|
||||
* masks.
|
||||
*/
|
||||
} ControlLineStates;
|
||||
|
||||
struct
|
||||
{
|
||||
bool Active; /**< Indicates if the interface is currently active, i.e. attached to the connected device */
|
||||
|
||||
uint32_t BaudRateBPS; /**< Baud rate of the virtual serial port, in bits per second */
|
||||
uint8_t CharFormat; /**< Character format of the virtual serial port, a value from the
|
||||
* CDCDevice_CDC_LineCodingFormats_t enum
|
||||
*/
|
||||
uint8_t ParityType; /**< Parity setting of the virtual serial port, a value from the
|
||||
* CDCDevice_LineCodingParity_t enum
|
||||
*/
|
||||
uint8_t DataBits; /**< Bits of data per character of the virtual serial port */
|
||||
} LineEncoding;
|
||||
} USB_ClassInfo_CDC_Host_State_t;
|
||||
|
||||
/* Type Defines: */
|
||||
/** Class state structure. An instance of this structure should be made within the user application,
|
||||
* and passed to each of the CDC class driver functions as the CDCInterfaceInfo parameter. This
|
||||
* stores each CDC interface's configuration and state information.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
const USB_ClassInfo_CDC_Host_Config_t Config; /**< Config data for the USB class interface within
|
||||
* the device. All elements in this section
|
||||
* <b>must</b> be set or the interface will fail
|
||||
* to enumerate and operate correctly.
|
||||
*/
|
||||
const struct
|
||||
{
|
||||
uint8_t DataINPipeNumber; /**< Pipe number of the CDC interface's IN data pipe */
|
||||
uint8_t DataOUTPipeNumber; /**< Pipe number of the CDC interface's OUT data pipe */
|
||||
uint8_t NotificationPipeNumber; /**< Pipe number of the CDC interface's IN notification endpoint, if used */
|
||||
} Config; /**< Config data for the USB class interface within the device. All elements in this section
|
||||
* <b>must</b> be set or the interface will fail to enumerate and operate correctly.
|
||||
*/
|
||||
struct
|
||||
{
|
||||
uint8_t ControlInterfaceNumber; /**< Interface number of the CDC control interface within the device */
|
||||
|
||||
USB_ClassInfo_CDC_Host_State_t State; /**< State data for the USB class interface within
|
||||
* the device. All elements in this section
|
||||
* <b>may</b> be set to initial values, but may
|
||||
* also be ignored to default to sane values when
|
||||
* the interface is enumerated.
|
||||
*/
|
||||
uint16_t DataINPipeSize; /**< Size in bytes of the CDC interface's IN data pipe */
|
||||
uint16_t DataOUTPipeSize; /**< Size in bytes of the CDC interface's OUT data pipe */
|
||||
uint16_t NotificationPipeSize; /**< Size in bytes of the CDC interface's IN notification endpoint, if used */
|
||||
|
||||
struct
|
||||
{
|
||||
uint8_t HostToDevice; /**< Control line states from the host to device, as a set of CDC_CONTROL_LINE_OUT_*
|
||||
* masks.
|
||||
*/
|
||||
uint8_t DeviceToHost; /**< Control line states from the device to host, as a set of CDC_CONTROL_LINE_IN_*
|
||||
* masks.
|
||||
*/
|
||||
} ControlLineStates;
|
||||
|
||||
struct
|
||||
{
|
||||
bool Active; /**< Indicates if the interface is currently active, i.e. attached to the connected device */
|
||||
|
||||
uint32_t BaudRateBPS; /**< Baud rate of the virtual serial port, in bits per second */
|
||||
uint8_t CharFormat; /**< Character format of the virtual serial port, a value from the
|
||||
* CDCDevice_CDC_LineCodingFormats_t enum
|
||||
*/
|
||||
uint8_t ParityType; /**< Parity setting of the virtual serial port, a value from the
|
||||
* CDCDevice_LineCodingParity_t enum
|
||||
*/
|
||||
uint8_t DataBits; /**< Bits of data per character of the virtual serial port */
|
||||
} LineEncoding;
|
||||
} State; /**< State data for the USB class interface within the device. All elements in this section
|
||||
* <b>may</b> be set to initial values, but may also be ignored to default to sane values when
|
||||
* the interface is enumerated.
|
||||
*/
|
||||
} USB_ClassInfo_CDC_Host_t;
|
||||
|
||||
/* Enums: */
|
||||
|
|
|
@ -138,7 +138,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
|
|||
|
||||
.KeyboardHID =
|
||||
{
|
||||
.Header = {.Size = sizeof(USB_Descriptor_HID_t), .Type = DTYPE_HID},
|
||||
.Header = {.Size = sizeof(USB_HID_Descriptor_t), .Type = DTYPE_HID},
|
||||
|
||||
.HIDSpec = VERSION_BCD(01.11),
|
||||
.CountryCode = 0x00,
|
||||
|
@ -234,7 +234,7 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex,
|
|||
break;
|
||||
case DTYPE_HID:
|
||||
Address = (void*)&ConfigurationDescriptor.KeyboardHID;
|
||||
Size = sizeof(USB_Descriptor_HID_t);
|
||||
Size = sizeof(USB_HID_Descriptor_t);
|
||||
break;
|
||||
case DTYPE_Report:
|
||||
Address = (void*)&KeyboardReport;
|
||||
|
|
|
@ -52,7 +52,7 @@
|
|||
{
|
||||
USB_Descriptor_Configuration_Header_t Config; /**< Configuration descriptor header structure */
|
||||
USB_Descriptor_Interface_t Interface; /**< Keyboard interface descriptor */
|
||||
USB_Descriptor_HID_t KeyboardHID; /**< Keyboard HID descriptor */
|
||||
USB_HID_Descriptor_t KeyboardHID; /**< Keyboard HID descriptor */
|
||||
USB_Descriptor_Endpoint_t KeyboardEndpoint; /**< Keyboard key report endpoint descriptor */
|
||||
} USB_Descriptor_Configuration_t;
|
||||
|
||||
|
|
Loading…
Reference in New Issue