improved USB write speeds
Fix race condition in USB CDC transmit

If the Start of Frame interrupt triggers just after the call
to USB_SendSpace in USB_Send then we can get data loss.
When the first bank is full and the second partially full,
the SOF handler will release the second bank via USB_Flush.
Data is then lost due to overflow as USB_Send continues writing data
to the now-closed bank.

Fix this by re-checking the FIFO status inside LockEP, immediately before
doing the data write.

Signed-off-by: Paul Brook <paul@nowt.org>
Improve CDC read code

Read CDC data from USB FIFO on demand instead of in ISR.
Remove superfluous ring buffer.

Signed-off-by: Paul Brook <paul@nowt.org>
USB CDC available() method returns correct number of bytes in buffer.

See #1953
Merge pull request #2104 from amulya349/master

Fix of a bug in Stream.cpp
Merge pull request #2117 from amulya349/master

Fixed mistake in comment
corrected wrong path to firmware binaries in wifishield upgrade script for mac
Update USBAPI.h

Fixes bug where Serial.read() would always return 0 as the first byte.
Merge pull request #2124 from embmicro/patch-1

Update USBAPI.h
Fixed regression in USBAPI and CDC (xaljox)

See:
https://github.com/arduino/Arduino/commit/9ac7e30252fce5b9dafde3288519b020b73c37bd#commitcomment-6718676
Allow variants to define an initVariant() function that is called at startup.

See #2080
Updates to revision log
initVariant() is now declared as external "C" function.

See #2080 for more details.
Backported digitalPinToInterrupt macro from IDE 1.5.x
Updated revision log
Merge pull request #2139 from cmaglie/init-variant

Allow variants to define an initVariant() function that is called at startup
Updated revision log
Merge pull request #2118 from benoit-artefactlabs/wifishield-upgrade-firmware-mac-path

corrected wrong path to firmware binaries in wifishield upgrade script f...
Fixed permission on wifishield upgrade script.
Fixed Smoothing example

"index" variable name create conflicts with Arduino Due where "index" is
a reserved word for Posix C.