circuitpython/ports
Andrew Leech e4fcd216e0 stm32/usbd_cdc_interface: Remove full==size-1 limitation on tx ringbuf.
Before this commit the USB VCP TX ring-buffer used the basic implementation
where it can only be filled to a maximum of buffer size-1.  For a 1024 size
buffer this means the largest packet that can be sent is 1023.  Once a
packet of this size is sent the next byte copied in goes to the final byte
in the buffer, so must be sent as a 1 byte packet before the read pointer
can be wrapped around to the beginning.  So in large streaming transfers,
watching the USB sniffer you basically get alternating 1023 byte packets
then 1 byte packets.

This commit changes the ring-buffer implementation to a scheme that doesn't
have the full-size limitation, and the USB VCP driver can now achieve a
constant stream of full-sized packets.  This scheme introduces a
restriction on the size of the buffer: it must be a power of 2, and the
maximum size is half of the size of the index (in this case the index is
16-bit, so the maximum size would be 32767 bytes rounded to 16384 for a
power-of-2).  But this is not a big limitation because the size of the
ring-buffer prior to this commit was restricted to powers of 2 because it
was using a mask-based method to wrap the indices.

For an explanation of the new scheme see
https://www.snellman.net/blog/archive/2016-12-13-ring-buffers/

The RX buffer could likely do with a similar change, though as it's not
read from in chunks like the TX buffer it doesn't present the same issue,
all that's lost is one byte capacity of the buffer.

USB VCP TX throughput is improved by this change, potentially doubling the
speed in certain cases.
2020-06-29 17:21:37 +10:00
..
bare-arm ports: Disable MICROPY_PY_ASSIGN_EXPR in bare-arm and minimal ports. 2020-06-16 22:06:21 +10:00
cc3200 stm32/irq: Clean up irq.h so it does not depend on core uPy defines. 2020-06-22 13:47:15 +10:00
esp32 esp32/esp32_rmt: Call rmt_driver_install before rmt_config. 2020-06-19 22:11:14 +10:00
esp8266 esp8266/esppwm: Fix PWM glitch when setting duty on different channel. 2020-05-27 16:15:28 +10:00
javascript all: Format code to add space after C++-style comment start. 2020-04-23 11:24:25 +10:00
mimxrt mimxrt/boards: Set __heap_size__ to 0 in MIMXRT1011.ld. 2020-06-10 22:49:26 +10:00
minimal ports: Disable MICROPY_PY_ASSIGN_EXPR in bare-arm and minimal ports. 2020-06-16 22:06:21 +10:00
nrf nrf/bluetooth: Use MP_ERROR_TEXT for all error messages. 2020-06-17 11:33:22 +10:00
pic16bit all: Format code to add space after C++-style comment start. 2020-04-23 11:24:25 +10:00
powerpc powerpc/uart: Choose which UART to use at build time, not runtime. 2020-05-29 22:54:55 +10:00
qemu-arm qemu-arm/Makefile: Add CFLAGS_EXTRA to CFLAGS. 2020-06-22 13:42:24 +10:00
samd all: Factor gchelper code to one place and use it for unix & ARM ports. 2020-04-29 23:45:19 +10:00
stm32 stm32/usbd_cdc_interface: Remove full==size-1 limitation on tx ringbuf. 2020-06-29 17:21:37 +10:00
teensy stm32/irq: Clean up irq.h so it does not depend on core uPy defines. 2020-06-22 13:47:15 +10:00
unix unix/btstack_usb: Allow choosing adaptor via environment variable. 2020-06-10 22:40:02 +10:00
windows windows: Make appveyor.yml self-contained. 2020-05-28 09:56:35 +10:00
zephyr zephyr: Use cmake find_package to locate zephyr. 2020-06-12 10:25:16 +10:00