Commit 9798440c authored by Dean Camera's avatar Dean Camera
Browse files

Changed to new device mode Class Driver function name prefixes to make way for...

Changed to new device mode Class Driver function name prefixes to make way for similar host mode Class drivers.
parent b2330934
......@@ -62,7 +62,7 @@ int main(void)
if (Microphone_Audio_Interface.InterfaceEnabled)
ProcessNextSample();
USB_Audio_USBTask(&Microphone_Audio_Interface);
Audio_Device_USBTask(&Microphone_Audio_Interface);
USB_USBTask();
}
}
......@@ -92,7 +92,7 @@ void SetupHardware(void)
*/
void ProcessNextSample(void)
{
if ((TIFR0 & (1 << OCF0A)) && USB_Audio_IsReadyForNextSample(&Microphone_Audio_Interface))
if ((TIFR0 & (1 << OCF0A)) && Audio_Device_IsReadyForNextSample(&Microphone_Audio_Interface))
{
TIFR0 |= (1 << OCF0A);
......@@ -104,7 +104,7 @@ void ProcessNextSample(void)
AudioSample -= (SAMPLE_MAX_RANGE / 2));
#endif
USB_Audio_WriteSample16(AudioSample);
Audio_Device_WriteSample16(AudioSample);
}
}
......@@ -133,12 +133,12 @@ void EVENT_USB_ConfigurationChanged(void)
{
LEDs_SetAllLEDs(LEDMASK_USB_READY);
if (!(USB_Audio_ConfigureEndpoints(&Microphone_Audio_Interface)))
if (!(Audio_Device_ConfigureEndpoints(&Microphone_Audio_Interface)))
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
}
/** Event handler for the library USB Unhandled Control Packet event. */
void EVENT_USB_UnhandledControlPacket(void)
{
USB_Audio_ProcessControlPacket(&Microphone_Audio_Interface);
Audio_Device_ProcessControlPacket(&Microphone_Audio_Interface);
}
......@@ -62,7 +62,7 @@ int main(void)
if (Speaker_Audio_Interface.InterfaceEnabled)
ProcessNextSample();
USB_Audio_USBTask(&Speaker_Audio_Interface);
Audio_Device_USBTask(&Speaker_Audio_Interface);
USB_USBTask();
}
}
......@@ -87,14 +87,14 @@ void SetupHardware(void)
*/
void ProcessNextSample(void)
{
if ((TIFR0 & (1 << OCF0A)) && USB_Audio_IsSampleReceived(&Speaker_Audio_Interface))
if ((TIFR0 & (1 << OCF0A)) && Audio_Device_IsSampleReceived(&Speaker_Audio_Interface))
{
/* Clear the sample reload timer */
TIFR0 |= (1 << OCF0A);
/* Retrieve the signed 16-bit left and right audio samples */
int16_t LeftSample_16Bit = (int16_t)USB_Audio_ReadSample16();
int16_t RightSample_16Bit = (int16_t)USB_Audio_ReadSample16();
int16_t LeftSample_16Bit = (int16_t)Audio_Device_ReadSample16();
int16_t RightSample_16Bit = (int16_t)Audio_Device_ReadSample16();
/* Massage signed 16-bit left and right audio samples into signed 8-bit */
int8_t LeftSample_8Bit = (LeftSample_16Bit >> 8);
......@@ -195,12 +195,12 @@ void EVENT_USB_ConfigurationChanged(void)
{
LEDs_SetAllLEDs(LEDMASK_USB_READY);
if (!(USB_Audio_ConfigureEndpoints(&Speaker_Audio_Interface)))
if (!(Audio_Device_ConfigureEndpoints(&Speaker_Audio_Interface)))
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
}
/** Event handler for the library USB Unhandled Control Packet event. */
void EVENT_USB_UnhandledControlPacket(void)
{
USB_Audio_ProcessControlPacket(&Speaker_Audio_Interface);
Audio_Device_ProcessControlPacket(&Speaker_Audio_Interface);
}
......@@ -67,11 +67,11 @@ int main(void)
{
CheckJoystickMovement();
uint16_t BytesToDiscard = USB_CDC_BytesReceived(&VirtualSerial_CDC_Interface);
uint16_t BytesToDiscard = CDC_Device_BytesReceived(&VirtualSerial_CDC_Interface);
while (BytesToDiscard--)
USB_CDC_ReceiveByte(&VirtualSerial_CDC_Interface);
CDC_Device_ReceiveByte(&VirtualSerial_CDC_Interface);
USB_CDC_USBTask(&VirtualSerial_CDC_Interface);
CDC_Device_USBTask(&VirtualSerial_CDC_Interface);
USB_USBTask();
}
}
......@@ -125,7 +125,7 @@ void CheckJoystickMovement(void)
{
ActionSent = true;
USB_CDC_SendString(&VirtualSerial_CDC_Interface, ReportString, strlen(ReportString));
CDC_Device_SendString(&VirtualSerial_CDC_Interface, ReportString, strlen(ReportString));
}
}
......@@ -146,12 +146,12 @@ void EVENT_USB_ConfigurationChanged(void)
{
LEDs_SetAllLEDs(LEDMASK_USB_READY);
if (!(USB_CDC_ConfigureEndpoints(&VirtualSerial_CDC_Interface)))
if (!(CDC_Device_ConfigureEndpoints(&VirtualSerial_CDC_Interface)))
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
}
/** Event handler for the library USB Unhandled Control Packet event. */
void EVENT_USB_UnhandledControlPacket(void)
{
USB_CDC_ProcessControlPacket(&VirtualSerial_CDC_Interface);
CDC_Device_ProcessControlPacket(&VirtualSerial_CDC_Interface);
}
......@@ -88,17 +88,17 @@ int main(void)
CheckJoystickMovement();
/* Discard all received data on the first CDC interface */
uint16_t BytesToDiscard = USB_CDC_BytesReceived(&VirtualSerial1_CDC_Interface);
uint16_t BytesToDiscard = CDC_Device_BytesReceived(&VirtualSerial1_CDC_Interface);
while (BytesToDiscard--)
USB_CDC_ReceiveByte(&VirtualSerial1_CDC_Interface);
CDC_Device_ReceiveByte(&VirtualSerial1_CDC_Interface);
/* Echo all received data on the second CDC interface */
uint16_t BytesToEcho = USB_CDC_BytesReceived(&VirtualSerial2_CDC_Interface);
uint16_t BytesToEcho = CDC_Device_BytesReceived(&VirtualSerial2_CDC_Interface);
while (BytesToEcho--)
USB_CDC_SendByte(&VirtualSerial2_CDC_Interface, USB_CDC_ReceiveByte(&VirtualSerial2_CDC_Interface));
CDC_Device_SendByte(&VirtualSerial2_CDC_Interface, CDC_Device_ReceiveByte(&VirtualSerial2_CDC_Interface));
USB_CDC_USBTask(&VirtualSerial1_CDC_Interface);
USB_CDC_USBTask(&VirtualSerial2_CDC_Interface);
CDC_Device_USBTask(&VirtualSerial1_CDC_Interface);
CDC_Device_USBTask(&VirtualSerial2_CDC_Interface);
USB_USBTask();
}
}
......@@ -154,7 +154,7 @@ void CheckJoystickMovement(void)
{
ActionSent = true;
USB_CDC_SendString(&VirtualSerial1_CDC_Interface, ReportString, strlen(ReportString));
CDC_Device_SendString(&VirtualSerial1_CDC_Interface, ReportString, strlen(ReportString));
}
}
......@@ -175,16 +175,16 @@ void EVENT_USB_ConfigurationChanged(void)
{
LEDs_SetAllLEDs(LEDMASK_USB_READY);
if (!(USB_CDC_ConfigureEndpoints(&VirtualSerial1_CDC_Interface)))
if (!(CDC_Device_ConfigureEndpoints(&VirtualSerial1_CDC_Interface)))
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
if (!(USB_CDC_ConfigureEndpoints(&VirtualSerial2_CDC_Interface)))
if (!(CDC_Device_ConfigureEndpoints(&VirtualSerial2_CDC_Interface)))
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
}
/** Event handler for the library USB Unhandled Control Packet event. */
void EVENT_USB_UnhandledControlPacket(void)
{
USB_CDC_ProcessControlPacket(&VirtualSerial1_CDC_Interface);
USB_CDC_ProcessControlPacket(&VirtualSerial2_CDC_Interface);
CDC_Device_ProcessControlPacket(&VirtualSerial1_CDC_Interface);
CDC_Device_ProcessControlPacket(&VirtualSerial2_CDC_Interface);
}
......@@ -63,7 +63,7 @@ int main(void)
for (;;)
{
USB_HID_USBTask(&Generic_HID_Interface);
HID_Device_USBTask(&Generic_HID_Interface);
USB_USBTask();
}
}
......@@ -106,14 +106,14 @@ void EVENT_USB_ConfigurationChanged(void)
{
LEDs_SetAllLEDs(LEDMASK_USB_READY);
if (!(USB_HID_ConfigureEndpoints(&Generic_HID_Interface)))
if (!(HID_Device_ConfigureEndpoints(&Generic_HID_Interface)))
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
}
/** Event handler for the library USB Unhandled Control Packet event. */
void EVENT_USB_UnhandledControlPacket(void)
{
USB_HID_ProcessControlPacket(&Generic_HID_Interface);
HID_Device_ProcessControlPacket(&Generic_HID_Interface);
}
/** ISR to keep track of each millisecond interrupt, for determining the HID class idle period remaining when set. */
......@@ -130,7 +130,7 @@ ISR(TIMER0_COMPA_vect, ISR_BLOCK)
*
* \return Number of bytes written in the report (or zero if no report is to be sent
*/
uint16_t CALLBACK_USB_HID_CreateNextHIDReport(USB_ClassInfo_HID_t* HIDInterfaceInfo, uint8_t* ReportID, void* ReportData)
uint16_t CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_t* HIDInterfaceInfo, uint8_t* ReportID, void* ReportData)
{
// Create generic HID report here
......@@ -143,8 +143,8 @@ uint16_t CALLBACK_USB_HID_CreateNextHIDReport(USB_ClassInfo_HID_t* HIDInterfaceI
* \param ReportData Pointer to a buffer where the created report has been stored
* \param ReportSize Size in bytes of the received HID report
*/
void CALLBACK_USB_HID_ProcessReceivedHIDReport(USB_ClassInfo_HID_t* HIDInterfaceInfo, uint8_t ReportID,
void* ReportData, uint16_t ReportSize)
void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_t* HIDInterfaceInfo, uint8_t ReportID,
void* ReportData, uint16_t ReportSize)
{
// Process received generic HID report here
}
......@@ -72,8 +72,8 @@
void EVENT_USB_ConfigurationChanged(void);
void EVENT_USB_UnhandledControlPacket(void);
uint16_t CALLBACK_USB_HID_CreateNextHIDReport(USB_ClassInfo_HID_t* HIDInterfaceInfo, uint8_t* ReportID, void* ReportData);
void CALLBACK_USB_HID_ProcessReceivedHIDReport(USB_ClassInfo_HID_t* HIDInterfaceInfo, uint8_t ReportID,
void* ReportData, uint16_t ReportSize);
uint16_t CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_t* HIDInterfaceInfo, uint8_t* ReportID, void* ReportData);
void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_t* HIDInterfaceInfo, uint8_t ReportID,
void* ReportData, uint16_t ReportSize);
#endif
......@@ -63,7 +63,7 @@ int main(void)
for (;;)
{
USB_HID_USBTask(&Joystick_HID_Interface);
HID_Device_USBTask(&Joystick_HID_Interface);
USB_USBTask();
}
}
......@@ -108,14 +108,14 @@ void EVENT_USB_ConfigurationChanged(void)
{
LEDs_SetAllLEDs(LEDMASK_USB_READY);
if (!(USB_HID_ConfigureEndpoints(&Joystick_HID_Interface)))
if (!(HID_Device_ConfigureEndpoints(&Joystick_HID_Interface)))
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
}
/** Event handler for the library USB Unhandled Control Packet event. */
void EVENT_USB_UnhandledControlPacket(void)
{
USB_HID_ProcessControlPacket(&Joystick_HID_Interface);
HID_Device_ProcessControlPacket(&Joystick_HID_Interface);
}
/** ISR to keep track of each millisecond interrupt, for determining the HID class idle period remaining when set. */
......@@ -132,7 +132,7 @@ ISR(TIMER0_COMPA_vect, ISR_BLOCK)
*
* \return Number of bytes written in the report (or zero if no report is to be sent
*/
uint16_t CALLBACK_USB_HID_CreateNextHIDReport(USB_ClassInfo_HID_t* HIDInterfaceInfo, uint8_t* ReportID, void* ReportData)
uint16_t CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_t* HIDInterfaceInfo, uint8_t* ReportID, void* ReportData)
{
USB_JoystickReport_Data_t* JoystickReport = (USB_JoystickReport_Data_t*)ReportData;
......@@ -164,8 +164,8 @@ uint16_t CALLBACK_USB_HID_CreateNextHIDReport(USB_ClassInfo_HID_t* HIDInterfaceI
* \param ReportData Pointer to a buffer where the created report has been stored
* \param ReportSize Size in bytes of the received HID report
*/
void CALLBACK_USB_HID_ProcessReceivedHIDReport(USB_ClassInfo_HID_t* HIDInterfaceInfo, uint8_t ReportID,
void* ReportData, uint16_t ReportSize)
void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_t* HIDInterfaceInfo, uint8_t ReportID,
void* ReportData, uint16_t ReportSize)
{
// Unused (but mandatory for the HID class driver) in this demo, since there are no Host->Device reports
}
......@@ -83,8 +83,8 @@
void EVENT_USB_ConfigurationChanged(void);
void EVENT_USB_UnhandledControlPacket(void);
uint16_t CALLBACK_USB_HID_CreateNextHIDReport(USB_ClassInfo_HID_t* HIDInterfaceInfo, uint8_t* ReportID, void* ReportData);
void CALLBACK_USB_HID_ProcessReceivedHIDReport(USB_ClassInfo_HID_t* HIDInterfaceInfo, uint8_t ReportID,
void* ReportData, uint16_t ReportSize);
uint16_t CALLBACK_HID_Device_CreateNextHIDReport(USB_ClassInfo_HID_t* HIDInterfaceInfo, uint8_t* ReportID, void* ReportData);
void CALLBACK_HID_Device_ProcessReceivedHIDReport(USB_ClassInfo_HID_t* HIDInterfaceInfo, uint8_t ReportID,
void* ReportData, uint16_t ReportSize);
#endif
......@@ -64,7 +64,7 @@ int main(void)
for (;;)
{
USB_HID_USBTask(&Keyboard_HID_Interface);
HID_Device_USBTask(&Keyboard_HID_Interface);
USB_USBTask();
}
}
......@@ -109,14 +109,14 @@ void EVENT_USB_ConfigurationChanged(void)
{
LEDs_SetAllLEDs(LEDMASK_USB_READY);
if (!(USB_HID_ConfigureEndpoints(&Keyboard_HID_Interface)))
if (!(HID_Device_ConfigureEndpoints(&Keyboard_HID_Interface)))
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
}
/** Event handler for the library USB Unhandled Control Packet event. */
void EVENT_USB_UnhandledControlPacket(void)
{
USB_HID_ProcessControlPacket(&Keyboard_HID_Interface);
HID_Device_ProcessControlPacket(&Keyboard_HID_Interface);
}
/** ISR to keep track of each millisecond interrupt, for determining the HID class idle period remaining when set. */
......@@ -133,7 +133,7 @@ ISR(TIMER0_COMPA_vect, ISR_BLOCK)
*
* \return Number of bytes written in the report (or zero if no report is to be sent
*/
uint16_t CALLBACK_USB_HID_CreateNextHIDReport(USB_ClassInfo_HID_t* HIDInterfaceInfo, uint8_t* ReportID, void* ReportData)
uint16_t CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_t* HIDInterfaceInfo, uint8_t* ReportID, void* ReportData)
{
USB_KeyboardReport_Data_t* KeyboardReport = (USB_KeyboardReport_Data_t*)ReportData;
......@@ -165,8 +165,8 @@ uint16_t CALLBACK_USB_HID_CreateNextHIDReport(USB_ClassInfo_HID_t* HIDInterfaceI
* \param ReportData Pointer to a buffer where the created report has been stored
* \param ReportSize Size in bytes of the received HID report
*/
void CALLBACK_USB_HID_ProcessReceivedHIDReport(USB_ClassInfo_HID_t* HIDInterfaceInfo, uint8_t ReportID,
void* ReportData, uint16_t ReportSize)
void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_t* HIDInterfaceInfo, uint8_t ReportID,
void* ReportData, uint16_t ReportSize)
{
uint8_t LEDMask = LEDS_NO_LEDS;
uint8_t* LEDReport = (uint8_t*)ReportData;
......
......@@ -86,8 +86,8 @@
void EVENT_USB_ConfigurationChanged(void);
void EVENT_USB_UnhandledControlPacket(void);
uint16_t CALLBACK_USB_HID_CreateNextHIDReport(USB_ClassInfo_HID_t* HIDInterfaceInfo, uint8_t* ReportID, void* ReportData);
void CALLBACK_USB_HID_ProcessReceivedHIDReport(USB_ClassInfo_HID_t* HIDInterfaceInfo, uint8_t ReportID,
void* ReportData, uint16_t ReportSize);
uint16_t CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_t* HIDInterfaceInfo, uint8_t* ReportID, void* ReportData);
void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_t* HIDInterfaceInfo, uint8_t ReportID,
void* ReportData, uint16_t ReportSize);
#endif
......@@ -80,8 +80,8 @@ int main(void)
for (;;)
{
USB_HID_USBTask(&Keyboard_HID_Interface);
USB_HID_USBTask(&Mouse_HID_Interface);
HID_Device_USBTask(&Keyboard_HID_Interface);
HID_Device_USBTask(&Mouse_HID_Interface);
USB_USBTask();
}
}
......@@ -125,18 +125,18 @@ void EVENT_USB_ConfigurationChanged(void)
{
LEDs_SetAllLEDs(LEDMASK_USB_READY);
if (!(USB_HID_ConfigureEndpoints(&Keyboard_HID_Interface)))
if (!(HID_Device_ConfigureEndpoints(&Keyboard_HID_Interface)))
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
if (!(USB_HID_ConfigureEndpoints(&Mouse_HID_Interface)))
if (!(HID_Device_ConfigureEndpoints(&Mouse_HID_Interface)))
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
}
/** Event handler for the library USB Unhandled Control Packet event. */
void EVENT_USB_UnhandledControlPacket(void)
{
USB_HID_ProcessControlPacket(&Keyboard_HID_Interface);
USB_HID_ProcessControlPacket(&Mouse_HID_Interface);
HID_Device_ProcessControlPacket(&Keyboard_HID_Interface);
HID_Device_ProcessControlPacket(&Mouse_HID_Interface);
}
/** ISR to keep track of each millisecond interrupt, for determining the HID class idle period remaining when set. */
......@@ -156,7 +156,7 @@ ISR(TIMER0_COMPA_vect, ISR_BLOCK)
*
* \return Number of bytes written in the report (or zero if no report is to be sent
*/
uint16_t CALLBACK_USB_HID_CreateNextHIDReport(USB_ClassInfo_HID_t* HIDInterfaceInfo, uint8_t* ReportID, void* ReportData)
uint16_t CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_t* HIDInterfaceInfo, uint8_t* ReportID, void* ReportData)
{
uint8_t JoyStatus_LCL = Joystick_GetStatus();
uint8_t ButtonStatus_LCL = Buttons_GetStatus();
......@@ -215,8 +215,8 @@ uint16_t CALLBACK_USB_HID_CreateNextHIDReport(USB_ClassInfo_HID_t* HIDInterfaceI
* \param ReportData Pointer to a buffer where the created report has been stored
* \param ReportSize Size in bytes of the received HID report
*/
void CALLBACK_USB_HID_ProcessReceivedHIDReport(USB_ClassInfo_HID_t* HIDInterfaceInfo, uint8_t ReportID,
void* ReportData, uint16_t ReportSize)
void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_t* HIDInterfaceInfo, uint8_t ReportID,
void* ReportData, uint16_t ReportSize)
{
if (HIDInterfaceInfo == &Keyboard_HID_Interface)
{
......
......@@ -90,8 +90,8 @@
void EVENT_USB_ConfigurationChanged(void);
void EVENT_USB_UnhandledControlPacket(void);
uint16_t CALLBACK_USB_HID_CreateNextHIDReport(USB_ClassInfo_HID_t* HIDInterfaceInfo, uint8_t* ReportID, void* ReportData);
void CALLBACK_USB_HID_ProcessReceivedHIDReport(USB_ClassInfo_HID_t* HIDInterfaceInfo, uint8_t ReportID,
void* ReportData, uint16_t ReportSize);
uint16_t CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_t* HIDInterfaceInfo, uint8_t* ReportID, void* ReportData);
void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_t* HIDInterfaceInfo, uint8_t ReportID,
void* ReportData, uint16_t ReportSize);
#endif
......@@ -65,9 +65,9 @@ int main(void)
CheckJoystickMovement();
USB_MIDI_EventPacket_t DummyMIDIEvent;
USB_MIDI_ReceiveEventPacket(&Keyboard_MIDI_Interface, &DummyMIDIEvent);
MIDI_Device_ReceiveEventPacket(&Keyboard_MIDI_Interface, &DummyMIDIEvent);
USB_MIDI_USBTask(&Keyboard_MIDI_Interface);
MIDI_Device_USBTask(&Keyboard_MIDI_Interface);
USB_USBTask();
}
}
......@@ -146,7 +146,7 @@ void CheckJoystickMovement(void)
.Data3 = MIDI_STANDARD_VELOCITY,
};
USB_MIDI_SendEventPacket(&Keyboard_MIDI_Interface, &MIDIEvent);
MIDI_Device_SendEventPacket(&Keyboard_MIDI_Interface, &MIDIEvent);
}
PrevJoystickStatus = JoystickStatus;
......@@ -169,12 +169,12 @@ void EVENT_USB_ConfigurationChanged(void)
{
LEDs_SetAllLEDs(LEDMASK_USB_READY);
if (!(USB_MIDI_ConfigureEndpoints(&Keyboard_MIDI_Interface)))
if (!(MIDI_Device_ConfigureEndpoints(&Keyboard_MIDI_Interface)))
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
}
/** Event handler for the library USB Unhandled Control Packet event. */
void EVENT_USB_UnhandledControlPacket(void)
{
USB_MIDI_ProcessControlPacket(&Keyboard_MIDI_Interface);
MIDI_Device_ProcessControlPacket(&Keyboard_MIDI_Interface);
}
......@@ -64,7 +64,7 @@ int main(void)
for (;;)
{
USB_MS_USBTask(&Disk_MS_Interface);
MS_Device_USBTask(&Disk_MS_Interface);
USB_USBTask();
}
}
......@@ -105,21 +105,21 @@ void EVENT_USB_ConfigurationChanged(void)
{
LEDs_SetAllLEDs(LEDMASK_USB_READY);
if (!(USB_MS_ConfigureEndpoints(&Disk_MS_Interface)))
if (!(MS_Device_ConfigureEndpoints(&Disk_MS_Interface)))
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
}
/** Event handler for the library USB Unhandled Control Packet event. */
void EVENT_USB_UnhandledControlPacket(void)
{
USB_MS_ProcessControlPacket(&Disk_MS_Interface);
MS_Device_ProcessControlPacket(&Disk_MS_Interface);
}
/** Mass Storage class driver callback function the reception of SCSI commands from the host, which must be processed.
*
* \param MSInterfaceInfo Pointer to the Mass Storage class interface configuration structure being referenced
*/
bool CALLBACK_USB_MS_SCSICommandReceived(USB_ClassInfo_MS_t* MSInterfaceInfo)
bool CALLBACK_MS_Device_SCSICommandReceived(USB_ClassInfo_MS_t* MSInterfaceInfo)
{
bool CommandSuccess;
......
......@@ -83,6 +83,6 @@
void EVENT_USB_ConfigurationChanged(void);
void EVENT_USB_UnhandledControlPacket(void);
bool CALLBACK_USB_MS_SCSICommandReceived(USB_ClassInfo_MS_t* MSInterfaceInfo);
bool CALLBACK_MS_Device_SCSICommandReceived(USB_ClassInfo_MS_t* MSInterfaceInfo);
#endif
......@@ -61,7 +61,7 @@ int main(void)
for (;;)
{
USB_HID_USBTask(&Mouse_HID_Interface);
HID_Device_USBTask(&Mouse_HID_Interface);
USB_USBTask();
}
}
......@@ -106,14 +106,14 @@ void EVENT_USB_ConfigurationChanged(void)
{
LEDs_SetAllLEDs(LEDMASK_USB_READY);
if (!(USB_HID_ConfigureEndpoints(&Mouse_HID_Interface)))
if (!(HID_Device_ConfigureEndpoints(&Mouse_HID_Interface)))
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
}
/** Event handler for the library USB Unhandled Control Packet event. */
void EVENT_USB_UnhandledControlPacket(void)
{
USB_HID_ProcessControlPacket(&Mouse_HID_Interface);
HID_Device_ProcessControlPacket(&Mouse_HID_Interface);
}
/** ISR to keep track of each millisecond interrupt, for determining the HID class idle period remaining when set. */
......@@ -130,7 +130,7 @@ ISR(TIMER0_COMPA_vect, ISR_BLOCK)
*
* \return Number of bytes written in the report (or zero if no report is to be sent
*/
uint16_t CALLBACK_USB_HID_CreateNextHIDReport(USB_ClassInfo_HID_t* HIDInterfaceInfo, uint8_t* ReportID, void* ReportData)
uint16_t CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_t* HIDInterfaceInfo, uint8_t* ReportID, void* ReportData)
{
USB_MouseReport_Data_t* MouseReport = (USB_MouseReport_Data_t*)ReportData;
......@@ -162,8 +162,8 @@ uint16_t CALLBACK_USB_HID_CreateNextHIDReport(USB_ClassInfo_HID_t* HIDInterfaceI
* \param ReportData Pointer to a buffer where the created report has been stored
* \param ReportSize Size in bytes of the received HID report
*/
void CALLBACK_USB_HID_ProcessReceivedHIDReport(USB_ClassInfo_HID_t* HIDInterfaceInfo, uint8_t ReportID,
void* ReportData, uint16_t ReportSize)
void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_t* HIDInterfaceInfo, uint8_t ReportID,
void* ReportData, uint16_t ReportSize)
{
// Unused (but mandatory for the HID class driver) in this demo, since there are no Host->Device reports
}
......@@ -85,8 +85,8 @@
void EVENT_USB_ConfigurationChanged(void);
void EVENT_USB_UnhandledControlPacket(void);
uint16_t CALLBACK_USB_HID_CreateNextHIDReport(USB_ClassInfo_HID_t* HIDInterfaceInfo, uint8_t* ReportID, void* ReportData);
void CALLBACK_USB_HID_ProcessReceivedHIDReport(USB_ClassInfo_HID_t* HIDInterfaceInfo, uint8_t ReportID,
void* ReportData, uint16_t ReportSize);
uint16_t CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_t* HIDInterfaceInfo, uint8_t* ReportID, void* ReportData);
void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_t* HIDInterfaceInfo, uint8_t ReportID,
void* ReportData, uint16_t ReportSize);
#endif
......@@ -82,7 +82,7 @@ int main(void)
TCP_TCPTask(&Ethernet_RNDIS_Interface);
USB_RNDIS_USBTask(&Ethernet_RNDIS_Interface);
RNDIS_Device_USBTask(&Ethernet_RNDIS_Interface);
USB_USBTask();
}
}
......@@ -120,12 +120,12 @@ void EVENT_USB_ConfigurationChanged(void)
{
LEDs_SetAllLEDs(LEDMASK_USB_READY);
if (!(USB_RNDIS_ConfigureEndpoints(&Ethernet_RNDIS_Interface)))
if (!(RNDIS_Device_ConfigureEndpoints(&Ethernet_RNDIS_Interface)))
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
}
/** Event handler for the library USB Unhandled Control Packet event. */
void EVENT_USB_UnhandledControlPacket(void)
{
USB_RNDIS_ProcessControlPacket(&Ethernet_RNDIS_Interface);
RNDIS_Device_ProcessControlPacket(&Ethernet_RNDIS_Interface);
}
......@@ -80,7 +80,5 @@
void EVENT_USB_Disconnect(void);
void EVENT_USB_ConfigurationChanged(void);
void EVENT_USB_UnhandledControlPacket(void);
void CALLBACK_USB_RNDIS_ProcessRNDISControlMessage(USB_ClassInfo_RNDIS_t* RNDISInterfaceInfo);
#endif
......@@ -74,21 +74,24 @@ int main(void)
for (;;)
{
for (uint8_t DataBytesRem = USB_CDC_BytesReceived(&VirtualSerial_CDC_Interface); DataBytesRem != 0; DataBytesRem--)
/* Read bytes from the USB OUT endpoint into the USART transmit buffer */
for (uint8_t DataBytesRem = CDC_Device_BytesReceived(&VirtualSerial_CDC_Interface); DataBytesRem != 0; DataBytesRem--)
{
if (!(BUFF_STATICSIZE - Rx_Buffer.Elements))
break;
Buffer_StoreElement(&Rx_Buffer, USB_CDC_ReceiveByte(&VirtualSerial_CDC_Interface));
Buffer_StoreElement(&Rx_Buffer, CDC_Device_ReceiveByte(&VirtualSerial_CDC_Interface));
}