The code for the second port was accidentally expanded into
usb_serial3.c, while the code for the third port was expanded in
usb_serial2.c.
Fixes: cd4c30fde5 ("Expand all USB serial 2 & 3 stuff (needed for Arduino IDE use)")
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
There are two pins on the SDCard IO pins that are valid alternate pins for Serial5
Serial5.setRX or setTX.
These pin numbers changed from T4 to T4.1 so update table depending on which board.
Add support for a triple serial port configuration (USB_TRIPLE_SERIAL),
providing a composite USB device, comprised of three serial ports.
The third serial port is called usb_serial3 (C) or SerialB (C++).
Note that no dummy C++ class is created if USB_DISABLED is defined,
unlike for the first port.
This increases binary size by ca. 0.5 KiB (despite needing 720 more
bytes for USB buffers, as gcc-5.4.1 no longer decides to unroll a loop
over all endpoints in usb_isr()).
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Add support for a dual serial port configuration (USB_DUAL_SERIAL),
providing a composite USB device, comprised of two serial ports.
The second serial port is called usb_serial2 (C) or SerialA (C++).
Note that no dummy C++ class is created if USB_DISABLED is defined,
unlike for the first port.
This increases binary size by ca. 1.2 KiB (720 bytes for USB buffers).
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Add preprocessor macros to control the naming of functions, structures
and classes, to ease the creation of multiple USB serial instances.
Name generation for each instance is controlled using the
USB_SERIAL_SUFFIX and SERIAL_CLASS_SUFFIX defines.
Move the preprocessor macro wrappers around the usb_serial_port data
members to usb_serial.h, as preprocessor macro names cannot be
parameterized.
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Extract core USB serial functionality in a new usb_serial_port C class,
to allow creating multiple USB serial instances without duplicating all
code.
The original API is retained by creating static inline functions and
preprocessor macros using the old names, which are wrappers around the
new usb_serial_port functions and data members.
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Create a macro to emit all values for a CDC Interface Association
Descriptor, and use it.
This will avoid duplication when adding support for multiple USB serial
interfaces.
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Create a macro to emit all values for the various CDC descriptors, and
use it. Note that this does not include the CDC Interface Association
Descriptor, as the latter is needed only for composite USB devices.
This will avoid duplication when adding support for multiple USB serial
interfaces.
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
When including "core_pins.h":
teensy3/usb_dev.c: In function '_reboot_Teensyduino_':
teensy3/usb_dev.c:899:1: warning: 'noreturn' function does return
Fix this by adding a call to __builtin_unreachable().
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
- usb_serial_class::readBytes() calls millis(), hence it should
include "core_pins.h",
- usb_serial_flush_callback() is a public function, but is not
declared in the header file.
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
When processing CDC_SET_CONTROL_LINE_STATE and CDC_SET_LINE_CODING
requests, wIndex is ignored. Hence if the CDC Status Interface is
enabled, these requests are always processed, even when not destined for
the actual serial status interface.
Fix this by adding a check to ensure that wIndex matches the CDC status
interface.
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>