aboutsummaryrefslogtreecommitdiffstats
path: root/Demos/Device
diff options
context:
space:
mode:
Diffstat (limited to 'Demos/Device')
-rw-r--r--Demos/Device/ClassDriver/AudioInput/AudioInput.h1
-rw-r--r--Demos/Device/ClassDriver/AudioInput/Descriptors.h1
-rw-r--r--Demos/Device/ClassDriver/AudioOutput/AudioOutput.h1
-rw-r--r--Demos/Device/ClassDriver/AudioOutput/Descriptors.h2
-rw-r--r--Demos/Device/ClassDriver/DualVirtualSerial/Descriptors.h2
-rw-r--r--Demos/Device/ClassDriver/DualVirtualSerial/DualVirtualSerial.h1
-rw-r--r--Demos/Device/ClassDriver/GenericHID/Descriptors.h1
-rw-r--r--Demos/Device/ClassDriver/GenericHID/GenericHID.h1
-rw-r--r--Demos/Device/ClassDriver/Joystick/Descriptors.h1
-rw-r--r--Demos/Device/ClassDriver/Joystick/Joystick.h1
-rw-r--r--Demos/Device/ClassDriver/Keyboard/Descriptors.h1
-rw-r--r--Demos/Device/ClassDriver/Keyboard/Keyboard.h1
-rw-r--r--Demos/Device/ClassDriver/KeyboardMouse/Descriptors.h1
-rw-r--r--Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.h1
-rw-r--r--Demos/Device/ClassDriver/MIDI/Descriptors.h1
-rw-r--r--Demos/Device/ClassDriver/MIDI/MIDI.h1
-rw-r--r--Demos/Device/ClassDriver/MassStorage/Descriptors.h1
-rw-r--r--Demos/Device/ClassDriver/MassStorage/Lib/DataflashManager.h1
-rw-r--r--Demos/Device/ClassDriver/MassStorage/Lib/SCSI.h1
-rw-r--r--Demos/Device/ClassDriver/MassStorage/MassStorage.h1
-rw-r--r--Demos/Device/ClassDriver/MassStorageKeyboard/Descriptors.h2
-rw-r--r--Demos/Device/ClassDriver/MassStorageKeyboard/Lib/SCSI.h1
-rw-r--r--Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.h2
-rw-r--r--Demos/Device/ClassDriver/Mouse/Descriptors.h1
-rw-r--r--Demos/Device/ClassDriver/Mouse/Mouse.h1
-rw-r--r--Demos/Device/ClassDriver/RNDISEthernet/Descriptors.h1
-rw-r--r--Demos/Device/ClassDriver/RNDISEthernet/Lib/ProtocolDecoders.h1
-rw-r--r--Demos/Device/ClassDriver/RNDISEthernet/RNDISEthernet.h1
-rw-r--r--Demos/Device/ClassDriver/VirtualSerial/Descriptors.h1
-rw-r--r--Demos/Device/ClassDriver/VirtualSerial/VirtualSerial.h1
-rw-r--r--Demos/Device/ClassDriver/VirtualSerialMouse/Descriptors.h2
-rw-r--r--Demos/Device/ClassDriver/VirtualSerialMouse/VirtualSerialMouse.h2
-rw-r--r--Demos/Device/LowLevel/AudioInput/AudioInput.c2
-rw-r--r--Demos/Device/LowLevel/AudioInput/Descriptors.c45
-rw-r--r--Demos/Device/LowLevel/AudioInput/Descriptors.h253
-rw-r--r--Demos/Device/LowLevel/AudioOutput/Descriptors.c47
-rw-r--r--Demos/Device/LowLevel/AudioOutput/Descriptors.h254
-rw-r--r--Demos/Device/LowLevel/DualVirtualSerial/Descriptors.c24
-rw-r--r--Demos/Device/LowLevel/DualVirtualSerial/Descriptors.h61
-rw-r--r--Demos/Device/LowLevel/DualVirtualSerial/DualVirtualSerial.c26
-rw-r--r--Demos/Device/LowLevel/DualVirtualSerial/DualVirtualSerial.h44
-rw-r--r--Demos/Device/LowLevel/GenericHID/Descriptors.c10
-rw-r--r--Demos/Device/LowLevel/GenericHID/Descriptors.h27
-rw-r--r--Demos/Device/LowLevel/GenericHID/GenericHID.c4
-rw-r--r--Demos/Device/LowLevel/GenericHID/GenericHID.h6
-rw-r--r--Demos/Device/LowLevel/Joystick/Descriptors.c6
-rw-r--r--Demos/Device/LowLevel/Joystick/Descriptors.h21
-rw-r--r--Demos/Device/LowLevel/Joystick/Joystick.c2
-rw-r--r--Demos/Device/LowLevel/Joystick/Joystick.h3
-rw-r--r--Demos/Device/LowLevel/Keyboard/Descriptors.c10
-rw-r--r--Demos/Device/LowLevel/Keyboard/Descriptors.h27
-rw-r--r--Demos/Device/LowLevel/Keyboard/Keyboard.c22
-rw-r--r--Demos/Device/LowLevel/Keyboard/Keyboard.h68
-rw-r--r--Demos/Device/LowLevel/KeyboardMouse/Descriptors.c16
-rw-r--r--Demos/Device/LowLevel/KeyboardMouse/Descriptors.h29
-rw-r--r--Demos/Device/LowLevel/KeyboardMouse/KeyboardMouse.c12
-rw-r--r--Demos/Device/LowLevel/KeyboardMouse/KeyboardMouse.h69
-rw-r--r--Demos/Device/LowLevel/MIDI/Descriptors.c50
-rw-r--r--Demos/Device/LowLevel/MIDI/Descriptors.h129
-rw-r--r--Demos/Device/LowLevel/MIDI/MIDI.c4
-rw-r--r--Demos/Device/LowLevel/MIDI/MIDI.h28
-rw-r--r--Demos/Device/LowLevel/MassStorage/Lib/SCSI.h5
-rw-r--r--Demos/Device/LowLevel/MassStorage/Lib/SCSI_Codes.h87
-rw-r--r--Demos/Device/LowLevel/MassStorage/MassStorage.c26
-rw-r--r--Demos/Device/LowLevel/MassStorage/MassStorage.h58
-rw-r--r--Demos/Device/LowLevel/Mouse/Descriptors.c10
-rw-r--r--Demos/Device/LowLevel/Mouse/Descriptors.h27
-rw-r--r--Demos/Device/LowLevel/Mouse/Mouse.c14
-rw-r--r--Demos/Device/LowLevel/Mouse/Mouse.h32
-rw-r--r--Demos/Device/LowLevel/RNDISEthernet/Descriptors.c12
-rw-r--r--Demos/Device/LowLevel/RNDISEthernet/Descriptors.h40
-rw-r--r--Demos/Device/LowLevel/RNDISEthernet/Lib/ARP.h2
-rw-r--r--Demos/Device/LowLevel/RNDISEthernet/Lib/Ethernet.h8
-rw-r--r--Demos/Device/LowLevel/RNDISEthernet/Lib/EthernetProtocols.h2
-rw-r--r--Demos/Device/LowLevel/RNDISEthernet/Lib/RNDIS.c2
-rw-r--r--Demos/Device/LowLevel/RNDISEthernet/Lib/RNDIS.h161
-rw-r--r--Demos/Device/LowLevel/RNDISEthernet/Lib/RNDISConstants.h113
-rw-r--r--Demos/Device/LowLevel/RNDISEthernet/RNDISEthernet.c8
-rw-r--r--Demos/Device/LowLevel/RNDISEthernet/RNDISEthernet.h13
-rw-r--r--Demos/Device/LowLevel/VirtualSerial/Descriptors.c12
-rw-r--r--Demos/Device/LowLevel/VirtualSerial/Descriptors.h40
-rw-r--r--Demos/Device/LowLevel/VirtualSerial/VirtualSerial.c41
-rw-r--r--Demos/Device/LowLevel/VirtualSerial/VirtualSerial.h109
83 files changed, 258 insertions, 1901 deletions
diff --git a/Demos/Device/ClassDriver/AudioInput/AudioInput.h b/Demos/Device/ClassDriver/AudioInput/AudioInput.h
index 741a091d0..a243333bf 100644
--- a/Demos/Device/ClassDriver/AudioInput/AudioInput.h
+++ b/Demos/Device/ClassDriver/AudioInput/AudioInput.h
@@ -47,7 +47,6 @@
#include <LUFA/Drivers/Board/Buttons.h>
#include <LUFA/Drivers/Peripheral/ADC.h>
#include <LUFA/Drivers/USB/USB.h>
- #include <LUFA/Drivers/USB/Class/Audio.h>
#include "Descriptors.h"
diff --git a/Demos/Device/ClassDriver/AudioInput/Descriptors.h b/Demos/Device/ClassDriver/AudioInput/Descriptors.h
index 5ca7afbf5..c3a437e98 100644
--- a/Demos/Device/ClassDriver/AudioInput/Descriptors.h
+++ b/Demos/Device/ClassDriver/AudioInput/Descriptors.h
@@ -38,7 +38,6 @@
/* Includes: */
#include <LUFA/Drivers/USB/USB.h>
- #include <LUFA/Drivers/USB/Class/Audio.h>
#include <avr/pgmspace.h>
diff --git a/Demos/Device/ClassDriver/AudioOutput/AudioOutput.h b/Demos/Device/ClassDriver/AudioOutput/AudioOutput.h
index 62498cb7f..c03a82050 100644
--- a/Demos/Device/ClassDriver/AudioOutput/AudioOutput.h
+++ b/Demos/Device/ClassDriver/AudioOutput/AudioOutput.h
@@ -48,7 +48,6 @@
#include <LUFA/Version.h>
#include <LUFA/Drivers/Board/LEDs.h>
#include <LUFA/Drivers/USB/USB.h>
- #include <LUFA/Drivers/USB/Class/Audio.h>
/* Macros: */
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
diff --git a/Demos/Device/ClassDriver/AudioOutput/Descriptors.h b/Demos/Device/ClassDriver/AudioOutput/Descriptors.h
index 5ca7afbf5..d5b11b377 100644
--- a/Demos/Device/ClassDriver/AudioOutput/Descriptors.h
+++ b/Demos/Device/ClassDriver/AudioOutput/Descriptors.h
@@ -38,7 +38,6 @@
/* Includes: */
#include <LUFA/Drivers/USB/USB.h>
- #include <LUFA/Drivers/USB/Class/Audio.h>
#include <avr/pgmspace.h>
@@ -82,4 +81,3 @@
ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
#endif
-
diff --git a/Demos/Device/ClassDriver/DualVirtualSerial/Descriptors.h b/Demos/Device/ClassDriver/DualVirtualSerial/Descriptors.h
index fba85e805..4749b60a4 100644
--- a/Demos/Device/ClassDriver/DualVirtualSerial/Descriptors.h
+++ b/Demos/Device/ClassDriver/DualVirtualSerial/Descriptors.h
@@ -40,7 +40,6 @@
#include <avr/pgmspace.h>
#include <LUFA/Drivers/USB/USB.h>
- #include <LUFA/Drivers/USB/Class/CDC.h>
/* Macros: */
/** Endpoint number of the first CDC interface's device-to-host notification IN endpoint. */
@@ -102,4 +101,3 @@
ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
#endif
-
diff --git a/Demos/Device/ClassDriver/DualVirtualSerial/DualVirtualSerial.h b/Demos/Device/ClassDriver/DualVirtualSerial/DualVirtualSerial.h
index eccb4d859..f2f43da02 100644
--- a/Demos/Device/ClassDriver/DualVirtualSerial/DualVirtualSerial.h
+++ b/Demos/Device/ClassDriver/DualVirtualSerial/DualVirtualSerial.h
@@ -49,7 +49,6 @@
#include <LUFA/Drivers/Board/LEDs.h>
#include <LUFA/Drivers/Board/Joystick.h>
#include <LUFA/Drivers/USB/USB.h>
- #include <LUFA/Drivers/USB/Class/CDC.h>
/* Macros: */
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
diff --git a/Demos/Device/ClassDriver/GenericHID/Descriptors.h b/Demos/Device/ClassDriver/GenericHID/Descriptors.h
index de427e626..2941bd403 100644
--- a/Demos/Device/ClassDriver/GenericHID/Descriptors.h
+++ b/Demos/Device/ClassDriver/GenericHID/Descriptors.h
@@ -40,7 +40,6 @@
#include <avr/pgmspace.h>
#include <LUFA/Drivers/USB/USB.h>
- #include <LUFA/Drivers/USB/Class/HID.h>
/* Type Defines: */
/** Type define for the device configuration descriptor structure. This must be defined in the
diff --git a/Demos/Device/ClassDriver/GenericHID/GenericHID.h b/Demos/Device/ClassDriver/GenericHID/GenericHID.h
index 28a2c440e..533c76bff 100644
--- a/Demos/Device/ClassDriver/GenericHID/GenericHID.h
+++ b/Demos/Device/ClassDriver/GenericHID/GenericHID.h
@@ -48,7 +48,6 @@
#include <LUFA/Version.h>
#include <LUFA/Drivers/Board/LEDs.h>
#include <LUFA/Drivers/USB/USB.h>
- #include <LUFA/Drivers/USB/Class/HID.h>
/* Macros: */
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
diff --git a/Demos/Device/ClassDriver/Joystick/Descriptors.h b/Demos/Device/ClassDriver/Joystick/Descriptors.h
index 878b0380c..b2b34b630 100644
--- a/Demos/Device/ClassDriver/Joystick/Descriptors.h
+++ b/Demos/Device/ClassDriver/Joystick/Descriptors.h
@@ -40,7 +40,6 @@
#include <avr/pgmspace.h>
#include <LUFA/Drivers/USB/USB.h>
- #include <LUFA/Drivers/USB/Class/HID.h>
/* Type Defines: */
/** Type define for the device configuration descriptor structure. This must be defined in the
diff --git a/Demos/Device/ClassDriver/Joystick/Joystick.h b/Demos/Device/ClassDriver/Joystick/Joystick.h
index 821400196..8826001cc 100644
--- a/Demos/Device/ClassDriver/Joystick/Joystick.h
+++ b/Demos/Device/ClassDriver/Joystick/Joystick.h
@@ -50,7 +50,6 @@
#include <LUFA/Drivers/Board/LEDs.h>
#include <LUFA/Drivers/Board/Buttons.h>
#include <LUFA/Drivers/USB/USB.h>
- #include <LUFA/Drivers/USB/Class/HID.h>
/* Type Defines: */
/** Type define for the joystick HID report structure, for creating and sending HID reports to the host PC.
diff --git a/Demos/Device/ClassDriver/Keyboard/Descriptors.h b/Demos/Device/ClassDriver/Keyboard/Descriptors.h
index d94beb718..5165700f4 100644
--- a/Demos/Device/ClassDriver/Keyboard/Descriptors.h
+++ b/Demos/Device/ClassDriver/Keyboard/Descriptors.h
@@ -40,7 +40,6 @@
#include <avr/pgmspace.h>
#include <LUFA/Drivers/USB/USB.h>
- #include <LUFA/Drivers/USB/Class/HID.h>
/* Type Defines: */
/** Type define for the device configuration descriptor structure. This must be defined in the
diff --git a/Demos/Device/ClassDriver/Keyboard/Keyboard.h b/Demos/Device/ClassDriver/Keyboard/Keyboard.h
index b2b29a379..3131945bd 100644
--- a/Demos/Device/ClassDriver/Keyboard/Keyboard.h
+++ b/Demos/Device/ClassDriver/Keyboard/Keyboard.h
@@ -51,7 +51,6 @@
#include <LUFA/Drivers/Board/LEDs.h>
#include <LUFA/Drivers/Board/Buttons.h>
#include <LUFA/Drivers/USB/USB.h>
- #include <LUFA/Drivers/USB/Class/HID.h>
/* Macros: */
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
diff --git a/Demos/Device/ClassDriver/KeyboardMouse/Descriptors.h b/Demos/Device/ClassDriver/KeyboardMouse/Descriptors.h
index 83636e0fa..5b6a60651 100644
--- a/Demos/Device/ClassDriver/KeyboardMouse/Descriptors.h
+++ b/Demos/Device/ClassDriver/KeyboardMouse/Descriptors.h
@@ -40,7 +40,6 @@
#include <avr/pgmspace.h>
#include <LUFA/Drivers/USB/USB.h>
- #include <LUFA/Drivers/USB/Class/HID.h>
/* Type Defines: */
/** Type define for the device configuration descriptor structure. This must be defined in the
diff --git a/Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.h b/Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.h
index 186602f63..5359eef2d 100644
--- a/Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.h
+++ b/Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.h
@@ -46,7 +46,6 @@
#include <LUFA/Drivers/Board/LEDs.h>
#include <LUFA/Drivers/Board/Buttons.h>
#include <LUFA/Drivers/USB/USB.h>
- #include <LUFA/Drivers/USB/Class/HID.h>
/* Macros: */
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
diff --git a/Demos/Device/ClassDriver/MIDI/Descriptors.h b/Demos/Device/ClassDriver/MIDI/Descriptors.h
index 06020c8f9..ca3219ada 100644
--- a/Demos/Device/ClassDriver/MIDI/Descriptors.h
+++ b/Demos/Device/ClassDriver/MIDI/Descriptors.h
@@ -38,7 +38,6 @@
/* Includes: */
#include <LUFA/Drivers/USB/USB.h>
- #include <LUFA/Drivers/USB/Class/MIDI.h>
#include <avr/pgmspace.h>
diff --git a/Demos/Device/ClassDriver/MIDI/MIDI.h b/Demos/Device/ClassDriver/MIDI/MIDI.h
index c97311654..e12ac678a 100644
--- a/Demos/Device/ClassDriver/MIDI/MIDI.h
+++ b/Demos/Device/ClassDriver/MIDI/MIDI.h
@@ -51,7 +51,6 @@
#include <LUFA/Drivers/Board/Joystick.h>
#include <LUFA/Drivers/Board/Buttons.h>
#include <LUFA/Drivers/USB/USB.h>
- #include <LUFA/Drivers/USB/Class/MIDI.h>
/* Macros: */
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
diff --git a/Demos/Device/ClassDriver/MassStorage/Descriptors.h b/Demos/Device/ClassDriver/MassStorage/Descriptors.h
index c816e2383..0327a4774 100644
--- a/Demos/Device/ClassDriver/MassStorage/Descriptors.h
+++ b/Demos/Device/ClassDriver/MassStorage/Descriptors.h
@@ -40,7 +40,6 @@
#include <avr/pgmspace.h>
#include <LUFA/Drivers/USB/USB.h>
- #include <LUFA/Drivers/USB/Class/MassStorage.h>
/* Macros: */
/** Endpoint number of the Mass Storage device-to-host data IN endpoint. */
diff --git a/Demos/Device/ClassDriver/MassStorage/Lib/DataflashManager.h b/Demos/Device/ClassDriver/MassStorage/Lib/DataflashManager.h
index d3949f23e..c07b46e69 100644
--- a/Demos/Device/ClassDriver/MassStorage/Lib/DataflashManager.h
+++ b/Demos/Device/ClassDriver/MassStorage/Lib/DataflashManager.h
@@ -44,7 +44,6 @@
#include <LUFA/Common/Common.h>
#include <LUFA/Drivers/USB/USB.h>
- #include <LUFA/Drivers/USB/Class/MassStorage.h>
#include <LUFA/Drivers/Board/Dataflash.h>
/* Preprocessor Checks: */
diff --git a/Demos/Device/ClassDriver/MassStorage/Lib/SCSI.h b/Demos/Device/ClassDriver/MassStorage/Lib/SCSI.h
index 6c7071dcd..787a039a0 100644
--- a/Demos/Device/ClassDriver/MassStorage/Lib/SCSI.h
+++ b/Demos/Device/ClassDriver/MassStorage/Lib/SCSI.h
@@ -41,7 +41,6 @@
#include <avr/pgmspace.h>
#include <LUFA/Drivers/USB/USB.h>
- #include <LUFA/Drivers/USB/Class/MassStorage.h>
#include "MassStorage.h"
#include "Descriptors.h"
diff --git a/Demos/Device/ClassDriver/MassStorage/MassStorage.h b/Demos/Device/ClassDriver/MassStorage/MassStorage.h
index 3e829e7b5..b76fee3ff 100644
--- a/Demos/Device/ClassDriver/MassStorage/MassStorage.h
+++ b/Demos/Device/ClassDriver/MassStorage/MassStorage.h
@@ -51,7 +51,6 @@
#include <LUFA/Version.h>
#include <LUFA/Drivers/Board/LEDs.h>
#include <LUFA/Drivers/USB/USB.h>
- #include <LUFA/Drivers/USB/Class/MassStorage.h>
/* Macros: */
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
diff --git a/Demos/Device/ClassDriver/MassStorageKeyboard/Descriptors.h b/Demos/Device/ClassDriver/MassStorageKeyboard/Descriptors.h
index dd861e6b8..6e668640b 100644
--- a/Demos/Device/ClassDriver/MassStorageKeyboard/Descriptors.h
+++ b/Demos/Device/ClassDriver/MassStorageKeyboard/Descriptors.h
@@ -41,8 +41,6 @@
#include <avr/pgmspace.h>
#include <LUFA/Drivers/USB/USB.h>
- #include <LUFA/Drivers/USB/Class/MassStorage.h>
- #include <LUFA/Drivers/USB/Class/HID.h>
/* Macros: */
/** Endpoint number of the Keyboard HID reporting IN endpoint. */
diff --git a/Demos/Device/ClassDriver/MassStorageKeyboard/Lib/SCSI.h b/Demos/Device/ClassDriver/MassStorageKeyboard/Lib/SCSI.h
index b2dd70feb..d7843b3bb 100644
--- a/Demos/Device/ClassDriver/MassStorageKeyboard/Lib/SCSI.h
+++ b/Demos/Device/ClassDriver/MassStorageKeyboard/Lib/SCSI.h
@@ -41,7 +41,6 @@
#include <avr/pgmspace.h>
#include <LUFA/Drivers/USB/USB.h>
- #include <LUFA/Drivers/USB/Class/MassStorage.h>
#include "MassStorageKeyboard.h"
#include "Descriptors.h"
diff --git a/Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.h b/Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.h
index 43e04d0b1..703035d5a 100644
--- a/Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.h
+++ b/Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.h
@@ -56,8 +56,6 @@
#include <LUFA/Drivers/Board/LEDs.h>
#include <LUFA/Drivers/Board/Buttons.h>
#include <LUFA/Drivers/USB/USB.h>
- #include <LUFA/Drivers/USB/Class/MassStorage.h>
- #include <LUFA/Drivers/USB/Class/Device/HID.h>
/* Macros: */
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
diff --git a/Demos/Device/ClassDriver/Mouse/Descriptors.h b/Demos/Device/ClassDriver/Mouse/Descriptors.h
index 243c88d35..6765223b5 100644
--- a/Demos/Device/ClassDriver/Mouse/Descriptors.h
+++ b/Demos/Device/ClassDriver/Mouse/Descriptors.h
@@ -38,7 +38,6 @@
/* Includes: */
#include <LUFA/Drivers/USB/USB.h>
- #include <LUFA/Drivers/USB/Class/HID.h>
#include <avr/pgmspace.h>
diff --git a/Demos/Device/ClassDriver/Mouse/Mouse.h b/Demos/Device/ClassDriver/Mouse/Mouse.h
index 602783718..6255c07c5 100644
--- a/Demos/Device/ClassDriver/Mouse/Mouse.h
+++ b/Demos/Device/ClassDriver/Mouse/Mouse.h
@@ -52,7 +52,6 @@
#include <LUFA/Drivers/Board/LEDs.h>
#include <LUFA/Drivers/Board/Buttons.h>
#include <LUFA/Drivers/USB/USB.h>
- #include <LUFA/Drivers/USB/Class/HID.h>
/* Macros: */
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
diff --git a/Demos/Device/ClassDriver/RNDISEthernet/Descriptors.h b/Demos/Device/ClassDriver/RNDISEthernet/Descriptors.h
index 7f67bc09b..4f7beb1ef 100644
--- a/Demos/Device/ClassDriver/RNDISEthernet/Descriptors.h
+++ b/Demos/Device/ClassDriver/RNDISEthernet/Descriptors.h
@@ -38,7 +38,6 @@
/* Includes: */
#include <LUFA/Drivers/USB/USB.h>
- #include <LUFA/Drivers/USB/Class/RNDIS.h>
#include <avr/pgmspace.h>
diff --git a/Demos/Device/ClassDriver/RNDISEthernet/Lib/ProtocolDecoders.h b/Demos/Device/ClassDriver/RNDISEthernet/Lib/ProtocolDecoders.h
index 572fdeb82..2bb7b33ce 100644
--- a/Demos/Device/ClassDriver/RNDISEthernet/Lib/ProtocolDecoders.h
+++ b/Demos/Device/ClassDriver/RNDISEthernet/Lib/ProtocolDecoders.h
@@ -41,7 +41,6 @@
#include <avr/pgmspace.h>
#include <stdio.h>
- #include <LUFA/Drivers/USB/Class/RNDIS.h>
#include <LUFA/Drivers/Peripheral/SerialStream.h>
#include "EthernetProtocols.h"
diff --git a/Demos/Device/ClassDriver/RNDISEthernet/RNDISEthernet.h b/Demos/Device/ClassDriver/RNDISEthernet/RNDISEthernet.h
index 2cbdb3104..ce2d55c71 100644
--- a/Demos/Device/ClassDriver/RNDISEthernet/RNDISEthernet.h
+++ b/Demos/Device/ClassDriver/RNDISEthernet/RNDISEthernet.h
@@ -54,7 +54,6 @@
#include <LUFA/Drivers/Board/LEDs.h>
#include <LUFA/Drivers/Peripheral/SerialStream.h>
#include <LUFA/Drivers/USB/USB.h>
- #include <LUFA/Drivers/USB/Class/RNDIS.h>
/* Macros: */
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
diff --git a/Demos/Device/ClassDriver/VirtualSerial/Descriptors.h b/Demos/Device/ClassDriver/VirtualSerial/Descriptors.h
index ddd9495ea..e9b55a3d0 100644
--- a/Demos/Device/ClassDriver/VirtualSerial/Descriptors.h
+++ b/Demos/Device/ClassDriver/VirtualSerial/Descriptors.h
@@ -40,7 +40,6 @@
#include <avr/pgmspace.h>
#include <LUFA/Drivers/USB/USB.h>
- #include <LUFA/Drivers/USB/Class/CDC.h>
/* Macros: */
/** Endpoint number of the CDC device-to-host notification IN endpoint. */
diff --git a/Demos/Device/ClassDriver/VirtualSerial/VirtualSerial.h b/Demos/Device/ClassDriver/VirtualSerial/VirtualSerial.h
index a16e4a7a1..bc82b02cd 100644
--- a/Demos/Device/ClassDriver/VirtualSerial/VirtualSerial.h
+++ b/Demos/Device/ClassDriver/VirtualSerial/VirtualSerial.h
@@ -50,7 +50,6 @@
#include <LUFA/Drivers/Board/LEDs.h>
#include <LUFA/Drivers/Board/Joystick.h>
#include <LUFA/Drivers/USB/USB.h>
- #include <LUFA/Drivers/USB/Class/CDC.h>
/* Macros: */
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
diff --git a/Demos/Device/ClassDriver/VirtualSerialMouse/Descriptors.h b/Demos/Device/ClassDriver/VirtualSerialMouse/Descriptors.h
index 85a5aed84..a9e6fb2f1 100644
--- a/Demos/Device/ClassDriver/VirtualSerialMouse/Descriptors.h
+++ b/Demos/Device/ClassDriver/VirtualSerialMouse/Descriptors.h
@@ -40,8 +40,6 @@
#include <avr/pgmspace.h>
#include <LUFA/Drivers/USB/USB.h>
- #include <LUFA/Drivers/USB/Class/CDC.h>
- #include <LUFA/Drivers/USB/Class/HID.h>
/* Macros: */
/** Endpoint number of the CDC device-to-host notification IN endpoint. */
diff --git a/Demos/Device/ClassDriver/VirtualSerialMouse/VirtualSerialMouse.h b/Demos/Device/ClassDriver/VirtualSerialMouse/VirtualSerialMouse.h
index 16c7891ae..f9d4fd521 100644
--- a/Demos/Device/ClassDriver/VirtualSerialMouse/VirtualSerialMouse.h
+++ b/Demos/Device/ClassDriver/VirtualSerialMouse/VirtualSerialMouse.h
@@ -50,8 +50,6 @@
#include <LUFA/Drivers/Board/Joystick.h>
#include <LUFA/Drivers/Board/Buttons.h>
#include <LUFA/Drivers/USB/USB.h>
- #include <LUFA/Drivers/USB/Class/CDC.h>
- #include <LUFA/Drivers/USB/Class/HID.h>
/* Macros: */
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
diff --git a/Demos/Device/LowLevel/AudioInput/AudioInput.c b/Demos/Device/LowLevel/AudioInput/AudioInput.c
index e681f3bd1..8e2d97471 100644
--- a/Demos/Device/LowLevel/AudioInput/AudioInput.c
+++ b/Demos/Device/LowLevel/AudioInput/AudioInput.c
@@ -185,7 +185,7 @@ void USB_Audio_Task(void)
/* Microphone is biased to half rail voltage, subtract the bias from the sample value */
AudioSample -= (SAMPLE_MAX_RANGE / 2);
#endif
- #end if
+ #endif
/* Write the sample to the buffer */
Endpoint_Write_Word_LE(AudioSample);
diff --git a/Demos/Device/LowLevel/AudioInput/Descriptors.c b/Demos/Device/LowLevel/AudioInput/Descriptors.c
index 432f0c909..85599fbc4 100644
--- a/Demos/Device/LowLevel/AudioInput/Descriptors.c
+++ b/Demos/Device/LowLevel/AudioInput/Descriptors.c
@@ -104,25 +104,25 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.Audio_ControlInterface_SPC =
{
- .Header = {.Size = sizeof(USB_Audio_Interface_AC_t), .Type = DTYPE_CSInterface},
- .Subtype = DSUBTYPE_AudioHeader,
+ .Header = {.Size = sizeof(USB_Audio_Descriptor_Interface_AC_t), .Type = DTYPE_CSInterface},
+ .Subtype = AUDIO_DSUBTYPE_CSInterface_Header,
.ACSpecification = VERSION_BCD(01.00),
- .TotalLength = (sizeof(USB_Audio_Interface_AC_t) +
- sizeof(USB_Audio_InputTerminal_t) +
- sizeof(USB_Audio_OutputTerminal_t)),
+ .TotalLength = (sizeof(USB_Audio_Descriptor_Interface_AC_t) +
+ sizeof(USB_Audio_Descriptor_InputTerminal_t) +
+ sizeof(USB_Audio_Descriptor_OutputTerminal_t)),
.InCollection = 1,
- .InterfaceNumbers = {1},
+ .InterfaceNumber = 1,
},
.Audio_InputTerminal =
{
- .Header = {.Size = sizeof(USB_Audio_InputTerminal_t), .Type = DTYPE_CSInterface},
- .Subtype = DSUBTYPE_InputTerminal,
+ .Header = {.Size = sizeof(USB_Audio_Descriptor_InputTerminal_t), .Type = DTYPE_CSInterface},
+ .Subtype = AUDIO_DSUBTYPE_CSInterface_InputTerminal,
.TerminalID = 0x01,
- .TerminalType = TERMINAL_IN_MIC,
+ .TerminalType = AUDIO_TERMINAL_IN_MIC,
.AssociatedOutputTerminal = 0x00,
.TotalChannels = 1,
@@ -134,11 +134,11 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.Audio_OutputTerminal =
{
- .Header = {.Size = sizeof(USB_Audio_OutputTerminal_t), .Type = DTYPE_CSInterface},
- .Subtype = DSUBTYPE_OutputTerminal,
+ .Header = {.Size = sizeof(USB_Audio_Descriptor_OutputTerminal_t), .Type = DTYPE_CSInterface},
+ .Subtype = AUDIO_DSUBTYPE_CSInterface_OutputTerminal,
.TerminalID = 0x02,
- .TerminalType = TERMINAL_STREAMING,
+ .TerminalType = AUDIO_TERMINAL_STREAMING,
.AssociatedInputTerminal = 0x00,
.SourceID = 0x01,
@@ -180,8 +180,8 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.Audio_StreamInterface_SPC =
{
- .Header = {.Size = sizeof(USB_Audio_Interface_AS_t), .Type = DTYPE_CSInterface},
- .Subtype = DSUBTYPE_General,
+ .Header = {.Size = sizeof(USB_Audio_Descriptor_Interface_AS_t), .Type = DTYPE_CSInterface},
+ .Subtype = AUDIO_DSUBTYPE_CSInterface_General,
.TerminalLink = 0x02,
@@ -191,25 +191,24 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.Audio_AudioFormat =
{
- .Header = {.Size = sizeof(USB_Audio_Format_t), .Type = DTYPE_CSInterface},
- .Subtype = DSUBTYPE_Format,
+ .Header = {.Size = sizeof(USB_Audio_Descriptor_Format_t), .Type = DTYPE_CSInterface},
+ .Subtype = AUDIO_DSUBTYPE_CSInterface_FormatType,
.FormatType = 0x01,
.Channels = 0x01,
.SubFrameSize = 0x02,
.BitResolution = 16,
- .SampleFrequencyType = (sizeof(ConfigurationDescriptor.Audio_AudioFormat.SampleFrequencies) /
- sizeof(Audio_SampleFreq_t)),
+ .SampleFrequencyType = AUDIO_TOTAL_SAMPLE_RATES,
- .SampleFrequencies = {SAMPLE_FREQ(AUDIO_SAMPLE_FREQUENCY)}
+ .SampleFrequencies = {AUDIO_SAMPLE_FREQ(AUDIO_SAMPLE_FREQUENCY)}
},
.Audio_StreamEndpoint =
{
.Endpoint =
{
- .Header = {.Size = sizeof(USB_Audio_StreamEndpoint_Std_t), .Type = DTYPE_Endpoint},
+ .Header = {.Size = sizeof(USB_Audio_Descriptor_StreamEndpoint_Std_t), .Type = DTYPE_Endpoint},
.EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_IN | AUDIO_STREAM_EPNUM),
.Attributes = (EP_TYPE_ISOCHRONOUS | ENDPOINT_ATTR_SYNC | ENDPOINT_USAGE_DATA),
@@ -223,10 +222,10 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.Audio_StreamEndpoint_SPC =
{
- .Header = {.Size = sizeof(USB_Audio_StreamEndpoint_Spc_t), .Type = DTYPE_CSEndpoint},
- .Subtype = DSUBTYPE_General,
+ .Header = {.Size = sizeof(USB_Audio_Descriptor_StreamEndpoint_Spc_t), .Type = DTYPE_CSEndpoint},
+ .Subtype = AUDIO_DSUBTYPE_CSEndpoint_General,
- .Attributes = EP_ACCEPTS_SMALL_PACKETS,
+ .Attributes = AUDIO_EP_ACCEPTS_SMALL_PACKETS,
.LockDelayUnits = 0x00,
.LockDelay = 0x0000
diff --git a/Demos/Device/LowLevel/AudioInput/Descriptors.h b/Demos/Device/LowLevel/AudioInput/Descriptors.h
index c8b43b617..c3a437e98 100644
--- a/Demos/Device/LowLevel/AudioInput/Descriptors.h
+++ b/Demos/Device/LowLevel/AudioInput/Descriptors.h
@@ -42,95 +42,6 @@
#include <avr/pgmspace.h>
/* Macros: */
- /** Audio class descriptor subtype value for a Audio class specific header descriptor. */
- #define DSUBTYPE_AudioHeader 0x01
-
- /** Audio class descriptor subtype value for an Output Terminal Audio class specific descriptor. */
- #define DSUBTYPE_InputTerminal 0x02
-
- /** Audio class descriptor subtype value for an Input Terminal Audio class specific descriptor. */
- #define DSUBTYPE_OutputTerminal 0x03
-
- /** Audio class descriptor subtype value for a Feature Unit Audio class specific descriptor. */
- #define DSUBTYPE_FeatureUnit 0x06
-
- /** Audio class descriptor subtype value for a general Audio class specific descriptor. */
- #define DSUBTYPE_General 0x01
-
- /** Audio class descriptor subtype value for an Audio class specific descriptor indicating the format of an audio stream. */
- #define DSUBTYPE_Format 0x02
-
- //@{
- /** Supported channel mask for an Audio class terminal descriptor. See the Audio class specification for more details. */
-
- #define CHANNEL_LEFT_FRONT (1 << 0)
- #define CHANNEL_RIGHT_FRONT (1 << 1)
- #define CHANNEL_CENTER_FRONT (1 << 2)
- #define CHANNEL_LOW_FREQ_ENHANCE (1 << 3)
- #define CHANNEL_LEFT_SURROUND (1 << 4)
- #define CHANNEL_RIGHT_SURROUND (1 << 5)
- #define CHANNEL_LEFT_OF_CENTER (1 << 6)
- #define CHANNEL_RIGHT_OF_CENTER (1 << 7)
- #define CHANNEL_SURROUND (1 << 8)
- #define CHANNEL_SIDE_LEFT (1 << 9)
- #define CHANNEL_SIDE_RIGHT (1 << 10)
- #define CHANNEL_TOP (1 << 11)
- //@}
-
- //@{
- /** Supported feature mask for an Audio class feature unit descriptor. See the Audio class specification for more details. */
-
- #define FEATURE_MUTE (1 << 0)
- #define FEATURE_VOLUME (1 << 1)
- #define FEATURE_BASS (1 << 2)
- #define FEATURE_MID (1 << 3)
- #define FEATURE_TREBLE (1 << 4)
- #define FEATURE_GRAPHIC_EQUALIZER (1 << 5)
- #define FEATURE_AUTOMATIC_GAIN (1 << 6)
- #define FEATURE_DELAY (1 << 7)
- #define FEATURE_BASS_BOOST (1 << 8)
- #define FEATURE_BASS_LOUDNESS (1 << 9)
- //@}
-
- //@{
- /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
-
- #define TERMINAL_UNDEFINED 0x0100
- #define TERMINAL_STREAMING 0x0101
- #define TERMINAL_VENDOR 0x01FF
- #define TERMINAL_IN_UNDEFINED 0x0200
- #define TERMINAL_IN_MIC 0x0201
- #define TERMINAL_IN_DESKTOP_MIC 0x0202
- #define TERMINAL_IN_PERSONAL_MIC 0x0203
- #define TERMINAL_IN_OMNIDIR_MIC 0x0204
- #define TERMINAL_IN_MIC_ARRAY 0x0205
- #define TERMINAL_IN_PROCESSING_MIC 0x0206
- #define TERMINAL_IN_OUT_UNDEFINED 0x0300
- #define TERMINAL_OUT_SPEAKER 0x0301
- #define TERMINAL_OUT_HEADPHONES 0x0302
- #define TERMINAL_OUT_HEAD_MOUNTED 0x0303
- #define TERMINAL_OUT_DESKTOP 0x0304
- #define TERMINAL_OUT_ROOM 0x0305
- #define TERMINAL_OUT_COMMUNICATION 0x0306
- #define TERMINAL_OUT_LOWFREQ 0x0307
- //@}
-
- /** Convenience macro, to fill a 24-bit AudioSampleFreq_t structure with the given sample rate as a 24-bit number.
- *
- * \param[in] freq Required audio sampling frequency in HZ
- */
- #define SAMPLE_FREQ(freq) {LowWord: ((uint32_t)(freq) & 0x00FFFF), HighByte: (((uint32_t)(freq) >> 16) & 0x0000FF)}
-
- /** Mask for the attributes parameter of an Audio class specific Endpoint descriptor, indicating that the endpoint
- * accepts only filled endpoint packets of audio samples.
- */
- #define EP_ACCEPTS_ONLY_FULL_PACKETS (1 << 7)
-
- /** Mask for the attributes parameter of an Audio class specific Endpoint descriptor, indicating that the endpoint
- * will accept partially filled endpoint packets of audio samples.
- */
- #define EP_ACCEPTS_SMALL_PACKETS (0 << 7)
-
/** Endpoint number of the Audio isochronous streaming data endpoint. */
#define AUDIO_STREAM_EPNUM 1
@@ -144,165 +55,23 @@
#define AUDIO_SAMPLE_FREQUENCY 48000
/* Type Defines: */
- /** Type define for an Audio class specific interface descriptor. This follows a regular interface descriptor to
- * supply extra information about the audio device's layout to the host. See the USB Audio specification for more
- * details.
- */
- typedef struct
- {
- USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length */
- uint8_t Subtype; /**< Sub type value used to distinguish between audio class specific descriptors */
-
- uint16_t ACSpecification; /**< 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 */
-
- uint8_t InCollection; /**< Total number of audio class interfaces within this device */
- uint8_t InterfaceNumbers[1]; /**< Interface numbers of each audio interface */
- } 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
- * specification for more details.
- */
- typedef struct
- {
- USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length */
- uint8_t Subtype; /**< Sub type value used to distinguish between audio class specific descriptors */
-
- uint8_t UnitID; /**< ID value of this feature unit - must be a unique value within the device */
- uint8_t SourceID; /**< Source ID value of the audio source input into this feature unit */
-
- uint8_t ControlSize; /**< Size of each element in the ChanelControlls array */
- 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_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,
- * a USB endpoint). See the USB Audio specification for more details.
- */
- typedef struct
- {
- USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length */
- uint8_t Subtype; /**< Sub type value used to distinguish between audio class specific descriptors */
-
- uint8_t TerminalID; /**< ID value of this terminal unit - must be a unique value within the device */
- uint16_t TerminalType; /**< Type of terminal, a TERMINAL_* mask */
- uint8_t AssociatedOutputTerminal; /**< ID of associated output terminal, for physically grouped terminals
- * such as the speaker and microphone of a phone handset
- */
- uint8_t TotalChannels; /**< Total number of separate audio channels within this interface (right, left, etc.) */
- uint16_t ChannelConfig; /**< CHANNEL_* masks indicating what channel layout is supported by this terminal */
-
- 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_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,
- * a USB endpoint). See the USB Audio specification for more details.
- */
- typedef struct
- {
- USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length */
- uint8_t Subtype; /**< Sub type value used to distinguish between audio class specific descriptors */
-
- uint8_t TerminalID; /**< ID value of this terminal unit - must be a unique value within the device */
- uint16_t TerminalType; /**< Type of terminal, a TERMINAL_* mask */
- uint8_t AssociatedInputTerminal; /**< ID of associated input terminal, for physically grouped terminals
- * such as the speaker and microphone of a phone handset
- */
- 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_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.
- */
- typedef struct
- {
- USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length */
- uint8_t Subtype; /**< Sub type value used to distinguish between audio class specific descriptors */
-
- uint8_t TerminalLink; /**< ID value of the output terminal this descriptor is describing */
-
- 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_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.
- */
- typedef struct
- {
- uint16_t LowWord; /**< Low 16 bits of the 24-bit value */
- uint8_t HighByte; /**< Upper 8 bits of the 24-bit value */
- } 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
- * in the device's audio streams. See the USB Audio specification for more details.
- */
- typedef struct
- {
- USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length */
- uint8_t Subtype; /**< Sub type value used to distinguish between audio class specific descriptors */
-
- uint8_t FormatType; /**< Format of the audio stream, see Audio Device Formats specification */
- uint8_t Channels; /**< Total number of discrete channels in the stream */
-
- uint8_t SubFrameSize; /**< Size in bytes of each channel's sample data in the stream */
- 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 */
- 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.
- */
- typedef struct
- {
- USB_Descriptor_Endpoint_t Endpoint; /**< Standard endpoint descriptor describing the audio endpoint */
-
- uint8_t Refresh; /**< Always set to zero */
- uint8_t SyncEndpointNumber; /**< Endpoint address to send synchronization information to, if needed (zero otherwise) */
- } 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
- * class specific extended endpoint descriptor. See the USB Audio specification for more details.
- */
- typedef struct
- {
- USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length */
- uint8_t Subtype; /**< Sub type value used to distinguish between audio class specific descriptors */
-
- uint8_t Attributes; /**< Audio class specific endpoint attributes, such as ACCEPTS_SMALL_PACKETS */
-
- 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_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
* vary between devices, and which describe the device's usage to the host.
*/
typedef struct
{
- USB_Descriptor_Configuration_Header_t Config;
- USB_Descriptor_Interface_t Audio_ControlInterface;
- USB_Audio_Interface_AC_t Audio_ControlInterface_SPC;
- USB_Audio_InputTerminal_t Audio_InputTerminal;
- USB_Audio_OutputTerminal_t Audio_OutputTerminal;
- USB_Descriptor_Interface_t Audio_StreamInterface_Alt0;
- USB_Descriptor_Interface_t Audio_StreamInterface_Alt1;
- USB_Audio_Interface_AS_t Audio_StreamInterface_SPC;
- USB_Audio_Format_t Audio_AudioFormat;
- USB_Audio_StreamEndpoint_Std_t Audio_StreamEndpoint;
- USB_Audio_StreamEndpoint_Spc_t Audio_StreamEndpoint_SPC;
+ USB_Descriptor_Configuration_Header_t Config;
+ USB_Descriptor_Interface_t Audio_ControlInterface;
+ USB_Audio_Descriptor_Interface_AC_t Audio_ControlInterface_SPC;
+ USB_Audio_Descriptor_InputTerminal_t Audio_InputTerminal;
+ USB_Audio_Descriptor_OutputTerminal_t Audio_OutputTerminal;
+ USB_Descriptor_Interface_t Audio_StreamInterface_Alt0;
+ USB_Descriptor_Interface_t Audio_StreamInterface_Alt1;
+ USB_Audio_Descriptor_Interface_AS_t Audio_StreamInterface_SPC;
+ USB_Audio_Descriptor_Format_t Audio_AudioFormat;
+ USB_Audio_Descriptor_StreamEndpoint_Std_t Audio_StreamEndpoint;
+ USB_Audio_Descriptor_StreamEndpoint_Spc_t Audio_StreamEndpoint_SPC;
} USB_Descriptor_Configuration_t;
/* Function Prototypes: */
diff --git a/Demos/Device/LowLevel/AudioOutput/Descriptors.c b/Demos/Device/LowLevel/AudioOutput/Descriptors.c
index cc3d8ccae..d177c31c3 100644
--- a/Demos/Device/LowLevel/AudioOutput/Descriptors.c
+++ b/Demos/Device/LowLevel/AudioOutput/Descriptors.c
@@ -104,29 +104,29 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.Audio_ControlInterface_SPC =
{
- .Header = {.Size = sizeof(USB_Audio_Interface_AC_t), .Type = DTYPE_CSInterface},
- .Subtype = DSUBTYPE_AudioHeader,
+ .Header = {.Size = sizeof(USB_Audio_Descriptor_Interface_AC_t), .Type = DTYPE_CSInterface},
+ .Subtype = AUDIO_DSUBTYPE_CSInterface_Header,
.ACSpecification = VERSION_BCD(01.00),
- .TotalLength = (sizeof(USB_Audio_Interface_AC_t) +
- sizeof(USB_Audio_InputTerminal_t) +
- sizeof(USB_Audio_OutputTerminal_t)),
+ .TotalLength = (sizeof(USB_Audio_Descriptor_Interface_AC_t) +
+ sizeof(USB_Audio_Descriptor_InputTerminal_t) +
+ sizeof(USB_Audio_Descriptor_OutputTerminal_t)),
.InCollection = 1,
- .InterfaceNumbers = {1},
+ .InterfaceNumber = 1,
},
.Audio_InputTerminal =
{
- .Header = {.Size = sizeof(USB_Audio_InputTerminal_t), .Type = DTYPE_CSInterface},
- .Subtype = DSUBTYPE_InputTerminal,
+ .Header = {.Size = sizeof(USB_Audio_Descriptor_InputTerminal_t), .Type = DTYPE_CSInterface},
+ .Subtype = AUDIO_DSUBTYPE_CSInterface_InputTerminal,
.TerminalID = 0x01,
- .TerminalType = TERMINAL_STREAMING,
+ .TerminalType = AUDIO_TERMINAL_STREAMING,
.AssociatedOutputTerminal = 0x00,
.TotalChannels = 2,
- .ChannelConfig = (CHANNEL_LEFT_FRONT | CHANNEL_RIGHT_FRONT),
+ .ChannelConfig = (AUDIO_CHANNEL_LEFT_FRONT | AUDIO_CHANNEL_RIGHT_FRONT),
.ChannelStrIndex = NO_DESCRIPTOR,
.TerminalStrIndex = NO_DESCRIPTOR
@@ -134,11 +134,11 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.Audio_OutputTerminal =
{
- .Header = {.Size = sizeof(USB_Audio_OutputTerminal_t), .Type = DTYPE_CSInterface},
- .Subtype = DSUBTYPE_OutputTerminal,
+ .Header = {.Size = sizeof(USB_Audio_Descriptor_OutputTerminal_t), .Type = DTYPE_CSInterface},
+ .Subtype = AUDIO_DSUBTYPE_CSInterface_OutputTerminal,
.TerminalID = 0x02,
- .TerminalType = TERMINAL_OUT_SPEAKER,
+ .TerminalType = AUDIO_TERMINAL_OUT_SPEAKER,
.AssociatedInputTerminal = 0x00,
.SourceID = 0x01,
@@ -180,8 +180,8 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.Audio_StreamInterface_SPC =
{
- .Header = {.Size = sizeof(USB_Audio_Interface_AS_t), .Type = DTYPE_CSInterface},
- .Subtype = DSUBTYPE_General,
+ .Header = {.Size = sizeof(USB_Audio_Descriptor_Interface_AS_t), .Type = DTYPE_CSInterface},
+ .Subtype = AUDIO_DSUBTYPE_CSInterface_General,
.TerminalLink = 0x01,
@@ -191,8 +191,8 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.Audio_AudioFormat =
{
- .Header = {.Size = sizeof(USB_Audio_Format_t), .Type = DTYPE_CSInterface},
- .Subtype = DSUBTYPE_Format,
+ .Header = {.Size = sizeof(USB_Audio_Descriptor_Format_t), .Type = DTYPE_CSInterface},
+ .Subtype = AUDIO_DSUBTYPE_CSInterface_FormatType,
.FormatType = 0x01,
.Channels = 0x02,
@@ -200,16 +200,15 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.SubFrameSize = 0x02,
.BitResolution = 16,
- .SampleFrequencyType = (sizeof(ConfigurationDescriptor.Audio_AudioFormat.SampleFrequencies) /
- sizeof(Audio_SampleFreq_t)),
- .SampleFrequencies = {SAMPLE_FREQ(AUDIO_SAMPLE_FREQUENCY)}
+ .SampleFrequencyType = AUDIO_TOTAL_SAMPLE_RATES,
+ .SampleFrequencies = {AUDIO_SAMPLE_FREQ(AUDIO_SAMPLE_FREQUENCY)}
},
.Audio_StreamEndpoint =
{
.Endpoint =
{
- .Header = {.Size = sizeof(USB_Audio_StreamEndpoint_Std_t), .Type = DTYPE_Endpoint},
+ .Header = {.Size = sizeof(USB_Audio_Descriptor_StreamEndpoint_Std_t), .Type = DTYPE_Endpoint},
.EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_OUT | AUDIO_STREAM_EPNUM),
.Attributes = (EP_TYPE_ISOCHRONOUS | ENDPOINT_ATTR_SYNC | ENDPOINT_USAGE_DATA),
@@ -223,10 +222,10 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.Audio_StreamEndpoint_SPC =
{
- .Header = {.Size = sizeof(USB_Audio_StreamEndpoint_Spc_t), .Type = DTYPE_CSEndpoint},
- .Subtype = DSUBTYPE_General,
+ .Header = {.Size = sizeof(USB_Audio_Descriptor_StreamEndpoint_Spc_t), .Type = DTYPE_CSEndpoint},
+ .Subtype = AUDIO_DSUBTYPE_CSEndpoint_General,
- .Attributes = EP_ACCEPTS_SMALL_PACKETS,
+ .Attributes = AUDIO_EP_ACCEPTS_SMALL_PACKETS,
.LockDelayUnits = 0x00,
.LockDelay = 0x0000
diff --git a/Demos/Device/LowLevel/AudioOutput/Descriptors.h b/Demos/Device/LowLevel/AudioOutput/Descriptors.h
index c8b43b617..d5b11b377 100644
--- a/Demos/Device/LowLevel/AudioOutput/Descriptors.h
+++ b/Demos/Device/LowLevel/AudioOutput/Descriptors.h
@@ -42,95 +42,6 @@
#include <avr/pgmspace.h>
/* Macros: */
- /** Audio class descriptor subtype value for a Audio class specific header descriptor. */
- #define DSUBTYPE_AudioHeader 0x01
-
- /** Audio class descriptor subtype value for an Output Terminal Audio class specific descriptor. */
- #define DSUBTYPE_InputTerminal 0x02
-
- /** Audio class descriptor subtype value for an Input Terminal Audio class specific descriptor. */
- #define DSUBTYPE_OutputTerminal 0x03
-
- /** Audio class descriptor subtype value for a Feature Unit Audio class specific descriptor. */
- #define DSUBTYPE_FeatureUnit 0x06
-
- /** Audio class descriptor subtype value for a general Audio class specific descriptor. */
- #define DSUBTYPE_General 0x01
-
- /** Audio class descriptor subtype value for an Audio class specific descriptor indicating the format of an audio stream. */
- #define DSUBTYPE_Format 0x02
-
- //@{
- /** Supported channel mask for an Audio class terminal descriptor. See the Audio class specification for more details. */
-
- #define CHANNEL_LEFT_FRONT (1 << 0)
- #define CHANNEL_RIGHT_FRONT (1 << 1)
- #define CHANNEL_CENTER_FRONT (1 << 2)
- #define CHANNEL_LOW_FREQ_ENHANCE (1 << 3)
- #define CHANNEL_LEFT_SURROUND (1 << 4)
- #define CHANNEL_RIGHT_SURROUND (1 << 5)
- #define CHANNEL_LEFT_OF_CENTER (1 << 6)
- #define CHANNEL_RIGHT_OF_CENTER (1 << 7)
- #define CHANNEL_SURROUND (1 << 8)
- #define CHANNEL_SIDE_LEFT (1 << 9)
- #define CHANNEL_SIDE_RIGHT (1 << 10)
- #define CHANNEL_TOP (1 << 11)
- //@}
-
- //@{
- /** Supported feature mask for an Audio class feature unit descriptor. See the Audio class specification for more details. */
-
- #define FEATURE_MUTE (1 << 0)
- #define FEATURE_VOLUME (1 << 1)
- #define FEATURE_BASS (1 << 2)
- #define FEATURE_MID (1 << 3)
- #define FEATURE_TREBLE (1 << 4)
- #define FEATURE_GRAPHIC_EQUALIZER (1 << 5)
- #define FEATURE_AUTOMATIC_GAIN (1 << 6)
- #define FEATURE_DELAY (1 << 7)
- #define FEATURE_BASS_BOOST (1 << 8)
- #define FEATURE_BASS_LOUDNESS (1 << 9)
- //@}
-
- //@{
- /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
-
- #define TERMINAL_UNDEFINED 0x0100
- #define TERMINAL_STREAMING 0x0101
- #define TERMINAL_VENDOR 0x01FF
- #define TERMINAL_IN_UNDEFINED 0x0200
- #define TERMINAL_IN_MIC 0x0201
- #define TERMINAL_IN_DESKTOP_MIC 0x0202
- #define TERMINAL_IN_PERSONAL_MIC 0x0203
- #define TERMINAL_IN_OMNIDIR_MIC 0x0204
- #define TERMINAL_IN_MIC_ARRAY 0x0205
- #define TERMINAL_IN_PROCESSING_MIC 0x0206
- #define TERMINAL_IN_OUT_UNDEFINED 0x0300
- #define TERMINAL_OUT_SPEAKER 0x0301
- #define TERMINAL_OUT_HEADPHONES 0x0302
- #define TERMINAL_OUT_HEAD_MOUNTED 0x0303
- #define TERMINAL_OUT_DESKTOP 0x0304
- #define TERMINAL_OUT_ROOM 0x0305
- #define TERMINAL_OUT_COMMUNICATION 0x0306
- #define TERMINAL_OUT_LOWFREQ 0x0307
- //@}
-
- /** Convenience macro, to fill a 24-bit AudioSampleFreq_t structure with the given sample rate as a 24-bit number.
- *
- * \param[in] freq Required audio sampling frequency in HZ
- */
- #define SAMPLE_FREQ(freq) {LowWord: ((uint32_t)(freq) & 0x00FFFF), HighByte: (((uint32_t)(freq) >> 16) & 0x0000FF)}
-
- /** Mask for the attributes parameter of an Audio class specific Endpoint descriptor, indicating that the endpoint
- * accepts only filled endpoint packets of audio samples.
- */
- #define EP_ACCEPTS_ONLY_FULL_PACKETS (1 << 7)
-
- /** Mask for the attributes parameter of an Audio class specific Endpoint descriptor, indicating that the endpoint
- * will accept partially filled endpoint packets of audio samples.
- */
- #define EP_ACCEPTS_SMALL_PACKETS (0 << 7)
-
/** Endpoint number of the Audio isochronous streaming data endpoint. */
#define AUDIO_STREAM_EPNUM 1
@@ -144,165 +55,23 @@
#define AUDIO_SAMPLE_FREQUENCY 48000
/* Type Defines: */
- /** Type define for an Audio class specific interface descriptor. This follows a regular interface descriptor to
- * supply extra information about the audio device's layout to the host. See the USB Audio specification for more
- * details.
- */
- typedef struct
- {
- USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length */
- uint8_t Subtype; /**< Sub type value used to distinguish between audio class specific descriptors */
-
- uint16_t ACSpecification; /**< 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 */
-
- uint8_t InCollection; /**< Total number of audio class interfaces within this device */
- uint8_t InterfaceNumbers[1]; /**< Interface numbers of each audio interface */
- } 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
- * specification for more details.
- */
- typedef struct
- {
- USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length */
- uint8_t Subtype; /**< Sub type value used to distinguish between audio class specific descriptors */
-
- uint8_t UnitID; /**< ID value of this feature unit - must be a unique value within the device */
- uint8_t SourceID; /**< Source ID value of the audio source input into this feature unit */
-
- uint8_t ControlSize; /**< Size of each element in the ChanelControlls array */
- 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_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,
- * a USB endpoint). See the USB Audio specification for more details.
- */
- typedef struct
- {
- USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length */
- uint8_t Subtype; /**< Sub type value used to distinguish between audio class specific descriptors */
-
- uint8_t TerminalID; /**< ID value of this terminal unit - must be a unique value within the device */
- uint16_t TerminalType; /**< Type of terminal, a TERMINAL_* mask */
- uint8_t AssociatedOutputTerminal; /**< ID of associated output terminal, for physically grouped terminals
- * such as the speaker and microphone of a phone handset
- */
- uint8_t TotalChannels; /**< Total number of separate audio channels within this interface (right, left, etc.) */
- uint16_t ChannelConfig; /**< CHANNEL_* masks indicating what channel layout is supported by this terminal */
-
- 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_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,
- * a USB endpoint). See the USB Audio specification for more details.
- */
- typedef struct
- {
- USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length */
- uint8_t Subtype; /**< Sub type value used to distinguish between audio class specific descriptors */
-
- uint8_t TerminalID; /**< ID value of this terminal unit - must be a unique value within the device */
- uint16_t TerminalType; /**< Type of terminal, a TERMINAL_* mask */
- uint8_t AssociatedInputTerminal; /**< ID of associated input terminal, for physically grouped terminals
- * such as the speaker and microphone of a phone handset
- */
- 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_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.
- */
- typedef struct
- {
- USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length */
- uint8_t Subtype; /**< Sub type value used to distinguish between audio class specific descriptors */
-
- uint8_t TerminalLink; /**< ID value of the output terminal this descriptor is describing */
-
- 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_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.
- */
- typedef struct
- {
- uint16_t LowWord; /**< Low 16 bits of the 24-bit value */
- uint8_t HighByte; /**< Upper 8 bits of the 24-bit value */
- } 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
- * in the device's audio streams. See the USB Audio specification for more details.
- */
- typedef struct
- {
- USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length */
- uint8_t Subtype; /**< Sub type value used to distinguish between audio class specific descriptors */
-
- uint8_t FormatType; /**< Format of the audio stream, see Audio Device Formats specification */
- uint8_t Channels; /**< Total number of discrete channels in the stream */
-
- uint8_t SubFrameSize; /**< Size in bytes of each channel's sample data in the stream */
- 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 */
- 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.
- */
- typedef struct
- {
- USB_Descriptor_Endpoint_t Endpoint; /**< Standard endpoint descriptor describing the audio endpoint */
-
- uint8_t Refresh; /**< Always set to zero */
- uint8_t SyncEndpointNumber; /**< Endpoint address to send synchronization information to, if needed (zero otherwise) */
- } 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
- * class specific extended endpoint descriptor. See the USB Audio specification for more details.
- */
- typedef struct
- {
- USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length */
- uint8_t Subtype; /**< Sub type value used to distinguish between audio class specific descriptors */
-
- uint8_t Attributes; /**< Audio class specific endpoint attributes, such as ACCEPTS_SMALL_PACKETS */
-
- 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_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
* vary between devices, and which describe the device's usage to the host.
*/
typedef struct
{
- USB_Descriptor_Configuration_Header_t Config;
- USB_Descriptor_Interface_t Audio_ControlInterface;
- USB_Audio_Interface_AC_t Audio_ControlInterface_SPC;
- USB_Audio_InputTerminal_t Audio_InputTerminal;
- USB_Audio_OutputTerminal_t Audio_OutputTerminal;
- USB_Descriptor_Interface_t Audio_StreamInterface_Alt0;
- USB_Descriptor_Interface_t Audio_StreamInterface_Alt1;
- USB_Audio_Interface_AS_t Audio_StreamInterface_SPC;
- USB_Audio_Format_t Audio_AudioFormat;
- USB_Audio_StreamEndpoint_Std_t Audio_StreamEndpoint;
- USB_Audio_StreamEndpoint_Spc_t Audio_StreamEndpoint_SPC;
+ USB_Descriptor_Configuration_Header_t Config;
+ USB_Descriptor_Interface_t Audio_ControlInterface;
+ USB_Audio_Descriptor_Interface_AC_t Audio_ControlInterface_SPC;
+ USB_Audio_Descriptor_InputTerminal_t Audio_InputTerminal;
+ USB_Audio_Descriptor_OutputTerminal_t Audio_OutputTerminal;
+ USB_Descriptor_Interface_t Audio_StreamInterface_Alt0;
+ USB_Descriptor_Interface_t Audio_StreamInterface_Alt1;
+ USB_Audio_Descriptor_Interface_AS_t Audio_StreamInterface_SPC;
+ USB_Audio_Descriptor_Format_t Audio_AudioFormat;
+ USB_Audio_Descriptor_StreamEndpoint_Std_t Audio_StreamEndpoint;
+ USB_Audio_Descriptor_StreamEndpoint_Spc_t Audio_StreamEndpoint_SPC;
} USB_Descriptor_Configuration_t;
/* Function Prototypes: */
@@ -312,4 +81,3 @@
ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
#endif
-
diff --git a/Demos/Device/LowLevel/DualVirtualSerial/Descriptors.c b/Demos/Device/LowLevel/DualVirtualSerial/Descriptors.c
index ca5af2770..775ab0828 100644
--- a/Demos/Device/LowLevel/DualVirtualSerial/Descriptors.c
+++ b/Demos/Device/LowLevel/DualVirtualSerial/Descriptors.c
@@ -130,24 +130,24 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.CDC1_Functional_Header =
{
- .Header = {.Size = sizeof(USB_Descriptor_CDC_FunctionalHeader_t), .Type = DTYPE_CSInterface},
- .Subtype = 0x00,
+ .Header = {.Size = sizeof(USB_CDC_Descriptor_FunctionalHeader_t), .Type = DTYPE_CSInterface},
+ .Subtype = CDC_DSUBTYPE_CSInterface_Header,
.CDCSpecification = VERSION_BCD(01.10),
},
.CDC1_Functional_ACM =
{
- .Header = {.Size = sizeof(USB_Descriptor_CDC_FunctionalACM_t), .Type = DTYPE_CSInterface},
- .Subtype = 0x02,
+ .Header = {.Size = sizeof(USB_CDC_Descriptor_FunctionalACM_t), .Type = DTYPE_CSInterface},
+ .Subtype = CDC_DSUBTYPE_CSInterface_ACM,
.Capabilities = 0x06,
},
.CDC1_Functional_Union =
{
- .Header = {.Size = sizeof(USB_Descriptor_CDC_FunctionalUnion_t), .Type = DTYPE_CSInterface},
- .Subtype = 0x06,
+ .Header = {.Size = sizeof(USB_CDC_Descriptor_FunctionalUnion_t), .Type = DTYPE_CSInterface},
+ .Subtype = CDC_DSUBTYPE_CSInterface_Union,
.MasterInterfaceNumber = 0,
.SlaveInterfaceNumber = 1,
@@ -231,24 +231,24 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.CDC2_Functional_Header =
{
- .Header = {.Size = sizeof(USB_Descriptor_CDC_FunctionalHeader_t), .Type = DTYPE_CSInterface},
- .Subtype = 0x00,
+ .Header = {.Size = sizeof(USB_CDC_Descriptor_FunctionalHeader_t), .Type = DTYPE_CSInterface},
+ .Subtype = CDC_DSUBTYPE_CSInterface_Header,
.CDCSpecification = VERSION_BCD(01.10),
},
.CDC2_Functional_ACM =
{
- .Header = {.Size = sizeof(USB_Descriptor_CDC_FunctionalACM_t), .Type = DTYPE_CSInterface},
- .Subtype = 0x02,
+ .Header = {.Size = sizeof(USB_CDC_Descriptor_FunctionalACM_t), .Type = DTYPE_CSInterface},
+ .Subtype = CDC_DSUBTYPE_CSInterface_ACM,
.Capabilities = 0x06,
},
.CDC2_Functional_Union =
{
- .Header = {.Size = sizeof(USB_Descriptor_CDC_FunctionalUnion_t), .Type = DTYPE_CSInterface},
- .Subtype = 0x06,
+ .Header = {.Size = sizeof(USB_CDC_Descriptor_FunctionalUnion_t), .Type = DTYPE_CSInterface},
+ .Subtype = CDC_DSUBTYPE_CSInterface_Union,
.MasterInterfaceNumber = 2,
.SlaveInterfaceNumber = 3,
diff --git a/Demos/Device/LowLevel/DualVirtualSerial/Descriptors.h b/Demos/Device/LowLevel/DualVirtualSerial/Descriptors.h
index ba876f1df..5ef3af94a 100644
--- a/Demos/Device/LowLevel/DualVirtualSerial/Descriptors.h
+++ b/Demos/Device/LowLevel/DualVirtualSerial/Descriptors.h
@@ -42,23 +42,23 @@
#include <avr/pgmspace.h>
/* Macros: */
+ /** Endpoint number of the first CDC interface's device-to-host notification IN endpoint. */
+ #define CDC1_NOTIFICATION_EPNUM 3
+
/** Endpoint number of the first CDC interface's device-to-host data IN endpoint. */
#define CDC1_TX_EPNUM 1
/** Endpoint number of the first CDC interface's host-to-device data OUT endpoint. */
#define CDC1_RX_EPNUM 2
- /** Endpoint number of the first CDC interface's device-to-host notification IN endpoint. */
- #define CDC1_NOTIFICATION_EPNUM 3
+ /** Endpoint number of the second CDC interface's device-to-host notification IN endpoint. */
+ #define CDC2_NOTIFICATION_EPNUM 4
/** Endpoint number of the second CDC interface's device-to-host data IN endpoint. */
- #define CDC2_TX_EPNUM 4
+ #define CDC2_TX_EPNUM 5
/** Endpoint number of the second CDC interface's host-to-device data OUT endpoint. */
- #define CDC2_RX_EPNUM 5
-
- /** Endpoint number of the second CDC interface's device-to-host notification IN endpoint. */
- #define CDC2_NOTIFICATION_EPNUM 6
+ #define CDC2_RX_EPNUM 6
/** Size in bytes of the CDC device-to-host notification IN endpoints. */
#define CDC_NOTIFICATION_EPSIZE 8
@@ -67,40 +67,6 @@
#define CDC_TXRX_EPSIZE 16
/* Type Defines: */
- /** Type define for a CDC class-specific functional header descriptor. This indicates to the host that the device
- * contains one or more CDC functional data descriptors, which give the CDC interface's capabilities and configuration.
- * See the CDC class specification for more details.
- */
- typedef struct
- {
- USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length. */
- uint8_t Subtype; /**< Sub type value used to distinguish between CDC class-specific descriptors. */
- uint16_t CDCSpecification; /**< Version number of the CDC specification implemented by the device,
- * encoded in BCD format.
- */
- } USB_Descriptor_CDC_FunctionalHeader_t;
-
- /** Type define for a CDC class-specific functional ACM descriptor. This indicates to the host that the CDC interface
- * supports the CDC ACM subclass of the CDC specification. See the CDC class specification for more details.
- */
- typedef struct
- {
- USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length. */
- uint8_t Subtype; /**< Sub type value used to distinguish between CDC class-specific descriptors. */
- uint8_t Capabilities; /**< Capabilities of the ACM interface, given as a bit mask. */
- } USB_Descriptor_CDC_FunctionalACM_t;
-
- /** Type define for a CDC class-specific functional Union descriptor. This indicates to the host that specific
- * CDC control and data interfaces are related. See the CDC class specification for more details.
- */
- typedef struct
- {
- USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length. */
- uint8_t Subtype; /**< Sub type value used to distinguish between CDC class-specific descriptors. */
- uint8_t MasterInterfaceNumber; /**< Interface number of the CDC Control interface. */
- uint8_t SlaveInterfaceNumber; /**< Interface number of the CDC Data interface. */
- } USB_Descriptor_CDC_FunctionalUnion_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
* vary between devices, and which describe the device's usage to the host.
@@ -110,18 +76,18 @@
USB_Descriptor_Configuration_Header_t Config;
USB_Descriptor_Interface_Association_t CDC1_IAD;
USB_Descriptor_Interface_t CDC1_CCI_Interface;
- USB_Descriptor_CDC_FunctionalHeader_t CDC1_Functional_Header;
- USB_Descriptor_CDC_FunctionalACM_t CDC1_Functional_ACM;
- USB_Descriptor_CDC_FunctionalUnion_t CDC1_Functional_Union;
+ USB_CDC_Descriptor_FunctionalHeader_t CDC1_Functional_Header;
+ USB_CDC_Descriptor_FunctionalACM_t CDC1_Functional_ACM;
+ USB_CDC_Descriptor_FunctionalUnion_t CDC1_Functional_Union;
USB_Descriptor_Endpoint_t CDC1_ManagementEndpoint;
USB_Descriptor_Interface_t CDC1_DCI_Interface;
USB_Descriptor_Endpoint_t CDC1_DataOutEndpoint;
USB_Descriptor_Endpoint_t CDC1_DataInEndpoint;
USB_Descriptor_Interface_Association_t CDC2_IAD;
USB_Descriptor_Interface_t CDC2_CCI_Interface;
- USB_Descriptor_CDC_FunctionalHeader_t CDC2_Functional_Header;
- USB_Descriptor_CDC_FunctionalACM_t CDC2_Functional_ACM;
- USB_Descriptor_CDC_FunctionalUnion_t CDC2_Functional_Union;
+ USB_CDC_Descriptor_FunctionalHeader_t CDC2_Functional_Header;
+ USB_CDC_Descriptor_FunctionalACM_t CDC2_Functional_ACM;
+ USB_CDC_Descriptor_FunctionalUnion_t CDC2_Functional_Union;
USB_Descriptor_Endpoint_t CDC2_ManagementEndpoint;
USB_Descriptor_Interface_t CDC2_DCI_Interface;
USB_Descriptor_Endpoint_t CDC2_DataOutEndpoint;
@@ -135,4 +101,3 @@
ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
#endif
-
diff --git a/Demos/Device/LowLevel/DualVirtualSerial/DualVirtualSerial.c b/Demos/Device/LowLevel/DualVirtualSerial/DualVirtualSerial.c
index 45159a8f8..b1a9d1c56 100644
--- a/Demos/Device/LowLevel/DualVirtualSerial/DualVirtualSerial.c
+++ b/Demos/Device/LowLevel/DualVirtualSerial/DualVirtualSerial.c
@@ -44,10 +44,10 @@
* It is possible to completely ignore these value or use other settings as the host is completely unaware of the physical
* serial link characteristics and instead sends and receives data in endpoint streams.
*/
-CDC_Line_Coding_t LineEncoding1 = { .BaudRateBPS = 0,
- .CharFormat = OneStopBit,
- .ParityType = Parity_None,
- .DataBits = 8 };
+CDC_LineEncoding_t LineEncoding1 = { .BaudRateBPS = 0,
+ .CharFormat = CDC_LINEENCODING_OneStopBit,
+ .ParityType = CDC_PARITY_None,
+ .DataBits = 8 };
/** Contains the current baud rate and other settings of the second virtual serial port. While this demo does not use
* the physical USART and thus does not use these settings, they must still be retained and returned to the host
@@ -57,10 +57,10 @@ CDC_Line_Coding_t LineEncoding1 = { .BaudRateBPS = 0,
* It is possible to completely ignore these value or use other settings as the host is completely unaware of the physical
* serial link characteristics and instead sends and receives data in endpoint streams.
*/
-CDC_Line_Coding_t LineEncoding2 = { .BaudRateBPS = 0,
- .CharFormat = OneStopBit,
- .ParityType = Parity_None,
- .DataBits = 8 };
+CDC_LineEncoding_t LineEncoding2 = { .BaudRateBPS = 0,
+ .CharFormat = CDC_LINEENCODING_OneStopBit,
+ .ParityType = CDC_PARITY_None,
+ .DataBits = 8 };
/** Main program entry point. This routine configures the hardware required by the application, then
@@ -158,29 +158,29 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
/* Process CDC specific control requests */
switch (USB_ControlRequest.bRequest)
{
- case REQ_GetLineEncoding:
+ case CDC_REQ_GetLineEncoding:
if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))
{
Endpoint_ClearSETUP();
/* Write the line coding data to the control endpoint */
- Endpoint_Write_Control_Stream_LE(LineEncodingData, sizeof(CDC_Line_Coding_t));
+ Endpoint_Write_Control_Stream_LE(LineEncodingData, sizeof(CDC_LineEncoding_t));
Endpoint_ClearOUT();
}
break;
- case REQ_SetLineEncoding:
+ case CDC_REQ_SetLineEncoding:
if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))
{
Endpoint_ClearSETUP();
/* Read the line coding data in from the host into the global struct */
- Endpoint_Read_Control_Stream_LE(LineEncodingData, sizeof(CDC_Line_Coding_t));
+ Endpoint_Read_Control_Stream_LE(LineEncodingData, sizeof(CDC_LineEncoding_t));
Endpoint_ClearIN();
}
break;
- case REQ_SetControlLineState:
+ case CDC_REQ_SetControlLineState:
if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))
{
Endpoint_ClearSETUP();
diff --git a/Demos/Device/LowLevel/DualVirtualSerial/DualVirtualSerial.h b/Demos/Device/LowLevel/DualVirtualSerial/DualVirtualSerial.h
index b66750112..626bc5373 100644
--- a/Demos/Device/LowLevel/DualVirtualSerial/DualVirtualSerial.h
+++ b/Demos/Device/LowLevel/DualVirtualSerial/DualVirtualSerial.h
@@ -51,15 +51,6 @@
#include <LUFA/Drivers/Board/LEDs.h>
/* Macros: */
- /** CDC Class specific request to get the current virtual serial port configuration settings. */
- #define REQ_GetLineEncoding 0x21
-
- /** CDC Class specific request to set the current virtual serial port configuration settings. */
- #define REQ_SetLineEncoding 0x20
-
- /** CDC Class specific request to set the current virtual serial port handshake line states. */
- #define REQ_SetControlLineState 0x22
-
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
#define LEDMASK_USB_NOTREADY LEDS_LED1
@@ -72,41 +63,6 @@
/** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */
#define LEDMASK_USB_ERROR (LEDS_LED1 | LEDS_LED3)
- /* Type Defines: */
- /** Type define for the virtual serial port line encoding settings, for storing the current USART configuration
- * as set by the host via a class specific request.
- */
- typedef 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 */
- } CDC_Line_Coding_t;
-
- /* Enums: */
- /** Enum for the possible line encoding formats of a virtual serial port. */
- enum CDCDevice_CDC_LineCodingFormats_t
- {
- OneStopBit = 0, /**< Each frame contains one stop bit */
- OneAndAHalfStopBits = 1, /**< Each frame contains one and a half stop bits */
- TwoStopBits = 2, /**< Each frame contains two stop bits */
- };
-
- /** Enum for the possible line encoding parity settings of a virtual serial port. */
- enum CDCDevice_LineCodingParity_t
- {
- Parity_None = 0, /**< No parity bit mode on each frame */
- Parity_Odd = 1, /**< Odd parity bit mode on each frame */
- Parity_Even = 2, /**< Even parity bit mode on each frame */
- Parity_Mark = 3, /**< Mark parity bit mode on each frame */
- Parity_Space = 4, /**< Space parity bit mode on each frame */
- };
-
/* Function Prototypes: */
void CDC1_Task(void);
void CDC2_Task(void);
diff --git a/Demos/Device/LowLevel/GenericHID/Descriptors.c b/Demos/Device/LowLevel/GenericHID/Descriptors.c
index 440179645..79cecb587 100644
--- a/Demos/Device/LowLevel/GenericHID/Descriptors.c
+++ b/Demos/Device/LowLevel/GenericHID/Descriptors.c
@@ -130,12 +130,12 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.HID_GenericHID =
{
- .Header = {.Size = sizeof(USB_Descriptor_HID_t), .Type = DTYPE_HID},
+ .Header = {.Size = sizeof(USB_HID_Descriptor_HID_t), .Type = HID_DTYPE_HID},
.HIDSpec = VERSION_BCD(01.11),
.CountryCode = 0x00,
.TotalReportDescriptors = 1,
- .HIDReportType = DTYPE_Report,
+ .HIDReportType = HID_DTYPE_Report,
.HIDReportLength = sizeof(GenericReport)
},
@@ -237,11 +237,11 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
}
break;
- case DTYPE_HID:
+ case HID_DTYPE_HID:
Address = &ConfigurationDescriptor.HID_GenericHID;
- Size = sizeof(USB_Descriptor_HID_t);
+ Size = sizeof(USB_HID_Descriptor_HID_t);
break;
- case DTYPE_Report:
+ case HID_DTYPE_Report:
Address = &GenericReport;
Size = sizeof(GenericReport);
break;
diff --git a/Demos/Device/LowLevel/GenericHID/Descriptors.h b/Demos/Device/LowLevel/GenericHID/Descriptors.h
index 2033c27e7..4d952e563 100644
--- a/Demos/Device/LowLevel/GenericHID/Descriptors.h
+++ b/Demos/Device/LowLevel/GenericHID/Descriptors.h
@@ -42,25 +42,6 @@
#include <avr/pgmspace.h>
/* Type Defines: */
- /** Type define for the HID class specific HID descriptor, to describe the HID device's specifications. Refer to the HID
- * specification for details on the structure elements.
- */
- typedef struct
- {
- USB_Descriptor_Header_t Header;
-
- uint16_t HIDSpec;
- uint8_t CountryCode;
-
- uint8_t TotalReportDescriptors;
-
- uint8_t HIDReportType;
- uint16_t HIDReportLength;
- } USB_Descriptor_HID_t;
-
- /** Type define for the data type used to store HID report descriptor elements. */
- typedef uint8_t USB_Descriptor_HIDReport_Datatype_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
* vary between devices, and which describe the device's usage to the host.
@@ -69,7 +50,7 @@
{
USB_Descriptor_Configuration_Header_t Config;
USB_Descriptor_Interface_t HID_Interface;
- USB_Descriptor_HID_t HID_GenericHID;
+ USB_HID_Descriptor_HID_t HID_GenericHID;
USB_Descriptor_Endpoint_t HID_ReportINEndpoint;
USB_Descriptor_Endpoint_t HID_ReportOUTEndpoint;
} USB_Descriptor_Configuration_t;
@@ -87,12 +68,6 @@
/** Size in bytes of the Generic HID reports (including report ID byte). */
#define GENERIC_REPORT_SIZE 8
- /** Descriptor header type value, to indicate a HID class HID descriptor. */
- #define DTYPE_HID 0x21
-
- /** Descriptor header type value, to indicate a HID class HID report descriptor. */
- #define DTYPE_Report 0x22
-
/* Function Prototypes: */
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
const uint8_t wIndex,
diff --git a/Demos/Device/LowLevel/GenericHID/GenericHID.c b/Demos/Device/LowLevel/GenericHID/GenericHID.c
index d7c2e3728..d0e89ca84 100644
--- a/Demos/Device/LowLevel/GenericHID/GenericHID.c
+++ b/Demos/Device/LowLevel/GenericHID/GenericHID.c
@@ -116,7 +116,7 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
/* Handle HID Class specific requests */
switch (USB_ControlRequest.bRequest)
{
- case REQ_GetReport:
+ case HID_REQ_GetReport:
if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))
{
uint8_t GenericData[GENERIC_REPORT_SIZE];
@@ -130,7 +130,7 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
}
break;
- case REQ_SetReport:
+ case HID_REQ_SetReport:
if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))
{
uint8_t GenericData[GENERIC_REPORT_SIZE];
diff --git a/Demos/Device/LowLevel/GenericHID/GenericHID.h b/Demos/Device/LowLevel/GenericHID/GenericHID.h
index 840902e51..d8900271c 100644
--- a/Demos/Device/LowLevel/GenericHID/GenericHID.h
+++ b/Demos/Device/LowLevel/GenericHID/GenericHID.h
@@ -51,12 +51,6 @@
#include <LUFA/Drivers/Board/LEDs.h>
/* Macros: */
- /** HID Class specific request to get the next HID report from the device. */
- #define REQ_GetReport 0x01
-
- /** HID Class specific request to send the next HID report to the device. */
- #define REQ_SetReport 0x09
-
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
#define LEDMASK_USB_NOTREADY LEDS_LED1
diff --git a/Demos/Device/LowLevel/Joystick/Descriptors.c b/Demos/Device/LowLevel/Joystick/Descriptors.c
index 08674c8d6..fac68871e 100644
--- a/Demos/Device/LowLevel/Joystick/Descriptors.c
+++ b/Demos/Device/LowLevel/Joystick/Descriptors.c
@@ -140,12 +140,12 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.HID_JoystickHID =
{
- .Header = {.Size = sizeof(USB_Descriptor_HID_t), .Type = DTYPE_HID},
+ .Header = {.Size = sizeof(USB_HID_Descriptor_HID_t), .Type = HID_DTYPE_HID},
.HIDSpec = VERSION_BCD(01.11),
.CountryCode = 0x00,
.TotalReportDescriptors = 1,
- .HIDReportType = DTYPE_Report,
+ .HIDReportType = HID_DTYPE_Report,
.HIDReportLength = sizeof(JoystickReport)
},
@@ -239,7 +239,7 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
break;
case DTYPE_HID:
Address = &ConfigurationDescriptor.HID_JoystickHID;
- Size = sizeof(USB_Descriptor_HID_t);
+ Size = sizeof(USB_HID_Descriptor_HID_t);
break;
case DTYPE_Report:
Address = &JoystickReport;
diff --git a/Demos/Device/LowLevel/Joystick/Descriptors.h b/Demos/Device/LowLevel/Joystick/Descriptors.h
index 76f609715..e58d9a487 100644
--- a/Demos/Device/LowLevel/Joystick/Descriptors.h
+++ b/Demos/Device/LowLevel/Joystick/Descriptors.h
@@ -42,25 +42,6 @@
#include <avr/pgmspace.h>
/* Type Defines: */
- /** Type define for the HID class specific HID descriptor, to describe the HID device's specifications. Refer to the HID
- * specification for details on the structure elements.
- */
- typedef struct
- {
- USB_Descriptor_Header_t Header;
-
- uint16_t HIDSpec;
- uint8_t CountryCode;
-
- uint8_t TotalReportDescriptors;
-
- uint8_t HIDReportType;
- uint16_t HIDReportLength;
- } USB_Descriptor_HID_t;
-
- /** Type define for the data type used to store HID report descriptor elements. */
- typedef uint8_t USB_Descriptor_HIDReport_Datatype_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
* vary between devices, and which describe the device's usage to the host.
@@ -69,7 +50,7 @@
{
USB_Descriptor_Configuration_Header_t Config;
USB_Descriptor_Interface_t HID_Interface;
- USB_Descriptor_HID_t HID_JoystickHID;
+ USB_HID_Descriptor_HID_t HID_JoystickHID;
USB_Descriptor_Endpoint_t HID_ReportINEndpoint;
} USB_Descriptor_Configuration_t;
diff --git a/Demos/Device/LowLevel/Joystick/Joystick.c b/Demos/Device/LowLevel/Joystick/Joystick.c
index 24f744fdb..0419a7e50 100644
--- a/Demos/Device/LowLevel/Joystick/Joystick.c
+++ b/Demos/Device/LowLevel/Joystick/Joystick.c
@@ -112,7 +112,7 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
/* Handle HID Class specific requests */
switch (USB_ControlRequest.bRequest)
{
- case REQ_GetReport:
+ case HID_REQ_GetReport:
if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))
{
USB_JoystickReport_Data_t JoystickReportData;
diff --git a/Demos/Device/LowLevel/Joystick/Joystick.h b/Demos/Device/LowLevel/Joystick/Joystick.h
index e1ae51228..3b02218ad 100644
--- a/Demos/Device/LowLevel/Joystick/Joystick.h
+++ b/Demos/Device/LowLevel/Joystick/Joystick.h
@@ -52,9 +52,6 @@
#include <LUFA/Drivers/Board/Buttons.h>
/* Macros: */
- /** HID Class specific request to get the next HID report from the device. */
- #define REQ_GetReport 0x01
-
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
#define LEDMASK_USB_NOTREADY LEDS_LED1
diff --git a/Demos/Device/LowLevel/Keyboard/Descriptors.c b/Demos/Device/LowLevel/Keyboard/Descriptors.c
index e1a87662f..711d0ff7e 100644
--- a/Demos/Device/LowLevel/Keyboard/Descriptors.c
+++ b/Demos/Device/LowLevel/Keyboard/Descriptors.c
@@ -147,12 +147,12 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.HID_KeyboardHID =
{
- .Header = {.Size = sizeof(USB_Descriptor_HID_t), .Type = DTYPE_HID},
+ .Header = {.Size = sizeof(USB_HID_Descriptor_HID_t), .Type = HID_DTYPE_HID},
.HIDSpec = VERSION_BCD(01.11),
.CountryCode = 0x00,
.TotalReportDescriptors = 1,
- .HIDReportType = DTYPE_Report,
+ .HIDReportType = HID_DTYPE_Report,
.HIDReportLength = sizeof(KeyboardReport)
},
@@ -254,11 +254,11 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
}
break;
- case DTYPE_HID:
+ case HID_DTYPE_HID:
Address = &ConfigurationDescriptor.HID_KeyboardHID;
- Size = sizeof(USB_Descriptor_HID_t);
+ Size = sizeof(USB_HID_Descriptor_HID_t);
break;
- case DTYPE_Report:
+ case HID_DTYPE_Report:
Address = &KeyboardReport;
Size = sizeof(KeyboardReport);
break;
diff --git a/Demos/Device/LowLevel/Keyboard/Descriptors.h b/Demos/Device/LowLevel/Keyboard/Descriptors.h
index 0ee13a4e4..75922954a 100644
--- a/Demos/Device/LowLevel/Keyboard/Descriptors.h
+++ b/Demos/Device/LowLevel/Keyboard/Descriptors.h
@@ -43,25 +43,6 @@
#include <avr/pgmspace.h>
/* Type Defines: */
- /** Type define for the HID class specific HID descriptor, to describe the HID device's specifications. Refer to the HID
- * specification for details on the structure elements.
- */
- typedef struct
- {
- USB_Descriptor_Header_t Header;
-
- uint16_t HIDSpec;
- uint8_t CountryCode;
-
- uint8_t TotalReportDescriptors;
-
- uint8_t HIDReportType;
- uint16_t HIDReportLength;
- } USB_Descriptor_HID_t;
-
- /** Type define for the data type used to store HID report descriptor elements. */
- typedef uint8_t USB_Descriptor_HIDReport_Datatype_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
* vary between devices, and which describe the device's usage to the host.
@@ -70,7 +51,7 @@
{
USB_Descriptor_Configuration_Header_t Config;
USB_Descriptor_Interface_t HID_Interface;
- USB_Descriptor_HID_t HID_KeyboardHID;
+ USB_HID_Descriptor_HID_t HID_KeyboardHID;
USB_Descriptor_Endpoint_t HID_ReportINEndpoint;
USB_Descriptor_Endpoint_t HID_ReportOUTEndpoint;
} USB_Descriptor_Configuration_t;
@@ -85,12 +66,6 @@
/** Size in bytes of the Keyboard HID reporting IN and OUT endpoints. */
#define KEYBOARD_EPSIZE 8
- /** Descriptor header type value, to indicate a HID class HID descriptor. */
- #define DTYPE_HID 0x21
-
- /** Descriptor header type value, to indicate a HID class HID report descriptor. */
- #define DTYPE_Report 0x22
-
/* Function Prototypes: */
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
const uint8_t wIndex,
diff --git a/Demos/Device/LowLevel/Keyboard/Keyboard.c b/Demos/Device/LowLevel/Keyboard/Keyboard.c
index 9d187f850..d1f52d16c 100644
--- a/Demos/Device/LowLevel/Keyboard/Keyboard.c
+++ b/Demos/Device/LowLevel/Keyboard/Keyboard.c
@@ -138,7 +138,7 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
/* Handle HID Class specific requests */
switch (USB_ControlRequest.bRequest)
{
- case REQ_GetReport:
+ case HID_REQ_GetReport:
if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))
{
USB_KeyboardReport_Data_t KeyboardReportData;
@@ -154,7 +154,7 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
}
break;
- case REQ_SetReport:
+ case HID_REQ_SetReport:
if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))
{
Endpoint_ClearSETUP();
@@ -177,7 +177,7 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
}
break;
- case REQ_GetProtocol:
+ case HID_REQ_GetProtocol:
if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))
{
Endpoint_ClearSETUP();
@@ -190,7 +190,7 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
}
break;
- case REQ_SetProtocol:
+ case HID_REQ_SetProtocol:
if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))
{
Endpoint_ClearSETUP();
@@ -201,7 +201,7 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
}
break;
- case REQ_SetIdle:
+ case HID_REQ_SetIdle:
if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))
{
Endpoint_ClearSETUP();
@@ -212,7 +212,7 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
}
break;
- case REQ_GetIdle:
+ case HID_REQ_GetIdle:
if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))
{
Endpoint_ClearSETUP();
@@ -251,7 +251,7 @@ void CreateKeyboardReport(USB_KeyboardReport_Data_t* const ReportData)
memset(ReportData, 0, sizeof(USB_KeyboardReport_Data_t));
/* Make sent key uppercase by indicating that the left shift key is pressed */
- ReportData->Modifier = KEYBOARD_MODIFER_LEFTSHIFT;
+ ReportData->Modifier = HID_KEYBOARD_MODIFER_LEFTSHIFT;
if (JoyStatus_LCL & JOY_UP)
ReportData->KeyCode[UsedKeyCodes++] = 0x04; // A
@@ -278,13 +278,13 @@ void ProcessLEDReport(const uint8_t LEDReport)
{
uint8_t LEDMask = LEDS_LED2;
- if (LEDReport & KEYBOARD_LED_NUMLOCK)
+ if (LEDReport & HID_KEYBOARD_LED_NUMLOCK)
LEDMask |= LEDS_LED1;
- if (LEDReport & KEYBOARD_LED_CAPSLOCK)
+ if (LEDReport & HID_KEYBOARD_LED_CAPSLOCK)
LEDMask |= LEDS_LED3;
- if (LEDReport & KEYBOARD_LED_SCROLLLOCK)
+ if (LEDReport & HID_KEYBOARD_LED_SCROLLLOCK)
LEDMask |= LEDS_LED4;
/* Set the status LEDs to the current Keyboard LED status */
@@ -305,7 +305,7 @@ void SendNextReport(void)
SendReport = (memcmp(&PrevKeyboardReportData, &KeyboardReportData, sizeof(USB_KeyboardReport_Data_t)) != 0);
/* Check if the idle period is set and has elapsed */
- if ((IdleCount != HID_IDLE_CHANGESONLY) && (!(IdleMSRemaining)))
+ if (IdleCount && (!(IdleMSRemaining)))
{
/* Reset the idle time remaining counter */
IdleMSRemaining = IdleCount;
diff --git a/Demos/Device/LowLevel/Keyboard/Keyboard.h b/Demos/Device/LowLevel/Keyboard/Keyboard.h
index 06526566c..d0502e1e5 100644
--- a/Demos/Device/LowLevel/Keyboard/Keyboard.h
+++ b/Demos/Device/LowLevel/Keyboard/Keyboard.h
@@ -54,63 +54,6 @@
#include <LUFA/Drivers/Board/LEDs.h>
/* Macros: */
- /** Idle period indicating that reports should be sent only when the inputs have changed. */
- #define HID_IDLE_CHANGESONLY 0
-
- /** HID Class specific request to get the next HID report from the device. */
- #define REQ_GetReport 0x01
-
- /** HID Class specific request to get the idle timeout period of the device. */
- #define REQ_GetIdle 0x02
-
- /** HID Class specific request to send the next HID report to the device. */
- #define REQ_SetReport 0x09
-
- /** HID Class specific request to set the idle timeout period of the device. */
- #define REQ_SetIdle 0x0A
-
- /** HID Class specific request to get the current HID protocol in use, either report or boot. */
- #define REQ_GetProtocol 0x03
-
- /** HID Class specific request to set the current HID protocol in use, either report or boot. */
- #define REQ_SetProtocol 0x0B
-
- /** Constant for a keyboard report modifier byte, indicating that the keyboard's left control key is currently pressed. */
- #define KEYBOARD_MODIFER_LEFTCTRL (1 << 0)
-
- /** Constant for a keyboard report modifier byte, indicating that the keyboard's left shift key is currently pressed. */
- #define KEYBOARD_MODIFER_LEFTSHIFT (1 << 1)
-
- /** Constant for a keyboard report modifier byte, indicating that the keyboard's left alt key is currently pressed. */
- #define KEYBOARD_MODIFER_LEFTALT (1 << 2)
-
- /** Constant for a keyboard report modifier byte, indicating that the keyboard's left GUI key is currently pressed. */
- #define KEYBOARD_MODIFER_LEFTGUI (1 << 3)
-
- /** Constant for a keyboard report modifier byte, indicating that the keyboard's right control key is currently pressed. */
- #define KEYBOARD_MODIFER_RIGHTCTRL (1 << 4)
-
- /** Constant for a keyboard report modifier byte, indicating that the keyboard's right shift key is currently pressed. */
- #define KEYBOARD_MODIFER_RIGHTSHIFT (1 << 5)
-
- /** Constant for a keyboard report modifier byte, indicating that the keyboard's right alt key is currently pressed. */
- #define KEYBOARD_MODIFER_RIGHTALT (1 << 6)
-
- /** Constant for a keyboard report modifier byte, indicating that the keyboard's right GUI key is currently pressed. */
- #define KEYBOARD_MODIFER_RIGHTGUI (1 << 7)
-
- /** Constant for a keyboard output report LED byte, indicating that the host's NUM LOCK mode is currently set. */
- #define KEYBOARD_LED_NUMLOCK (1 << 0)
-
- /** Constant for a keyboard output report LED byte, indicating that the host's CAPS LOCK mode is currently set. */
- #define KEYBOARD_LED_CAPSLOCK (1 << 1)
-
- /** Constant for a keyboard output report LED byte, indicating that the host's SCROLL LOCK mode is currently set. */
- #define KEYBOARD_LED_SCROLLLOCK (1 << 2)
-
- /** Constant for a keyboard output report LED byte, indicating that the host's KATANA mode is currently set. */
- #define KEYBOARD_LED_KATANA (1 << 3)
-
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
#define LEDMASK_USB_NOTREADY LEDS_LED1
@@ -123,17 +66,6 @@
/** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */
#define LEDMASK_USB_ERROR (LEDS_LED1 | LEDS_LED3)
- /* Type Defines: */
- /** Type define for the keyboard HID report structure, for creating and sending HID reports to the host PC.
- * This mirrors the layout described to the host in the HID report descriptor, in Descriptors.c.
- */
- typedef struct
- {
- uint8_t Modifier; /**< Modifier mask byte, containing a mask of modifier keys set (such as shift or CTRL) */
- uint8_t Reserved; /**< Reserved, always set as 0x00 */
- uint8_t KeyCode[6]; /**< Array of up to six simultaneous key codes of pressed keys */
- } USB_KeyboardReport_Data_t;
-
/* Function Prototypes: */
void SetupHardware(void);
void HID_Task(void);
diff --git a/Demos/Device/LowLevel/KeyboardMouse/Descriptors.c b/Demos/Device/LowLevel/KeyboardMouse/Descriptors.c
index b04dccdf8..39d6c73e8 100644
--- a/Demos/Device/LowLevel/KeyboardMouse/Descriptors.c
+++ b/Demos/Device/LowLevel/KeyboardMouse/Descriptors.c
@@ -180,12 +180,12 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.HID1_KeyboardHID =
{
- .Header = {.Size = sizeof(USB_Descriptor_HID_t), .Type = DTYPE_HID},
+ .Header = {.Size = sizeof(USB_HID_Descriptor_HID_t), .Type = HID_DTYPE_HID},
.HIDSpec = VERSION_BCD(01.11),
.CountryCode = 0x00,
.TotalReportDescriptors = 1,
- .HIDReportType = DTYPE_Report,
+ .HIDReportType = HID_DTYPE_Report,
.HIDReportLength = sizeof(KeyboardReport)
},
@@ -227,12 +227,12 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.HID2_MouseHID =
{
- .Header = {.Size = sizeof(USB_Descriptor_HID_t), .Type = DTYPE_HID},
+ .Header = {.Size = sizeof(USB_HID_Descriptor_HID_t), .Type = HID_DTYPE_HID},
.HIDSpec = VERSION_BCD(01.11),
.CountryCode = 0x00,
.TotalReportDescriptors = 1,
- .HIDReportType = DTYPE_Report,
+ .HIDReportType = HID_DTYPE_Report,
.HIDReportLength = sizeof(MouseReport)
},
@@ -324,19 +324,19 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
}
break;
- case DTYPE_HID:
+ case HID_DTYPE_HID:
if (!(wIndex))
{
Address = &ConfigurationDescriptor.HID1_KeyboardHID;
- Size = sizeof(USB_Descriptor_HID_t);
+ Size = sizeof(USB_HID_Descriptor_HID_t);
}
else
{
Address = &ConfigurationDescriptor.HID2_MouseHID;
- Size = sizeof(USB_Descriptor_HID_t);
+ Size = sizeof(USB_HID_Descriptor_HID_t);
}
break;
- case DTYPE_Report:
+ case HID_DTYPE_Report:
if (!(wIndex))
{
Address = &KeyboardReport;
diff --git a/Demos/Device/LowLevel/KeyboardMouse/Descriptors.h b/Demos/Device/LowLevel/KeyboardMouse/Descriptors.h
index 908591c26..11eadc771 100644
--- a/Demos/Device/LowLevel/KeyboardMouse/Descriptors.h
+++ b/Demos/Device/LowLevel/KeyboardMouse/Descriptors.h
@@ -43,25 +43,6 @@
#include <avr/pgmspace.h>
/* Type Defines: */
- /** Type define for the HID class specific HID descriptor, to describe the HID device's specifications. Refer to the HID
- * specification for details on the structure elements.
- */
- typedef struct
- {
- USB_Descriptor_Header_t Header;
-
- uint16_t HIDSpec;
- uint8_t CountryCode;
-
- uint8_t TotalReportDescriptors;
-
- uint8_t HIDReportType;
- uint16_t HIDReportLength;
- } USB_Descriptor_HID_t;
-
- /** Type define for the data type used to store HID report descriptor elements. */
- typedef uint8_t USB_Descriptor_HIDReport_Datatype_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
* vary between devices, and which describe the device's usage to the host.
@@ -70,11 +51,11 @@
{
USB_Descriptor_Configuration_Header_t Config;
USB_Descriptor_Interface_t HID1_KeyboardInterface;
- USB_Descriptor_HID_t HID1_KeyboardHID;
+ USB_HID_Descriptor_HID_t HID1_KeyboardHID;
USB_Descriptor_Endpoint_t HID1_ReportINEndpoint;
USB_Descriptor_Endpoint_t HID1_ReportOUTEndpoint;
USB_Descriptor_Interface_t HID2_MouseInterface;
- USB_Descriptor_HID_t HID2_MouseHID;
+ USB_HID_Descriptor_HID_t HID2_MouseHID;
USB_Descriptor_Endpoint_t HID2_ReportINEndpoint;
} USB_Descriptor_Configuration_t;
@@ -91,12 +72,6 @@
/** Size in bytes of each of the HID reporting IN and OUT endpoints. */
#define HID_EPSIZE 8
- /** Descriptor header type value, to indicate a HID class HID descriptor. */
- #define DTYPE_HID 0x21
-
- /** Descriptor header type value, to indicate a HID class HID report descriptor. */
- #define DTYPE_Report 0x22
-
/* Function Prototypes: */
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
const uint8_t wIndex,
diff --git a/Demos/Device/LowLevel/KeyboardMouse/KeyboardMouse.c b/Demos/Device/LowLevel/KeyboardMouse/KeyboardMouse.c
index 678957378..fc81445c1 100644
--- a/Demos/Device/LowLevel/KeyboardMouse/KeyboardMouse.c
+++ b/Demos/Device/LowLevel/KeyboardMouse/KeyboardMouse.c
@@ -129,7 +129,7 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
/* Handle HID Class specific requests */
switch (USB_ControlRequest.bRequest)
{
- case REQ_GetReport:
+ case HID_REQ_GetReport:
if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))
{
Endpoint_ClearSETUP();
@@ -155,7 +155,7 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
}
break;
- case REQ_SetReport:
+ case HID_REQ_SetReport:
if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))
{
Endpoint_ClearSETUP();
@@ -190,13 +190,13 @@ void Keyboard_ProcessLEDReport(const uint8_t LEDStatus)
{
uint8_t LEDMask = LEDS_LED2;
- if (LEDStatus & KEYBOARD_LED_NUMLOCK)
+ if (LEDStatus & HID_KEYBOARD_LED_NUMLOCK)
LEDMask |= LEDS_LED1;
- if (LEDStatus & KEYBOARD_LED_CAPSLOCK)
+ if (LEDStatus & HID_KEYBOARD_LED_CAPSLOCK)
LEDMask |= LEDS_LED3;
- if (LEDStatus & KEYBOARD_LED_SCROLLLOCK)
+ if (LEDStatus & HID_KEYBOARD_LED_SCROLLLOCK)
LEDMask |= LEDS_LED4;
/* Set the status LEDs to the current Keyboard LED status */
@@ -219,7 +219,7 @@ void Keyboard_HID_Task(void)
if (!(Buttons_GetStatus() & BUTTONS_BUTTON1))
{
/* Make sent key uppercase by indicating that the left shift key is pressed */
- KeyboardReportData.Modifier = KEYBOARD_MODIFER_LEFTSHIFT;
+ KeyboardReportData.Modifier = HID_KEYBOARD_MODIFER_LEFTSHIFT;
if (JoyStatus_LCL & JOY_UP)
KeyboardReportData.KeyCode[0] = 0x04; // A
diff --git a/Demos/Device/LowLevel/KeyboardMouse/KeyboardMouse.h b/Demos/Device/LowLevel/KeyboardMouse/KeyboardMouse.h
index 40572992d..bcf77ccd6 100644
--- a/Demos/Device/LowLevel/KeyboardMouse/KeyboardMouse.h
+++ b/Demos/Device/LowLevel/KeyboardMouse/KeyboardMouse.h
@@ -49,54 +49,6 @@
#include <LUFA/Drivers/Board/Buttons.h>
/* Macros: */
- /** HID Class specific request to get the next HID report from the device. */
- #define REQ_GetReport 0x01
-
- /** HID Class specific request to send the next HID report to the device. */
- #define REQ_SetReport 0x09
-
- /** HID Class specific request to get the current HID protocol in use, either report or boot. */
- #define REQ_GetProtocol 0x03
-
- /** HID Class specific request to set the current HID protocol in use, either report or boot. */
- #define REQ_SetProtocol 0x0B
-
- /** Constant for a keyboard report modifier byte, indicating that the keyboard's left control key is currently pressed. */
- #define KEYBOARD_MODIFER_LEFTCTRL (1 << 0)
-
- /** Constant for a keyboard report modifier byte, indicating that the keyboard's left shift key is currently pressed. */
- #define KEYBOARD_MODIFER_LEFTSHIFT (1 << 1)
-
- /** Constant for a keyboard report modifier byte, indicating that the keyboard's left alt key is currently pressed. */
- #define KEYBOARD_MODIFER_LEFTALT (1 << 2)
-
- /** Constant for a keyboard report modifier byte, indicating that the keyboard's left GUI key is currently pressed. */
- #define KEYBOARD_MODIFER_LEFTGUI (1 << 3)
-
- /** Constant for a keyboard report modifier byte, indicating that the keyboard's right control key is currently pressed. */
- #define KEYBOARD_MODIFER_RIGHTCTRL (1 << 4)
-
- /** Constant for a keyboard report modifier byte, indicating that the keyboard's right shift key is currently pressed. */
- #define KEYBOARD_MODIFER_RIGHTSHIFT (1 << 5)
-
- /** Constant for a keyboard report modifier byte, indicating that the keyboard's right alt key is currently pressed. */
- #define KEYBOARD_MODIFER_RIGHTALT (1 << 6)
-
- /** Constant for a keyboard report modifier byte, indicating that the keyboard's right GUI key is currently pressed. */
- #define KEYBOARD_MODIFER_RIGHTGUI (1 << 7)
-
- /** Constant for a keyboard output report LED byte, indicating that the host's NUM LOCK mode is currently set. */
- #define KEYBOARD_LED_NUMLOCK (1 << 0)
-
- /** Constant for a keyboard output report LED byte, indicating that the host's CAPS LOCK mode is currently set. */
- #define KEYBOARD_LED_CAPSLOCK (1 << 1)
-
- /** Constant for a keyboard output report LED byte, indicating that the host's SCROLL LOCK mode is currently set. */
- #define KEYBOARD_LED_SCROLLLOCK (1 << 2)
-
- /** Constant for a keyboard output report LED byte, indicating that the host's KATANA mode is currently set. */
- #define KEYBOARD_LED_KATANA (1 << 3)
-
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
#define LEDMASK_USB_NOTREADY LEDS_LED1
@@ -109,27 +61,6 @@
/** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */
#define LEDMASK_USB_ERROR (LEDS_LED1 | LEDS_LED3)
- /* Type Defines: */
- /** Type define for the keyboard HID report structure, for creating and sending HID reports to the host PC.
- * This mirrors the layout described to the host in the HID report descriptor, in Descriptors.c.
- */
- typedef struct
- {
- uint8_t Modifier; /**< Modifier mask byte, containing a mask of modifier keys set (such as shift or CTRL) */
- uint8_t Reserved; /**< Reserved, always set as 0x00 */
- uint8_t KeyCode[6]; /**< Array of up to six simultaneous key codes of pressed keys */
- } USB_KeyboardReport_Data_t;
-
- /** Type define for the mouse HID report structure, for creating and sending HID reports to the host PC.
- * This mirrors the layout described to the host in the HID report descriptor, in Descriptors.c.
- */
- typedef struct
- {
- uint8_t Button; /**< Bit mask of the currently pressed mouse buttons */
- int8_t X; /**< Current mouse delta X movement, as a signed 8-bit integer */
- int8_t Y; /**< Current mouse delta Y movement, as a signed 8-bit integer */
- } USB_MouseReport_Data_t;
-
/* Function Prototypes: */
void SetupHardware(void);
void Keyboard_ProcessLEDReport(const uint8_t LEDStatus);
diff --git a/Demos/Device/LowLevel/MIDI/Descriptors.c b/Demos/Device/LowLevel/MIDI/Descriptors.c
index 5640c67ca..d6092bbd4 100644
--- a/Demos/Device/LowLevel/MIDI/Descriptors.c
+++ b/Demos/Device/LowLevel/MIDI/Descriptors.c
@@ -104,14 +104,14 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.Audio_ControlInterface_SPC =
{
- .Header = {.Size = sizeof(USB_Audio_Interface_AC_t), .Type = DTYPE_CSInterface},
- .Subtype = DSUBTYPE_AudioHeader,
+ .Header = {.Size = sizeof(USB_Audio_Descriptor_Interface_AC_t), .Type = DTYPE_CSInterface},
+ .Subtype = AUDIO_DSUBTYPE_CSInterface_Header,
- .AudioSpecification = VERSION_BCD(01.00),
- .TotalLength = sizeof(USB_Audio_Interface_AC_t),
+ .ACSpecification = VERSION_BCD(01.00),
+ .TotalLength = sizeof(USB_Audio_Descriptor_Interface_AC_t),
.InCollection = 1,
- .InterfaceNumbers = {1},
+ .InterfaceNumber = 1,
},
.Audio_StreamInterface =
@@ -132,8 +132,8 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.Audio_StreamInterface_SPC =
{
- .Header = {.Size = sizeof(USB_Audio_Interface_MIDI_AS_t), .Type = DTYPE_CSInterface},
- .Subtype = DSUBTYPE_General,
+ .Header = {.Size = sizeof(USB_MIDI_Descriptor_AudioInterface_AS_t), .Type = DTYPE_CSInterface},
+ .Subtype = AUDIO_DSUBTYPE_CSInterface_General,
.AudioSpecification = VERSION_BCD(01.00),
@@ -143,10 +143,10 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.MIDI_In_Jack_Emb =
{
- .Header = {.Size = sizeof(USB_MIDI_In_Jack_t), .Type = DTYPE_CSInterface},
- .Subtype = DSUBTYPE_InputJack,
+ .Header = {.Size = sizeof(USB_MIDI_Descriptor_InputJack_t), .Type = DTYPE_CSInterface},
+ .Subtype = AUDIO_DSUBTYPE_CSInterface_InputTerminal,
- .JackType = JACKTYPE_EMBEDDED,
+ .JackType = MIDI_JACKTYPE_Embedded,
.JackID = 0x01,
.JackStrIndex = NO_DESCRIPTOR
@@ -154,10 +154,10 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.MIDI_In_Jack_Ext =
{
- .Header = {.Size = sizeof(USB_MIDI_In_Jack_t), .Type = DTYPE_CSInterface},
- .Subtype = DSUBTYPE_InputJack,
+ .Header = {.Size = sizeof(USB_MIDI_Descriptor_InputJack_t), .Type = DTYPE_CSInterface},
+ .Subtype = AUDIO_DSUBTYPE_CSInterface_InputTerminal,
- .JackType = JACKTYPE_EXTERNAL,
+ .JackType = MIDI_JACKTYPE_External,
.JackID = 0x02,
.JackStrIndex = NO_DESCRIPTOR
@@ -165,10 +165,10 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.MIDI_Out_Jack_Emb =
{
- .Header = {.Size = sizeof(USB_MIDI_Out_Jack_t), .Type = DTYPE_CSInterface},
- .Subtype = DSUBTYPE_OutputJack,
+ .Header = {.Size = sizeof(USB_MIDI_Descriptor_OutputJack_t), .Type = DTYPE_CSInterface},
+ .Subtype = AUDIO_DSUBTYPE_CSInterface_OutputTerminal,
- .JackType = JACKTYPE_EMBEDDED,
+ .JackType = MIDI_JACKTYPE_Embedded,
.JackID = 0x03,
.NumberOfPins = 1,
@@ -180,10 +180,10 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.MIDI_Out_Jack_Ext =
{
- .Header = {.Size = sizeof(USB_MIDI_Out_Jack_t), .Type = DTYPE_CSInterface},
- .Subtype = DSUBTYPE_OutputJack,
+ .Header = {.Size = sizeof(USB_MIDI_Descriptor_OutputJack_t), .Type = DTYPE_CSInterface},
+ .Subtype = AUDIO_DSUBTYPE_CSInterface_OutputTerminal,
- .JackType = JACKTYPE_EXTERNAL,
+ .JackType = MIDI_JACKTYPE_External,
.JackID = 0x04,
.NumberOfPins = 1,
@@ -197,7 +197,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
.Endpoint =
{
- .Header = {.Size = sizeof(USB_Audio_StreamEndpoint_Std_t), .Type = DTYPE_Endpoint},
+ .Header = {.Size = sizeof(USB_Audio_Descriptor_StreamEndpoint_Std_t), .Type = DTYPE_Endpoint},
.EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_OUT | MIDI_STREAM_OUT_EPNUM),
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
@@ -211,8 +211,8 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.MIDI_In_Jack_Endpoint_SPC =
{
- .Header = {.Size = sizeof(USB_MIDI_Jack_Endpoint_t), .Type = DTYPE_CSEndpoint},
- .Subtype = DSUBTYPE_General,
+ .Header = {.Size = sizeof(USB_MIDI_Descriptor_Jack_Endpoint_t), .Type = DTYPE_CSEndpoint},
+ .Subtype = AUDIO_DSUBTYPE_CSEndpoint_General,
.TotalEmbeddedJacks = 0x01,
.AssociatedJackID = {0x01}
@@ -222,7 +222,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
.Endpoint =
{
- .Header = {.Size = sizeof(USB_Audio_StreamEndpoint_Std_t), .Type = DTYPE_Endpoint},
+ .Header = {.Size = sizeof(USB_Audio_Descriptor_StreamEndpoint_Std_t), .Type = DTYPE_Endpoint},
.EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_IN | MIDI_STREAM_IN_EPNUM),
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
@@ -236,8 +236,8 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.MIDI_Out_Jack_Endpoint_SPC =
{
- .Header = {.Size = sizeof(USB_MIDI_Jack_Endpoint_t), .Type = DTYPE_CSEndpoint},
- .Subtype = DSUBTYPE_General,
+ .Header = {.Size = sizeof(USB_MIDI_Descriptor_Jack_Endpoint_t), .Type = DTYPE_CSEndpoint},
+ .Subtype = AUDIO_DSUBTYPE_CSEndpoint_General,
.TotalEmbeddedJacks = 0x01,
.AssociatedJackID = {0x03}
diff --git a/Demos/Device/LowLevel/MIDI/Descriptors.h b/Demos/Device/LowLevel/MIDI/Descriptors.h
index abaabb731..deae054bb 100644
--- a/Demos/Device/LowLevel/MIDI/Descriptors.h
+++ b/Demos/Device/LowLevel/MIDI/Descriptors.h
@@ -42,24 +42,6 @@
#include <avr/pgmspace.h>
/* Macros: */
- /** Audio class descriptor subtype value for a Audio class specific header descriptor. */
- #define DSUBTYPE_AudioHeader 0x01
-
- /** Audio class descriptor subtype value for a Audio class specific MIDI input jack descriptor. */
- #define DSUBTYPE_InputJack 0x02
-
- /** Audio class descriptor subtype value for a Audio class specific MIDI output jack descriptor. */
- #define DSUBTYPE_OutputJack 0x03
-
- /** Audio class descriptor subtype value for a general Audio class specific descriptor. */
- #define DSUBTYPE_General 0x01
-
- /** Audio class descriptor jack type value for an embedded (logical) MIDI input or output jack. */
- #define JACKTYPE_EMBEDDED 0x01
-
- /** Audio class descriptor jack type value for an external (physical) MIDI input or output jack. */
- #define JACKTYPE_EXTERNAL 0x02
-
/** Endpoint number of the MIDI streaming data IN endpoint, for device-to-host data transfers. */
#define MIDI_STREAM_IN_EPNUM 1
@@ -70,110 +52,25 @@
#define MIDI_STREAM_EPSIZE 64
/* Type Defines: */
- /** Type define for an Audio class specific interface descriptor. This follows a regular interface descriptor to
- * supply extra information about the audio device's layout to the host. See the USB Audio specification for more
- * details.
- */
- typedef struct
- {
- USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length */
- uint8_t Subtype; /**< Sub type value used to distinguish between audio class specific descriptors */
-
- uint16_t AudioSpecification; /**< Binary coded decimal value, indicating the supported Audio Class specification version */
- uint16_t TotalLength; /**< Total length of the Audio class specific control descriptors, including this descriptor */
-
- uint8_t InCollection; /**< Total number of audio class interfaces within this device */
- uint8_t InterfaceNumbers[1]; /**< Interface numbers of each audio interface */
- } 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.
- * See the USB Audio specification for more details.
- */
- typedef struct
- {
- USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length */
- uint8_t Subtype; /**< Sub type value used to distinguish between audio class specific descriptors */
-
- 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_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.
- */
- typedef struct
- {
- USB_Descriptor_Endpoint_t Endpoint; /**< Standard endpoint descriptor describing the audio endpoint */
-
- uint8_t Refresh; /**< Always set to zero */
- uint8_t SyncEndpointNumber; /**< Endpoint address to send synchronization information to, if needed (zero otherwise) */
- } 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).
- */
- typedef struct
- {
- USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length */
- uint8_t Subtype; /**< Sub type value used to distinguish between audio class specific descriptors */
-
- uint8_t JackType; /**< Type of jack, one of the JACKTYPE_* mask values */
- uint8_t JackID; /**< ID value of this jack - must be a unique value within the device */
-
- uint8_t JackStrIndex; /**< Index of a string descriptor describing this descriptor within the device */
- } USB_MIDI_In_Jack_t;
-
- /** Type define for an Audio class specific MIDI OUT jack. This gives information to the host on a MIDI output, either
- * a physical output jack, or a logical jack (sending output data internally, or to the host via an endpoint).
- */
- typedef struct
- {
- USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length */
- uint8_t Subtype; /**< Sub type value used to distinguish between audio class specific descriptors */
-
- uint8_t JackType; /**< Type of jack, one of the JACKTYPE_* mask values */
- uint8_t JackID; /**< ID value of this jack - must be a unique value within the device */
-
- uint8_t NumberOfPins; /**< Number of output channels within the jack, either physical or logical */
- uint8_t SourceJackID[1]; /**< ID of each output pin's source data jack */
- uint8_t SourcePinID[1]; /**< Pin number in the input jack of each output pin's source data */
-
- uint8_t JackStrIndex; /**< Index of a string descriptor describing this descriptor within the device */
- } USB_MIDI_Out_Jack_t;
-
- /** Type define for an Audio class specific extended MIDI jack endpoint descriptor. This contains extra information
- * on the usage of MIDI endpoints used to stream MIDI events in and out of the USB Audio device, and follows an Audio
- * class specific extended MIDI endpoint descriptor. See the USB Audio specification for more details.
- */
- typedef struct
- {
- USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length */
- uint8_t Subtype; /**< Sub type value used to distinguish between audio class specific descriptors */
-
- uint8_t TotalEmbeddedJacks; /**< Total number of jacks inside this endpoint */
- uint8_t AssociatedJackID[1]; /**< IDs of each jack inside the endpoint */
- } USB_MIDI_Jack_Endpoint_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
* vary between devices, and which describe the device's usage to the host.
*/
typedef struct
{
- USB_Descriptor_Configuration_Header_t Config;
- USB_Descriptor_Interface_t Audio_ControlInterface;
- USB_Audio_Interface_AC_t Audio_ControlInterface_SPC;
- USB_Descriptor_Interface_t Audio_StreamInterface;
- USB_Audio_Interface_MIDI_AS_t Audio_StreamInterface_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_Audio_StreamEndpoint_Std_t MIDI_In_Jack_Endpoint;
- USB_MIDI_Jack_Endpoint_t MIDI_In_Jack_Endpoint_SPC;
- USB_Audio_StreamEndpoint_Std_t MIDI_Out_Jack_Endpoint;
- USB_MIDI_Jack_Endpoint_t MIDI_Out_Jack_Endpoint_SPC;
+ USB_Descriptor_Configuration_Header_t Config;
+ USB_Descriptor_Interface_t Audio_ControlInterface;
+ USB_Audio_Descriptor_Interface_AC_t Audio_ControlInterface_SPC;
+ USB_Descriptor_Interface_t Audio_StreamInterface;
+ USB_MIDI_Descriptor_AudioInterface_AS_t Audio_StreamInterface_SPC;
+ USB_MIDI_Descriptor_InputJack_t MIDI_In_Jack_Emb;
+ USB_MIDI_Descriptor_InputJack_t MIDI_In_Jack_Ext;
+ USB_MIDI_Descriptor_OutputJack_t MIDI_Out_Jack_Emb;
+ USB_MIDI_Descriptor_OutputJack_t MIDI_Out_Jack_Ext;
+ USB_Audio_Descriptor_StreamEndpoint_Std_t MIDI_In_Jack_Endpoint;
+ USB_MIDI_Descriptor_Jack_Endpoint_t MIDI_In_Jack_Endpoint_SPC;
+ USB_Audio_Descriptor_StreamEndpoint_Std_t MIDI_Out_Jack_Endpoint;
+ USB_MIDI_Descriptor_Jack_Endpoint_t MIDI_Out_Jack_Endpoint_SPC;
} USB_Descriptor_Configuration_t;
/* Function Prototypes: */
diff --git a/Demos/Device/LowLevel/MIDI/MIDI.c b/Demos/Device/LowLevel/MIDI/MIDI.c
index 4696d2336..05a3a71fc 100644
--- a/Demos/Device/LowLevel/MIDI/MIDI.c
+++ b/Demos/Device/LowLevel/MIDI/MIDI.c
@@ -160,7 +160,7 @@ void MIDI_Task(void)
/* Check if a MIDI command is to be sent */
if (MIDICommand)
{
- USB_MIDI_EventPacket_t MIDIEvent = (USB_MIDI_EventPacket_t)
+ MIDI_EventPacket_t MIDIEvent = (MIDI_EventPacket_t)
{
.CableNumber = 0,
.Command = (MIDICommand >> 4),
@@ -187,7 +187,7 @@ void MIDI_Task(void)
/* Check if a MIDI command has been received */
if (Endpoint_IsOUTReceived())
{
- USB_MIDI_EventPacket_t MIDIEvent;
+ MIDI_EventPacket_t MIDIEvent;
/* Read the MIDI event packet from the endpoint */
Endpoint_Read_Stream_LE(&MIDIEvent, sizeof(MIDIEvent));
diff --git a/Demos/Device/LowLevel/MIDI/MIDI.h b/Demos/Device/LowLevel/MIDI/MIDI.h
index e2f39f3bd..36a1afc45 100644
--- a/Demos/Device/LowLevel/MIDI/MIDI.h
+++ b/Demos/Device/LowLevel/MIDI/MIDI.h
@@ -52,22 +52,6 @@
#include <LUFA/Drivers/Board/Buttons.h>
/* Macros: */
- /** MIDI command for a note on (activation) event. */
- #define MIDI_COMMAND_NOTE_ON 0x90
-
- /** MIDI command for a note off (deactivation) event. */
- #define MIDI_COMMAND_NOTE_OFF 0x80
-
- /** Standard key press velocity value used for all note events, as no pressure sensor is mounted. */
- #define MIDI_STANDARD_VELOCITY 64
-
- /** Convenience macro. MIDI channels are numbered from 1-10 (natural numbers) however the logical channel
- * addresses are zero-indexed. This converts a natural MIDI channel number into the logical channel address.
- *
- * \param[in] channel MIDI channel number to address
- */
- #define MIDI_CHANNEL(channel) ((channel) - 1)
-
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
#define LEDMASK_USB_NOTREADY LEDS_LED1
@@ -80,18 +64,6 @@
/** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */
#define LEDMASK_USB_ERROR (LEDS_LED1 | LEDS_LED3)
- /* Type Defines: */
- /** Type define for a USB MIDI event packet, used to encapsulate sent and received MIDI messages from a USB MIDI interface. */
- typedef struct
- {
- unsigned char Command : 4; /**< MIDI command being sent or received in the event packet */
- unsigned char CableNumber : 4; /**< Virtual cable number of the event being sent or received in the given MIDI interface */
-
- 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;
-
/* Function Prototypes: */
void SetupHardware(void);
void MIDI_Task(void);
diff --git a/Demos/Device/LowLevel/MassStorage/Lib/SCSI.h b/Demos/Device/LowLevel/MassStorage/Lib/SCSI.h
index 0c4869df4..5a7a3e0a1 100644
--- a/Demos/Device/LowLevel/MassStorage/Lib/SCSI.h
+++ b/Demos/Device/LowLevel/MassStorage/Lib/SCSI.h
@@ -47,7 +47,6 @@
#include "MassStorage.h"
#include "Descriptors.h"
#include "DataflashManager.h"
- #include "SCSI_Codes.h"
/* Macros: */
/** Macro to set the current SCSI sense data to the given key, additional sense code and additional sense qualifier. This
@@ -109,7 +108,7 @@
uint8_t VendorID[8];
uint8_t ProductID[16];
uint8_t RevisionID[4];
- } SCSI_Inquiry_Response_t;
+ } MS_SCSI_Inquiry_Response_t;
/** Type define for a SCSI sense structure to a SCSI REQUEST SENSE command. For details of the
* structure contents, refer to the SCSI specifications.
@@ -133,7 +132,7 @@
uint8_t AdditionalSenseQualifier;
uint8_t FieldReplaceableUnitCode;
uint8_t SenseKeySpecific[3];
- } SCSI_Request_Sense_Response_t;
+ } MS_SCSI_Request_Sense_Response_t;
/* Function Prototypes: */
bool SCSI_DecodeSCSICommand(void);
diff --git a/Demos/Device/LowLevel/MassStorage/Lib/SCSI_Codes.h b/Demos/Device/LowLevel/MassStorage/Lib/SCSI_Codes.h
deleted file mode 100644
index 6bcd5780f..000000000
--- a/Demos/Device/LowLevel/MassStorage/Lib/SCSI_Codes.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- LUFA Library
- Copyright (C) Dean Camera, 2010.
-
- dean [at] fourwalledcubicle [dot] com
- www.fourwalledcubicle.com
-*/
-
-/*
- Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
- all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
- software without specific, written prior permission.
-
- The author disclaim all warranties with regard to this
- software, including all implied warranties of merchantability
- and fitness. In no event shall the author be liable for any
- special, indirect or consequential damages or any damages
- whatsoever resulting from loss of use, data or profits, whether
- in an action of contract, negligence or other tortious action,
- arising out of or in connection with the use or performance of
- this software.
-*/
-
-/** \file
- *
- * Header containing macros for possible SCSI commands and SENSE data. Refer to
- * the SCSI standard documentation for more information on each SCSI command and
- * the SENSE data.
- */
-
-#ifndef _SCSI_CODES_H_
-#define _SCSI_CODES_H_
-
- /* Macros: */
- #define SCSI_CMD_INQUIRY 0x12
- #define SCSI_CMD_REQUEST_SENSE 0x03
- #define SCSI_CMD_TEST_UNIT_READY 0x00
- #define SCSI_CMD_READ_CAPACITY_10 0x25
- #define SCSI_CMD_SEND_DIAGNOSTIC 0x1D
- #define SCSI_CMD_PREVENT_ALLOW_MEDIUM_REMOVAL 0x1E
- #define SCSI_CMD_WRITE_10 0x2A
- #define SCSI_CMD_READ_10 0x28
- #define SCSI_CMD_WRITE_6 0x0A
- #define SCSI_CMD_READ_6 0x08
- #define SCSI_CMD_VERIFY_10 0x2F
- #define SCSI_CMD_MODE_SENSE_6 0x1A
- #define SCSI_CMD_MODE_SENSE_10 0x5A
-
- #define SCSI_SENSE_KEY_GOOD 0x00
- #define SCSI_SENSE_KEY_RECOVERED_ERROR 0x01
- #define SCSI_SENSE_KEY_NOT_READY 0x02
- #define SCSI_SENSE_KEY_MEDIUM_ERROR 0x03
- #define SCSI_SENSE_KEY_HARDWARE_ERROR 0x04
- #define SCSI_SENSE_KEY_ILLEGAL_REQUEST 0x05
- #define SCSI_SENSE_KEY_UNIT_ATTENTION 0x06
- #define SCSI_SENSE_KEY_DATA_PROTECT 0x07
- #define SCSI_SENSE_KEY_BLANK_CHECK 0x08
- #define SCSI_SENSE_KEY_VENDOR_SPECIFIC 0x09
- #define SCSI_SENSE_KEY_COPY_ABORTED 0x0A
- #define SCSI_SENSE_KEY_ABORTED_COMMAND 0x0B
- #define SCSI_SENSE_KEY_VOLUME_OVERFLOW 0x0D
- #define SCSI_SENSE_KEY_MISCOMPARE 0x0E
-
- #define SCSI_ASENSE_NO_ADDITIONAL_INFORMATION 0x00
- #define SCSI_ASENSE_LOGICAL_UNIT_NOT_READY 0x04
- #define SCSI_ASENSE_INVALID_COMMAND 0x20
- #define SCSI_ASENSE_LOGICAL_BLOCK_ADDRESS_OUT_OF_RANGE 0x21
- #define SCSI_ASENSE_INVALID_FIELD_IN_CDB 0x24
- #define SCSI_ASENSE_WRITE_PROTECTED 0x27
- #define SCSI_ASENSE_NOT_READY_TO_READY_CHANGE 0x28
- #define SCSI_ASENSE_FORMAT_ERROR 0x31
- #define SCSI_ASENSE_MEDIUM_NOT_PRESENT 0x3A
-
- #define SCSI_ASENSEQ_NO_QUALIFIER 0x00
- #define SCSI_ASENSEQ_FORMAT_COMMAND_FAILED 0x01
- #define SCSI_ASENSEQ_INITIALIZING_COMMAND_REQUIRED 0x02
- #define SCSI_ASENSEQ_OPERATION_IN_PROGRESS 0x07
-
-#endif
-
diff --git a/Demos/Device/LowLevel/MassStorage/MassStorage.c b/Demos/Device/LowLevel/MassStorage/MassStorage.c
index a168061f5..9eb964e75 100644
--- a/Demos/Device/LowLevel/MassStorage/MassStorage.c
+++ b/Demos/Device/LowLevel/MassStorage/MassStorage.c
@@ -38,13 +38,13 @@
#include "MassStorage.h"
/** Structure to hold the latest Command Block Wrapper issued by the host, containing a SCSI command to execute. */
-CommandBlockWrapper_t CommandBlock;
+MS_CommandBlockWrapper_t CommandBlock;
/** Structure to hold the latest Command Status Wrapper to return to the host, containing the status of the last issued command. */
-CommandStatusWrapper_t CommandStatus = { .Signature = CSW_SIGNATURE };
+MS_CommandStatusWrapper_t CommandStatus = { .Signature = MS_CSW_SIGNATURE };
/** Flag to asynchronously abort any in-progress data transfers upon the reception of a mass storage reset command. */
-volatile bool IsMassStoreReset = false;
+volatile bool IsMassStoreReset = false;
/** Main program entry point. This routine configures the hardware required by the application, then
@@ -129,7 +129,7 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
/* Process UFI specific control requests */
switch (USB_ControlRequest.bRequest)
{
- case REQ_MassStorageReset:
+ case MS_REQ_MassStorageReset:
if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))
{
Endpoint_ClearSETUP();
@@ -140,7 +140,7 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
}
break;
- case REQ_GetMaxLUN:
+ case MS_REQ_GetMaxLUN:
if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))
{
Endpoint_ClearSETUP();
@@ -172,11 +172,11 @@ void MassStorage_Task(void)
LEDs_SetAllLEDs(LEDMASK_USB_BUSY);
/* Check direction of command, select Data IN endpoint if data is from the device */
- if (CommandBlock.Flags & COMMAND_DIRECTION_DATA_IN)
+ if (CommandBlock.Flags & MS_COMMAND_DIR_DATA_IN)
Endpoint_SelectEndpoint(MASS_STORAGE_IN_EPNUM);
/* Decode the received SCSI command, set returned status code */
- CommandStatus.Status = SCSI_DecodeSCSICommand() ? Command_Pass : Command_Fail;
+ CommandStatus.Status = SCSI_DecodeSCSICommand() ? MS_SCSI_COMMAND_Pass : MS_SCSI_COMMAND_Fail;
/* Load in the CBW tag into the CSW to link them together */
CommandStatus.Tag = CommandBlock.Tag;
@@ -185,7 +185,7 @@ void MassStorage_Task(void)
CommandStatus.DataTransferResidue = CommandBlock.DataTransferLength;
/* Stall the selected data pipe if command failed (if data is still to be transferred) */
- if ((CommandStatus.Status == Command_Fail) && (CommandStatus.DataTransferResidue))
+ if ((CommandStatus.Status == MS_SCSI_COMMAND_Fail) && (CommandStatus.DataTransferResidue))
Endpoint_StallTransaction();
/* Return command status block to the host */
@@ -237,11 +237,11 @@ static bool ReadInCommandBlock(void)
return false;
/* Verify the command block - abort if invalid */
- if ((CommandBlock.Signature != CBW_SIGNATURE) ||
- (CommandBlock.LUN >= TOTAL_LUNS) ||
- (CommandBlock.Flags & 0x1F) ||
- (CommandBlock.SCSICommandLength == 0) ||
- (CommandBlock.SCSICommandLength > MAX_SCSI_COMMAND_LENGTH))
+ if ((CommandBlock.Signature != MS_CBW_SIGNATURE) ||
+ (CommandBlock.LUN >= TOTAL_LUNS) ||
+ (CommandBlock.Flags & 0x1F) ||
+ (CommandBlock.SCSICommandLength == 0) ||
+ (CommandBlock.SCSICommandLength > sizeof(CommandBlock.SCSICommandData)))
{
/* Stall both data pipes until reset by host */
Endpoint_StallTransaction();
diff --git a/Demos/Device/LowLevel/MassStorage/MassStorage.h b/Demos/Device/LowLevel/MassStorage/MassStorage.h
index d993a9a5d..825d96912 100644
--- a/Demos/Device/LowLevel/MassStorage/MassStorage.h
+++ b/Demos/Device/LowLevel/MassStorage/MassStorage.h
@@ -53,27 +53,6 @@
#include <LUFA/Drivers/Board/Dataflash.h>
/* Macros: */
- /** Mass Storage Class specific request to reset the Mass Storage interface, ready for the next command. */
- #define REQ_MassStorageReset 0xFF
-
- /** Mass Storage Class specific request to retrieve the total number of Logical Units (drives) in the SCSI device. */
- #define REQ_GetMaxLUN 0xFE
-
- /** Maximum length of a SCSI command which can be issued by the device or host in a Mass Storage bulk wrapper. */
- #define MAX_SCSI_COMMAND_LENGTH 16
-
- /** Magic signature for a Command Block Wrapper used in the Mass Storage Bulk-Only transport protocol. */
- #define CBW_SIGNATURE 0x43425355UL
-
- /** Magic signature for a Command Status Wrapper used in the Mass Storage Bulk-Only transport protocol. */
- #define CSW_SIGNATURE 0x53425355UL
-
- /** Mask for a Command Block Wrapper's flags attribute to specify a command with data sent from host-to-device. */
- #define COMMAND_DIRECTION_DATA_OUT (0 << 7)
-
- /** Mask for a Command Block Wrapper's flags attribute to specify a command with data sent from device-to-host. */
- #define COMMAND_DIRECTION_DATA_IN (1 << 7)
-
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
#define LEDMASK_USB_NOTREADY LEDS_LED1
@@ -89,41 +68,10 @@
/** LED mask for the library LED driver, to indicate that the USB interface is busy. */
#define LEDMASK_USB_BUSY LEDS_LED2
- /* Type Defines: */
- /** Type define for a Command Block Wrapper, used in the Mass Storage Bulk-Only Transport protocol. */
- typedef struct
- {
- uint32_t Signature; /**< Command block signature, must be CBW_SIGNATURE to indicate a valid Command Block */
- uint32_t Tag; /**< Unique command ID value, to associate a command block wrapper with its command status wrapper */
- uint32_t DataTransferLength; /**< Length of the optional data portion of the issued command, in bytes */
- uint8_t Flags; /**< Command block flags, indicating command data direction */
- 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[MAX_SCSI_COMMAND_LENGTH]; /**< Issued SCSI command in the Command Block */
- } CommandBlockWrapper_t;
-
- /** Type define for a Command Status Wrapper, used in the Mass Storage Bulk-Only Transport protocol. */
- typedef struct
- {
- uint32_t Signature; /**< Status block signature, must be CSW_SIGNATURE to indicate a valid Command Status */
- 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;
-
- /* Enums: */
- /** Enum for the possible command status wrapper return status codes. */
- enum MassStorage_CommandStatusCodes_t
- {
- Command_Pass = 0, /**< Command completed with no error */
- Command_Fail = 1, /**< Command failed to complete - host may check the exact error via a SCSI REQUEST SENSE command */
- Phase_Error = 2 /**< Command failed due to being invalid in the current phase */
- };
-
/* Global Variables: */
- extern CommandBlockWrapper_t CommandBlock;
- extern CommandStatusWrapper_t CommandStatus;
- extern volatile bool IsMassStoreReset;
+ extern MS_CommandBlockWrapper_t CommandBlock;
+ extern MS_CommandStatusWrapper_t CommandStatus;
+ extern volatile bool IsMassStoreReset;
/* Function Prototypes: */
void SetupHardware(void);
diff --git a/Demos/Device/LowLevel/Mouse/Descriptors.c b/Demos/Device/LowLevel/Mouse/Descriptors.c
index d6caf51cd..dab5425e4 100644
--- a/Demos/Device/LowLevel/Mouse/Descriptors.c
+++ b/Demos/Device/LowLevel/Mouse/Descriptors.c
@@ -140,12 +140,12 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.HID_MouseHID =
{
- .Header = {.Size = sizeof(USB_Descriptor_HID_t), .Type = DTYPE_HID},
+ .Header = {.Size = sizeof(USB_HID_Descriptor_HID_t), .Type = HID_DTYPE_HID},
.HIDSpec = VERSION_BCD(01.11),
.CountryCode = 0x00,
.TotalReportDescriptors = 1,
- .HIDReportType = DTYPE_Report,
+ .HIDReportType = HID_DTYPE_Report,
.HIDReportLength = sizeof(MouseReport)
},
@@ -237,11 +237,11 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
}
break;
- case DTYPE_HID:
+ case HID_DTYPE_HID:
Address = &ConfigurationDescriptor.HID_MouseHID;
- Size = sizeof(USB_Descriptor_HID_t);
+ Size = sizeof(USB_HID_Descriptor_HID_t);
break;
- case DTYPE_Report:
+ case HID_DTYPE_Report:
Address = &MouseReport;
Size = sizeof(MouseReport);
break;
diff --git a/Demos/Device/LowLevel/Mouse/Descriptors.h b/Demos/Device/LowLevel/Mouse/Descriptors.h
index 2d9a329d0..6765223b5 100644
--- a/Demos/Device/LowLevel/Mouse/Descriptors.h
+++ b/Demos/Device/LowLevel/Mouse/Descriptors.h
@@ -42,25 +42,6 @@
#include <avr/pgmspace.h>
/* Type Defines: */
- /** Type define for the HID class specific HID descriptor, to describe the HID device's specifications. Refer to the HID
- * specification for details on the structure elements.
- */
- typedef struct
- {
- USB_Descriptor_Header_t Header;
-
- uint16_t HIDSpec;
- uint8_t CountryCode;
-
- uint8_t TotalReportDescriptors;
-
- uint8_t HIDReportType;
- uint16_t HIDReportLength;
- } USB_Descriptor_HID_t;
-
- /** Type define for the data type used to store HID report descriptor elements. */
- typedef uint8_t USB_Descriptor_HIDReport_Datatype_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
* vary between devices, and which describe the device's usage to the host.
@@ -69,7 +50,7 @@
{
USB_Descriptor_Configuration_Header_t Config;
USB_Descriptor_Interface_t HID_Interface;
- USB_Descriptor_HID_t HID_MouseHID;
+ USB_HID_Descriptor_HID_t HID_MouseHID;
USB_Descriptor_Endpoint_t HID_ReportINEndpoint;
} USB_Descriptor_Configuration_t;
@@ -80,12 +61,6 @@
/** Size in bytes of the Mouse HID reporting IN endpoint. */
#define MOUSE_EPSIZE 8
- /** Descriptor header type value, to indicate a HID class HID descriptor. */
- #define DTYPE_HID 0x21
-
- /** Descriptor header type value, to indicate a HID class HID report descriptor. */
- #define DTYPE_Report 0x22
-
/* Function Prototypes: */
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
const uint8_t wIndex,
diff --git a/Demos/Device/LowLevel/Mouse/Mouse.c b/Demos/Device/LowLevel/Mouse/Mouse.c
index 23df2a610..5df26bde8 100644
--- a/Demos/Device/LowLevel/Mouse/Mouse.c
+++ b/Demos/Device/LowLevel/Mouse/Mouse.c
@@ -44,7 +44,7 @@ bool UsingReportProtocol = true;
/** Current Idle period. This is set by the host via a Set Idle HID class request to silence the device's reports
* for either the entire idle duration, or until the report status changes (e.g. the user moves the mouse).
*/
-uint16_t IdleCount = HID_IDLE_CHANGESONLY;
+uint16_t IdleCount = 0;
/** Current Idle period remaining. When the IdleCount value is set, this tracks the remaining number of idle
* milliseconds. This is separate to the IdleCount timer and is incremented and compared as the host may request
@@ -135,7 +135,7 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
/* Handle HID Class specific requests */
switch (USB_ControlRequest.bRequest)
{
- case REQ_GetReport:
+ case HID_REQ_GetReport:
if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))
{
USB_MouseReport_Data_t MouseReportData;
@@ -154,7 +154,7 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
}
break;
- case REQ_GetProtocol:
+ case HID_REQ_GetProtocol:
if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))
{
Endpoint_ClearSETUP();
@@ -167,7 +167,7 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
}
break;
- case REQ_SetProtocol:
+ case HID_REQ_SetProtocol:
if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))
{
Endpoint_ClearSETUP();
@@ -178,7 +178,7 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
}
break;
- case REQ_SetIdle:
+ case HID_REQ_SetIdle:
if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))
{
Endpoint_ClearSETUP();
@@ -189,7 +189,7 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
}
break;
- case REQ_GetIdle:
+ case HID_REQ_GetIdle:
if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))
{
Endpoint_ClearSETUP();
@@ -261,7 +261,7 @@ void SendNextReport(void)
SendReport = true;
/* Check if the idle period is set and has elapsed */
- if ((IdleCount != HID_IDLE_CHANGESONLY) && (!(IdleMSRemaining)))
+ if (IdleCount && (!(IdleMSRemaining)))
{
/* Reset the idle time remaining counter */
IdleMSRemaining = IdleCount;
diff --git a/Demos/Device/LowLevel/Mouse/Mouse.h b/Demos/Device/LowLevel/Mouse/Mouse.h
index f551f5d6e..7158b7736 100644
--- a/Demos/Device/LowLevel/Mouse/Mouse.h
+++ b/Demos/Device/LowLevel/Mouse/Mouse.h
@@ -53,27 +53,6 @@
#include <LUFA/Drivers/Board/Buttons.h>
/* Macros: */
- /** Idle period indicating that reports should be sent only when the inputs have changed */
- #define HID_IDLE_CHANGESONLY 0
-
- /** HID Class specific request to get the next HID report from the device. */
- #define REQ_GetReport 0x01
-
- /** HID Class specific request to get the idle timeout period of the device. */
- #define REQ_GetIdle 0x02
-
- /** HID Class specific request to send the next HID report to the device. */
- #define REQ_SetReport 0x09
-
- /** HID Class specific request to set the idle timeout period of the device. */
- #define REQ_SetIdle 0x0A
-
- /** HID Class specific request to get the current HID protocol in use, either report or boot. */
- #define REQ_GetProtocol 0x03
-
- /** HID Class specific request to set the current HID protocol in use, either report or boot. */
- #define REQ_SetProtocol 0x0B
-
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
#define LEDMASK_USB_NOTREADY LEDS_LED1
@@ -86,17 +65,6 @@
/** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */
#define LEDMASK_USB_ERROR (LEDS_LED1 | LEDS_LED3)
- /* Type Defines: */
- /** Type define for the mouse HID report structure, for creating and sending HID reports to the host PC.
- * This mirrors the layout described to the host in the HID report descriptor, in Descriptors.c.
- */
- typedef struct
- {
- uint8_t Button; /**< Bit mask of the currently pressed mouse buttons */
- int8_t X; /**< Current mouse delta X movement, as a signed 8-bit integer */
- int8_t Y; /**< Current mouse delta Y movement, as a signed 8-bit integer */
- } USB_MouseReport_Data_t;
-
/* Function Prototypes: */
void SetupHardware(void);
void Mouse_Task(void);
diff --git a/Demos/Device/LowLevel/RNDISEthernet/Descriptors.c b/Demos/Device/LowLevel/RNDISEthernet/Descriptors.c
index 97da47e69..33f1dfe93 100644
--- a/Demos/Device/LowLevel/RNDISEthernet/Descriptors.c
+++ b/Demos/Device/LowLevel/RNDISEthernet/Descriptors.c
@@ -104,24 +104,24 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.CDC_Functional_Header =
{
- .Header = {.Size = sizeof(USB_Descriptor_CDC_FunctionalHeader_t), .Type = DTYPE_CSInterface},
- .Subtype = 0x00,
+ .Header = {.Size = sizeof(USB_CDC_Descriptor_FunctionalHeader_t), .Type = DTYPE_CSInterface},
+ .Subtype = CDC_DSUBTYPE_CSInterface_Header,
.CDCSpecification = VERSION_BCD(01.10),
},
.CDC_Functional_ACM =
{
- .Header = {.Size = sizeof(USB_Descriptor_CDC_FunctionalACM_t), .Type = DTYPE_CSInterface},
- .Subtype = 0x02,
+ .Header = {.Size = sizeof(USB_CDC_Descriptor_FunctionalACM_t), .Type = DTYPE_CSInterface},
+ .Subtype = CDC_DSUBTYPE_CSInterface_ACM,
.Capabilities = 0x00,
},
.CDC_Functional_Union =
{
- .Header = {.Size = sizeof(USB_Descriptor_CDC_FunctionalUnion_t), .Type = DTYPE_CSInterface},
- .Subtype = 0x06,
+ .Header = {.Size = sizeof(USB_CDC_Descriptor_FunctionalUnion_t), .Type = DTYPE_CSInterface},
+ .Subtype = CDC_DSUBTYPE_CSInterface_Union,
.MasterInterfaceNumber = 0,
.SlaveInterfaceNumber = 1,
diff --git a/Demos/Device/LowLevel/RNDISEthernet/Descriptors.h b/Demos/Device/LowLevel/RNDISEthernet/Descriptors.h
index 34d64e007..c24462d29 100644
--- a/Demos/Device/LowLevel/RNDISEthernet/Descriptors.h
+++ b/Demos/Device/LowLevel/RNDISEthernet/Descriptors.h
@@ -58,40 +58,6 @@
#define CDC_NOTIFICATION_EPSIZE 8
/* Type Defines: */
- /** Type define for a CDC class-specific functional header descriptor. This indicates to the host that the device
- * contains one or more CDC functional data descriptors, which give the CDC interface's capabilities and configuration.
- * See the CDC class specification for more details.
- */
- typedef struct
- {
- USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length. */
- uint8_t Subtype; /**< Sub type value used to distinguish between CDC class-specific descriptors. */
- uint16_t CDCSpecification; /**< Version number of the CDC specification implemented by the device,
- * encoded in BCD format.
- */
- } USB_Descriptor_CDC_FunctionalHeader_t;
-
- /** Type define for a CDC class-specific functional ACM descriptor. This indicates to the host that the CDC interface
- * supports the CDC ACM subclass of the CDC specification. See the CDC class specification for more details.
- */
- typedef struct
- {
- USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length. */
- uint8_t Subtype; /**< Sub type value used to distinguish between CDC class-specific descriptors. */
- uint8_t Capabilities; /**< Capabilities of the ACM interface, given as a bit mask. */
- } USB_Descriptor_CDC_FunctionalACM_t;
-
- /** Type define for a CDC class-specific functional Union descriptor. This indicates to the host that specific
- * CDC control and data interfaces are related. See the CDC class specification for more details.
- */
- typedef struct
- {
- USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length. */
- uint8_t Subtype; /**< Sub type value used to distinguish between CDC class-specific descriptors. */
- uint8_t MasterInterfaceNumber; /**< Interface number of the CDC Control interface. */
- uint8_t SlaveInterfaceNumber; /**< Interface number of the CDC Data interface. */
- } USB_Descriptor_CDC_FunctionalUnion_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
* vary between devices, and which describe the device's usage to the host.
@@ -100,9 +66,9 @@
{
USB_Descriptor_Configuration_Header_t Config;
USB_Descriptor_Interface_t CDC_CCI_Interface;
- USB_Descriptor_CDC_FunctionalHeader_t CDC_Functional_Header;
- USB_Descriptor_CDC_FunctionalACM_t CDC_Functional_ACM;
- USB_Descriptor_CDC_FunctionalUnion_t CDC_Functional_Union;
+ USB_CDC_Descriptor_FunctionalHeader_t CDC_Functional_Header;
+ USB_CDC_Descriptor_FunctionalACM_t CDC_Functional_ACM;
+ USB_CDC_Descriptor_FunctionalUnion_t CDC_Functional_Union;
USB_Descriptor_Endpoint_t CDC_NotificationEndpoint;
USB_Descriptor_Interface_t CDC_DCI_Interface;
USB_Descriptor_Endpoint_t RNDIS_DataOutEndpoint;
diff --git a/Demos/Device/LowLevel/RNDISEthernet/Lib/ARP.h b/Demos/Device/LowLevel/RNDISEthernet/Lib/ARP.h
index d97761539..b8e312c93 100644
--- a/Demos/Device/LowLevel/RNDISEthernet/Lib/ARP.h
+++ b/Demos/Device/LowLevel/RNDISEthernet/Lib/ARP.h
@@ -40,6 +40,8 @@
#include <avr/io.h>
#include <string.h>
+ #include <LUFA/Drivers/USB/USB.h>
+
#include "EthernetProtocols.h"
#include "Ethernet.h"
#include "ProtocolDecoders.h"
diff --git a/Demos/Device/LowLevel/RNDISEthernet/Lib/Ethernet.h b/Demos/Device/LowLevel/RNDISEthernet/Lib/Ethernet.h
index 68fffb48f..52d120dbb 100644
--- a/Demos/Device/LowLevel/RNDISEthernet/Lib/Ethernet.h
+++ b/Demos/Device/LowLevel/RNDISEthernet/Lib/Ethernet.h
@@ -81,14 +81,6 @@
#define NO_PROCESS -1
/* Type Defines: */
- /** Type define for an Ethernet frame buffer. */
- typedef struct
- {
- uint8_t FrameData[ETHERNET_FRAME_SIZE_MAX]; /**< Ethernet frame contents */
- uint16_t FrameLength; /**< Length in bytes of the Ethernet frame stored in the buffer */
- bool FrameInBuffer; /**< Indicates if a frame is currently stored in the buffer */
- } Ethernet_Frame_Info_t;
-
/** Type define for an Ethernet frame header. */
typedef struct
{
diff --git a/Demos/Device/LowLevel/RNDISEthernet/Lib/EthernetProtocols.h b/Demos/Device/LowLevel/RNDISEthernet/Lib/EthernetProtocols.h
index 8f529d6b4..4c1caaa88 100644
--- a/Demos/Device/LowLevel/RNDISEthernet/Lib/EthernetProtocols.h
+++ b/Demos/Device/LowLevel/RNDISEthernet/Lib/EthernetProtocols.h
@@ -76,7 +76,7 @@
typedef struct
{
uint8_t Octets[6]; /**< Individual bytes of a MAC address */
- } MAC_Address_t;
+ } RNDIS_MAC_Address_t;
/** Type define for a protocol IP address of a device on a network. */
typedef struct
diff --git a/Demos/Device/LowLevel/RNDISEthernet/Lib/RNDIS.c b/Demos/Device/LowLevel/RNDISEthernet/Lib/RNDIS.c
index 520557003..2a537e2ae 100644
--- a/Demos/Device/LowLevel/RNDISEthernet/Lib/RNDIS.c
+++ b/Demos/Device/LowLevel/RNDISEthernet/Lib/RNDIS.c
@@ -264,7 +264,7 @@ static bool ProcessNDISQuery(const uint32_t OId, void* QueryData, uint16_t Query
*ResponseSize = sizeof(uint32_t);
/* Always indicate hardware ready */
- *((uint32_t*)ResponseData) = NdisHardwareStatusReady;
+ *((uint32_t*)ResponseData) = NDIS_HardwareStatus_Ready;
return true;
case OID_GEN_MEDIA_SUPPORTED:
diff --git a/Demos/Device/LowLevel/RNDISEthernet/Lib/RNDIS.h b/Demos/Device/LowLevel/RNDISEthernet/Lib/RNDIS.h
index ed35b3546..00ce86961 100644
--- a/Demos/Device/LowLevel/RNDISEthernet/Lib/RNDIS.h
+++ b/Demos/Device/LowLevel/RNDISEthernet/Lib/RNDIS.h
@@ -44,167 +44,6 @@
#include "RNDISConstants.h"
#include "Ethernet.h"
- /* Macros: */
- /** Implemented RNDIS Version Major. */
- #define REMOTE_NDIS_VERSION_MAJOR 0x01
-
- /** Implemented RNDIS Version Minor. */
- #define REMOTE_NDIS_VERSION_MINOR 0x00
-
- /** RNDIS request to issue a host-to-device NDIS command. */
- #define REQ_SendEncapsulatedCommand 0x00
-
- /** RNDIS request to issue a device-to-host NDIS response. */
- #define REQ_GetEncapsulatedResponse 0x01
-
- /* Enums: */
- /** Enum for the possible NDIS adapter states. */
- enum RNDIS_States_t
- {
- RNDIS_Uninitialized = 0, /**< Adapter currently uninitialized */
- RNDIS_Initialized = 1, /**< Adapter currently initialized but not ready for data transfers */
- RNDIS_Data_Initialized = 2, /**< Adapter currently initialized and ready for data transfers */
- };
-
- /** Enum for the NDIS hardware states. */
- enum NDIS_Hardware_Status_t
- {
- NdisHardwareStatusReady, /**< Hardware Ready to accept commands from the host */
- NdisHardwareStatusInitializing, /**< Hardware busy initializing */
- NdisHardwareStatusReset, /**< Hardware reset */
- NdisHardwareStatusClosing, /**< Hardware currently closing */
- NdisHardwareStatusNotReady /**< Hardware not ready to accept commands from the host */
- };
-
- /* Type Defines: */
- /** 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
- {
- uint32_t MessageType;
- uint32_t MessageLength;
- uint32_t DataOffset;
- uint32_t DataLength;
- uint32_t OOBDataOffset;
- uint32_t OOBDataLength;
- uint32_t NumOOBDataElements;
- uint32_t PerPacketInfoOffset;
- uint32_t PerPacketInfoLength;
- uint32_t VcHandle;
- uint32_t Reserved;
- } RNDIS_Packet_Message_t;
-
- /** Type define for a RNDIS Initialize command message. */
- typedef struct
- {
- uint32_t MessageType;
- uint32_t MessageLength;
- uint32_t RequestId;
-
- uint32_t MajorVersion;
- uint32_t MinorVersion;
- uint32_t MaxTransferSize;
- } RNDIS_Initialize_Message_t;
-
- /** Type define for a RNDIS Initialize complete response message. */
- typedef struct
- {
- uint32_t MessageType;
- uint32_t MessageLength;
- uint32_t RequestId;
- uint32_t Status;
-
- uint32_t MajorVersion;
- uint32_t MinorVersion;
- uint32_t DeviceFlags;
- uint32_t Medium;
- uint32_t MaxPacketsPerTransfer;
- uint32_t MaxTransferSize;
- uint32_t PacketAlignmentFactor;
- uint32_t AFListOffset;
- uint32_t AFListSize;
- } RNDIS_Initialize_Complete_t;
-
- /** Type define for a RNDIS Keep-alive command message. */
- typedef struct
- {
- uint32_t MessageType;
- uint32_t MessageLength;
- uint32_t RequestId;
- } RNDIS_KeepAlive_Message_t;
-
- /** Type define for a RNDIS Keep-alive complete message. */
- typedef struct
- {
- uint32_t MessageType;
- uint32_t MessageLength;
- uint32_t RequestId;
- uint32_t Status;
- } RNDIS_KeepAlive_Complete_t;
-
- /** Type define for a RNDIS Reset complete message. */
- typedef struct
- {
- uint32_t MessageType;
- uint32_t MessageLength;
- uint32_t Status;
-
- uint32_t AddressingReset;
- } RNDIS_Reset_Complete_t;
-
- /** Type define for a RNDIS Set command message. */
- typedef struct
- {
- uint32_t MessageType;
- uint32_t MessageLength;
- uint32_t RequestId;
-
- uint32_t Oid;
- uint32_t InformationBufferLength;
- uint32_t InformationBufferOffset;
- uint32_t DeviceVcHandle;
- } RNDIS_Set_Message_t;
-
- /** Type define for a RNDIS Set complete response message. */
- typedef struct
- {
- uint32_t MessageType;
- uint32_t MessageLength;
- uint32_t RequestId;
- uint32_t Status;
- } RNDIS_Set_Complete_t;
-
- /** Type define for a RNDIS Query command message. */
- typedef struct
- {
- uint32_t MessageType;
- uint32_t MessageLength;
- uint32_t RequestId;
-
- uint32_t Oid;
- uint32_t InformationBufferLength;
- uint32_t InformationBufferOffset;
- uint32_t DeviceVcHandle;
- } RNDIS_Query_Message_t;
-
- /** Type define for a RNDIS Query complete response message. */
- typedef struct
- {
- uint32_t MessageType;
- uint32_t MessageLength;
- uint32_t RequestId;
- uint32_t Status;
-
- uint32_t InformationBufferLength;
- uint32_t InformationBufferOffset;
- } RNDIS_Query_Complete_t;
-
/* External Variables: */
extern uint8_t RNDISMessageBuffer[];
extern RNDIS_Message_Header_t* MessageHeader;
diff --git a/Demos/Device/LowLevel/RNDISEthernet/Lib/RNDISConstants.h b/Demos/Device/LowLevel/RNDISEthernet/Lib/RNDISConstants.h
deleted file mode 100644
index 273fdb81e..000000000
--- a/Demos/Device/LowLevel/RNDISEthernet/Lib/RNDISConstants.h
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- LUFA Library
- Copyright (C) Dean Camera, 2010.
-
- dean [at] fourwalledcubicle [dot] com
- www.fourwalledcubicle.com
-*/
-
-/*
- Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
- all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
- software without specific, written prior permission.
-
- The author disclaim all warranties with regard to this
- software, including all implied warranties of merchantability
- and fitness. In no event shall the author be liable for any
- special, indirect or consequential damages or any damages
- whatsoever resulting from loss of use, data or profits, whether
- in an action of contract, negligence or other tortious action,
- arising out of or in connection with the use or performance of
- this software.
-*/
-
-/** \file
- *
- * RNDIS specification related constants. For more information on these
- * constants, please refer to the Microsoft RNDIS specification.
- */
-
-#ifndef _RNDIS_CONSTANTS_DEVICE_H_
-#define _RNDIS_CONSTANTS_DEVICE_H_
-
- /* Macros: */
- #define REMOTE_NDIS_PACKET_MSG 0x00000001UL
- #define REMOTE_NDIS_INITIALIZE_MSG 0x00000002UL
- #define REMOTE_NDIS_HALT_MSG 0x00000003UL
- #define REMOTE_NDIS_QUERY_MSG 0x00000004UL
- #define REMOTE_NDIS_SET_MSG 0x00000005UL
- #define REMOTE_NDIS_RESET_MSG 0x00000006UL
- #define REMOTE_NDIS_INDICATE_STATUS_MSG 0x00000007UL
- #define REMOTE_NDIS_KEEPALIVE_MSG 0x00000008UL
-
- #define REMOTE_NDIS_INITIALIZE_CMPLT 0x80000002UL
- #define REMOTE_NDIS_QUERY_CMPLT 0x80000004UL
- #define REMOTE_NDIS_SET_CMPLT 0x80000005UL
- #define REMOTE_NDIS_RESET_CMPLT 0x80000006UL
- #define REMOTE_NDIS_KEEPALIVE_CMPLT 0x80000008UL
-
- #define REMOTE_NDIS_STATUS_SUCCESS 0x00000000UL
- #define REMOTE_NDIS_STATUS_FAILURE 0xC0000001UL
- #define REMOTE_NDIS_STATUS_INVALID_DATA 0xC0010015UL
- #define REMOTE_NDIS_STATUS_NOT_SUPPORTED 0xC00000BBUL
- #define REMOTE_NDIS_STATUS_MEDIA_CONNECT 0x4001000BUL
- #define REMOTE_NDIS_STATUS_MEDIA_DISCONNECT 0x4001000CUL
-
- #define REMOTE_NDIS_MEDIA_STATE_CONNECTED 0x00000000UL
- #define REMOTE_NDIS_MEDIA_STATE_DISCONNECTED 0x00000001UL
-
- #define REMOTE_NDIS_MEDIUM_802_3 0x00000000UL
-
- #define REMOTE_NDIS_DF_CONNECTIONLESS 0x00000001UL
- #define REMOTE_NDIS_DF_CONNECTION_ORIENTED 0x00000002UL
-
- #define REMOTE_NDIS_PACKET_DIRECTED 0x00000001UL
- #define REMOTE_NDIS_PACKET_MULTICAST 0x00000002UL
- #define REMOTE_NDIS_PACKET_ALL_MULTICAST 0x00000004UL
- #define REMOTE_NDIS_PACKET_BROADCAST 0x00000008UL
- #define REMOTE_NDIS_PACKET_SOURCE_ROUTING 0x00000010UL
- #define REMOTE_NDIS_PACKET_PROMISCUOUS 0x00000020UL
- #define REMOTE_NDIS_PACKET_SMT 0x00000040UL
- #define REMOTE_NDIS_PACKET_ALL_LOCAL 0x00000080UL
- #define REMOTE_NDIS_PACKET_GROUP 0x00001000UL
- #define REMOTE_NDIS_PACKET_ALL_FUNCTIONAL 0x00002000UL
- #define REMOTE_NDIS_PACKET_FUNCTIONAL 0x00004000UL
- #define REMOTE_NDIS_PACKET_MAC_FRAME 0x00008000UL
-
- #define OID_GEN_SUPPORTED_LIST 0x00010101UL
- #define OID_GEN_HARDWARE_STATUS 0x00010102UL
- #define OID_GEN_MEDIA_SUPPORTED 0x00010103UL
- #define OID_GEN_MEDIA_IN_USE 0x00010104UL
- #define OID_GEN_MAXIMUM_FRAME_SIZE 0x00010106UL
- #define OID_GEN_MAXIMUM_TOTAL_SIZE 0x00010111UL
- #define OID_GEN_LINK_SPEED 0x00010107UL
- #define OID_GEN_TRANSMIT_BLOCK_SIZE 0x0001010AUL
- #define OID_GEN_RECEIVE_BLOCK_SIZE 0x0001010BUL
- #define OID_GEN_VENDOR_ID 0x0001010CUL
- #define OID_GEN_VENDOR_DESCRIPTION 0x0001010DUL
- #define OID_GEN_CURRENT_PACKET_FILTER 0x0001010EUL
- #define OID_GEN_MAXIMUM_TOTAL_SIZE 0x00010111UL
- #define OID_GEN_MEDIA_CONNECT_STATUS 0x00010114UL
- #define OID_GEN_PHYSICAL_MEDIUM 0x00010202UL
- #define OID_GEN_XMIT_OK 0x00020101UL
- #define OID_GEN_RCV_OK 0x00020102UL
- #define OID_GEN_XMIT_ERROR 0x00020103UL
- #define OID_GEN_RCV_ERROR 0x00020104UL
- #define OID_GEN_RCV_NO_BUFFER 0x00020105UL
- #define OID_802_3_PERMANENT_ADDRESS 0x01010101UL
- #define OID_802_3_CURRENT_ADDRESS 0x01010102UL
- #define OID_802_3_MULTICAST_LIST 0x01010103UL
- #define OID_802_3_MAXIMUM_LIST_SIZE 0x01010104UL
- #define OID_802_3_RCV_ERROR_ALIGNMENT 0x01020101UL
- #define OID_802_3_XMIT_ONE_COLLISION 0x01020102UL
- #define OID_802_3_XMIT_MORE_COLLISIONS 0x01020103UL
-
-#endif
-
diff --git a/Demos/Device/LowLevel/RNDISEthernet/RNDISEthernet.c b/Demos/Device/LowLevel/RNDISEthernet/RNDISEthernet.c
index e8eda4ccd..4e26db735 100644
--- a/Demos/Device/LowLevel/RNDISEthernet/RNDISEthernet.c
+++ b/Demos/Device/LowLevel/RNDISEthernet/RNDISEthernet.c
@@ -121,7 +121,7 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
/* Process RNDIS class commands */
switch (USB_ControlRequest.bRequest)
{
- case REQ_SendEncapsulatedCommand:
+ case RNDIS_REQ_SendEncapsulatedCommand:
if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))
{
Endpoint_ClearSETUP();
@@ -135,7 +135,7 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
}
break;
- case REQ_GetEncapsulatedResponse:
+ case RNDIS_REQ_GetEncapsulatedResponse:
if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))
{
/* Check if a response to the last message is ready */
@@ -172,10 +172,10 @@ void RNDIS_Task(void)
/* Check if a message response is ready for the host */
if (Endpoint_IsINReady() && ResponseReady)
{
- USB_Notification_t Notification = (USB_Notification_t)
+ USB_Request_Header_t Notification = (USB_Request_Header_t)
{
.bmRequestType = (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE),
- .bNotification = NOTIF_RESPONSE_AVAILABLE,
+ .bRequest = RNDIS_NOTIF_ResponseAvailable,
.wValue = 0,
.wIndex = 0,
.wLength = 0,
diff --git a/Demos/Device/LowLevel/RNDISEthernet/RNDISEthernet.h b/Demos/Device/LowLevel/RNDISEthernet/RNDISEthernet.h
index fb1a8d314..d3a818262 100644
--- a/Demos/Device/LowLevel/RNDISEthernet/RNDISEthernet.h
+++ b/Demos/Device/LowLevel/RNDISEthernet/RNDISEthernet.h
@@ -75,19 +75,6 @@
/** LED mask for the library LED driver, to indicate that the USB interface is busy. */
#define LEDMASK_USB_BUSY LEDS_LED2
- /* Type Defines: */
- /** Type define for a RNDIS notification message, for transmission to the RNDIS host via the notification
- * Endpoint.
- */
- typedef struct
- {
- uint8_t bmRequestType; /**< Notification type, a mask of values from SrdRequestType.h */
- uint8_t bNotification; /**< Notification index, indicating what the RNDIS notification relates to */
- uint16_t wValue; /**< Two byte notification value parameter */
- uint16_t wIndex; /**< Two byte notification index parameter */
- uint16_t wLength; /**< Size of data payload following the notification header */
- } USB_Notification_t;
-
/* Function Prototypes: */
void SetupHardware(void);
void RNDIS_Task(void);
diff --git a/Demos/Device/LowLevel/VirtualSerial/Descriptors.c b/Demos/Device/LowLevel/VirtualSerial/Descriptors.c
index 9b3aea4b8..1d98fbb81 100644
--- a/Demos/Device/LowLevel/VirtualSerial/Descriptors.c
+++ b/Demos/Device/LowLevel/VirtualSerial/Descriptors.c
@@ -116,24 +116,24 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.CDC_Functional_Header =
{
- .Header = {.Size = sizeof(USB_Descriptor_CDC_FunctionalHeader_t), .Type = DTYPE_CSInterface},
- .Subtype = 0x00,
+ .Header = {.Size = sizeof(USB_CDC_Descriptor_FunctionalHeader_t), .Type = DTYPE_CSInterface},
+ .Subtype = CDC_DSUBTYPE_CSInterface_Header,
.CDCSpecification = VERSION_BCD(01.10),
},
.CDC_Functional_ACM =
{
- .Header = {.Size = sizeof(USB_Descriptor_CDC_FunctionalACM_t), .Type = DTYPE_CSInterface},
- .Subtype = 0x02,
+ .Header = {.Size = sizeof(USB_CDC_Descriptor_FunctionalACM_t), .Type = DTYPE_CSInterface},
+ .Subtype = CDC_DSUBTYPE_CSInterface_ACM,
.Capabilities = 0x06,
},
.CDC_Functional_Union =
{
- .Header = {.Size = sizeof(USB_Descriptor_CDC_FunctionalUnion_t), .Type = DTYPE_CSInterface},
- .Subtype = 0x06,
+ .Header = {.Size = sizeof(USB_CDC_Descriptor_FunctionalUnion_t), .Type = DTYPE_CSInterface},
+ .Subtype = CDC_DSUBTYPE_CSInterface_Union,
.MasterInterfaceNumber = 0,
.SlaveInterfaceNumber = 1,
diff --git a/Demos/Device/LowLevel/VirtualSerial/Descriptors.h b/Demos/Device/LowLevel/VirtualSerial/Descriptors.h
index 7a8da898e..670e3433a 100644
--- a/Demos/Device/LowLevel/VirtualSerial/Descriptors.h
+++ b/Demos/Device/LowLevel/VirtualSerial/Descriptors.h
@@ -58,40 +58,6 @@
#define CDC_TXRX_EPSIZE 16
/* Type Defines: */
- /** Type define for a CDC class-specific functional header descriptor. This indicates to the host that the device
- * contains one or more CDC functional data descriptors, which give the CDC interface's capabilities and configuration.
- * See the CDC class specification for more details.
- */
- typedef struct
- {
- USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length. */
- uint8_t Subtype; /**< Sub type value used to distinguish between CDC class-specific descriptors. */
- uint16_t CDCSpecification; /**< Version number of the CDC specification implemented by the device,
- * encoded in BCD format.
- */
- } USB_Descriptor_CDC_FunctionalHeader_t;
-
- /** Type define for a CDC class-specific functional ACM descriptor. This indicates to the host that the CDC interface
- * supports the CDC ACM subclass of the CDC specification. See the CDC class specification for more details.
- */
- typedef struct
- {
- USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length. */
- uint8_t Subtype; /**< Sub type value used to distinguish between CDC class-specific descriptors. */
- uint8_t Capabilities; /**< Capabilities of the ACM interface, given as a bit mask. */
- } USB_Descriptor_CDC_FunctionalACM_t;
-
- /** Type define for a CDC class-specific functional Union descriptor. This indicates to the host that specific
- * CDC control and data interfaces are related. See the CDC class specification for more details.
- */
- typedef struct
- {
- USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length. */
- uint8_t Subtype; /**< Sub type value used to distinguish between CDC class-specific descriptors. */
- uint8_t MasterInterfaceNumber; /**< Interface number of the CDC Control interface. */
- uint8_t SlaveInterfaceNumber; /**< Interface number of the CDC Data interface. */
- } USB_Descriptor_CDC_FunctionalUnion_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
* vary between devices, and which describe the device's usage to the host.
@@ -100,9 +66,9 @@
{
USB_Descriptor_Configuration_Header_t Config;
USB_Descriptor_Interface_t CDC_CCI_Interface;
- USB_Descriptor_CDC_FunctionalHeader_t CDC_Functional_Header;
- USB_Descriptor_CDC_FunctionalACM_t CDC_Functional_ACM;
- USB_Descriptor_CDC_FunctionalUnion_t CDC_Functional_Union;
+ USB_CDC_Descriptor_FunctionalHeader_t CDC_Functional_Header;
+ USB_CDC_Descriptor_FunctionalACM_t CDC_Functional_ACM;
+ USB_CDC_Descriptor_FunctionalUnion_t CDC_Functional_Union;
USB_Descriptor_Endpoint_t CDC_NotificationEndpoint;
USB_Descriptor_Interface_t CDC_DCI_Interface;
USB_Descriptor_Endpoint_t CDC_DataOutEndpoint;
diff --git a/Demos/Device/LowLevel/VirtualSerial/VirtualSerial.c b/Demos/Device/LowLevel/VirtualSerial/VirtualSerial.c
index 22d65ffe7..9cf958a06 100644
--- a/Demos/Device/LowLevel/VirtualSerial/VirtualSerial.c
+++ b/Demos/Device/LowLevel/VirtualSerial/VirtualSerial.c
@@ -44,10 +44,10 @@
* It is possible to completely ignore these value or use other settings as the host is completely unaware of the physical
* serial link characteristics and instead sends and receives data in endpoint streams.
*/
-CDC_Line_Coding_t LineEncoding = { .BaudRateBPS = 0,
- .CharFormat = OneStopBit,
- .ParityType = Parity_None,
- .DataBits = 8 };
+CDC_LineEncoding_t LineEncoding = { .BaudRateBPS = 0,
+ .CharFormat = CDC_LINEENCODING_OneStopBit,
+ .ParityType = CDC_PARITY_None,
+ .DataBits = 8 };
/** Main program entry point. This routine contains the overall program flow, including initial
* setup of all components and the main program loop.
@@ -131,29 +131,29 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
/* Process CDC specific control requests */
switch (USB_ControlRequest.bRequest)
{
- case REQ_GetLineEncoding:
+ case CDC_REQ_GetLineEncoding:
if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))
{
Endpoint_ClearSETUP();
/* Write the line coding data to the control endpoint */
- Endpoint_Write_Control_Stream_LE(&LineEncoding, sizeof(CDC_Line_Coding_t));
+ Endpoint_Write_Control_Stream_LE(&LineEncoding, sizeof(CDC_LineEncoding_t));
Endpoint_ClearOUT();
}
break;
- case REQ_SetLineEncoding:
+ case CDC_REQ_SetLineEncoding:
if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))
{
Endpoint_ClearSETUP();
/* Read the line coding data in from the host into the global struct */
- Endpoint_Read_Control_Stream_LE(&LineEncoding, sizeof(CDC_Line_Coding_t));
+ Endpoint_Read_Control_Stream_LE(&LineEncoding, sizeof(CDC_LineEncoding_t));
Endpoint_ClearIN();
}
break;
- case REQ_SetControlLineState:
+ case CDC_REQ_SetControlLineState:
if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))
{
Endpoint_ClearSETUP();
@@ -180,29 +180,6 @@ void CDC_Task(void)
if (USB_DeviceState != DEVICE_STATE_Configured)
return;
-#if 0
- /* NOTE: Here you can use the notification endpoint to send back line state changes to the host, for the special RS-232
- * handshake signal lines (and some error states), via the CONTROL_LINE_IN_* masks and the following code:
- */
- USB_Notification_Header_t Notification = (USB_Notification_Header_t)
- {
- .NotificationType = (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE),
- .Notification = NOTIF_SerialState,
- .wValue = 0,
- .wIndex = 0,
- .wLength = sizeof(uint16_t),
- };
-
- uint16_t LineStateMask;
-
- // Set LineStateMask here to a mask of CONTROL_LINE_IN_* masks to set the input handshake line states to send to the host
-
- Endpoint_SelectEndpoint(CDC_NOTIFICATION_EPNUM);
- Endpoint_Write_Stream_LE(&Notification, sizeof(Notification));
- Endpoint_Write_Stream_LE(&LineStateMask, sizeof(LineStateMask));
- Endpoint_ClearIN();
-#endif
-
/* Determine if a joystick action has occurred */
if (JoyStatus_LCL & JOY_UP)
ReportString = "Joystick Up\r\n";
diff --git a/Demos/Device/LowLevel/VirtualSerial/VirtualSerial.h b/Demos/Device/LowLevel/VirtualSerial/VirtualSerial.h
index b435cca6e..9634bd379 100644
--- a/Demos/Device/LowLevel/VirtualSerial/VirtualSerial.h
+++ b/Demos/Device/LowLevel/VirtualSerial/VirtualSerial.h
@@ -51,66 +51,6 @@
#include <LUFA/Drivers/Board/LEDs.h>
/* Macros: */
- /** CDC Class specific request to get the current virtual serial port configuration settings. */
- #define REQ_GetLineEncoding 0x21
-
- /** CDC Class specific request to set the current virtual serial port configuration settings. */
- #define REQ_SetLineEncoding 0x20
-
- /** CDC Class specific request to set the current virtual serial port handshake line states. */
- #define REQ_SetControlLineState 0x22
-
- /** Notification type constant for a change in the virtual serial port handshake line states, for
- * use with a USB_Notification_Header_t notification structure when sent to the host via the CDC
- * notification endpoint.
- */
- #define NOTIF_SerialState 0x20
-
- /** Mask for the DTR handshake line for use with the REQ_SetControlLineState class specific request
- * from the host, to indicate that the DTR line state should be high.
- */
- #define CONTROL_LINE_OUT_DTR (1 << 0)
-
- /** Mask for the RTS handshake line for use with the REQ_SetControlLineState class specific request
- * from the host, to indicate that theRTS line state should be high.
- */
- #define CONTROL_LINE_OUT_RTS (1 << 1)
-
- /** Mask for the DCD handshake line for use with the NOTIF_SerialState class specific notification
- * from the device to the host, to indicate that the DCD line state is currently high.
- */
- #define CONTROL_LINE_IN_DCD (1 << 0)
-
- /** Mask for the DSR handshake line for use with the NOTIF_SerialState class specific notification
- * from the device to the host, to indicate that the DSR line state is currently high.
- */
- #define CONTROL_LINE_IN_DSR (1 << 1)
-
- /** Mask for the BREAK handshake line for use with the NOTIF_SerialState class specific notification
- * from the device to the host, to indicate that the BREAK line state is currently high.
- */
- #define CONTROL_LINE_IN_BREAK (1 << 2)
-
- /** Mask for the RING handshake line for use with the NOTIF_SerialState class specific notification
- * from the device to the host, to indicate that the RING line state is currently high.
- */
- #define CONTROL_LINE_IN_RING (1 << 3)
-
- /** Mask for use with the NOTIF_SerialState class specific notification from the device to the host,
- * to indicate that a framing error has occurred on the virtual serial port.
- */
- #define CONTROL_LINE_IN_FRAMEERROR (1 << 4)
-
- /** Mask for use with the NOTIF_SerialState class specific notification from the device to the host,
- * to indicate that a parity error has occurred on the virtual serial port.
- */
- #define CONTROL_LINE_IN_PARITYERROR (1 << 5)
-
- /** Mask for use with the NOTIF_SerialState class specific notification from the device to the host,
- * to indicate that a data overrun error has occurred on the virtual serial port.
- */
- #define CONTROL_LINE_IN_OVERRUNERROR (1 << 6)
-
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
#define LEDMASK_USB_NOTREADY LEDS_LED1
@@ -123,55 +63,6 @@
/** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */
#define LEDMASK_USB_ERROR (LEDS_LED1 | LEDS_LED3)
- /* Type Defines: */
- /** Type define for the virtual serial port line encoding settings, for storing the current USART configuration
- * as set by the host via a class specific request.
- */
- typedef 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 */
- } CDC_Line_Coding_t;
-
- /** Type define for a CDC notification, sent to the host via the CDC notification endpoint to indicate a
- * change in the device state asynchronously.
- */
- typedef struct
- {
- uint8_t NotificationType; /**< Notification type, a mask of REQDIR_*, REQTYPE_* and REQREC_* constants
- * from the library StdRequestType.h header
- */
- uint8_t Notification; /**< Notification value, a NOTIF_* constant */
- uint16_t wValue; /**< Notification wValue, notification-specific */
- uint16_t wIndex; /**< Notification wIndex, notification-specific */
- uint16_t wLength; /**< Notification wLength, notification-specific */
- } USB_Notification_Header_t;
-
- /* Enums: */
- /** Enum for the possible line encoding formats of a virtual serial port. */
- enum CDCDevice_CDC_LineCodingFormats_t
- {
- OneStopBit = 0, /**< Each frame contains one stop bit */
- OneAndAHalfStopBits = 1, /**< Each frame contains one and a half stop bits */
- TwoStopBits = 2, /**< Each frame contains two stop bits */
- };
-
- /** Enum for the possible line encoding parity settings of a virtual serial port. */
- enum CDCDevice_LineCodingParity_t
- {
- Parity_None = 0, /**< No parity bit mode on each frame */
- Parity_Odd = 1, /**< Odd parity bit mode on each frame */
- Parity_Even = 2, /**< Even parity bit mode on each frame */
- Parity_Mark = 3, /**< Mark parity bit mode on each frame */
- Parity_Space = 4, /**< Space parity bit mode on each frame */
- };
-
/* Function Prototypes: */
void SetupHardware(void);
void CDC_Task(void);