From afd828c095f38753e989391eab670b8736e4bd6e Mon Sep 17 00:00:00 2001 From: Dean Camera Date: Sun, 30 Jan 2011 19:47:31 +0000 Subject: [PATCH] Removed SerialStream module, rolled functionality into the base USART Serial peripheral driver instead through the new Serial_CreateStream() and Serial_CreateBlockingStream() methods. Renamed the Serial byte send/receive functions to remain consistent with the CDC driver's byte functions. Altered the serial byte receive function to make it non-blocking. --- .../RNDISEthernet/Lib/ProtocolDecoders.h | 2 +- .../ClassDriver/RNDISEthernet/RNDISEthernet.c | 5 +- .../ClassDriver/RNDISEthernet/RNDISEthernet.h | 2 +- .../Device/ClassDriver/RNDISEthernet/makefile | 3 +- Demos/Device/Incomplete/Sideshow/Sideshow.c | 5 +- Demos/Device/Incomplete/Sideshow/Sideshow.h | 2 +- Demos/Device/Incomplete/Sideshow/makefile | 3 +- .../RNDISEthernet/Lib/ProtocolDecoders.h | 2 +- .../LowLevel/RNDISEthernet/RNDISEthernet.c | 5 +- Demos/Device/LowLevel/RNDISEthernet/makefile | 3 +- .../MouseHostDevice/MouseHostDevice.c | 5 +- .../MouseHostDevice/MouseHostDevice.h | 2 +- .../ClassDriver/MouseHostDevice/makefile | 3 +- .../JoystickHostWithParser.c | 5 +- .../JoystickHostWithParser.h | 2 +- .../JoystickHostWithParser/makefile | 3 +- .../ClassDriver/KeyboardHost/KeyboardHost.c | 5 +- .../ClassDriver/KeyboardHost/KeyboardHost.h | 2 +- Demos/Host/ClassDriver/KeyboardHost/makefile | 3 +- .../KeyboardHostWithParser.c | 5 +- .../KeyboardHostWithParser.h | 2 +- .../KeyboardHostWithParser/makefile | 3 +- Demos/Host/ClassDriver/MIDIHost/MIDIHost.c | 5 +- Demos/Host/ClassDriver/MIDIHost/MIDIHost.h | 2 +- Demos/Host/ClassDriver/MIDIHost/makefile | 3 +- .../MassStorageHost/MassStorageHost.c | 5 +- .../MassStorageHost/MassStorageHost.h | 2 +- .../Host/ClassDriver/MassStorageHost/makefile | 3 +- Demos/Host/ClassDriver/MouseHost/MouseHost.c | 5 +- Demos/Host/ClassDriver/MouseHost/MouseHost.h | 2 +- Demos/Host/ClassDriver/MouseHost/makefile | 3 +- .../MouseHostWithParser/MouseHostWithParser.c | 5 +- .../MouseHostWithParser/MouseHostWithParser.h | 2 +- .../ClassDriver/MouseHostWithParser/makefile | 3 +- .../ClassDriver/PrinterHost/PrinterHost.c | 5 +- .../ClassDriver/PrinterHost/PrinterHost.h | 2 +- Demos/Host/ClassDriver/PrinterHost/makefile | 3 +- .../RNDISEthernetHost/RNDISEthernetHost.c | 5 +- .../RNDISEthernetHost/RNDISEthernetHost.h | 1 - .../ClassDriver/RNDISEthernetHost/makefile | 3 +- .../StillImageHost/StillImageHost.c | 5 +- .../StillImageHost/StillImageHost.h | 2 +- .../Host/ClassDriver/StillImageHost/makefile | 3 +- .../VirtualSerialHost/VirtualSerialHost.c | 7 +- .../VirtualSerialHost/VirtualSerialHost.h | 2 +- .../ClassDriver/VirtualSerialHost/makefile | 3 +- .../BluetoothHost/BluetoothEvents.h | 2 +- .../Incomplete/BluetoothHost/BluetoothHost.c | 5 +- .../Incomplete/BluetoothHost/BluetoothHost.h | 2 +- .../BluetoothHost/Lib/BluetoothACLPackets.h | 2 +- .../BluetoothHost/Lib/BluetoothHCICommands.h | 2 +- .../Incomplete/BluetoothHost/Lib/RFCOMM.h | 2 +- .../BluetoothHost/Lib/RFCOMMControl.h | 2 +- Demos/Host/Incomplete/BluetoothHost/Lib/SDP.h | 2 +- Demos/Host/Incomplete/BluetoothHost/makefile | 3 +- .../LowLevel/GenericHIDHost/GenericHIDHost.c | 5 +- .../LowLevel/GenericHIDHost/GenericHIDHost.h | 2 +- Demos/Host/LowLevel/GenericHIDHost/makefile | 3 +- .../JoystickHostWithParser.c | 5 +- .../JoystickHostWithParser.h | 2 +- .../LowLevel/JoystickHostWithParser/makefile | 3 +- .../Host/LowLevel/KeyboardHost/KeyboardHost.c | 5 +- .../Host/LowLevel/KeyboardHost/KeyboardHost.h | 2 +- Demos/Host/LowLevel/KeyboardHost/makefile | 3 +- .../KeyboardHostWithParser.c | 5 +- .../KeyboardHostWithParser.h | 2 +- .../LowLevel/KeyboardHostWithParser/makefile | 3 +- Demos/Host/LowLevel/MIDIHost/MIDIHost.c | 5 +- Demos/Host/LowLevel/MIDIHost/MIDIHost.h | 2 +- Demos/Host/LowLevel/MIDIHost/makefile | 3 +- .../MassStorageHost/MassStorageHost.c | 5 +- .../MassStorageHost/MassStorageHost.h | 2 +- Demos/Host/LowLevel/MassStorageHost/makefile | 3 +- Demos/Host/LowLevel/MouseHost/MouseHost.c | 5 +- Demos/Host/LowLevel/MouseHost/MouseHost.h | 2 +- Demos/Host/LowLevel/MouseHost/makefile | 3 +- .../MouseHostWithParser/MouseHostWithParser.c | 5 +- .../MouseHostWithParser/MouseHostWithParser.h | 2 +- .../LowLevel/MouseHostWithParser/makefile | 3 +- Demos/Host/LowLevel/PrinterHost/PrinterHost.c | 5 +- Demos/Host/LowLevel/PrinterHost/PrinterHost.h | 2 +- Demos/Host/LowLevel/PrinterHost/makefile | 3 +- .../RNDISEthernetHost/RNDISEthernetHost.c | 5 +- .../RNDISEthernetHost/RNDISEthernetHost.h | 2 +- .../Host/LowLevel/RNDISEthernetHost/makefile | 3 +- .../LowLevel/StillImageHost/StillImageHost.c | 5 +- .../LowLevel/StillImageHost/StillImageHost.h | 2 +- Demos/Host/LowLevel/StillImageHost/makefile | 3 +- .../VirtualSerialHost/VirtualSerialHost.c | 5 +- .../VirtualSerialHost/VirtualSerialHost.h | 2 +- .../Host/LowLevel/VirtualSerialHost/makefile | 3 +- LUFA.pnproj | 2 +- LUFA/Drivers/Peripheral/Serial.c | 37 ++- LUFA/Drivers/Peripheral/Serial.h | 83 ++++- LUFA/Drivers/Peripheral/SerialStream.c | 54 ---- LUFA/Drivers/Peripheral/SerialStream.h | 139 --------- LUFA/Drivers/USB/Class/Common/HID.h | 34 +- LUFA/Drivers/USB/Class/Common/HIDParser.h | 107 ++++--- LUFA/Drivers/USB/Class/Device/CDC.h | 6 +- LUFA/Drivers/USB/Class/Host/CDC.h | 9 +- LUFA/ManPages/ChangeLog.txt | 7 +- LUFA/ManPages/MigrationInformation.txt | 294 +++++++++--------- LUFA/makefile | 4 +- .../AVRISP-MKII/Lib/XPROG/XPROGProtocol.h | 1 - .../StandaloneProgrammer.c | 5 +- .../StandaloneProgrammer.h | 2 +- .../Incomplete/StandaloneProgrammer/makefile | 3 +- 107 files changed, 520 insertions(+), 562 deletions(-) delete mode 100644 LUFA/Drivers/Peripheral/SerialStream.c delete mode 100644 LUFA/Drivers/Peripheral/SerialStream.h diff --git a/Demos/Device/ClassDriver/RNDISEthernet/Lib/ProtocolDecoders.h b/Demos/Device/ClassDriver/RNDISEthernet/Lib/ProtocolDecoders.h index 108b90cae5..d798c2251d 100644 --- a/Demos/Device/ClassDriver/RNDISEthernet/Lib/ProtocolDecoders.h +++ b/Demos/Device/ClassDriver/RNDISEthernet/Lib/ProtocolDecoders.h @@ -41,7 +41,7 @@ #include #include - #include + #include #include "EthernetProtocols.h" #include "Ethernet.h" diff --git a/Demos/Device/ClassDriver/RNDISEthernet/RNDISEthernet.c b/Demos/Device/ClassDriver/RNDISEthernet/RNDISEthernet.c index c9b5ad9ce3..585604672f 100644 --- a/Demos/Device/ClassDriver/RNDISEthernet/RNDISEthernet.c +++ b/Demos/Device/ClassDriver/RNDISEthernet/RNDISEthernet.c @@ -104,8 +104,11 @@ void SetupHardware(void) /* Hardware Initialization */ LEDs_Init(); - SerialStream_Init(9600, false); + Serial_Init(9600, false); USB_Init(); + + /* Create a stdio stream for the serial port for stdin and stdout */ + Serial_CreateStream(NULL); } /** Event handler for the library USB Connection event. */ diff --git a/Demos/Device/ClassDriver/RNDISEthernet/RNDISEthernet.h b/Demos/Device/ClassDriver/RNDISEthernet/RNDISEthernet.h index fa242ecf67..8509a8d282 100644 --- a/Demos/Device/ClassDriver/RNDISEthernet/RNDISEthernet.h +++ b/Demos/Device/ClassDriver/RNDISEthernet/RNDISEthernet.h @@ -52,7 +52,7 @@ #include #include - #include + #include #include /* Macros: */ diff --git a/Demos/Device/ClassDriver/RNDISEthernet/makefile b/Demos/Device/ClassDriver/RNDISEthernet/makefile index 2d3e5d541e..e4e2274531 100644 --- a/Demos/Device/ClassDriver/RNDISEthernet/makefile +++ b/Demos/Device/ClassDriver/RNDISEthernet/makefile @@ -149,8 +149,7 @@ SRC = $(TARGET).c \ Lib/Webserver.c \ $(LUFA_SRC_USB) \ $(LUFA_SRC_USBCLASS) \ - $(LUFA_SRC_SERIAL) \ - $(LUFA_SRC_SERIALSTREAM) + $(LUFA_SRC_SERIAL) # List C++ source files here. (C dependencies are automatically generated.) diff --git a/Demos/Device/Incomplete/Sideshow/Sideshow.c b/Demos/Device/Incomplete/Sideshow/Sideshow.c index 4b6b268466..09076e1532 100644 --- a/Demos/Device/Incomplete/Sideshow/Sideshow.c +++ b/Demos/Device/Incomplete/Sideshow/Sideshow.c @@ -80,7 +80,10 @@ void SetupHardware(void) /* Hardware Initialization */ LEDs_Init(); USB_Init(); - SerialStream_Init(9600, false); + Serial_Init(9600, false); + + /* Create a stdio stream for the serial port for stdin and stdout */ + Serial_CreateStream(NULL); } void EVENT_USB_Device_Connect(void) diff --git a/Demos/Device/Incomplete/Sideshow/Sideshow.h b/Demos/Device/Incomplete/Sideshow/Sideshow.h index 6bbf4b5a53..eaa2c1dd3d 100644 --- a/Demos/Device/Incomplete/Sideshow/Sideshow.h +++ b/Demos/Device/Incomplete/Sideshow/Sideshow.h @@ -43,7 +43,7 @@ #include #include #include - #include + #include /* Macros: */ /** Device control request for used in the Microsoft OS Descriptor for retrieving the OS Feature diff --git a/Demos/Device/Incomplete/Sideshow/makefile b/Demos/Device/Incomplete/Sideshow/makefile index 81756c12bb..2060175492 100644 --- a/Demos/Device/Incomplete/Sideshow/makefile +++ b/Demos/Device/Incomplete/Sideshow/makefile @@ -135,8 +135,7 @@ SRC = $(TARGET).c \ Lib/SideshowCommon.c \ Lib/SideshowContent.c \ $(LUFA_SRC_USB) \ - $(LUFA_SRC_SERIAL) \ - $(LUFA_SRC_SERIALSTREAM) + $(LUFA_SRC_SERIAL) # List C++ source files here. (C dependencies are automatically generated.) diff --git a/Demos/Device/LowLevel/RNDISEthernet/Lib/ProtocolDecoders.h b/Demos/Device/LowLevel/RNDISEthernet/Lib/ProtocolDecoders.h index e98ab24f0d..aeece37625 100644 --- a/Demos/Device/LowLevel/RNDISEthernet/Lib/ProtocolDecoders.h +++ b/Demos/Device/LowLevel/RNDISEthernet/Lib/ProtocolDecoders.h @@ -41,7 +41,7 @@ #include #include - #include + #include #include "EthernetProtocols.h" #include "Ethernet.h" diff --git a/Demos/Device/LowLevel/RNDISEthernet/RNDISEthernet.c b/Demos/Device/LowLevel/RNDISEthernet/RNDISEthernet.c index 9796d4ebcb..cc5f9e3022 100644 --- a/Demos/Device/LowLevel/RNDISEthernet/RNDISEthernet.c +++ b/Demos/Device/LowLevel/RNDISEthernet/RNDISEthernet.c @@ -71,8 +71,11 @@ void SetupHardware(void) /* Hardware Initialization */ LEDs_Init(); - SerialStream_Init(9600, false); + Serial_Init(9600, false); USB_Init(); + + /* Create a stdio stream for the serial port for stdin and stdout */ + Serial_CreateStream(NULL); } /** Event handler for the USB_Connect event. This indicates that the device is enumerating via the status LEDs and diff --git a/Demos/Device/LowLevel/RNDISEthernet/makefile b/Demos/Device/LowLevel/RNDISEthernet/makefile index 53f678b86b..09213a98e3 100644 --- a/Demos/Device/LowLevel/RNDISEthernet/makefile +++ b/Demos/Device/LowLevel/RNDISEthernet/makefile @@ -149,8 +149,7 @@ SRC = $(TARGET).c \ Lib/Webserver.c \ Lib/RNDIS.c \ $(LUFA_SRC_USB) \ - $(LUFA_SRC_SERIAL) \ - $(LUFA_SRC_SERIALSTREAM) + $(LUFA_SRC_SERIAL) # List C++ source files here. (C dependencies are automatically generated.) diff --git a/Demos/DualRole/ClassDriver/MouseHostDevice/MouseHostDevice.c b/Demos/DualRole/ClassDriver/MouseHostDevice/MouseHostDevice.c index e0de5c2e88..16c8953dc5 100644 --- a/Demos/DualRole/ClassDriver/MouseHostDevice/MouseHostDevice.c +++ b/Demos/DualRole/ClassDriver/MouseHostDevice/MouseHostDevice.c @@ -76,11 +76,14 @@ void SetupHardware(void) clock_prescale_set(clock_div_1); /* Hardware Initialization */ - SerialStream_Init(9600, false); + Serial_Init(9600, false); LEDs_Init(); Joystick_Init(); Buttons_Init(); USB_Init(USB_MODE_UID); + + /* Create a stdio stream for the serial port for stdin and stdout */ + Serial_CreateStream(NULL); } /** Event handler for the library USB mode change event. */ diff --git a/Demos/DualRole/ClassDriver/MouseHostDevice/MouseHostDevice.h b/Demos/DualRole/ClassDriver/MouseHostDevice/MouseHostDevice.h index 4c9ea7fed8..e0649c820c 100644 --- a/Demos/DualRole/ClassDriver/MouseHostDevice/MouseHostDevice.h +++ b/Demos/DualRole/ClassDriver/MouseHostDevice/MouseHostDevice.h @@ -46,7 +46,7 @@ #include #include - #include + #include #include #include #include diff --git a/Demos/DualRole/ClassDriver/MouseHostDevice/makefile b/Demos/DualRole/ClassDriver/MouseHostDevice/makefile index 0ed12ad218..8aca25a0e7 100644 --- a/Demos/DualRole/ClassDriver/MouseHostDevice/makefile +++ b/Demos/DualRole/ClassDriver/MouseHostDevice/makefile @@ -133,8 +133,7 @@ SRC = $(TARGET).c \ HostFunctions.c \ $(LUFA_SRC_USB) \ $(LUFA_SRC_USBCLASS) \ - $(LUFA_SRC_SERIAL) \ - $(LUFA_SRC_SERIALSTREAM) + $(LUFA_SRC_SERIAL) # List C++ source files here. (C dependencies are automatically generated.) diff --git a/Demos/Host/ClassDriver/JoystickHostWithParser/JoystickHostWithParser.c b/Demos/Host/ClassDriver/JoystickHostWithParser/JoystickHostWithParser.c index 0cbfac9cd5..5674f35f27 100644 --- a/Demos/Host/ClassDriver/JoystickHostWithParser/JoystickHostWithParser.c +++ b/Demos/Host/ClassDriver/JoystickHostWithParser/JoystickHostWithParser.c @@ -182,9 +182,12 @@ void SetupHardware(void) clock_prescale_set(clock_div_1); /* Hardware Initialization */ - SerialStream_Init(9600, false); + Serial_Init(9600, false); LEDs_Init(); USB_Init(); + + /* Create a stdio stream for the serial port for stdin and stdout */ + Serial_CreateStream(NULL); } /** Event handler for the USB_DeviceAttached event. This indicates that a device has been attached to the host, and diff --git a/Demos/Host/ClassDriver/JoystickHostWithParser/JoystickHostWithParser.h b/Demos/Host/ClassDriver/JoystickHostWithParser/JoystickHostWithParser.h index 3d7f075da6..fe6fae7d15 100644 --- a/Demos/Host/ClassDriver/JoystickHostWithParser/JoystickHostWithParser.h +++ b/Demos/Host/ClassDriver/JoystickHostWithParser/JoystickHostWithParser.h @@ -46,7 +46,7 @@ #include #include - #include + #include #include #include diff --git a/Demos/Host/ClassDriver/JoystickHostWithParser/makefile b/Demos/Host/ClassDriver/JoystickHostWithParser/makefile index a585f3f9fa..4133b2b080 100644 --- a/Demos/Host/ClassDriver/JoystickHostWithParser/makefile +++ b/Demos/Host/ClassDriver/JoystickHostWithParser/makefile @@ -128,8 +128,7 @@ include $(LUFA_PATH)/LUFA/makefile SRC = $(TARGET).c \ $(LUFA_SRC_USB) \ $(LUFA_SRC_USBCLASS) \ - $(LUFA_SRC_SERIAL) \ - $(LUFA_SRC_SERIALSTREAM) + $(LUFA_SRC_SERIAL) # List C++ source files here. (C dependencies are automatically generated.) diff --git a/Demos/Host/ClassDriver/KeyboardHost/KeyboardHost.c b/Demos/Host/ClassDriver/KeyboardHost/KeyboardHost.c index 1e32d92c7e..a985ec25be 100644 --- a/Demos/Host/ClassDriver/KeyboardHost/KeyboardHost.c +++ b/Demos/Host/ClassDriver/KeyboardHost/KeyboardHost.c @@ -174,9 +174,12 @@ void SetupHardware(void) clock_prescale_set(clock_div_1); /* Hardware Initialization */ - SerialStream_Init(9600, false); + Serial_Init(9600, false); LEDs_Init(); USB_Init(); + + /* Create a stdio stream for the serial port for stdin and stdout */ + Serial_CreateStream(NULL); } /** Event handler for the USB_DeviceAttached event. This indicates that a device has been attached to the host, and diff --git a/Demos/Host/ClassDriver/KeyboardHost/KeyboardHost.h b/Demos/Host/ClassDriver/KeyboardHost/KeyboardHost.h index b6440b5465..52c63709ab 100644 --- a/Demos/Host/ClassDriver/KeyboardHost/KeyboardHost.h +++ b/Demos/Host/ClassDriver/KeyboardHost/KeyboardHost.h @@ -46,7 +46,7 @@ #include #include - #include + #include #include #include diff --git a/Demos/Host/ClassDriver/KeyboardHost/makefile b/Demos/Host/ClassDriver/KeyboardHost/makefile index 8dc1791bc6..30946c5bf5 100644 --- a/Demos/Host/ClassDriver/KeyboardHost/makefile +++ b/Demos/Host/ClassDriver/KeyboardHost/makefile @@ -128,8 +128,7 @@ include $(LUFA_PATH)/LUFA/makefile SRC = $(TARGET).c \ $(LUFA_SRC_USB) \ $(LUFA_SRC_USBCLASS) \ - $(LUFA_SRC_SERIAL) \ - $(LUFA_SRC_SERIALSTREAM) + $(LUFA_SRC_SERIAL) # List C++ source files here. (C dependencies are automatically generated.) diff --git a/Demos/Host/ClassDriver/KeyboardHostWithParser/KeyboardHostWithParser.c b/Demos/Host/ClassDriver/KeyboardHostWithParser/KeyboardHostWithParser.c index 8d7fa93c26..fc549ab90d 100644 --- a/Demos/Host/ClassDriver/KeyboardHostWithParser/KeyboardHostWithParser.c +++ b/Demos/Host/ClassDriver/KeyboardHostWithParser/KeyboardHostWithParser.c @@ -200,9 +200,12 @@ void SetupHardware(void) clock_prescale_set(clock_div_1); /* Hardware Initialization */ - SerialStream_Init(9600, false); + Serial_Init(9600, false); LEDs_Init(); USB_Init(); + + /* Create a stdio stream for the serial port for stdin and stdout */ + Serial_CreateStream(NULL); } /** Event handler for the USB_DeviceAttached event. This indicates that a device has been attached to the host, and diff --git a/Demos/Host/ClassDriver/KeyboardHostWithParser/KeyboardHostWithParser.h b/Demos/Host/ClassDriver/KeyboardHostWithParser/KeyboardHostWithParser.h index 2dc1489210..94e653a5ff 100644 --- a/Demos/Host/ClassDriver/KeyboardHostWithParser/KeyboardHostWithParser.h +++ b/Demos/Host/ClassDriver/KeyboardHostWithParser/KeyboardHostWithParser.h @@ -46,7 +46,7 @@ #include #include - #include + #include #include #include diff --git a/Demos/Host/ClassDriver/KeyboardHostWithParser/makefile b/Demos/Host/ClassDriver/KeyboardHostWithParser/makefile index 90ec16242a..4e07a6883a 100644 --- a/Demos/Host/ClassDriver/KeyboardHostWithParser/makefile +++ b/Demos/Host/ClassDriver/KeyboardHostWithParser/makefile @@ -128,8 +128,7 @@ include $(LUFA_PATH)/LUFA/makefile SRC = $(TARGET).c \ $(LUFA_SRC_USB) \ $(LUFA_SRC_USBCLASS) \ - $(LUFA_SRC_SERIAL) \ - $(LUFA_SRC_SERIALSTREAM) + $(LUFA_SRC_SERIAL) # List C++ source files here. (C dependencies are automatically generated.) diff --git a/Demos/Host/ClassDriver/MIDIHost/MIDIHost.c b/Demos/Host/ClassDriver/MIDIHost/MIDIHost.c index ae40aeb282..4cfaccdc35 100644 --- a/Demos/Host/ClassDriver/MIDIHost/MIDIHost.c +++ b/Demos/Host/ClassDriver/MIDIHost/MIDIHost.c @@ -141,11 +141,14 @@ void SetupHardware(void) clock_prescale_set(clock_div_1); /* Hardware Initialization */ - SerialStream_Init(9600, false); + Serial_Init(9600, false); LEDs_Init(); Buttons_Init(); Joystick_Init(); USB_Init(); + + /* Create a stdio stream for the serial port for stdin and stdout */ + Serial_CreateStream(NULL); } void CheckJoystickMovement(void) diff --git a/Demos/Host/ClassDriver/MIDIHost/MIDIHost.h b/Demos/Host/ClassDriver/MIDIHost/MIDIHost.h index a497225b94..2688500bcf 100644 --- a/Demos/Host/ClassDriver/MIDIHost/MIDIHost.h +++ b/Demos/Host/ClassDriver/MIDIHost/MIDIHost.h @@ -46,7 +46,7 @@ #include #include - #include + #include #include #include #include diff --git a/Demos/Host/ClassDriver/MIDIHost/makefile b/Demos/Host/ClassDriver/MIDIHost/makefile index 64a05e1e68..fe203868f6 100644 --- a/Demos/Host/ClassDriver/MIDIHost/makefile +++ b/Demos/Host/ClassDriver/MIDIHost/makefile @@ -128,8 +128,7 @@ include $(LUFA_PATH)/LUFA/makefile SRC = $(TARGET).c \ $(LUFA_SRC_USB) \ $(LUFA_SRC_USBCLASS) \ - $(LUFA_SRC_SERIAL) \ - $(LUFA_SRC_SERIALSTREAM) + $(LUFA_SRC_SERIAL) # List C++ source files here. (C dependencies are automatically generated.) diff --git a/Demos/Host/ClassDriver/MassStorageHost/MassStorageHost.c b/Demos/Host/ClassDriver/MassStorageHost/MassStorageHost.c index d620174787..3392878892 100644 --- a/Demos/Host/ClassDriver/MassStorageHost/MassStorageHost.c +++ b/Demos/Host/ClassDriver/MassStorageHost/MassStorageHost.c @@ -243,9 +243,12 @@ void SetupHardware(void) clock_prescale_set(clock_div_1); /* Hardware Initialization */ - SerialStream_Init(9600, false); + Serial_Init(9600, false); LEDs_Init(); USB_Init(); + + /* Create a stdio stream for the serial port for stdin and stdout */ + Serial_CreateStream(NULL); } /** Event handler for the USB_DeviceAttached event. This indicates that a device has been attached to the host, and diff --git a/Demos/Host/ClassDriver/MassStorageHost/MassStorageHost.h b/Demos/Host/ClassDriver/MassStorageHost/MassStorageHost.h index a07668db2c..dfc6a8f947 100644 --- a/Demos/Host/ClassDriver/MassStorageHost/MassStorageHost.h +++ b/Demos/Host/ClassDriver/MassStorageHost/MassStorageHost.h @@ -47,7 +47,7 @@ #include #include - #include + #include #include #include diff --git a/Demos/Host/ClassDriver/MassStorageHost/makefile b/Demos/Host/ClassDriver/MassStorageHost/makefile index a3b7ff1787..8124af8126 100644 --- a/Demos/Host/ClassDriver/MassStorageHost/makefile +++ b/Demos/Host/ClassDriver/MassStorageHost/makefile @@ -129,8 +129,7 @@ include $(LUFA_PATH)/LUFA/makefile SRC = $(TARGET).c \ $(LUFA_SRC_USB) \ $(LUFA_SRC_USBCLASS) \ - $(LUFA_SRC_SERIAL) \ - $(LUFA_SRC_SERIALSTREAM) + $(LUFA_SRC_SERIAL) # List C++ source files here. (C dependencies are automatically generated.) diff --git a/Demos/Host/ClassDriver/MouseHost/MouseHost.c b/Demos/Host/ClassDriver/MouseHost/MouseHost.c index 9ad6b4a609..67f55d8610 100644 --- a/Demos/Host/ClassDriver/MouseHost/MouseHost.c +++ b/Demos/Host/ClassDriver/MouseHost/MouseHost.c @@ -161,9 +161,12 @@ void SetupHardware(void) clock_prescale_set(clock_div_1); /* Hardware Initialization */ - SerialStream_Init(9600, false); + Serial_Init(9600, false); LEDs_Init(); USB_Init(); + + /* Create a stdio stream for the serial port for stdin and stdout */ + Serial_CreateStream(NULL); } /** Event handler for the USB_DeviceAttached event. This indicates that a device has been attached to the host, and diff --git a/Demos/Host/ClassDriver/MouseHost/MouseHost.h b/Demos/Host/ClassDriver/MouseHost/MouseHost.h index 4afbc6e3f0..6dee569a08 100644 --- a/Demos/Host/ClassDriver/MouseHost/MouseHost.h +++ b/Demos/Host/ClassDriver/MouseHost/MouseHost.h @@ -46,7 +46,7 @@ #include #include - #include + #include #include #include diff --git a/Demos/Host/ClassDriver/MouseHost/makefile b/Demos/Host/ClassDriver/MouseHost/makefile index 0812c5cb1e..77c47237e9 100644 --- a/Demos/Host/ClassDriver/MouseHost/makefile +++ b/Demos/Host/ClassDriver/MouseHost/makefile @@ -128,8 +128,7 @@ include $(LUFA_PATH)/LUFA/makefile SRC = $(TARGET).c \ $(LUFA_SRC_USB) \ $(LUFA_SRC_USBCLASS) \ - $(LUFA_SRC_SERIAL) \ - $(LUFA_SRC_SERIALSTREAM) + $(LUFA_SRC_SERIAL) # List C++ source files here. (C dependencies are automatically generated.) diff --git a/Demos/Host/ClassDriver/MouseHostWithParser/MouseHostWithParser.c b/Demos/Host/ClassDriver/MouseHostWithParser/MouseHostWithParser.c index d34acc8c3c..d2b73c9509 100644 --- a/Demos/Host/ClassDriver/MouseHostWithParser/MouseHostWithParser.c +++ b/Demos/Host/ClassDriver/MouseHostWithParser/MouseHostWithParser.c @@ -191,9 +191,12 @@ void SetupHardware(void) clock_prescale_set(clock_div_1); /* Hardware Initialization */ - SerialStream_Init(9600, false); + Serial_Init(9600, false); LEDs_Init(); USB_Init(); + + /* Create a stdio stream for the serial port for stdin and stdout */ + Serial_CreateStream(NULL); } /** Event handler for the USB_DeviceAttached event. This indicates that a device has been attached to the host, and diff --git a/Demos/Host/ClassDriver/MouseHostWithParser/MouseHostWithParser.h b/Demos/Host/ClassDriver/MouseHostWithParser/MouseHostWithParser.h index 17691934e7..8d90d5cf4e 100644 --- a/Demos/Host/ClassDriver/MouseHostWithParser/MouseHostWithParser.h +++ b/Demos/Host/ClassDriver/MouseHostWithParser/MouseHostWithParser.h @@ -46,7 +46,7 @@ #include #include - #include + #include #include #include diff --git a/Demos/Host/ClassDriver/MouseHostWithParser/makefile b/Demos/Host/ClassDriver/MouseHostWithParser/makefile index 48923b2de5..37424e8269 100644 --- a/Demos/Host/ClassDriver/MouseHostWithParser/makefile +++ b/Demos/Host/ClassDriver/MouseHostWithParser/makefile @@ -128,8 +128,7 @@ include $(LUFA_PATH)/LUFA/makefile SRC = $(TARGET).c \ $(LUFA_SRC_USB) \ $(LUFA_SRC_USBCLASS) \ - $(LUFA_SRC_SERIAL) \ - $(LUFA_SRC_SERIALSTREAM) + $(LUFA_SRC_SERIAL) # List C++ source files here. (C dependencies are automatically generated.) diff --git a/Demos/Host/ClassDriver/PrinterHost/PrinterHost.c b/Demos/Host/ClassDriver/PrinterHost/PrinterHost.c index ebcf0b8b62..7e9a2c7a10 100644 --- a/Demos/Host/ClassDriver/PrinterHost/PrinterHost.c +++ b/Demos/Host/ClassDriver/PrinterHost/PrinterHost.c @@ -165,9 +165,12 @@ void SetupHardware(void) clock_prescale_set(clock_div_1); /* Hardware Initialization */ - SerialStream_Init(9600, false); + Serial_Init(9600, false); LEDs_Init(); USB_Init(); + + /* Create a stdio stream for the serial port for stdin and stdout */ + Serial_CreateStream(NULL); } /** Event handler for the USB_DeviceAttached event. This indicates that a device has been attached to the host, and diff --git a/Demos/Host/ClassDriver/PrinterHost/PrinterHost.h b/Demos/Host/ClassDriver/PrinterHost/PrinterHost.h index a8d43e4619..0c0a8277a9 100644 --- a/Demos/Host/ClassDriver/PrinterHost/PrinterHost.h +++ b/Demos/Host/ClassDriver/PrinterHost/PrinterHost.h @@ -46,7 +46,7 @@ #include #include - #include + #include #include #include diff --git a/Demos/Host/ClassDriver/PrinterHost/makefile b/Demos/Host/ClassDriver/PrinterHost/makefile index 15c2678822..a5df91fce1 100644 --- a/Demos/Host/ClassDriver/PrinterHost/makefile +++ b/Demos/Host/ClassDriver/PrinterHost/makefile @@ -128,8 +128,7 @@ include $(LUFA_PATH)/LUFA/makefile SRC = $(TARGET).c \ $(LUFA_SRC_USB) \ $(LUFA_SRC_USBCLASS) \ - $(LUFA_SRC_SERIAL) \ - $(LUFA_SRC_SERIALSTREAM) + $(LUFA_SRC_SERIAL) # List C++ source files here. (C dependencies are automatically generated.) diff --git a/Demos/Host/ClassDriver/RNDISEthernetHost/RNDISEthernetHost.c b/Demos/Host/ClassDriver/RNDISEthernetHost/RNDISEthernetHost.c index 965a3cc3f8..55c412872e 100644 --- a/Demos/Host/ClassDriver/RNDISEthernetHost/RNDISEthernetHost.c +++ b/Demos/Host/ClassDriver/RNDISEthernetHost/RNDISEthernetHost.c @@ -190,9 +190,12 @@ void SetupHardware(void) clock_prescale_set(clock_div_1); /* Hardware Initialization */ - SerialStream_Init(9600, false); + Serial_Init(9600, false); LEDs_Init(); USB_Init(); + + /* Create a stdio stream for the serial port for stdin and stdout */ + Serial_CreateStream(NULL); } /** Event handler for the USB_DeviceAttached event. This indicates that a device has been attached to the host, and diff --git a/Demos/Host/ClassDriver/RNDISEthernetHost/RNDISEthernetHost.h b/Demos/Host/ClassDriver/RNDISEthernetHost/RNDISEthernetHost.h index 82443235cd..e9496a5c24 100644 --- a/Demos/Host/ClassDriver/RNDISEthernetHost/RNDISEthernetHost.h +++ b/Demos/Host/ClassDriver/RNDISEthernetHost/RNDISEthernetHost.h @@ -46,7 +46,6 @@ #include #include - #include #include #include diff --git a/Demos/Host/ClassDriver/RNDISEthernetHost/makefile b/Demos/Host/ClassDriver/RNDISEthernetHost/makefile index 8453a491d0..942544718c 100644 --- a/Demos/Host/ClassDriver/RNDISEthernetHost/makefile +++ b/Demos/Host/ClassDriver/RNDISEthernetHost/makefile @@ -128,8 +128,7 @@ include $(LUFA_PATH)/LUFA/makefile SRC = $(TARGET).c \ $(LUFA_SRC_USB) \ $(LUFA_SRC_USBCLASS) \ - $(LUFA_SRC_SERIAL) \ - $(LUFA_SRC_SERIALSTREAM) + $(LUFA_SRC_SERIAL) # List C++ source files here. (C dependencies are automatically generated.) diff --git a/Demos/Host/ClassDriver/StillImageHost/StillImageHost.c b/Demos/Host/ClassDriver/StillImageHost/StillImageHost.c index 581787d308..7018f9d2dc 100644 --- a/Demos/Host/ClassDriver/StillImageHost/StillImageHost.c +++ b/Demos/Host/ClassDriver/StillImageHost/StillImageHost.c @@ -159,9 +159,12 @@ void SetupHardware(void) clock_prescale_set(clock_div_1); /* Hardware Initialization */ - SerialStream_Init(9600, false); + Serial_Init(9600, false); LEDs_Init(); USB_Init(); + + /* Create a stdio stream for the serial port for stdin and stdout */ + Serial_CreateStream(NULL); } /** Event handler for the USB_DeviceAttached event. This indicates that a device has been attached to the host, and diff --git a/Demos/Host/ClassDriver/StillImageHost/StillImageHost.h b/Demos/Host/ClassDriver/StillImageHost/StillImageHost.h index df8b560de4..82bef4f40e 100644 --- a/Demos/Host/ClassDriver/StillImageHost/StillImageHost.h +++ b/Demos/Host/ClassDriver/StillImageHost/StillImageHost.h @@ -46,7 +46,7 @@ #include #include - #include + #include #include #include diff --git a/Demos/Host/ClassDriver/StillImageHost/makefile b/Demos/Host/ClassDriver/StillImageHost/makefile index 8c6cdb53e6..e4ded2cc15 100644 --- a/Demos/Host/ClassDriver/StillImageHost/makefile +++ b/Demos/Host/ClassDriver/StillImageHost/makefile @@ -128,8 +128,7 @@ include $(LUFA_PATH)/LUFA/makefile SRC = $(TARGET).c \ $(LUFA_SRC_USB) \ $(LUFA_SRC_USBCLASS) \ - $(LUFA_SRC_SERIAL) \ - $(LUFA_SRC_SERIALSTREAM) + $(LUFA_SRC_SERIAL) # List C++ source files here. (C dependencies are automatically generated.) diff --git a/Demos/Host/ClassDriver/VirtualSerialHost/VirtualSerialHost.c b/Demos/Host/ClassDriver/VirtualSerialHost/VirtualSerialHost.c index e2f062cc12..e308e36efe 100644 --- a/Demos/Host/ClassDriver/VirtualSerialHost/VirtualSerialHost.c +++ b/Demos/Host/ClassDriver/VirtualSerialHost/VirtualSerialHost.c @@ -61,7 +61,7 @@ USB_ClassInfo_CDC_Host_t VirtualSerial_CDC_Interface = int main(void) { SetupHardware(); - + puts_P(PSTR(ESC_FG_CYAN "CDC Host Demo running.\r\n" ESC_FG_WHITE)); LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); @@ -135,9 +135,12 @@ void SetupHardware(void) clock_prescale_set(clock_div_1); /* Hardware Initialization */ - SerialStream_Init(9600, false); + Serial_Init(9600, false); LEDs_Init(); USB_Init(); + + /* Create a stdio stream for the serial port for stdin and stdout */ + Serial_CreateStream(NULL); } /** Event handler for the USB_DeviceAttached event. This indicates that a device has been attached to the host, and diff --git a/Demos/Host/ClassDriver/VirtualSerialHost/VirtualSerialHost.h b/Demos/Host/ClassDriver/VirtualSerialHost/VirtualSerialHost.h index 7c77719111..ee625d79c5 100644 --- a/Demos/Host/ClassDriver/VirtualSerialHost/VirtualSerialHost.h +++ b/Demos/Host/ClassDriver/VirtualSerialHost/VirtualSerialHost.h @@ -46,7 +46,7 @@ #include #include - #include + #include #include #include diff --git a/Demos/Host/ClassDriver/VirtualSerialHost/makefile b/Demos/Host/ClassDriver/VirtualSerialHost/makefile index 38ac416b84..c957f831f7 100644 --- a/Demos/Host/ClassDriver/VirtualSerialHost/makefile +++ b/Demos/Host/ClassDriver/VirtualSerialHost/makefile @@ -128,8 +128,7 @@ include $(LUFA_PATH)/LUFA/makefile SRC = $(TARGET).c \ $(LUFA_SRC_USB) \ $(LUFA_SRC_USBCLASS) \ - $(LUFA_SRC_SERIAL) \ - $(LUFA_SRC_SERIALSTREAM) + $(LUFA_SRC_SERIAL) # List C++ source files here. (C dependencies are automatically generated.) diff --git a/Demos/Host/Incomplete/BluetoothHost/BluetoothEvents.h b/Demos/Host/Incomplete/BluetoothHost/BluetoothEvents.h index 0c6e030be3..1dab3b7b69 100644 --- a/Demos/Host/Incomplete/BluetoothHost/BluetoothEvents.h +++ b/Demos/Host/Incomplete/BluetoothHost/BluetoothEvents.h @@ -45,7 +45,7 @@ #include "Lib/SDP.h" #include "Lib/RFCOMM.h" - #include + #include #include /* Macros: */ diff --git a/Demos/Host/Incomplete/BluetoothHost/BluetoothHost.c b/Demos/Host/Incomplete/BluetoothHost/BluetoothHost.c index c4f091c983..9d18b83b88 100644 --- a/Demos/Host/Incomplete/BluetoothHost/BluetoothHost.c +++ b/Demos/Host/Incomplete/BluetoothHost/BluetoothHost.c @@ -77,9 +77,12 @@ void SetupHardware(void) clock_prescale_set(clock_div_1); /* Hardware Initialization */ - SerialStream_Init(9600, false); + Serial_Init(9600, false); LEDs_Init(); USB_Init(); + + /* Create a stdio stream for the serial port for stdin and stdout */ + Serial_CreateStream(NULL); } /** Event handler for the USB_DeviceAttached event. This indicates that a device has been attached to the host, and diff --git a/Demos/Host/Incomplete/BluetoothHost/BluetoothHost.h b/Demos/Host/Incomplete/BluetoothHost/BluetoothHost.h index cdb9ba39e1..aecdf965ca 100644 --- a/Demos/Host/Incomplete/BluetoothHost/BluetoothHost.h +++ b/Demos/Host/Incomplete/BluetoothHost/BluetoothHost.h @@ -52,7 +52,7 @@ #include #include #include - #include + #include #include /* Macros: */ diff --git a/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothACLPackets.h b/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothACLPackets.h index d45c577846..c32b52e25e 100644 --- a/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothACLPackets.h +++ b/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothACLPackets.h @@ -43,7 +43,7 @@ #include #include - #include + #include #include "BluetoothStack.h" diff --git a/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothHCICommands.h b/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothHCICommands.h index 49db8781ff..ae5da6730e 100644 --- a/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothHCICommands.h +++ b/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothHCICommands.h @@ -43,7 +43,7 @@ #include #include - #include + #include #include "BluetoothStack.h" #include "BluetoothClassCodes.h" diff --git a/Demos/Host/Incomplete/BluetoothHost/Lib/RFCOMM.h b/Demos/Host/Incomplete/BluetoothHost/Lib/RFCOMM.h index 7239486932..88b0c7fc47 100644 --- a/Demos/Host/Incomplete/BluetoothHost/Lib/RFCOMM.h +++ b/Demos/Host/Incomplete/BluetoothHost/Lib/RFCOMM.h @@ -44,7 +44,7 @@ #include #include - #include + #include #include "BluetoothStack.h" #include "RFCOMMControl.h" diff --git a/Demos/Host/Incomplete/BluetoothHost/Lib/RFCOMMControl.h b/Demos/Host/Incomplete/BluetoothHost/Lib/RFCOMMControl.h index 4888e3fba2..8ff6334048 100644 --- a/Demos/Host/Incomplete/BluetoothHost/Lib/RFCOMMControl.h +++ b/Demos/Host/Incomplete/BluetoothHost/Lib/RFCOMMControl.h @@ -44,7 +44,7 @@ #include #include - #include + #include #include "BluetoothStack.h" #include "RFCOMM.h" diff --git a/Demos/Host/Incomplete/BluetoothHost/Lib/SDP.h b/Demos/Host/Incomplete/BluetoothHost/Lib/SDP.h index 842bc58adb..695aac733c 100644 --- a/Demos/Host/Incomplete/BluetoothHost/Lib/SDP.h +++ b/Demos/Host/Incomplete/BluetoothHost/Lib/SDP.h @@ -44,7 +44,7 @@ #include #include - #include + #include #include "BluetoothStack.h" #include "SDPServices.h" diff --git a/Demos/Host/Incomplete/BluetoothHost/makefile b/Demos/Host/Incomplete/BluetoothHost/makefile index d8f4b9eee1..de80a0e5b0 100644 --- a/Demos/Host/Incomplete/BluetoothHost/makefile +++ b/Demos/Host/Incomplete/BluetoothHost/makefile @@ -137,8 +137,7 @@ SRC = $(TARGET).c \ Lib/RFCOMM.c \ Lib/RFCOMMControl.c \ $(LUFA_SRC_USB) \ - $(LUFA_SRC_SERIAL) \ - $(LUFA_SRC_SERIALSTREAM) + $(LUFA_SRC_SERIAL) # List C++ source files here. (C dependencies are automatically generated.) diff --git a/Demos/Host/LowLevel/GenericHIDHost/GenericHIDHost.c b/Demos/Host/LowLevel/GenericHIDHost/GenericHIDHost.c index 48864bb987..6dcfff88e6 100644 --- a/Demos/Host/LowLevel/GenericHIDHost/GenericHIDHost.c +++ b/Demos/Host/LowLevel/GenericHIDHost/GenericHIDHost.c @@ -66,9 +66,12 @@ void SetupHardware(void) clock_prescale_set(clock_div_1); /* Hardware Initialization */ - SerialStream_Init(9600, false); + Serial_Init(9600, false); LEDs_Init(); USB_Init(); + + /* Create a stdio stream for the serial port for stdin and stdout */ + Serial_CreateStream(NULL); } /** Event handler for the USB_DeviceAttached event. This indicates that a device has been attached to the host, and diff --git a/Demos/Host/LowLevel/GenericHIDHost/GenericHIDHost.h b/Demos/Host/LowLevel/GenericHIDHost/GenericHIDHost.h index 5920ab9059..90d7badd81 100644 --- a/Demos/Host/LowLevel/GenericHIDHost/GenericHIDHost.h +++ b/Demos/Host/LowLevel/GenericHIDHost/GenericHIDHost.h @@ -47,7 +47,7 @@ #include #include #include - #include + #include #include #include "ConfigDescriptor.h" diff --git a/Demos/Host/LowLevel/GenericHIDHost/makefile b/Demos/Host/LowLevel/GenericHIDHost/makefile index fd239a7224..4db0c93a27 100644 --- a/Demos/Host/LowLevel/GenericHIDHost/makefile +++ b/Demos/Host/LowLevel/GenericHIDHost/makefile @@ -128,8 +128,7 @@ include $(LUFA_PATH)/LUFA/makefile SRC = $(TARGET).c \ ConfigDescriptor.c \ $(LUFA_SRC_USB) \ - $(LUFA_SRC_SERIAL) \ - $(LUFA_SRC_SERIALSTREAM) + $(LUFA_SRC_SERIAL) # List C++ source files here. (C dependencies are automatically generated.) diff --git a/Demos/Host/LowLevel/JoystickHostWithParser/JoystickHostWithParser.c b/Demos/Host/LowLevel/JoystickHostWithParser/JoystickHostWithParser.c index c69e62d74c..5dcd97ca4c 100644 --- a/Demos/Host/LowLevel/JoystickHostWithParser/JoystickHostWithParser.c +++ b/Demos/Host/LowLevel/JoystickHostWithParser/JoystickHostWithParser.c @@ -66,9 +66,12 @@ void SetupHardware(void) clock_prescale_set(clock_div_1); /* Hardware Initialization */ - SerialStream_Init(9600, false); + Serial_Init(9600, false); LEDs_Init(); USB_Init(); + + /* Create a stdio stream for the serial port for stdin and stdout */ + Serial_CreateStream(NULL); } /** Event handler for the USB_DeviceAttached event. This indicates that a device has been attached to the host, and diff --git a/Demos/Host/LowLevel/JoystickHostWithParser/JoystickHostWithParser.h b/Demos/Host/LowLevel/JoystickHostWithParser/JoystickHostWithParser.h index 5365f83c36..6bcc0613a7 100644 --- a/Demos/Host/LowLevel/JoystickHostWithParser/JoystickHostWithParser.h +++ b/Demos/Host/LowLevel/JoystickHostWithParser/JoystickHostWithParser.h @@ -46,7 +46,7 @@ #include #include - #include + #include #include #include diff --git a/Demos/Host/LowLevel/JoystickHostWithParser/makefile b/Demos/Host/LowLevel/JoystickHostWithParser/makefile index 7e44f1ffd4..93d0522709 100644 --- a/Demos/Host/LowLevel/JoystickHostWithParser/makefile +++ b/Demos/Host/LowLevel/JoystickHostWithParser/makefile @@ -129,8 +129,7 @@ SRC = $(TARGET).c \ ConfigDescriptor.c \ HIDReport.c \ $(LUFA_SRC_USB) \ - $(LUFA_SRC_SERIAL) \ - $(LUFA_SRC_SERIALSTREAM) + $(LUFA_SRC_SERIAL) # List C++ source files here. (C dependencies are automatically generated.) diff --git a/Demos/Host/LowLevel/KeyboardHost/KeyboardHost.c b/Demos/Host/LowLevel/KeyboardHost/KeyboardHost.c index 7af114b1f8..e2e6e36d0c 100644 --- a/Demos/Host/LowLevel/KeyboardHost/KeyboardHost.c +++ b/Demos/Host/LowLevel/KeyboardHost/KeyboardHost.c @@ -66,9 +66,12 @@ void SetupHardware(void) clock_prescale_set(clock_div_1); /* Hardware Initialization */ - SerialStream_Init(9600, false); + Serial_Init(9600, false); LEDs_Init(); USB_Init(); + + /* Create a stdio stream for the serial port for stdin and stdout */ + Serial_CreateStream(NULL); } /** Event handler for the USB_DeviceAttached event. This indicates that a device has been attached to the host, and diff --git a/Demos/Host/LowLevel/KeyboardHost/KeyboardHost.h b/Demos/Host/LowLevel/KeyboardHost/KeyboardHost.h index 7a92aebcff..bad76379d2 100644 --- a/Demos/Host/LowLevel/KeyboardHost/KeyboardHost.h +++ b/Demos/Host/LowLevel/KeyboardHost/KeyboardHost.h @@ -47,7 +47,7 @@ #include #include #include - #include + #include #include #include "ConfigDescriptor.h" diff --git a/Demos/Host/LowLevel/KeyboardHost/makefile b/Demos/Host/LowLevel/KeyboardHost/makefile index ca8d3bd51a..1c733784ad 100644 --- a/Demos/Host/LowLevel/KeyboardHost/makefile +++ b/Demos/Host/LowLevel/KeyboardHost/makefile @@ -128,8 +128,7 @@ include $(LUFA_PATH)/LUFA/makefile SRC = $(TARGET).c \ ConfigDescriptor.c \ $(LUFA_SRC_USB) \ - $(LUFA_SRC_SERIAL) \ - $(LUFA_SRC_SERIALSTREAM) + $(LUFA_SRC_SERIAL) # List C++ source files here. (C dependencies are automatically generated.) diff --git a/Demos/Host/LowLevel/KeyboardHostWithParser/KeyboardHostWithParser.c b/Demos/Host/LowLevel/KeyboardHostWithParser/KeyboardHostWithParser.c index 356aba8b70..bac6bdc75a 100644 --- a/Demos/Host/LowLevel/KeyboardHostWithParser/KeyboardHostWithParser.c +++ b/Demos/Host/LowLevel/KeyboardHostWithParser/KeyboardHostWithParser.c @@ -66,9 +66,12 @@ void SetupHardware(void) clock_prescale_set(clock_div_1); /* Hardware Initialization */ - SerialStream_Init(9600, false); + Serial_Init(9600, false); LEDs_Init(); USB_Init(); + + /* Create a stdio stream for the serial port for stdin and stdout */ + Serial_CreateStream(NULL); } /** Event handler for the USB_DeviceAttached event. This indicates that a device has been attached to the host, and diff --git a/Demos/Host/LowLevel/KeyboardHostWithParser/KeyboardHostWithParser.h b/Demos/Host/LowLevel/KeyboardHostWithParser/KeyboardHostWithParser.h index 1b60546b55..f9df827435 100644 --- a/Demos/Host/LowLevel/KeyboardHostWithParser/KeyboardHostWithParser.h +++ b/Demos/Host/LowLevel/KeyboardHostWithParser/KeyboardHostWithParser.h @@ -42,7 +42,7 @@ #include #include #include - #include + #include #include #include "ConfigDescriptor.h" diff --git a/Demos/Host/LowLevel/KeyboardHostWithParser/makefile b/Demos/Host/LowLevel/KeyboardHostWithParser/makefile index 7e0ad9f56b..a0ff248ffa 100644 --- a/Demos/Host/LowLevel/KeyboardHostWithParser/makefile +++ b/Demos/Host/LowLevel/KeyboardHostWithParser/makefile @@ -129,8 +129,7 @@ SRC = $(TARGET).c \ ConfigDescriptor.c \ HIDReport.c \ $(LUFA_SRC_USB) \ - $(LUFA_SRC_SERIAL) \ - $(LUFA_SRC_SERIALSTREAM) + $(LUFA_SRC_SERIAL) # List C++ source files here. (C dependencies are automatically generated.) diff --git a/Demos/Host/LowLevel/MIDIHost/MIDIHost.c b/Demos/Host/LowLevel/MIDIHost/MIDIHost.c index 22e588ca1b..a981066c74 100644 --- a/Demos/Host/LowLevel/MIDIHost/MIDIHost.c +++ b/Demos/Host/LowLevel/MIDIHost/MIDIHost.c @@ -66,11 +66,14 @@ void SetupHardware(void) clock_prescale_set(clock_div_1); /* Hardware Initialization */ - SerialStream_Init(9600, false); + Serial_Init(9600, false); LEDs_Init(); Buttons_Init(); Joystick_Init(); USB_Init(); + + /* Create a stdio stream for the serial port for stdin and stdout */ + Serial_CreateStream(NULL); } /** Event handler for the USB_DeviceAttached event. This indicates that a device has been attached to the host, and diff --git a/Demos/Host/LowLevel/MIDIHost/MIDIHost.h b/Demos/Host/LowLevel/MIDIHost/MIDIHost.h index cd91075058..ded949e3c8 100644 --- a/Demos/Host/LowLevel/MIDIHost/MIDIHost.h +++ b/Demos/Host/LowLevel/MIDIHost/MIDIHost.h @@ -47,7 +47,7 @@ #include #include #include - #include + #include #include #include #include diff --git a/Demos/Host/LowLevel/MIDIHost/makefile b/Demos/Host/LowLevel/MIDIHost/makefile index dca2cd7cae..146ca54774 100644 --- a/Demos/Host/LowLevel/MIDIHost/makefile +++ b/Demos/Host/LowLevel/MIDIHost/makefile @@ -128,8 +128,7 @@ include $(LUFA_PATH)/LUFA/makefile SRC = $(TARGET).c \ ConfigDescriptor.c \ $(LUFA_SRC_USB) \ - $(LUFA_SRC_SERIAL) \ - $(LUFA_SRC_SERIALSTREAM) + $(LUFA_SRC_SERIAL) # List C++ source files here. (C dependencies are automatically generated.) diff --git a/Demos/Host/LowLevel/MassStorageHost/MassStorageHost.c b/Demos/Host/LowLevel/MassStorageHost/MassStorageHost.c index a595d1144c..5030b85c4c 100644 --- a/Demos/Host/LowLevel/MassStorageHost/MassStorageHost.c +++ b/Demos/Host/LowLevel/MassStorageHost/MassStorageHost.c @@ -70,10 +70,13 @@ void SetupHardware(void) clock_prescale_set(clock_div_1); /* Hardware Initialization */ - SerialStream_Init(9600, false); + Serial_Init(9600, false); LEDs_Init(); Buttons_Init(); USB_Init(); + + /* Create a stdio stream for the serial port for stdin and stdout */ + Serial_CreateStream(NULL); } /** Event handler for the USB_DeviceAttached event. This indicates that a device has been attached to the host, and diff --git a/Demos/Host/LowLevel/MassStorageHost/MassStorageHost.h b/Demos/Host/LowLevel/MassStorageHost/MassStorageHost.h index c148dfc82c..92bfb65b53 100644 --- a/Demos/Host/LowLevel/MassStorageHost/MassStorageHost.h +++ b/Demos/Host/LowLevel/MassStorageHost/MassStorageHost.h @@ -53,7 +53,7 @@ #include #include #include - #include + #include #include #include diff --git a/Demos/Host/LowLevel/MassStorageHost/makefile b/Demos/Host/LowLevel/MassStorageHost/makefile index ec2e35b6f0..ce38971dda 100644 --- a/Demos/Host/LowLevel/MassStorageHost/makefile +++ b/Demos/Host/LowLevel/MassStorageHost/makefile @@ -130,8 +130,7 @@ SRC = $(TARGET).c \ ConfigDescriptor.c \ Lib/MassStoreCommands.c \ $(LUFA_SRC_USB) \ - $(LUFA_SRC_SERIAL) \ - $(LUFA_SRC_SERIALSTREAM) + $(LUFA_SRC_SERIAL) # List C++ source files here. (C dependencies are automatically generated.) diff --git a/Demos/Host/LowLevel/MouseHost/MouseHost.c b/Demos/Host/LowLevel/MouseHost/MouseHost.c index 4e9a038ce3..b62e72c199 100644 --- a/Demos/Host/LowLevel/MouseHost/MouseHost.c +++ b/Demos/Host/LowLevel/MouseHost/MouseHost.c @@ -66,9 +66,12 @@ void SetupHardware(void) clock_prescale_set(clock_div_1); /* Hardware Initialization */ - SerialStream_Init(9600, false); + Serial_Init(9600, false); LEDs_Init(); USB_Init(); + + /* Create a stdio stream for the serial port for stdin and stdout */ + Serial_CreateStream(NULL); } /** Event handler for the USB_DeviceAttached event. This indicates that a device has been attached to the host, and diff --git a/Demos/Host/LowLevel/MouseHost/MouseHost.h b/Demos/Host/LowLevel/MouseHost/MouseHost.h index e70fd364d1..9b960bd7aa 100644 --- a/Demos/Host/LowLevel/MouseHost/MouseHost.h +++ b/Demos/Host/LowLevel/MouseHost/MouseHost.h @@ -47,7 +47,7 @@ #include #include #include - #include + #include #include #include "ConfigDescriptor.h" diff --git a/Demos/Host/LowLevel/MouseHost/makefile b/Demos/Host/LowLevel/MouseHost/makefile index cc2d14efc5..f64af3b3f4 100644 --- a/Demos/Host/LowLevel/MouseHost/makefile +++ b/Demos/Host/LowLevel/MouseHost/makefile @@ -128,8 +128,7 @@ include $(LUFA_PATH)/LUFA/makefile SRC = $(TARGET).c \ ConfigDescriptor.c \ $(LUFA_SRC_USB) \ - $(LUFA_SRC_SERIAL) \ - $(LUFA_SRC_SERIALSTREAM) + $(LUFA_SRC_SERIAL) # List C++ source files here. (C dependencies are automatically generated.) diff --git a/Demos/Host/LowLevel/MouseHostWithParser/MouseHostWithParser.c b/Demos/Host/LowLevel/MouseHostWithParser/MouseHostWithParser.c index 2823515671..af33ba58f3 100644 --- a/Demos/Host/LowLevel/MouseHostWithParser/MouseHostWithParser.c +++ b/Demos/Host/LowLevel/MouseHostWithParser/MouseHostWithParser.c @@ -66,9 +66,12 @@ void SetupHardware(void) clock_prescale_set(clock_div_1); /* Hardware Initialization */ - SerialStream_Init(9600, false); + Serial_Init(9600, false); LEDs_Init(); USB_Init(); + + /* Create a stdio stream for the serial port for stdin and stdout */ + Serial_CreateStream(NULL); } /** Event handler for the USB_DeviceAttached event. This indicates that a device has been attached to the host, and diff --git a/Demos/Host/LowLevel/MouseHostWithParser/MouseHostWithParser.h b/Demos/Host/LowLevel/MouseHostWithParser/MouseHostWithParser.h index 81b60d390d..1ccbedaadc 100644 --- a/Demos/Host/LowLevel/MouseHostWithParser/MouseHostWithParser.h +++ b/Demos/Host/LowLevel/MouseHostWithParser/MouseHostWithParser.h @@ -46,7 +46,7 @@ #include #include - #include + #include #include #include diff --git a/Demos/Host/LowLevel/MouseHostWithParser/makefile b/Demos/Host/LowLevel/MouseHostWithParser/makefile index c311f7450b..79d8ec2735 100644 --- a/Demos/Host/LowLevel/MouseHostWithParser/makefile +++ b/Demos/Host/LowLevel/MouseHostWithParser/makefile @@ -129,8 +129,7 @@ SRC = $(TARGET).c \ ConfigDescriptor.c \ HIDReport.c \ $(LUFA_SRC_USB) \ - $(LUFA_SRC_SERIAL) \ - $(LUFA_SRC_SERIALSTREAM) + $(LUFA_SRC_SERIAL) # List C++ source files here. (C dependencies are automatically generated.) diff --git a/Demos/Host/LowLevel/PrinterHost/PrinterHost.c b/Demos/Host/LowLevel/PrinterHost/PrinterHost.c index 0b7a38a48d..e468cc6562 100644 --- a/Demos/Host/LowLevel/PrinterHost/PrinterHost.c +++ b/Demos/Host/LowLevel/PrinterHost/PrinterHost.c @@ -66,9 +66,12 @@ void SetupHardware(void) clock_prescale_set(clock_div_1); /* Hardware Initialization */ - SerialStream_Init(9600, false); + Serial_Init(9600, false); LEDs_Init(); USB_Init(); + + /* Create a stdio stream for the serial port for stdin and stdout */ + Serial_CreateStream(NULL); } /** Event handler for the USB_DeviceAttached event. This indicates that a device has been attached to the host, and diff --git a/Demos/Host/LowLevel/PrinterHost/PrinterHost.h b/Demos/Host/LowLevel/PrinterHost/PrinterHost.h index e8d1d6c747..efef070266 100644 --- a/Demos/Host/LowLevel/PrinterHost/PrinterHost.h +++ b/Demos/Host/LowLevel/PrinterHost/PrinterHost.h @@ -51,7 +51,7 @@ #include #include #include - #include + #include #include /* Macros: */ diff --git a/Demos/Host/LowLevel/PrinterHost/makefile b/Demos/Host/LowLevel/PrinterHost/makefile index 3727a77bfd..f4946c490c 100644 --- a/Demos/Host/LowLevel/PrinterHost/makefile +++ b/Demos/Host/LowLevel/PrinterHost/makefile @@ -129,8 +129,7 @@ SRC = $(TARGET).c \ ConfigDescriptor.c \ Lib/PrinterCommands.c \ $(LUFA_SRC_USB) \ - $(LUFA_SRC_SERIAL) \ - $(LUFA_SRC_SERIALSTREAM) + $(LUFA_SRC_SERIAL) # List C++ source files here. (C dependencies are automatically generated.) diff --git a/Demos/Host/LowLevel/RNDISEthernetHost/RNDISEthernetHost.c b/Demos/Host/LowLevel/RNDISEthernetHost/RNDISEthernetHost.c index a671225cdf..780e320274 100644 --- a/Demos/Host/LowLevel/RNDISEthernetHost/RNDISEthernetHost.c +++ b/Demos/Host/LowLevel/RNDISEthernetHost/RNDISEthernetHost.c @@ -66,9 +66,12 @@ void SetupHardware(void) clock_prescale_set(clock_div_1); /* Hardware Initialization */ - SerialStream_Init(9600, false); + Serial_Init(9600, false); LEDs_Init(); USB_Init(); + + /* Create a stdio stream for the serial port for stdin and stdout */ + Serial_CreateStream(NULL); } /** Event handler for the USB_DeviceAttached event. This indicates that a device has been attached to the host, and diff --git a/Demos/Host/LowLevel/RNDISEthernetHost/RNDISEthernetHost.h b/Demos/Host/LowLevel/RNDISEthernetHost/RNDISEthernetHost.h index 30e8e296d4..0f36411e7b 100644 --- a/Demos/Host/LowLevel/RNDISEthernetHost/RNDISEthernetHost.h +++ b/Demos/Host/LowLevel/RNDISEthernetHost/RNDISEthernetHost.h @@ -47,7 +47,7 @@ #include #include #include - #include + #include #include #include "Lib/RNDISCommands.h" diff --git a/Demos/Host/LowLevel/RNDISEthernetHost/makefile b/Demos/Host/LowLevel/RNDISEthernetHost/makefile index 976a162383..dce4aadd16 100644 --- a/Demos/Host/LowLevel/RNDISEthernetHost/makefile +++ b/Demos/Host/LowLevel/RNDISEthernetHost/makefile @@ -129,8 +129,7 @@ SRC = $(TARGET).c \ ConfigDescriptor.c \ Lib/RNDISCommands.c \ $(LUFA_SRC_USB) \ - $(LUFA_SRC_SERIAL) \ - $(LUFA_SRC_SERIALSTREAM) + $(LUFA_SRC_SERIAL) # List C++ source files here. (C dependencies are automatically generated.) diff --git a/Demos/Host/LowLevel/StillImageHost/StillImageHost.c b/Demos/Host/LowLevel/StillImageHost/StillImageHost.c index 144acf356a..62382ccca0 100644 --- a/Demos/Host/LowLevel/StillImageHost/StillImageHost.c +++ b/Demos/Host/LowLevel/StillImageHost/StillImageHost.c @@ -67,9 +67,12 @@ void SetupHardware(void) CLKPR = 0; /* Hardware Initialization */ - SerialStream_Init(9600, false); + Serial_Init(9600, false); LEDs_Init(); USB_Init(); + + /* Create a stdio stream for the serial port for stdin and stdout */ + Serial_CreateStream(NULL); } /** Event handler for the USB_DeviceAttached event. This indicates that a device has been attached to the host, and diff --git a/Demos/Host/LowLevel/StillImageHost/StillImageHost.h b/Demos/Host/LowLevel/StillImageHost/StillImageHost.h index 35a2cac33c..bcb5e6bbc8 100644 --- a/Demos/Host/LowLevel/StillImageHost/StillImageHost.h +++ b/Demos/Host/LowLevel/StillImageHost/StillImageHost.h @@ -49,7 +49,7 @@ #include #include - #include + #include #include /* Macros: */ diff --git a/Demos/Host/LowLevel/StillImageHost/makefile b/Demos/Host/LowLevel/StillImageHost/makefile index 946ad78cb1..ebf57ca839 100644 --- a/Demos/Host/LowLevel/StillImageHost/makefile +++ b/Demos/Host/LowLevel/StillImageHost/makefile @@ -129,8 +129,7 @@ SRC = $(TARGET).c \ ConfigDescriptor.c \ Lib/StillImageCommands.c \ $(LUFA_SRC_USB) \ - $(LUFA_SRC_SERIAL) \ - $(LUFA_SRC_SERIALSTREAM) + $(LUFA_SRC_SERIAL) # List C++ source files here. (C dependencies are automatically generated.) diff --git a/Demos/Host/LowLevel/VirtualSerialHost/VirtualSerialHost.c b/Demos/Host/LowLevel/VirtualSerialHost/VirtualSerialHost.c index 3d5fd343a7..bd793ca504 100644 --- a/Demos/Host/LowLevel/VirtualSerialHost/VirtualSerialHost.c +++ b/Demos/Host/LowLevel/VirtualSerialHost/VirtualSerialHost.c @@ -66,9 +66,12 @@ void SetupHardware(void) clock_prescale_set(clock_div_1); /* Hardware Initialization */ - SerialStream_Init(9600, false); + Serial_Init(9600, false); LEDs_Init(); USB_Init(); + + /* Create a stdio stream for the serial port for stdin and stdout */ + Serial_CreateStream(NULL); } /** Event handler for the USB_DeviceAttached event. This indicates that a device has been attached to the host, and diff --git a/Demos/Host/LowLevel/VirtualSerialHost/VirtualSerialHost.h b/Demos/Host/LowLevel/VirtualSerialHost/VirtualSerialHost.h index 4a48fb0b31..e513b29268 100644 --- a/Demos/Host/LowLevel/VirtualSerialHost/VirtualSerialHost.h +++ b/Demos/Host/LowLevel/VirtualSerialHost/VirtualSerialHost.h @@ -47,7 +47,7 @@ #include #include #include - #include + #include #include #include "ConfigDescriptor.h" diff --git a/Demos/Host/LowLevel/VirtualSerialHost/makefile b/Demos/Host/LowLevel/VirtualSerialHost/makefile index 03c968505e..298c029330 100644 --- a/Demos/Host/LowLevel/VirtualSerialHost/makefile +++ b/Demos/Host/LowLevel/VirtualSerialHost/makefile @@ -128,8 +128,7 @@ include $(LUFA_PATH)/LUFA/makefile SRC = $(TARGET).c \ ConfigDescriptor.c \ $(LUFA_SRC_USB) \ - $(LUFA_SRC_SERIAL) \ - $(LUFA_SRC_SERIALSTREAM) + $(LUFA_SRC_SERIAL) # List C++ source files here. (C dependencies are automatically generated.) diff --git a/LUFA.pnproj b/LUFA.pnproj index 2da3a92771..ca4a7e0003 100644 --- a/LUFA.pnproj +++ b/LUFA.pnproj @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/LUFA/Drivers/Peripheral/Serial.c b/LUFA/Drivers/Peripheral/Serial.c index d2078c92c9..d9d946e360 100644 --- a/LUFA/Drivers/Peripheral/Serial.c +++ b/LUFA/Drivers/Peripheral/Serial.c @@ -30,24 +30,53 @@ #include "Serial.h" -void Serial_TxString_P(const char* FlashStringPtr) +FILE USARTSerialStream; + +int Serial_putchar(char DataByte, + FILE *Stream) +{ + (void)Stream; + + Serial_SendByte(DataByte); + return 0; +} + +int Serial_getchar(FILE *Stream) +{ + (void)Stream; + + if (!(Serial_IsCharReceived())) + return _FDEV_EOF; + + return Serial_ReceiveByte(); +} + +int Serial_getchar_Blocking(FILE *Stream) +{ + (void)Stream; + + while (!(Serial_IsCharReceived())); + return Serial_ReceiveByte(); +} + +void Serial_SendString_P(const char* FlashStringPtr) { uint8_t CurrByte; while ((CurrByte = pgm_read_byte(FlashStringPtr)) != 0x00) { - Serial_TxByte(CurrByte); + Serial_SendByte(CurrByte); FlashStringPtr++; } } -void Serial_TxString(const char* StringPtr) +void Serial_SendString(const char* StringPtr) { uint8_t CurrByte; while ((CurrByte = *StringPtr) != 0x00) { - Serial_TxByte(CurrByte); + Serial_SendByte(CurrByte); StringPtr++; } } diff --git a/LUFA/Drivers/Peripheral/Serial.h b/LUFA/Drivers/Peripheral/Serial.h index 7b3659ca01..58c570eab2 100644 --- a/LUFA/Drivers/Peripheral/Serial.h +++ b/LUFA/Drivers/Peripheral/Serial.h @@ -70,6 +70,7 @@ #include #include #include + #include #include "../../Common/Common.h" #include "../Misc/TerminalCodes.h" @@ -79,6 +80,18 @@ extern "C" { #endif + /* Private Interface - For use in library only: */ + #if !defined(__DOXYGEN__) + /* External Variables: */ + extern FILE USARTSerialStream; + + /* Function Prototypes: */ + int Serial_putchar(char DataByte, + FILE *Stream); + int Serial_getchar(FILE *Stream); + int Serial_getchar_Blocking(FILE *Stream); + #endif + /* Public Interface - May be used in end-application: */ /* Macros: */ /** Macro for calculating the baud value from a given baud rate when the U2X (double speed) bit is @@ -96,14 +109,14 @@ * * \param[in] FlashStringPtr Pointer to a string located in program space. */ - void Serial_TxString_P(const char* FlashStringPtr) ATTR_NON_NULL_PTR_ARG(1); + void Serial_SendString_P(const char* FlashStringPtr) ATTR_NON_NULL_PTR_ARG(1); /** Transmits a given string located in SRAM memory through the USART. * * \param[in] StringPtr Pointer to a string located in SRAM space. */ - void Serial_TxString(const char* StringPtr) ATTR_NON_NULL_PTR_ARG(1); - + void Serial_SendString(const char* StringPtr) ATTR_NON_NULL_PTR_ARG(1); + /* Inline Functions: */ /** Initializes the USART, ready for serial data transmission and reception. This initializes the interface to * standard 8-bit, no parity, 1 stop bit settings suitable for most applications. @@ -137,6 +150,52 @@ PORTD &= ~(1 << 2); } + /** Creates a standard character stream from the USART so that it can be used with all the regular functions + * in the avr-libc \c library that accept a \c FILE stream as a destination (e.g. \c fprintf). The created + * stream is bidirectional and can be used for both input and output functions. + * + * Reading data from this stream is non-blocking, i.e. in most instances, complete strings cannot be read in by a single + * fetch, as the endpoint will not be ready at some point in the transmission, aborting the transfer. However, this may + * be used when the read data is processed byte-per-bye (via \c getc()) or when the user application will implement its own + * line buffering. + * + * \param[in,out] Stream Pointer to a FILE structure where the created stream should be placed, if \c NULL stdio + * and stdin will be configured to use the USART. + * + * \pre The USART must first be configured via a call to \ref Serial_Init() before the stream is used. + */ + static inline void Serial_CreateStream(FILE* Stream) + { + if (!(Stream)) + { + Stream = &USARTSerialStream; + stdin = Stream; + stdout = Stream; + } + + *Stream = (FILE)FDEV_SETUP_STREAM(Serial_putchar, Serial_getchar, _FDEV_SETUP_RW); + } + + /** Identical to \ref Serial_CreateStream(), except that reads are blocking until the calling stream function terminates + * the transfer. + * + * \param[in,out] Stream Pointer to a FILE structure where the created stream should be placed, if \c NULL stdio + * and stdin will be configured to use the USART. + * + * \pre The USART must first be configured via a call to \ref Serial_Init() before the stream is used. + */ + static inline void Serial_CreateBlockingStream(FILE* Stream) + { + if (!(Stream)) + { + Stream = &USARTSerialStream; + stdin = Stream; + stdout = Stream; + } + + *Stream = (FILE)FDEV_SETUP_STREAM(Serial_putchar, Serial_getchar_Blocking, _FDEV_SETUP_RW); + } + /** Indicates whether a character has been received through the USART. * * \return Boolean \c true if a character has been received, \c false otherwise. @@ -151,23 +210,23 @@ * * \param[in] DataByte Byte to transmit through the USART. */ - static inline void Serial_TxByte(const char DataByte) ATTR_ALWAYS_INLINE; - static inline void Serial_TxByte(const char DataByte) + static inline void Serial_SendByte(const char DataByte) ATTR_ALWAYS_INLINE; + static inline void Serial_SendByte(const char DataByte) { while (!(UCSR1A & (1 << UDRE1))); UDR1 = DataByte; } - /** Receives a byte from the USART. This function blocks until a byte has been - * received; if non-blocking behaviour is required, test for a received character - * beforehand with \ref Serial_IsCharReceived(). + /** Receives the next byte from the USART. * - * \return Byte received from the USART. + * \return Next byte received from the USART, or a negative value if no byte has been received. */ - static inline char Serial_RxByte(void) ATTR_ALWAYS_INLINE; - static inline char Serial_RxByte(void) + static inline int16_t Serial_ReceiveByte(void) ATTR_ALWAYS_INLINE; + static inline int16_t Serial_ReceiveByte(void) { - while (!(UCSR1A & (1 << RXC1))); + if (!(Serial_IsCharReceived())) + return -1; + return UDR1; } diff --git a/LUFA/Drivers/Peripheral/SerialStream.c b/LUFA/Drivers/Peripheral/SerialStream.c deleted file mode 100644 index de800549e9..0000000000 --- a/LUFA/Drivers/Peripheral/SerialStream.c +++ /dev/null @@ -1,54 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2011. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2011 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. -*/ - -#define __INCLUDE_FROM_SERIALSTREAM_C -#include "SerialStream.h" - -FILE USARTStream = FDEV_SETUP_STREAM(SerialStream_TxByte, SerialStream_RxByte, _FDEV_SETUP_RW); - -static int SerialStream_TxByte(char DataByte, - FILE *Stream) -{ - (void)Stream; - - Serial_TxByte(DataByte); - return 0; -} - -static int SerialStream_RxByte(FILE *Stream) -{ - (void)Stream; - - if (!(Serial_IsCharReceived())) - return _FDEV_EOF; - - return Serial_RxByte(); -} - diff --git a/LUFA/Drivers/Peripheral/SerialStream.h b/LUFA/Drivers/Peripheral/SerialStream.h deleted file mode 100644 index cf376e98a3..0000000000 --- a/LUFA/Drivers/Peripheral/SerialStream.h +++ /dev/null @@ -1,139 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2011. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2011 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 - * \brief Standard avr-libc character stream driver for the USART. - * - * Serial stream driver for the USART subsystem on supported USB AVRs. This makes use of the functions in the - * regular USART driver (see \ref Group_Serial), but allows the avr-libc standard stream functions (\c printf, - * \c puts, etc.) to work with the - * USART. - */ - -/** \ingroup Group_PeripheralDrivers - * @defgroup Group_SerialStream Serial Stream Driver - LUFA/Drivers/Peripheral/SerialStream.h - * - * \section Sec_Dependencies Module Source Dependencies - * The following files must be built with any user project that uses this module: - * - LUFA/Drivers/Peripheral/SerialStream.c (Makefile source module name: LUFA_SRC_SERIALSTREAM) - * - * \section Sec_ModDescription Module Description - * Serial stream driver for the USART subsystem on supported USB AVRs. This makes use of the functions in the - * regular USART driver (see \ref Group_Serial), but allows the avr-libc standard stream functions (\c printf, - * \c puts, etc.) to work with the USART. Upon configuration, this will redirect the \c stdin standard input - * and \c stdout output streams to the USART. - * - * \section Sec_ExampleUsage Example Usage - * The following snippet is an example of how this module may be used within a typical - * application. - * - * \code - * // Initialise the Serial Stream driver before first use, with 9600 baud (and no double-speed mode) - * SerialStream_Init(9600, false); - * - * // Write a string to the USART via the implicit stdout stream - * printf("Test String using stdout\r\n"); - * - * // Write a string to the USART via the explicit USART stream - * fprintf(&USARTStream, "Test String using explicit stream handle\r\n"); - * - * // Read in an integer from the USART using the implicit stdin stream - * uint16_t TestValue; - * scanf("%d", &TestValue); - * \endcode - * - * @{ - */ - -#ifndef __SERIAL_STREAM_H__ -#define __SERIAL_STREAM_H__ - - /* Includes: */ - #include - #include - - #include "Serial.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Private Interface - For use in library only: */ - #if !defined(__DOXYGEN__) - /* Function Prototypes: */ - #if defined(__INCLUDE_FROM_SERIALSTREAM_C) - static int SerialStream_TxByte(char DataByte, - FILE *Stream) ATTR_NON_NULL_PTR_ARG(2); - static int SerialStream_RxByte(FILE *Stream) ATTR_NON_NULL_PTR_ARG(1); - #endif - #endif - - /* Public Interface - May be used in end-application: */ - /* External Variables: */ - /** Named stream for the USART, once \ref SerialStream_Init() has been called. This may be used with the - * file based stream functions (fprintf, fscanf, etc.) that require a handle to the stream rather than - * using the stdin and stdout named streams. - */ - extern FILE USARTStream; - - /* Inline Functions: */ - /** Initialises the serial stream (and regular USART driver) so that both the stream and regular - * USART driver functions can be used. Must be called before any stream or regular USART functions. - * - * \param[in] BaudRate Baud rate to configure the USART to. - * \param[in] DoubleSpeed Enables double speed mode when set, halving the sample time to double the baud rate. - */ - static inline void SerialStream_Init(const uint32_t BaudRate, - const bool DoubleSpeed) - { - Serial_Init(BaudRate, DoubleSpeed); - - stdout = &USARTStream; - stdin = &USARTStream; - } - - /** Turns off the serial stream (and regular USART driver), disabling and returning used hardware to - * their default configuration. - */ - static inline void SerialStream_ShutDown(void) - { - Serial_ShutDown(); - } - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/LUFA/Drivers/USB/Class/Common/HID.h b/LUFA/Drivers/USB/Class/Common/HID.h index d28417ed54..485b9dbb08 100644 --- a/LUFA/Drivers/USB/Class/Common/HID.h +++ b/LUFA/Drivers/USB/Class/Common/HID.h @@ -343,11 +343,11 @@ * Where \c uintA_t is a type large enough to hold one bit per button, and \c intB_t is a type large enough to hold the * ranges of the signed \c MinAxisVal and \c MaxAxisVal values. * - * \param[in] MinAxisVal Minimum X/Y logical axis value - * \param[in] MaxAxisVal Maximum X/Y logical axis value - * \param[in] MinPhysicalVal Minimum X/Y physical axis value, for movement resolution calculations - * \param[in] MaxPhysicalVal Maximum X/Y physical axis value, for movement resolution calculations - * \param[in] Buttons Total number of buttons in the device + * \param[in] MinAxisVal Minimum X/Y logical axis value. + * \param[in] MaxAxisVal Maximum X/Y logical axis value. + * \param[in] MinPhysicalVal Minimum X/Y physical axis value, for movement resolution calculations. + * \param[in] MaxPhysicalVal Maximum X/Y physical axis value, for movement resolution calculations. + * \param[in] Buttons Total number of buttons in the device. */ #define HID_DESCRIPTOR_JOYSTICK(MinAxisVal, MaxAxisVal, MinPhysicalVal, MaxPhysicalVal, Buttons) \ HID_RI_USAGE_PAGE(8, 0x01), \ @@ -393,7 +393,7 @@ * \endcode * * \param[in] MaxKeys Number of simultaneous keys that can be reported at the one time (a value between 1 and - * (ENDPOINT_SIZE - 2) ) + * (ENDPOINT_SIZE - 2) ). */ #define HID_DESCRIPTOR_KEYBOARD(MaxKeys) \ HID_RI_USAGE_PAGE(8, 0x01), \ @@ -446,12 +446,12 @@ * Where \c intA_t is a type large enough to hold one bit per button, and \c intB_t is a type large enough to hold the * ranges of the signed \c MinAxisVal and \c MaxAxisVal values. * - * \param[in] MinAxisVal Minimum X/Y logical axis value - * \param[in] MaxAxisVal Maximum X/Y logical axis value - * \param[in] MinPhysicalVal Minimum X/Y physical axis value, for movement resolution calculations - * \param[in] MaxPhysicalVal Maximum X/Y physical axis value, for movement resolution calculations - * \param[in] Buttons Total number of buttons in the device - * \param[in] AbsoluteCoords Boolean true to use absolute X/Y coordinates (e.g. touchscreen) + * \param[in] MinAxisVal Minimum X/Y logical axis value. + * \param[in] MaxAxisVal Maximum X/Y logical axis value. + * \param[in] MinPhysicalVal Minimum X/Y physical axis value, for movement resolution calculations. + * \param[in] MaxPhysicalVal Maximum X/Y physical axis value, for movement resolution calculations. + * \param[in] Buttons Total number of buttons in the device. + * \param[in] AbsoluteCoords Boolean true to use absolute X/Y coordinates (e.g. touchscreen). */ #define HID_DESCRIPTOR_MOUSE(MinAxisVal, MaxAxisVal, MinPhysicalVal, MaxPhysicalVal, Buttons, AbsoluteCoords) \ HID_RI_USAGE_PAGE(8, 0x01), \ @@ -488,11 +488,11 @@ * used for transporting abitrary data between the USB host and device via HID reports. The resulting report should be * a uint8_t byte array of the specified length in both Device to Host (IN) and Host to Device (OUT) directions. * - * \param[in] VendorPageNum Vendor Defined HID Usage Page index, ranging from 0x00 to 0xFF - * \param[in] CollectionUsage Vendor Usage for the encompasing report IN and OUT collection, ranging from 0x00 to 0xFF - * \param[in] DataINUsage Vendor Usage for the IN report data, ranging from 0x00 to 0xFF - * \param[in] DataOUTUsage Vendor Usage for the OUT report data, ranging from 0x00 to 0xFF - * \param[in] NumBytes Length of the data IN and OUT reports + * \param[in] VendorPageNum Vendor Defined HID Usage Page index, ranging from 0x00 to 0xFF. + * \param[in] CollectionUsage Vendor Usage for the encompasing report IN and OUT collection, ranging from 0x00 to 0xFF. + * \param[in] DataINUsage Vendor Usage for the IN report data, ranging from 0x00 to 0xFF. + * \param[in] DataOUTUsage Vendor Usage for the OUT report data, ranging from 0x00 to 0xFF. + * \param[in] NumBytes Length of the data IN and OUT reports. */ #define HID_DESCRIPTOR_VENDOR(VendorPageNum, CollectionUsage, DataINUsage, DataOUTUsage, NumBytes) \ HID_RI_USAGE_PAGE(16, (0xFF00 | VendorPageNum)), \ diff --git a/LUFA/Drivers/USB/Class/Common/HIDParser.h b/LUFA/Drivers/USB/Class/Common/HIDParser.h index 8347f1dcf4..c1689fad83 100644 --- a/LUFA/Drivers/USB/Class/Common/HIDParser.h +++ b/LUFA/Drivers/USB/Class/Common/HIDParser.h @@ -44,13 +44,20 @@ * - LUFA/Drivers/USB/Class/Host/HIDParser.c (Makefile source module name: LUFA_SRC_USB) * * \section Sec_ModDescription Module Description - * Functions, macros, variables, enums and types related to the parsing of HID class device report descriptors. + * Human Interface Device (HID) class report descriptor parser. This module implements a parser than is + * capable of processing a complete HID report descriptor, and outputting a flat structure containing the + * contents of the report in an a more friendly format. The parsed data may then be further processed and used + * within an application to process sent and received HID reports to and from an attached HID device. * - * The processed HID report is presented back to the user application as a flat structure containing each report - * item's IN, OUT and FEATURE items along with each item's attributes. + * A HID report descriptor consists of a set of HID report items, which describe the function and layout + * of data exchanged between a HID device and a host, including both the physical encoding of each item + * (such as a button, key press or joystick axis) in the sent and received data packets - known as "reports" - + * as well as other information about each item such as the usages, data range, physical location and other + * characterstics. In this way a HID device can retain a high degree of flexibility in its capabilities, as it + * is not forced to comply with a given report layout or featureset. * - * This library portion also allows for easy setting and retrieval of data from a HID report, including devices - * with multiple reports on the one HID interface. + * This module also contains routines for the processing of data in an actual HID report, using the parsed report + * descritor data as a guide for the encoding. * * @{ */ @@ -159,8 +166,8 @@ */ typedef struct { - uint32_t Minimum; /**< Minimum value for the attribute. */ - uint32_t Maximum; /**< Maximum value for the attribute. */ + uint32_t Minimum; /**< Minimum value for the attribute. */ + uint32_t Maximum; /**< Maximum value for the attribute. */ } HID_MinMax_t; /** \brief HID Parser Report Item Unit Structure. @@ -169,8 +176,8 @@ */ typedef struct { - uint32_t Type; /**< Unit type (refer to HID specifications for details). */ - uint8_t Exponent; /**< Unit exponent (refer to HID specifications for details). */ + uint32_t Type; /**< Unit type (refer to HID specifications for details). */ + uint8_t Exponent; /**< Unit exponent (refer to HID specifications for details). */ } HID_Unit_t; /** \brief HID Parser Report Item Usage Structure. @@ -179,8 +186,8 @@ */ typedef struct { - uint16_t Page; /**< Usage page of the report item. */ - uint16_t Usage; /**< Usage of the report item. */ + uint16_t Page; /**< Usage page of the report item. */ + uint16_t Usage; /**< Usage of the report item. */ } HID_Usage_t; /** \brief HID Parser Report Item Collection Path Structure. @@ -188,11 +195,11 @@ * Type define for a COLLECTION object. Contains the collection attributes and a reference to the * parent collection if any. */ - typedef struct CollectionPath + typedef struct HID_CollectionPath { - uint8_t Type; /**< Collection type (e.g. "Generic Desktop"). */ - HID_Usage_t Usage; /**< Collection usage. */ - struct CollectionPath* Parent; /**< Reference to parent collection, or \c NULL if root collection. */ + uint8_t Type; /**< Collection type (e.g. "Generic Desktop"). */ + HID_Usage_t Usage; /**< Collection usage. */ + struct HID_CollectionPath* Parent; /**< Reference to parent collection, or \c NULL if root collection. */ } HID_CollectionPath_t; /** \brief HID Parser Report Item Attributes Structure. @@ -201,12 +208,12 @@ */ typedef struct { - uint8_t BitSize; /**< Size in bits of the report item's data. */ + uint8_t BitSize; /**< Size in bits of the report item's data. */ - HID_Usage_t Usage; /**< Usage of the report item. */ - HID_Unit_t Unit; /**< Unit type and exponent of the report item. */ - HID_MinMax_t Logical; /**< Logical minimum and maximum of the report item. */ - HID_MinMax_t Physical; /**< Physical minimum and maximum of the report item. */ + HID_Usage_t Usage; /**< Usage of the report item. */ + HID_Unit_t Unit; /**< Unit type and exponent of the report item. */ + HID_MinMax_t Logical; /**< Logical minimum and maximum of the report item. */ + HID_MinMax_t Physical; /**< Physical minimum and maximum of the report item. */ } HID_ReportItem_Attributes_t; /** \brief HID Parser Report Item Details Structure. @@ -215,18 +222,18 @@ */ typedef struct { - uint16_t BitOffset; /**< Bit offset in the IN, OUT or FEATURE report of the item. */ - uint8_t ItemType; /**< Report item type, a value in \ref HID_ReportItemTypes_t. */ - uint16_t ItemFlags; /**< Item data flags, a mask of HID_IOF_* constants. */ - uint8_t ReportID; /**< Report ID this item belongs to, or 0x00 if device has only one report */ - HID_CollectionPath_t* CollectionPath; /**< Collection path of the item. */ - - HID_ReportItem_Attributes_t Attributes; /**< Report item attributes. */ - - uint32_t Value; /**< Current value of the report item - use \ref HID_ALIGN_DATA() when processing - * a retrieved value so that it is aligned to a specific type. - */ - uint32_t PreviousValue; /**< Previous value of the report item. */ + uint16_t BitOffset; /**< Bit offset in the IN, OUT or FEATURE report of the item. */ + uint8_t ItemType; /**< Report item type, a value in \ref HID_ReportItemTypes_t. */ + uint16_t ItemFlags; /**< Item data flags, a mask of HID_IOF_* constants. */ + uint8_t ReportID; /**< Report ID this item belongs to, or 0x00 if device has only one report */ + HID_CollectionPath_t* CollectionPath; /**< Collection path of the item. */ + + HID_ReportItem_Attributes_t Attributes; /**< Report item attributes. */ + + uint32_t Value; /**< Current value of the report item - use \ref HID_ALIGN_DATA() when processing + * a retrieved value so that it is aligned to a specific type. + */ + uint32_t PreviousValue; /**< Previous value of the report item. */ } HID_ReportItem_t; /** \brief HID Parser Report Size Structure. @@ -235,10 +242,10 @@ */ typedef struct { - uint8_t ReportID; /**< Report ID of the report within the HID interface. */ - uint16_t ReportSizeBits[3]; /**< Total number of bits in each report type for the given Report ID, - * indexed by the \ref HID_ReportItemTypes_t enum. - */ + uint8_t ReportID; /**< Report ID of the report within the HID interface. */ + uint16_t ReportSizeBits[3]; /**< Total number of bits in each report type for the given Report ID, + * indexed by the \ref HID_ReportItemTypes_t enum. + */ } HID_ReportSizeInfo_t; /** \brief HID Parser State Structure. @@ -247,21 +254,19 @@ */ typedef struct { - uint8_t TotalReportItems; /**< Total number of report items stored in the - * \c ReportItems array. - */ - HID_ReportItem_t ReportItems[HID_MAX_REPORTITEMS]; /**< Report items array, including - * all IN, OUT and FEATURE items. - */ - HID_CollectionPath_t CollectionPaths[HID_MAX_COLLECTIONS]; /**< All collection items, referenced - * by the report items. - */ - uint8_t TotalDeviceReports; /**< Number of reports within the HID interface */ - HID_ReportSizeInfo_t ReportIDSizes[HID_MAX_REPORT_IDS]; /**< Report sizes for each report in the interface */ - uint16_t LargestReportSizeBits; /**< Largest report that the attached device will generate, in bits */ - bool UsingReportIDs; /**< Indicates if the device has at least one REPORT ID - * element in its HID report descriptor. - */ + uint8_t TotalReportItems; /**< Total number of report items stored in the \c ReportItems array. */ + HID_ReportItem_t ReportItems[HID_MAX_REPORTITEMS]; /**< Report items array, including all IN, OUT + * and FEATURE items. + */ + HID_CollectionPath_t CollectionPaths[HID_MAX_COLLECTIONS]; /**< All collection items, referenced + * by the report items. + */ + uint8_t TotalDeviceReports; /**< Number of reports within the HID interface */ + HID_ReportSizeInfo_t ReportIDSizes[HID_MAX_REPORT_IDS]; /**< Report sizes for each report in the interface */ + uint16_t LargestReportSizeBits; /**< Largest report that the attached device will generate, in bits */ + bool UsingReportIDs; /**< Indicates if the device has at least one REPORT ID + * element in its HID report descriptor. + */ } HID_ReportInfo_t; /* Function Prototypes: */ diff --git a/LUFA/Drivers/USB/Class/Device/CDC.h b/LUFA/Drivers/USB/Class/Device/CDC.h index 62ee0433f9..85ab16396c 100644 --- a/LUFA/Drivers/USB/Class/Device/CDC.h +++ b/LUFA/Drivers/USB/Class/Device/CDC.h @@ -280,12 +280,12 @@ void CDC_Device_SendControlLineStateChange(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); /** Creates a standard character stream for the given CDC Device instance so that it can be used with all the regular - * functions in the avr-libc library that accept a FILE stream as a destination (e.g. fprintf). The created + * functions in the avr-libc library that accept a \c FILE stream as a destination (e.g. \c fprintf). The created * stream is bidirectional and can be used for both input and output functions. * * Reading data from this stream is non-blocking, i.e. in most instances, complete strings cannot be read in by a single * fetch, as the endpoint will not be ready at some point in the transmission, aborting the transfer. However, this may - * be used when the read data is processed byte-per-bye (via getc()) or when the user application will implement its own + * be used when the read data is processed byte-per-bye (via \c getc()) or when the user application will implement its own * line buffering. * * \note The created stream can be given as stdout if desired to direct the standard output from all functions @@ -297,7 +297,7 @@ void CDC_Device_CreateStream(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo, FILE* const Stream) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2); - /** Identical to CDC_Device_CreateStream(), except that reads are blocking until the calling stream function terminates + /** Identical to \ref CDC_Device_CreateStream(), except that reads are blocking until the calling stream function terminates * the transfer. While blocking, the USB and CDC service tasks are called repeatedly to maintain USB communications. * * \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class configuration and state. diff --git a/LUFA/Drivers/USB/Class/Host/CDC.h b/LUFA/Drivers/USB/Class/Host/CDC.h index 9033cbfb99..3b84bb2d7c 100644 --- a/LUFA/Drivers/USB/Class/Host/CDC.h +++ b/LUFA/Drivers/USB/Class/Host/CDC.h @@ -270,9 +270,14 @@ uint8_t CDC_Host_Flush(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); /** Creates a standard character stream for the given CDC Device instance so that it can be used with all the regular - * functions in the avr-libc \c library that accept a FILE stream as a destination (e.g. fprintf). The created + * functions in the avr-libc \c library that accept a \c FILE stream as a destination (e.g. \c fprintf). The created * stream is bidirectional and can be used for both input and output functions. * + * Reading data from this stream is non-blocking, i.e. in most instances, complete strings cannot be read in by a single + * fetch, as the endpoint will not be ready at some point in the transmission, aborting the transfer. However, this may + * be used when the read data is processed byte-per-bye (via \c getc()) or when the user application will implement its own + * line buffering. + * * \note The created stream can be given as stdout if desired to direct the standard output from all \c functions * to the given CDC interface. * @@ -282,7 +287,7 @@ void CDC_Host_CreateStream(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo, FILE* const Stream); - /** Identical to CDC_Host_CreateStream(), except that reads are blocking until the calling stream function terminates + /** Identical to \ref CDC_Host_CreateStream(), except that reads are blocking until the calling stream function terminates * the transfer. While blocking, the USB and CDC service tasks are called repeatedly to maintain USB communications. * * \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class configuration and state. diff --git a/LUFA/ManPages/ChangeLog.txt b/LUFA/ManPages/ChangeLog.txt index 03d8125f39..70a1868c79 100644 --- a/LUFA/ManPages/ChangeLog.txt +++ b/LUFA/ManPages/ChangeLog.txt @@ -9,7 +9,6 @@ * \section Sec_ChangeLogXXXXXX Version XXXXXX * New: * - Core: - * - Added new MIDIToneGenerator project * - Added new ORDERED_EP_CONFIG compile time option to restrict endpoint/pipe configuration to ascending order * in exchange for a smaller compiled program binary size * - Added a new general RingBuff.h miscellaneous ring buffer library driver header @@ -23,6 +22,7 @@ * - Added new MAX() and MIN() convenience macros * - Library Applications: * - Added ability to write protect Mass Storage disk write operations from the host OS + * - Added new MIDIToneGenerator project * - Added new KeyboardMouseMultiReport Device ClassDriver demo * * Changed: @@ -40,6 +40,11 @@ * - Changed over all project and demo HID report descriptors to use the new HID report item macros * - Moved the HIDParser.c source file to the LUFA/Drivers/USB/Class/Common/ directory from the LUFA/Drivers/USB/Class/Host/ * - Added support to the HID parser for extended USAGE items that contain the usage page as well as the usage index + * - Removed the SerialStream driver, rolled functionality into the regular Serial peripheral driver via the new + * Serial_CreateStream() and Serial_CreateBlockingStream() functions + * - Renamed the low level Serial byte send/receive functions, to be consistent with the CDC class driver byte functions + * - Altered the behaviour of the serial byte reception function so that is is non-blocking, and now returns a negative + * value if no character is received (to remain consistent with the CDC class driver byte reception routines) * - Library Applications: * - Changed the XPLAINBridge software UART to use the regular timer CTC mode instead of the alternative CTC mode * via the Input Capture register, to reduce user confusion diff --git a/LUFA/ManPages/MigrationInformation.txt b/LUFA/ManPages/MigrationInformation.txt index 8f8fbcd298..f9538dab69 100644 --- a/LUFA/ManPages/MigrationInformation.txt +++ b/LUFA/ManPages/MigrationInformation.txt @@ -14,41 +14,47 @@ * Non-USB Library Components * - The TWI driver \ref TWI_StartTransmission() function return type has now changed, so that the function returns an * error code from the \ref TWI_ErrorCodes_t enum instead of a boolean success flag. Existing code must now check - * against the \ref TWI_ERROR_NoError return value for success instead of a boolean true value, or it will not function + * against the \ref TWI_ERROR_NoError return value for success instead of a boolean \c true value, or it will not function * correctly. + * - The Serial Stream driver has been removed, and its functionality rolled into the regular serial driver. Existing code + * should remove references to the \c LUFA_SRC_SERIALSTREAM module in their makefiles, include the regular Serial driver + * header instead and call the regular \ref Serial_Init() function followed by the new \ref Serial_CreateStream() function + * with a \c NULL parameter. + * - The \ref Serial_ReceiveByte() function has changed, and now returns a signed 16-bit integer, with -1 indicating no data was + * received. * * USB Core * - By default, unordered Endpoint and Pipe configuration is now allowed once again, via the previous workaround of * reconfiguring all Endpoints/Pipes in order each time a new Endpoint/Pipe is created. To minimise the compiled program - * size, the new ORDERED_EP_CONFIG compile time option may be defined in the project makefile to restrict the ordering + * size, the new \c ORDERED_EP_CONFIG compile time option may be defined in the project makefile to restrict the ordering * in exchange for a smaller compiled binary size. * * Device Mode - * - The Endpoint stream functions now all require a BytesProcessed parameter instead of the previous callback parameter. - * This should be set to NULL to retain previous behaviour of the functions, or point to a location where the number of bytes - * processed in the current transaction can be stored. If the BytesProcessed parameter is non-NULL, each time the endpoint + * - The Endpoint stream functions now all require a \c BytesProcessed parameter instead of the previous callback parameter. + * This should be set to \c NULL to retain previous behaviour of the functions, or point to a location where the number of bytes + * processed in the current transaction can be stored. If the \c BytesProcessed parameter is non \c NULL, each time the endpoint * bank becomes full and the packet is sent, the routine will exit with the new \ref ENDPOINT_RWSTREAM_IncompleteTransfer * error code to allow the user application to determine when to send the next chunk of data. * * Host Mode - * - The Pipe stream functions now all require a BytesProcessed parameter instead of the previous callback parameter. - * This should be set to NULL to retain previous behaviour of the functions, or point to a location where the number of bytes - * processed in the current transaction can be stored. If the BytesProcessed parameter is non-NULL, each time the pipe + * - The Pipe stream functions now all require a \c BytesProcessed parameter instead of the previous callback parameter. + * This should be set to \c NULL to retain previous behaviour of the functions, or point to a location where the number of bytes + * processed in the current transaction can be stored. If the BytesProcessed parameter is non \c NULL, each time the pipe * bank becomes full and the packet is sent, the routine will exit with the new \ref PIPE_RWSTREAM_IncompleteTransfer * error code to allow the user application to determine when to send the next chunk of data. * * \section Sec_Migration101122 Migrating from 100807 to 101122 * USB Core - * - A new USB driver source file, Drivers/USB/HighLevel/EndpointStream.c now exists. This source file should be added + * - A new USB driver source file, \c Drivers/USB/HighLevel/EndpointStream.c now exists. This source file should be added * to all project makefiles using the USB driver of LUFA, or the makefile should be updated to use the new module source * variables. - * - A new USB driver source file, Drivers/USB/HighLevel/PipeStream.c now exists. This source file should be added to all + * - A new USB driver source file, \c Drivers/USB/HighLevel/PipeStream.c now exists. This source file should be added to all * project makefiles using the USB driver of LUFA, or the makefile should be updated to use the new module source variables. - * - The EVENT_USB_InitFailure() event has been removed, as the USB_Init() function will no longer fail; if not USB mode is + * - The \c EVENT_USB_InitFailure() event has been removed, as the \ref USB_Init() function will no longer fail; if not USB mode is * specified, the controller will default to UID selection mode. * - The USB mode specifier constants have been moved into a new enum and renamed. Existing projects should use the equivalent * value in the new \ref USB_Modes_t enum. - * - All class driver headers are now included as part of the standard LUFA/Drivers/USB/USB.h master dispatch header, and should + * - All class driver headers are now included as part of the standard \c LUFA/Drivers/USB/USB.h master dispatch header, and should * no longer be included separately. Class driver module source files must still be added as a separate module in the project's * makefile if used. * @@ -56,15 +62,15 @@ * - Endpoints MUST be allocated in ascending order to ensure that bank corruption does not occur. Ensure that your user application * allocated endpoints in ascending order - or if your application uses the USB device mode class drivers, ensure that each instance's * endpoint indexes are not overlapped with other interface's endpoints. - * - The signature for the CALLBACK_USB_GetDescriptor() callback has changed, the "void** const DescriptorAddress" parameter is - * now "const void** const DescriptorAddress". Existing applications should update their callback signatures to match this, and - * eliminate any casting of descriptor pointers to a non-const pointer. + * - The signature for the \ref CALLBACK_USB_GetDescriptor() callback has changed, the \c void** \c const \c DescriptorAddress parameter is + * now \c const \c void** \c const \c DescriptorAddress. Existing applications should update their callback signatures to match this, and + * eliminate any casting of descriptor pointers to a non \c const pointer. * - The names of the class specific descriptor type defines in the USB Class drivers have changed - refer to the driver documentation * for each class driver for the new class specific descriptor type names. - * - The ENDPOINT_DOUBLEBANK_SUPPORTED() macro is has been renamed \ref ENDPOINT_BANKS_SUPPORTED() and now returns the total number of + * - The \c ENDPOINT_DOUBLEBANK_SUPPORTED() macro is has been renamed \ref ENDPOINT_BANKS_SUPPORTED() and now returns the total number of * banks supported by the given endpoint. Existing code should switch to the new naming scheme, and test that the return value of the * macro is equal to or greater than 2 to regain the previous functionality. - * - The EVENT_USB_Device_UnhandledControlRequest() event is now named \ref EVENT_USB_Device_ControlRequest() and fires before (not after) + * - The \c EVENT_USB_Device_UnhandledControlRequest() event is now named \ref EVENT_USB_Device_ControlRequest() and fires before (not after) * the internal library event handlers. Existing code should rename the event handlers in the user application to match the new event * name, and should ensure that the new execution order does not affect the application's operation. * @@ -72,11 +78,11 @@ * - Pipes MUST be allocated in ascending order to ensure that bank corruption does not occur. Ensure that your user application * allocated pipes in ascending order - or if your application uses the USB host mode class drivers, ensure that each instance's * pipe indexes are not overlapped with other interface's pipes. - * - The PRNT_Host_SendData() function has been renamed to \ref PRNT_Host_SendString(). Existing applications should simply + * - The \c PRNT_Host_SendData() function has been renamed to \ref PRNT_Host_SendString(). Existing applications should simply * replace all references to the obsolete function name with the new function name. * - The names of the class specific descriptor type defines in the USB Class drivers have changed - refer to the driver documentation * for each class driver for the new class specific descriptor type names. - * - The Still Image Host class' function prefix has been changed from "SImage_" to "SI_", to remain consistent with the rest of the + * - The Still Image Host class' function prefix has been changed from \c SImage_ to \c SI_, to remain consistent with the rest of the * driver's enums, type defines and constants. * * \section Sec_Migration100807 Migrating from 100513 to 100807 @@ -87,19 +93,19 @@ * copy-paste the new functions from the board Dataflash stub driver. * * USB Core - * - A new USB driver source file, Drivers/USB/LowLevel/Device.c now exists. This source file should be added to all project + * - A new USB driver source file, \c Drivers/USB/LowLevel/Device.c now exists. This source file should be added to all project * makefiles using the USB driver of LUFA, or the makefile should be updated to use the new module source variables. - * - The Drivers/USB/LowLevel/DevChapter9.c source file has moved to Drivers/USB/HighLevel/DeviceStandardReq.c - this should + * - The \c Drivers/USB/LowLevel/DevChapter9.c source file has moved to \c Drivers/USB/HighLevel/DeviceStandardReq.c - this should * be updated in all project makefiles, or the makefile should be updated to use the new module source variables. - * - The Drivers/USB/LowLevel/HostChapter9.h source file has moved to Drivers/USB/HighLevel/HostStandardReq.c - this should + * - The \c Drivers/USB/LowLevel/HostChapter9.h source file has moved to \c Drivers/USB/HighLevel/HostStandardReq.c - this should * be updated in all project makefiles, or the makefile should be updated to use the new module source variables. - * - The Drivers/USB/LowLevel/LowLevel.c source file has moved to Drivers/LowLevel/USBController.c - this should be updated + * - The \c Drivers/USB/LowLevel/LowLevel.c source file has moved to \c Drivers/LowLevel/USBController.c - this should be updated * in all project makefiles, or the makefile should be updated to use the new module source variables. * * Device Mode - * - The USB_Device_IsRemoteWakeupSent() macro has been removed, as the remote wakeup request is now fully handled by the - * enhanced \ref USB_Device_SendRemoteWakeup() function. Existing code may now discard any checks to USB_Device_IsRemoteWakeupSent(). - * - The USB_Device_IsUSBSuspended() macro has been removed, as it is obsolete. Existing code should compare \ref USB_DeviceState + * - The \c USB_Device_IsRemoteWakeupSent() macro has been removed, as the remote wakeup request is now fully handled by the + * enhanced \ref USB_Device_SendRemoteWakeup() function. Existing code may now discard any checks to \c USB_Device_IsRemoteWakeupSent(). + * - The \c USB_Device_IsUSBSuspended() macro has been removed, as it is obsolete. Existing code should compare \ref USB_DeviceState * to see if it the device is in the \ref DEVICE_STATE_Suspended state instead. * - The \ref CDC_Device_ReceiveByte() function has changed, and now returns a signed 16-bit integer, with -1 indicating no data was * received. This allows for more efficient coding, as a call to \ref CDC_Device_BytesReceived() is no longer needed if the exact @@ -119,25 +125,25 @@ * device must respond or the function will abort. * * Device Mode - * - The \ref USB_Init() function no longer calls sei() to enable global interrupts, as the user application may need + * - The \ref USB_Init() function no longer calls \c sei() to enable global interrupts, as the user application may need * to perform other initialization before it is ready to handle global interrupts. The user application is now responsible * for enabling global interrupts before or shortly after calling \ref USB_Init() to ensure that the enumeration process * functions correctly. - * - The USBInterrupt.c USB driver source file has been relocated from LUFA/Drivers/USB/HighLevel/ to LUFA/Drivers/USB/LowLevel. + * - The \c USBInterrupt.c USB driver source file has been relocated from \c LUFA/Drivers/USB/HighLevel/ to \c LUFA/Drivers/USB/LowLevel. * Projects must update their makefile SRC values accordingly. - * - The HID Device Class driver's function signature for the CALLBACK_HID_Device_ProcessHIDReport() function has been changed, to - * allow for a new ReportType parameter. This new parameter must be added in all user applications using the Device mode HID Class + * - The HID Device Class driver's function signature for the \ref CALLBACK_HID_Device_ProcessHIDReport() function has been changed, to + * allow for a new \c ReportType parameter. This new parameter must be added in all user applications using the Device mode HID Class * Driver, but may be ignored unless Host-to-Device FEATURE HID reports are used. * * Host Mode - * - The \ref USB_Init() function no longer calls sei() to enable global interrupts, as the user application may need + * - The \ref USB_Init() function no longer calls \c sei() to enable global interrupts, as the user application may need * to perform other initialization before it is ready to handle global interrupts. The user application is now responsible * for enabling global interrupts before or shortly after calling \ref USB_Init() to ensure that the enumeration process * functions correctly. - * - The USBInterrupt.c USB driver source file has been relocated from LUFA/Drivers/USB/HighLevel/ to LUFA/Drivers/USB/LowLevel. - * Projects must update their makefile SRC values accordingly. - * - The HID Host Class driver's function signature for the HID_Host_SendReportByID() function has been changed, to allow for a new - * ReportType parameter. Existing calls to this function should substitute REPORT_ITEM_TYPE_Out as this parameter's value. + * - The \c USBInterrupt.c USB driver source file has been relocated from \c LUFA/Drivers/USB/HighLevel/ to \c LUFA/Drivers/USB/LowLevel. + * Projects must update their makefile \c SRC values accordingly. + * - The HID Host Class driver's function signature for the \ref HID_Host_SendReportByID() function has been changed, to allow for a new + * ReportType parameter. Existing calls to this function should substitute \c REPORT_ITEM_TYPE_Out as this parameter's value. * * \section Sec_Migration100219 Migrating from 091223 to 100219 * @@ -152,9 +158,9 @@ * packed into a single USB packet. This means that the sending of MIDI events will now be delayed until the MIDI send * pipe bank is full. To override this new behaviour and revert to the previous behaviour, the user application may manually * flush the queued event(s) to the device by calling \ref MIDI_Host_Flush(). - * - The Pipe_IsEndpointBound() function now takes the endpoint's direction into account, by checking if the MSB of the endpoint's address + * - The \ref Pipe_IsEndpointBound() function now takes the endpoint's direction into account, by checking if the MSB of the endpoint's address * is set to denote IN endpoints. If the previous functionality where the direction is to be discounted is required, mask the endpoint - * address against the \ref PIPE_EPNUM_MASK token before calling Pipe_IsEndpointBound(). + * address against the \ref PIPE_EPNUM_MASK token before calling \ref Pipe_IsEndpointBound(). * * Device Mode * - The MIDI Device Class driver send and receive routines now operate on packed events, where multiple MIDI events may be @@ -165,52 +171,52 @@ * \section Sec_Migration091223 Migrating from 091122 to 091223 * * Host Mode - * - The Still Image Host Class driver SI_Host_USBTask() and SI_Host_ConfigurePipes() functions were misnamed, and are - * now named SImage_Host_USBTask() and SImage_Host_ConfigurePipes() respectively. - * - The HOST_SENDCONTROL_DeviceDisconnect enum value has been renamed to \ref HOST_SENDCONTROL_DeviceDisconnected to be in + * - The Still Image Host Class driver \ref SI_Host_USBTask() and \ref SI_Host_ConfigurePipes() functions were misnamed, and are + * now named \c SImage_Host_USBTask() and \c SImage_Host_ConfigurePipes() respectively. + * - The \c HOST_SENDCONTROL_DeviceDisconnect enum value has been renamed to \ref HOST_SENDCONTROL_DeviceDisconnected to be in * line with the rest of the library error codes. * - The HID Parser item usages no longer contain separate minimum and maximum values, as this was a violation of the HID * specification. Instead, the values are distributed evenly across each item as its usage value, to ensure that all items * can be distinguished from one-another. * * Device Mode - * - The CALLBACK_HID_Device_CreateHIDReport() HID Device Class driver callback now has a new ReportType parameter to + * - The \ref CALLBACK_HID_Device_CreateHIDReport() HID Device Class driver callback now has a new \c ReportType parameter to * indicate the report type to generate. Existing applications may simply add and ignore this additional parameter. * * \section Sec_Migration091122 Migrating from 090924 to 091122 * * Host Mode - * - The HID_PARSE_UsageStackOverflow HID parser error constant is now named \ref HID_PARSE_UsageListOverflow - * - The \ref CALLBACK_HIDParser_FilterHIDReportItem() HID Parser callback now passes a complete HID_ReportItem_t to the + * - The \c HID_PARSE_UsageStackOverflow HID parser error constant is now named \ref HID_PARSE_UsageListOverflow + * - The \ref CALLBACK_HIDParser_FilterHIDReportItem() HID Parser callback now passes a complete \ref HID_ReportItem_t to the * user application, instead of just its attributes. - * - The USB_GetDeviceConfigDescriptor() function was incorrectly named and is now called \ref USB_Host_GetDeviceConfigDescriptor(). + * - The \c USB_GetDeviceConfigDescriptor() function was incorrectly named and is now called \ref USB_Host_GetDeviceConfigDescriptor(). * * \section Sec_Migration090924 Migrating from 090810 to 090924 * * Non-USB Library Components - * - The ADC_Off() function has been renamed to \ref ADC_ShutDown() to be consistent with the rest of the library. + * - The \c ADC_Off() function has been renamed to \ref ADC_ShutDown() to be consistent with the rest of the library. * - The \ref SPI_Init() routine's parameters have changed, so that the clock polarity and data sampling modes can be set. See * the \ref SPI_Init() function documentation for more details * - The \ref Dataflash_Init() routine no longer initializes the SPI bus - the SPI bus should be initialized manually via a - * call to SPI_Init() before using the Dataflash driver + * call to \ref SPI_Init() before using the Dataflash driver * * Host Mode - * - The USB_GetDeviceConfigDescriptor() function's parameters and behaviour has changed; the user is required to + * - The \c USB_GetDeviceConfigDescriptor() function's parameters and behaviour has changed; the user is required to * preallocate the largest allowable buffer, and pass the size of the buffer to the function. This allows for a single * call to the function to retrieve, size check and validate the Configuration Descriptor rather than having the user * application perform these intermediary steps. * - The HID report parser now requires a mandatory callback in the user code, to filter only the items the application * is interested in into the processed HID report item structure to save RAM. See \ref CALLBACK_HIDParser_FilterHIDReportItem(). - * - The HID report parser now always parses FEATURE and always ignores constant-data items - the HID_ENABLE_FEATURE_PROCESSING - * and HID_INCLUDE_CONSTANT_DATA_ITEMS compile time tokens now have no effect. - * - The USE_NONSTANDARD_DESCRIPTOR_NAMES compile time token has been removed - there are now separate USB_Descriptor_* - * and USB_StdDescriptor_* structures for both the LUFA and standardized element naming conventions so that both may be used in - * the one project. For existing projects using the standardized names, change all code to use the USB_StdDescriptor_* variants. + * - The HID report parser now always parses FEATURE and always ignores constant-data items - the \c HID_ENABLE_FEATURE_PROCESSING + * and \c HID_INCLUDE_CONSTANT_DATA_ITEMS compile time tokens now have no effect. + * - The \c USE_NONSTANDARD_DESCRIPTOR_NAMES compile time token has been removed - there are now separate \c USB_Descriptor_* + * and \c USB_StdDescriptor_* structures for both the LUFA and standardized element naming conventions so that both may be used in + * the one project. For existing projects using the standardized names, change all code to use the \c USB_StdDescriptor_* variants. * * Device Mode - * - The USE_NONSTANDARD_DESCRIPTOR_NAMES compile time token has been removed - there are now separate USB_Descriptor_* - * and USB_StdDescriptor_* structures for both the LUFA and standardized element naming conventions so that both may be used in - * the one project. For existing projects using the standardized names, change all code to use the USB_StdDescriptor_* variants. + * - The \c USE_NONSTANDARD_DESCRIPTOR_NAMES compile time token has been removed - there are now separate \c USB_Descriptor_* + * and \c USB_StdDescriptor_* structures for both the LUFA and standardized element naming conventions so that both may be used in + * the one project. For existing projects using the standardized names, change all code to use the \c USB_StdDescriptor_* variants. * * \section Sec_Migration090810 Migrating from 090605 to 090810 * @@ -219,11 +225,10 @@ * User applications using the scheduler should switch to regular loops instead. The scheduler code will be removed in a future * release. * - The "Dynamic Memory Block Allocator" has been removed, as it was unused in (and unrelated to) the LUFA library and never - * used in user applications. The library is available from the author's website for those wishing to still use it in their - * applications. + * used in user applications. * * Non-USB Library Components - * - The ATTR_NOINLINE function attribute macro has been renamed to ATTR_NO_INLINE to be in line with the rest of the function attribute + * - The \c ATTR_NOINLINE function attribute macro has been renamed to \ref ATTR_NO_INLINE to be in line with the rest of the function attribute * macro names. * * Library Demos @@ -232,178 +237,167 @@ * possible so that fixes to the class drivers propagate to all applications which use them automatically with each new LUFA release. * * Host Mode - * - The HIDParser.c module has moved from LUFA/Drivers/USB/Class/ to LUFA/Drivers/USB/Class/Host/. - * - The USB_GetDeviceConfigDescriptor() function now requires the desired configuration index within the device as its first + * - The \c HIDParser.c module has moved from \c LUFA/Drivers/USB/Class/ to \c LUFA/Drivers/USB/Class/Host/. + * - The \c USB_GetDeviceConfigDescriptor() function now requires the desired configuration index within the device as its first * parameter, to add support for multi-configuration devices. Existing code should use a configuration index of 1 to indicate the * first configuration descriptor within the device. * - The non-standard "Ready" host state has been removed. Existing \ref HOST_STATE_Configured code should be moved to the end of * the existing \ref HOST_STATE_Addressed state, and the existing HOST_STATE_Ready state code should be moved to the \ref HOST_STATE_Configured * state. - * - The USB_IsConnected global has been removed, as it is too vague for general use. Test \ref USB_HostState explicitly to ensure the host is + * - The \c USB_IsConnected global has been removed, as it is too vague for general use. Test \ref USB_HostState explicitly to ensure the host is * in the desired state instead. * - The USB event names have been changed and their firing conditions changed to properly separate out Host mode events from Device mode * events. See the \ref Group_Events page for details on the new event names and firing conditions. * * Device Mode * - The \ref CALLBACK_USB_GetDescriptor() function now takes an extra parameter to specify the descriptor's memory space so that - * descriptors in mixed memory spaces can be used. The previous functionality can be returned by defining the USE_FLASH_DESCRIPTORS + * descriptors in mixed memory spaces can be used. The previous functionality can be returned by defining the \c USE_FLASH_DESCRIPTORS * token in the project makefile to fix all descriptors into FLASH space and remove the extra function parameter. - * - The USB_IsSuspended global has been removed - test \ref USB_DeviceState against \ref DEVICE_STATE_Suspended instead. - * - The USB_IsConnected global has been removed, as it is too vague for general use. Test \ref USB_DeviceState explicitly to ensure the device + * - The \c USB_IsSuspended global has been removed - test \ref USB_DeviceState against \ref DEVICE_STATE_Suspended instead. + * - The \c USB_IsConnected global has been removed, as it is too vague for general use. Test \ref USB_DeviceState explicitly to ensure the device * is in the desired state instead. - * - The VBUS events have been removed, as they are already exposed to the user via the USB_Connect and USB_Disconnect events. + * - The VBUS events have been removed, as they are already exposed to the user via the \c USB_Connect and \c USB_Disconnect events. * - The USB event names have been changed and their firing conditions changed to properly separate out Host mode events from Device mode - * events. See the \ref Group_Events page for details on the new event names and firing conditions. * + * events. See the \ref Group_Events page for details on the new event names and firing conditions. * * \section Sec_Migration090605 Migrating from 090510 to 090605 * * Device Mode * - Support for non-control data endpoint interrupts has been dropped due to many issues in the implementation. All existing * projects using interrupts on non-control endpoints should switch to polling. For control interrupts, the library can - * manage the control endpoint via interrupts automatically by compiling with the INTERRUPT_CONTROL_ENDPOINT token defined. - * - The DESCRIPTOR_ADDRESS() macro has been removed. User applications should use normal casts to obtain a descriptor's memory + * manage the control endpoint via interrupts automatically by compiling with the \c INTERRUPT_CONTROL_ENDPOINT token defined. + * - The \c DESCRIPTOR_ADDRESS() macro has been removed. User applications should use normal casts to obtain a descriptor's memory * address. * - The library events system has been rewritten, so that all macros have been removed to allow for clearer user code. See * \ref Group_Events for new API details. - * - The STREAM_CALLBACK() macro has been removed. User applications should replace all instances of the macro with regular - * function signatures of a function accepting no arguments and returning a uint8_t value. - * - The Event_DeviceError() event no longer exists, as its sole caller (unlinked USB_GetDescriptor() function) now produces a - * compilation error rather than a runtime error. The StdDescriptors.c file no longer exists as a result, and should be removed + * - The \c STREAM_CALLBACK() macro has been removed. User applications should replace all instances of the macro with regular + * function signatures of a function accepting no arguments and returning a \c uint8_t value. + * - The \c Event_DeviceError() event no longer exists, as its sole caller (unlinked \c USB_GetDescriptor() function) now produces a + * compilation error rather than a runtime error. The \c StdDescriptors.c file no longer exists as a result, and should be removed * from project makefiles. - * - The USB_GetDescriptor() function has been renamed to CALLBACK_USB_GetDescriptor() to be in line with the new CALLBACK_ function - * prefixes for functions which *must* be implemented in the user application. + * - The \c USB_GetDescriptor() function has been renamed to \ref CALLBACK_USB_GetDescriptor() to be in line with the new \c CALLBACK_ + * function prefixes for functions which must be implemented in the user application. * * Host Mode * - Support for non-control data pipe interrupts has been dropped due to many issues in the implementation. All existing * projects using interrupts on non-control pipes should switch to polling. * - The library events system has been rewritten, so that all macros have been removed to allow for clearer user code. See * \ref Group_Events for new API details. - * - The STREAM_CALLBACK() macro has been removed. User applications should replace all instances of the macro with regular - * function signatures of a function accepting no arguments and returning a uint8_t value. - * - The DESCRIPTOR_COMPARATOR() macro has been removed. User applications should replace all instances of the macro with - * regular function signatures of a function accepting a void pointer to the descriptor to test, and returning a uint8_t value. + * - The \c STREAM_CALLBACK() macro has been removed. User applications should replace all instances of the macro with regular + * function signatures of a function accepting no arguments and returning a \c uint8_t value. + * - The \c DESCRIPTOR_COMPARATOR() macro has been removed. User applications should replace all instances of the macro with + * regular function signatures of a function accepting a void pointer to the descriptor to test, and returning a \c uint8_t value. * * \section Sec_Migration090510 Migrating from 090401 to 090510 * * All - * - The ButtLoadTag.h header has been removed, as it was never used for its intended purpose. Projects should either remove all - * BUTTLOADTAG elements, or download and extract ButtLoadTag.h header from the ButtLoad project. - * - The Drivers/AT90USBXXX directory has been renamed to Drivers/Peripheral. - * - The Serial_Stream driver has been renamed to SerialStream to remain consistent with the rest of the library naming scheme. - * - The HWB driver has changed to the Buttons driver. See the board Buttons driver documentation for the new API. + * - The \c ButtLoadTag.h header has been removed, as it was never used for its intended purpose. Projects should either remove all + * \c BUTTLOADTAG() elements, or download and extract \c ButtLoadTag.h header from the ButtLoad project. + * - The \c Drivers/AT90USBXXX/ directory has been renamed to \c Drivers/Peripheral/. + * - The \c Serial_Stream driver has been renamed to \c SerialStream to remain consistent with the rest of the library naming scheme. + * - The HWB driver has changed to the \c Buttons driver. See the board Buttons driver documentation for the new API. * * Dual Role Mode - * - The USB_PowerOnFail even has been renamed to USB_InitFailure. - * - The functions in OTG.h have been renamed to remain more consistent with the library API. See the functions in OTG.h for more + * - The \c USB_PowerOnFail even has been renamed to \c USB_InitFailure. + * - The functions in \c OTG.h have been renamed to remain more consistent with the library API. See the functions in \c OTG.h for more * details. * - * Library Demos - * - Most demos, bootloaders and applications have had significant changes from previous versions. Applications built off of any - * library demos should update to the latest versions. - * * Device Mode - * - The Endpoint_ClearCurrentBank() macro has been removed, and is now replaced with the Endpoint_ClearIN(), Endpoint_ClearOUT() - * macros. See Endpoint.h documentation for more details on the new endpoint management macros. - * - The Endpoint_ReadWriteAllowed() macro has been renamed to Endpoint_IsReadWriteAllowed() to be more consistent with the rest of + * - The \c Endpoint_ClearCurrentBank() macro has been removed, and is now replaced with the \ref Endpoint_ClearIN(), \ref Endpoint_ClearOUT() + * macros. See \c Endpoint.h documentation for more details on the new endpoint management macros. + * - The \c Endpoint_ReadWriteAllowed() macro has been renamed to \ref Endpoint_IsReadWriteAllowed() to be more consistent with the rest of * the API naming scheme. - * - The Endpoint_IsSetupINReady() and Endpoint_IsSetupOutReceived() macros have been renamed to Endpoint_IsINReady() and - * Endpoint_IsOUTReceived() respectively. - * - The Endpoint_IsSetupReceived() macro has been renamed to Endpoint_IsSETUPReceived(). - * - The Endpoint_ClearSetupReceived() macro has been renamed to Endpoint_ClearSETUP(). - * - All endpoint read/write/discard aliases which did not have an explicitly endianness specifier (such as Endpoint_Read_Word()) have - * been removed for clarity. Existing projects should use the "_LE" suffix on such calls to use the explicit Little Endian versions. - * - The USB_UnhandledControlPacket event no longer has any parameters. User code should no longer attempt to read in the remainder of + * - The \c Endpoint_IsSetupINReady() and \c Endpoint_IsSetupOUTReceived() macros have been renamed to \ref Endpoint_IsINReady() and + * \ref Endpoint_IsOUTReceived() respectively. + * - The \c Endpoint_IsSetupReceived() macro has been renamed to \ref Endpoint_IsSETUPReceived(). + * - The \c Endpoint_ClearSetupReceived() macro has been renamed to \ref Endpoint_ClearSETUP(). + * - All endpoint read/write/discard aliases which did not have an explicitly endianness specifier (such as \c Endpoint_Read_Word()) have + * been removed for clarity. Existing projects should use the \c _LE suffix on such calls to use the explicit Little Endian versions. + * - The \c USB_UnhandledControlPacket event no longer has any parameters. User code should no longer attempt to read in the remainder of * the Control Request header as all Control Request header data is now preloaded by the library and made available in the * USB_ControlRequest structure. - * - The FEATURELESS_CONTROL_ONLY_DEVICE token has been renamed to CONTROL_ONLY_DEVICE. - * - The STATIC_ENDPOINT_CONFIGURATION is no longer applicable as the library will apply this optimization when appropriate automatically. - * - The values of the Endpoint_Stream_RW_ErrorCodes_t and Endpoint_ControlStream_RW_ErrorCodes_t enums have had the "ERROR_" portion + * - The \c FEATURELESS_CONTROL_ONLY_DEVICE token has been renamed to \c CONTROL_ONLY_DEVICE. + * - The \c STATIC_ENDPOINT_CONFIGURATION is no longer applicable as the library will apply this optimization when appropriate automatically. + * - The values of the \ref Endpoint_Stream_RW_ErrorCodes_t and \ref Endpoint_ControlStream_RW_ErrorCodes_t enums have had the \c ERROR_ portion * of their names removed. * * Host Mode - * - The USB_Host_SendControlRequest() function no longer automatically selects the Control pipe (pipe 0) to allow it to be used on + * - The \ref USB_Host_SendControlRequest() function no longer automatically selects the Control pipe (pipe 0) to allow it to be used on * other control type pipes. Care should be taken to ensure that the Control pipe is always selected before the function is called * in existing projects where the Control pipe is to be operated on. * - The USB Host management task now saves and restores the currently selected pipe before and after the task runs. Projects no longer * need to manage this manually when calling the USB management task. - * - The Pipe_ClearCurrentBank() macro has been removed, and is now replaced with the Pipe_ClearIN(), Pipe_ClearOUT() macros. See + * - The \c Pipe_ClearCurrentBank() macro has been removed, and is now replaced with the Pipe_ClearIN(), Pipe_ClearOUT() macros. See * Pipe.h documentation for more details on the new pipe management macros. - * - The Pipe_ReadWriteAllowed() macro has been renamed to Pipe_IsReadWriteAllowed() to be more consistent with the rest of the API + * - The \c Pipe_ReadWriteAllowed() macro has been renamed to \ref Pipe_IsReadWriteAllowed() to be more consistent with the rest of the API * naming scheme. - * - The Pipe_IsSetupINReceived() and Pipe_IsOutReady() macros have been renamed to Pipe_IsINReceived() and Pipe_IsOUTReady() + * - The \c Pipe_IsSetupINReceived() and \c Pipe_IsOutReady() macros have been renamed to \ref Pipe_IsINReceived() and \ref Pipe_IsOUTReady() * respectively. - * - The new Pipe_ClearSETUP() macro should be used to send SETUP transactions, rather than the previous Pipe_ClearSetupOUT() macro. - * - The Pipe_IsSetupSent() macro has been renamed to Pipe_IsSETUPSent(). - * - The Pipe_ClearSetupSent() macro is no longer applicable and should be removed. - * - All pipe read/write/discard aliases which did not have an explicitly endianness specifier (such as Pipe_Read_Word()) have - * been removed for clarity. Existing projects should use the "_LE" suffix on such calls to use the explicit Little Endian versions. - * - The Host_IsResetBusDone() macro has been renamed to Host_IsBusResetComplete(). - * - The Pipe_Ignore_Word() and Pipe_Ignore_DWord() functions have been renamed to Pipe_Discard_Word() and Pipe_Discard_DWord() to remain - * consistent with the rest of the pipe API. - * - It is no longer needed to manually include the headers from LUFA/Drivers/USB/Class, as they are now included along with the rest - * of the USB headers when LUFA/Drivers/USB/USB.h is included. - * - Functions in the ConfigDescriptor.h header file no longer have "Host_" as part of their names. - * - The ProcessHIDReport() has been renamed to USB_ProcessHIDReport(), GetReportItemInfo() has been renamed to USB_GetHIDReportItemInfo() - * and SetReportItemInfo() has been renamed to USB_GetHIDReportItemInfo(). - * - The values of the DSearch_Return_ErrorCodes_t and DSearch_Comp_Return_ErrorCodes_t enums have had their respective "Descriptor_Search" - * and "Descriptor_Search_Comp" prefixes changed to all caps. - * - The USB_HostRequest global has been renamed to USB_ControlRequest, and is used in Device mode also. The USB_Host_Request_Header_t - * structure type has been renamed to USB_Request_Header_t. - * - The values of the Pipe_Stream_RW_ErrorCodes_t enum have had the "ERROR_" portion of their names removed. + * - The new \ref Pipe_ClearSETUP() macro should be used to send SETUP transactions, rather than the previous \c Pipe_ClearSetupOUT() macro. + * - The \c Pipe_IsSetupSent() macro has been renamed to \ref Pipe_IsSETUPSent(). + * - The \c Pipe_ClearSetupSent() macro is no longer applicable and should be removed. + * - All pipe read/write/discard aliases which did not have an explicitly endianness specifier (such as \c Pipe_Read_Word()) have + * been removed for clarity. Existing projects should use the \c _LE suffix on such calls to use the explicit Little Endian versions. + * - The \c Host_IsResetBusDone() macro has been renamed to \c Host_IsBusResetComplete(). + * - The \c Pipe_Ignore_Word() and \c Pipe_Ignore_DWord() functions have been renamed to \ref Pipe_Discard_Word() and \ref Pipe_Discard_DWord() + * to remain consistent with the rest of the pipe API. + * - It is no longer needed to manually include the headers from \c LUFA/Drivers/USB/Class, as they are now included along with the rest + * of the USB headers when \c LUFA/Drivers/USB/USB.h is included. + * - Functions in the \c ConfigDescriptor.h header file no longer have \c Host_ as part of their names. + * - The \c ProcessHIDReport() has been renamed to \ref USB_ProcessHIDReport(), \c GetReportItemInfo() has been renamed to \ref USB_GetHIDReportItemInfo() + * and \c SetReportItemInfo() has been renamed to \ref USB_GetHIDReportItemInfo(). + * - The values of the \ref DSearch_Return_ErrorCodes_t and \ref DSearch_Comp_Return_ErrorCodes_t enums have had their respective \c Descriptor_Search + * and \c Descriptor_Search_Comp prefixes changed to all caps. + * - The \c USB_HostRequest global has been renamed to \ref USB_ControlRequest, and is used in Device mode also. The \c USB_Host_Request_Header_t + * structure type has been renamed to \ref USB_Request_Header_t. + * - The values of the \ref Pipe_Stream_RW_ErrorCodes_t enum have had the \c ERROR_ portion of their names removed. * * \section Sec_Migration090401 Migrating from 090209 to 090401 * * All - * - LUFA projects must now give the raw input clock frequency (before any prescaling) as a compile time constant "F_CLOCK", + * - LUFA projects must now give the raw input clock frequency (before any prescaling) as a compile time constant \c F_CLOCK, * defined in the project makefile and passed to the compiler via the -D switch. * - The makefile EEPROM programming targets for FLIP and dfu-programmer no longer program in the FLASH data in addition to the * EEPROM data into the device. If both are to be programmed, both the EEPROM and FLASH programming targets must be called. - * - As the avr-libc macro has been corrected in recent avr-libc distributions, the SetSystemClockPrescaler() macro has been removed. - * Include and call clock_prescale_set(clock_div_1); instead on recent avr-libc distributions. + * - As the avr-libc macro has been corrected in recent avr-libc distributions, the \c SetSystemClockPrescaler() macro has been removed. + * Include \c and call \c clock_prescale_set(clock_div_1); instead on recent avr-libc distributions. * * Library Demos * - The USBtoSerial demo now discards all data when not connected to a host, rather than buffering it for later transmission. - * - Most demos, bootloaders and applications have had their control request handling code corrected, to properly send the status - * stage in all handled requests. If you are using code based off one of the library demos, bootloaders or applications, you should - * update to the latest revisions. * * Non-USB Library Components - * - The ATTR_ALWAYSINLINE function attribute macro has been renamed to ATTR_ALWAYS_INLINE. - * - Custom board Dataflash drivers now require the implementation of Dataflash_SelectChipFromPage() and Dataflash_SendAddressBytes(). + * - The \c ATTR_ALWAYSINLINE function attribute macro has been renamed to \ref ATTR_ALWAYS_INLINE. + * - Custom board Dataflash drivers now require the implementation of \ref Dataflash_SelectChipFromPage() and \ref Dataflash_SendAddressBytes(). * * Device Mode - * - The NO_CLEARSET_FEATURE_REQUEST compile time token has been renamed to FEATURELESS_CONTROL_ONLY_DEVICE, and its function expanded + * - The \c NO_CLEARSET_FEATURE_REQUEST compile time token has been renamed to \c FEATURELESS_CONTROL_ONLY_DEVICE, and its function expanded * to also remove parts of the Get Status chapter 9 request to further reduce code usage. On all applications currently using the - * NO_CLEARSET_FEATURE_REQUEST compile time token, it can be replaced with the FEATURELESS_CONTROL_ONLY_DEVICE token with no further + * \c NO_CLEARSET_FEATURE_REQUEST compile time token, it can be replaced with the \c FEATURELESS_CONTROL_ONLY_DEVICE token with no further * modifications required. * * \section Sec_Migration090209 Migrating from 081217 to 090209 * * Device Mode - * - The ENDPOINT_MAX_ENDPOINTS constant has been renamed to the more appropriate name of ENDPOINT_TOTAL_ENDPOINTS. - * - The USB_STREAM_TIMEOUT_MS stream timeout default period has been extended to 100ms. This can be overridden in the user + * - The \c ENDPOINT_MAX_ENDPOINTS constant has been renamed to the more appropriate name of \c ENDPOINT_TOTAL_ENDPOINTS. + * - The \c USB_STREAM_TIMEOUT_MS stream timeout default period has been extended to 100ms. This can be overridden in the user * makefile if desired to restore the previous 50ms timeout. * * Host Mode - * - The PIPE_MAX_ENDPOINTS constant has been renamed to the more appropriate name of PIPE_TOTAL_ENDPOINTS. - * - The USB_STREAM_TIMEOUT_MS stream timeout default period has been extended to 100ms. This can be overridden in the user + * - The \c PIPE_MAX_ENDPOINTS constant has been renamed to the more appropriate name of \c PIPE_TOTAL_ENDPOINTS. + * - The \c USB_STREAM_TIMEOUT_MS stream timeout default period has been extended to 100ms. This can be overridden in the user * makefile if desired to restore the previous 50ms timeout. - * - The USB_DeviceEnumerationFailed event now contains a second "SubErrorCode" parameter, giving the error code of the function + * - The \c USB_DeviceEnumerationFailed event now contains a second \c SubErrorCode parameter, giving the error code of the function * which failed. - * - The HID_PARSE_Sucessful enum member constant has been corrected to HID_PARSE_Successful. + * - The \c HID_PARSE_Sucessful enum member constant name has been corrected to \ref HID_PARSE_Successful. * * Non-USB Library Components - * - The previous SPI_SendByte() functionality is now located in SPI_TransferByte(). SPI_SendByte() now discards the return byte - * for speed, to compliment the new SPI_ReceiveByte() function. If two-way SPI transfers are required, calls to SPI_SendByte() - * should be changed to SPI_TransferByte(). + * - The previous \c SPI_SendByte() functionality is now located in \ref SPI_TransferByte(). \ref SPI_SendByte() now discards the return byte + * for speed, to compliment the new \ref SPI_ReceiveByte() function. If bidirectional SPI transfers are required, calls to \ref SPI_SendByte() + * should be changed to \ref SPI_TransferByte(). * - The serial driver now sets the Tx line as an output explicitly, and enables the pull-up of the Rx line. - * - The Serial_Init() and SerialStream_Init() functions now take a second DoubleSpeed parameter, which indicates if the USART - * should be initialized in double speed mode - useful in some circumstances for attaining baud rates not usually possible at - * the given AVR clock speed. - * - * Library Demos - * - Most library demos have been enhanced and/or had errors corrected. All users of all demos should upgrade their codebase to - * the latest demo versions. + * - The \ref Serial_Init() and \c SerialStream_Init() functions now take a second \c DoubleSpeed parameter, which indicates if the USART + * should be initialized in double speed mode - useful in some circumstances for attaining baud rates not usually possible at the given AVR + * clock speed. * * \section Sec_Migration171208 Migrating from V1.5.3 to 081217 * diff --git a/LUFA/makefile b/LUFA/makefile index 3c85d40ab0..d1710ef808 100644 --- a/LUFA/makefile +++ b/LUFA/makefile @@ -46,7 +46,6 @@ LUFA_SRC_USBCLASS = $(LUFA_ROOT_PATH)/Drivers/USB/Class/Device/Audio.c $(LUFA_ROOT_PATH)/Drivers/USB/Class/Host/StillImage.c LUFA_SRC_TEMPERATURE = $(LUFA_ROOT_PATH)/Drivers/Board/Temperature.c LUFA_SRC_SERIAL = $(LUFA_ROOT_PATH)/Drivers/Peripheral/Serial.c -LUFA_SRC_SERIALSTREAM = $(LUFA_ROOT_PATH)/Drivers/Peripheral/SerialStream.c LUFA_SRC_TWI = $(LUFA_ROOT_PATH)/Drivers/Peripheral/TWI.c LUFA_SRC_SCHEDULER = $(LUFA_ROOT_PATH)/Scheduler/Scheduler.c @@ -55,8 +54,7 @@ LUFA_SRC_SCHEDULER = $(LUFA_ROOT_PATH)/Scheduler/Scheduler.c ifeq ($(origin LUFA_PATH), undefined) LUFA_SRC_ALL_FILES = $(LUFA_SRC_USB) $(LUFA_SRC_USBCLASS) \ $(LUFA_SRC_TEMPERATURE) $(LUFA_SRC_SERIAL) \ - $(LUFA_SRC_SERIALSTREAM) $(LUFA_SRC_TWI) \ - $(LUFA_SRC_SCHEDULER) + $(LUFA_SRC_TWI) $(LUFA_SRC_SCHEDULER) all: diff --git a/Projects/AVRISP-MKII/Lib/XPROG/XPROGProtocol.h b/Projects/AVRISP-MKII/Lib/XPROG/XPROGProtocol.h index d3f7eb9e04..d637c79ea9 100644 --- a/Projects/AVRISP-MKII/Lib/XPROG/XPROGProtocol.h +++ b/Projects/AVRISP-MKII/Lib/XPROG/XPROGProtocol.h @@ -42,7 +42,6 @@ #include #include - #include #include "../V2Protocol.h" #include "XMEGANVM.h" diff --git a/Projects/Incomplete/StandaloneProgrammer/StandaloneProgrammer.c b/Projects/Incomplete/StandaloneProgrammer/StandaloneProgrammer.c index 09c04f64f6..86007daa5e 100644 --- a/Projects/Incomplete/StandaloneProgrammer/StandaloneProgrammer.c +++ b/Projects/Incomplete/StandaloneProgrammer/StandaloneProgrammer.c @@ -152,7 +152,10 @@ void SetupHardware(void) SPI_Init(SPI_SPEED_FCPU_DIV_2 | SPI_SCK_LEAD_FALLING | SPI_SAMPLE_TRAILING | SPI_MODE_MASTER); Dataflash_Init(); Buttons_Init(); - SerialStream_Init(9600, true); + Serial_Init(9600, true); + + /* Create a stdio stream for the serial port for stdin and stdout */ + Serial_CreateStream(NULL); #if defined(USB_CAN_BE_DEVICE) /* Clear Dataflash sector protections, if enabled */ diff --git a/Projects/Incomplete/StandaloneProgrammer/StandaloneProgrammer.h b/Projects/Incomplete/StandaloneProgrammer/StandaloneProgrammer.h index c26d9c5301..f562cc18ab 100644 --- a/Projects/Incomplete/StandaloneProgrammer/StandaloneProgrammer.h +++ b/Projects/Incomplete/StandaloneProgrammer/StandaloneProgrammer.h @@ -53,7 +53,7 @@ #include #include - #include + #include /* Macros: */ /** LED mask for the library LED driver, to indicate that the USB interface is not ready. */ diff --git a/Projects/Incomplete/StandaloneProgrammer/makefile b/Projects/Incomplete/StandaloneProgrammer/makefile index e90586e36d..6656d9270e 100644 --- a/Projects/Incomplete/StandaloneProgrammer/makefile +++ b/Projects/Incomplete/StandaloneProgrammer/makefile @@ -142,8 +142,7 @@ SRC = $(TARGET).c \ Lib/PetiteFATFs/pff.c \ $(LUFA_SRC_USB) \ $(LUFA_SRC_USBCLASS) \ - $(LUFA_SRC_SERIAL) \ - $(LUFA_SRC_SERIALSTREAM) + $(LUFA_SRC_SERIAL) # List C++ source files here. (C dependencies are automatically generated.)