serial_putc() can cause rx bytes to be dropped

While fixing this issue in the various LPC* ports, I noticed a comment
pointing to this mbed forum post which summarizes this bug quite well:
  https://mbed.org/forum/bugs-suggestions/topic/4473/

This bug was introduced in the following commit:
https://github.com/mbedmicro/mbed/commit/2662e105c43c93986d52713234375b7910acf297

The following code was added to serial_putc() as part of this commit:
    uint32_t lsr = obj->uart->LSR;
    lsr = lsr;
    uint32_t thr = obj->uart->THR;
    thr = thr;

As the forum post indicates, this causes the serial_putc() routine to
actually eat an inbound received byte if it exists since reading THR is
really reading the RBR, the Receiver Buffer Register.  This code looks
like code that was probably added so that the developer could take a
snapshot of these registers and look at them in the debugger.  It
probably got committed in error.
Merge pull request #60 from jorisa/master

Fix MASKED_ACCESS bug in gpio_init
Merge pull request #57 from adamgreen/serialTxDropsRx

serial_putc() can cause rx bytes to be dropped
Fixed problem in PWMOUT mapping table

Fixed problem in PWMOUT output issue.
Startup code cean-up (correced exception names).
Corrected test cases.
[LPC1768] Fix serial_clear

serial_clear() erroneously disabled the UART FIFOs.
Reported by Adam Green.
Merge remote-tracking branch 'github/master'
Merge pull request #61 from ytsuboi/master

Fixed problem in PWMOUT mapping table
Keeping LPC11CXX in sync with LPC11XX

* i2c_api.c: Fixed missing mask register setting for I2C (83e065d1bc)
* analogin_api.c: Fixed error handling and cleanup (10e30b5cfb)
* gpio_irq_api.c: Fixed gpio_irq_api bugs (1ff64de847)
Merge pull request #63 from jorisa/master

Fix hardfault when attaching callback to CAN2 when CAN1 is not defined
Updated synchronization script

Added persistent line endings, commit message on the command line and
"quiet" option (run without user interaction).
Change the synch.py script to make it usable as a module
Changed do_sync do return the list of changed repositories
More changes to the synchronization script

1. added the possibility to redirect stderr to stdout in utils.run_cmd
2. synch.py now calls the above run_cmd in redirect mode instead of the
old 'cmd'  that doesn't intercept standard streams. This makes it easier
for an external tool to intercept the output of 'hg'.
LPC1768 InterruptIn speedup

Use __CLZ to speed up GPIO interrupt processing.
Merge remote-tracking branch 'upstream/master'