We modified the following to support the export function to the IAR.
- In tools files, add RZ_A1H to the target of IAR.
- In tools files, add the tmpl files.
realiseEndpoint() was unnecessarily allocating twice the buffer space for each endpoint buffer. This was presumably for the sake of the hardware SIE's double-buffering (EVEN/ODD) system, but that's vestigial - this implementation doesn't use the double-buffering capability at all, leaving the ODDRST bit in the CTL register always set. The double-size allocation is a pure waste of memory.
The IRQ handler calculated the endpoint number wrong when handling IN and OUT tokens. The errant code worked by accident for endpoints 1 and 2 but was incorrect for other addresses. For endpoints 5 and above it resulted in stray pointer read/writes that could crash the device.
Happy Gecko's USB Low Energy Mode does not work properly with
isochronous endpoints.
Note that Happy Gecko errata USB_E112 states:
Do not use the SUSPEND mode of LEMOSCCTRL in USB_CTRL.
In rare cases with high data throughput, a transmission can
fail when this mode is enabled.
Use the GATED mode of LEMOSCCTRL for the best energy
efficiency. The NONE mode can be used to disable energy
savings
However, even using GATE mode causes problems for high-frequency
isochronous transfers. The primary effect for OUT endpoints is that
the first read will succeed, and the following one (targetting the
next frame) will fail with zero bytes incoming data, and PKTDRPSTS
is set in the related interrupt status register.
Disabling LEMOSCCTRL (set to NONE) solves the problem. Since this
will cause increased energy usage, do this only when an ISOC endpoint
is added.
USB device support for Wonder, Leopard and Happy Gecko. See
details on configuration etc on the previous commit.
Known issue: USBAudio does not work reliably on Happy Gecko.
** Overview
This commit provides USB device-mode drivers for Silicon Labs chips.
The code is based on the SiLabs USB driver that is part of the
Simplicity dev environment.
Because Mbed USBDevice class wants to control the USB transactions
itself, large parts of the higher level code originally present in the
driver have been stripped out. An attempt has been made to keep Mbed
code separate enough that patches can be applied with minor effort, if
needed.
** Use of dynamic memory
Due to requirements imposed by the USB hardware, the driver needs read
and write buffers for every enabled endpoint. Since information on
what EPs will be used is only available during runtime, dynamic memory
allocation is used to minimize memory usage.
If needed, dynamic memory use can be disabled via a flag in
usbconfig.h. In this case, please read the documentation to see what
limitations this imposes. Static memory usage can also be reduced by
limiting the maximum number of active endpoints - see configuration in
usbconfig.h and USBEndpoints_EFM32.h.
** Power management
Driver supports the new SiLabs functionality in Mbed sleep(). Normal
sleep (EM1) is always available, and deep sleep (EM2) is available
when USB is either disconnected or suspended. How and when different
sleep modes are made possible can be configured in usbconfig.h
** Supported hardware
Current release officially supports, and has only been tested on Giant
Gecko. Upcoming releases will add support for other SiLabs platforms
on Mbed.