From 9798440ca4f694e7cd8312a51b82e59589f1ebeb Mon Sep 17 00:00:00 2001 From: Dean Camera Date: Thu, 11 Jun 2009 06:15:45 +0000 Subject: Changed to new device mode Class Driver function name prefixes to make way for similar host mode Class drivers. --- Demos/Device/ClassDriver/AudioInput/AudioInput.c | 10 +++++----- Demos/Device/ClassDriver/AudioOutput/AudioOutput.c | 12 ++++++------ Demos/Device/ClassDriver/CDC/CDC.c | 12 ++++++------ Demos/Device/ClassDriver/DualCDC/DualCDC.c | 22 +++++++++++----------- Demos/Device/ClassDriver/GenericHID/GenericHID.c | 12 ++++++------ Demos/Device/ClassDriver/GenericHID/GenericHID.h | 6 +++--- Demos/Device/ClassDriver/Joystick/Joystick.c | 12 ++++++------ Demos/Device/ClassDriver/Joystick/Joystick.h | 6 +++--- Demos/Device/ClassDriver/Keyboard/Keyboard.c | 12 ++++++------ Demos/Device/ClassDriver/Keyboard/Keyboard.h | 6 +++--- .../ClassDriver/KeyboardMouse/KeyboardMouse.c | 18 +++++++++--------- .../ClassDriver/KeyboardMouse/KeyboardMouse.h | 6 +++--- Demos/Device/ClassDriver/MIDI/MIDI.c | 10 +++++----- Demos/Device/ClassDriver/MassStorage/MassStorage.c | 8 ++++---- Demos/Device/ClassDriver/MassStorage/MassStorage.h | 2 +- Demos/Device/ClassDriver/Mouse/Mouse.c | 12 ++++++------ Demos/Device/ClassDriver/Mouse/Mouse.h | 6 +++--- .../ClassDriver/RNDISEthernet/RNDISEthernet.c | 6 +++--- .../ClassDriver/RNDISEthernet/RNDISEthernet.h | 2 -- Demos/Device/ClassDriver/USBtoSerial/USBtoSerial.c | 19 +++++++++++-------- Demos/Device/ClassDriver/USBtoSerial/USBtoSerial.h | 2 +- 21 files changed, 101 insertions(+), 100 deletions(-) (limited to 'Demos/Device') diff --git a/Demos/Device/ClassDriver/AudioInput/AudioInput.c b/Demos/Device/ClassDriver/AudioInput/AudioInput.c index 93ffe0bf4..a361ea1a4 100644 --- a/Demos/Device/ClassDriver/AudioInput/AudioInput.c +++ b/Demos/Device/ClassDriver/AudioInput/AudioInput.c @@ -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); } diff --git a/Demos/Device/ClassDriver/AudioOutput/AudioOutput.c b/Demos/Device/ClassDriver/AudioOutput/AudioOutput.c index 4497963de..67e08f2c3 100644 --- a/Demos/Device/ClassDriver/AudioOutput/AudioOutput.c +++ b/Demos/Device/ClassDriver/AudioOutput/AudioOutput.c @@ -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); } diff --git a/Demos/Device/ClassDriver/CDC/CDC.c b/Demos/Device/ClassDriver/CDC/CDC.c index 6f1539334..86d5c36c1 100644 --- a/Demos/Device/ClassDriver/CDC/CDC.c +++ b/Demos/Device/ClassDriver/CDC/CDC.c @@ -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); } diff --git a/Demos/Device/ClassDriver/DualCDC/DualCDC.c b/Demos/Device/ClassDriver/DualCDC/DualCDC.c index 216902c67..ca33f10ac 100644 --- a/Demos/Device/ClassDriver/DualCDC/DualCDC.c +++ b/Demos/Device/ClassDriver/DualCDC/DualCDC.c @@ -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); } diff --git a/Demos/Device/ClassDriver/GenericHID/GenericHID.c b/Demos/Device/ClassDriver/GenericHID/GenericHID.c index 172df7fa7..6bf761366 100644 --- a/Demos/Device/ClassDriver/GenericHID/GenericHID.c +++ b/Demos/Device/ClassDriver/GenericHID/GenericHID.c @@ -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 } diff --git a/Demos/Device/ClassDriver/GenericHID/GenericHID.h b/Demos/Device/ClassDriver/GenericHID/GenericHID.h index 5ea084c7e..cfb9df88b 100644 --- a/Demos/Device/ClassDriver/GenericHID/GenericHID.h +++ b/Demos/Device/ClassDriver/GenericHID/GenericHID.h @@ -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 diff --git a/Demos/Device/ClassDriver/Joystick/Joystick.c b/Demos/Device/ClassDriver/Joystick/Joystick.c index 1cf59bbfd..47d6930d0 100644 --- a/Demos/Device/ClassDriver/Joystick/Joystick.c +++ b/Demos/Device/ClassDriver/Joystick/Joystick.c @@ -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 } diff --git a/Demos/Device/ClassDriver/Joystick/Joystick.h b/Demos/Device/ClassDriver/Joystick/Joystick.h index 4209f4d7e..16c6abb6c 100644 --- a/Demos/Device/ClassDriver/Joystick/Joystick.h +++ b/Demos/Device/ClassDriver/Joystick/Joystick.h @@ -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 diff --git a/Demos/Device/ClassDriver/Keyboard/Keyboard.c b/Demos/Device/ClassDriver/Keyboard/Keyboard.c index fbfcf2fd9..6fe36db1f 100644 --- a/Demos/Device/ClassDriver/Keyboard/Keyboard.c +++ b/Demos/Device/ClassDriver/Keyboard/Keyboard.c @@ -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; diff --git a/Demos/Device/ClassDriver/Keyboard/Keyboard.h b/Demos/Device/ClassDriver/Keyboard/Keyboard.h index 1b4bb7092..c24adfbc0 100644 --- a/Demos/Device/ClassDriver/Keyboard/Keyboard.h +++ b/Demos/Device/ClassDriver/Keyboard/Keyboard.h @@ -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 diff --git a/Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.c b/Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.c index 5cea55580..859845db8 100644 --- a/Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.c +++ b/Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.c @@ -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) { diff --git a/Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.h b/Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.h index 74b1c9e5f..ae69d3d3f 100644 --- a/Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.h +++ b/Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.h @@ -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 diff --git a/Demos/Device/ClassDriver/MIDI/MIDI.c b/Demos/Device/ClassDriver/MIDI/MIDI.c index bb4eaf2df..234adca25 100644 --- a/Demos/Device/ClassDriver/MIDI/MIDI.c +++ b/Demos/Device/ClassDriver/MIDI/MIDI.c @@ -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); } diff --git a/Demos/Device/ClassDriver/MassStorage/MassStorage.c b/Demos/Device/ClassDriver/MassStorage/MassStorage.c index 5dbc4a2cc..66bba8f50 100644 --- a/Demos/Device/ClassDriver/MassStorage/MassStorage.c +++ b/Demos/Device/ClassDriver/MassStorage/MassStorage.c @@ -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; diff --git a/Demos/Device/ClassDriver/MassStorage/MassStorage.h b/Demos/Device/ClassDriver/MassStorage/MassStorage.h index 50a77250d..afc67dfd7 100644 --- a/Demos/Device/ClassDriver/MassStorage/MassStorage.h +++ b/Demos/Device/ClassDriver/MassStorage/MassStorage.h @@ -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 diff --git a/Demos/Device/ClassDriver/Mouse/Mouse.c b/Demos/Device/ClassDriver/Mouse/Mouse.c index 2ae277865..4eeb732ff 100644 --- a/Demos/Device/ClassDriver/Mouse/Mouse.c +++ b/Demos/Device/ClassDriver/Mouse/Mouse.c @@ -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 } diff --git a/Demos/Device/ClassDriver/Mouse/Mouse.h b/Demos/Device/ClassDriver/Mouse/Mouse.h index 6de20ee79..a64370058 100644 --- a/Demos/Device/ClassDriver/Mouse/Mouse.h +++ b/Demos/Device/ClassDriver/Mouse/Mouse.h @@ -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 diff --git a/Demos/Device/ClassDriver/RNDISEthernet/RNDISEthernet.c b/Demos/Device/ClassDriver/RNDISEthernet/RNDISEthernet.c index 8c55dff3b..3c9fddfd4 100644 --- a/Demos/Device/ClassDriver/RNDISEthernet/RNDISEthernet.c +++ b/Demos/Device/ClassDriver/RNDISEthernet/RNDISEthernet.c @@ -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); } diff --git a/Demos/Device/ClassDriver/RNDISEthernet/RNDISEthernet.h b/Demos/Device/ClassDriver/RNDISEthernet/RNDISEthernet.h index f0ba75a3d..6db021d91 100644 --- a/Demos/Device/ClassDriver/RNDISEthernet/RNDISEthernet.h +++ b/Demos/Device/ClassDriver/RNDISEthernet/RNDISEthernet.h @@ -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 diff --git a/Demos/Device/ClassDriver/USBtoSerial/USBtoSerial.c b/Demos/Device/ClassDriver/USBtoSerial/USBtoSerial.c index 85826c2b3..dbe21c21c 100644 --- a/Demos/Device/ClassDriver/USBtoSerial/USBtoSerial.c +++ b/Demos/Device/ClassDriver/USBtoSerial/USBtoSerial.c @@ -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)); } + /* Read bytes from the USART receive buffer into the USB IN endpoint */ if (Tx_Buffer.Elements) - USB_CDC_SendByte(&VirtualSerial_CDC_Interface, Buffer_GetElement(&Rx_Buffer)); - + CDC_Device_SendByte(&VirtualSerial_CDC_Interface, Buffer_GetElement(&Tx_Buffer)); + + /* Read bytes from the USART transmit buffer into the USART */ if (Rx_Buffer.Elements) Serial_TxByte(Buffer_GetElement(&Rx_Buffer)); - USB_CDC_USBTask(&VirtualSerial_CDC_Interface); + CDC_Device_USBTask(&VirtualSerial_CDC_Interface); USB_USBTask(); } } @@ -126,14 +129,14 @@ 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); } /** ISR to manage the reception of data from the serial port, placing received bytes into a circular buffer @@ -149,7 +152,7 @@ ISR(USART1_RX_vect, ISR_BLOCK) * * \param CDCInterfaceInfo Pointer to the CDC class interface configuration structure being referenced */ -void EVENT_USB_CDC_LineEncodingChanged(USB_ClassInfo_CDC_t* CDCInterfaceInfo) +void EVENT_CDC_Device_LineEncodingChanged(USB_ClassInfo_CDC_t* CDCInterfaceInfo) { uint8_t ConfigMask = 0; diff --git a/Demos/Device/ClassDriver/USBtoSerial/USBtoSerial.h b/Demos/Device/ClassDriver/USBtoSerial/USBtoSerial.h index 9660381bb..d46358255 100644 --- a/Demos/Device/ClassDriver/USBtoSerial/USBtoSerial.h +++ b/Demos/Device/ClassDriver/USBtoSerial/USBtoSerial.h @@ -74,6 +74,6 @@ void EVENT_USB_ConfigurationChanged(void); void EVENT_USB_UnhandledControlPacket(void); - void EVENT_USB_CDC_LineEncodingChanged(USB_ClassInfo_CDC_t* CDCInterfaceInfo); + void EVENT_CDC_Device_LineEncodingChanged(USB_ClassInfo_CDC_t* CDCInterfaceInfo); #endif -- cgit v1.2.3