libbladeRF: Moved stream code and definitions to stream.c/.h

Re-arranged some code in preparation for making changes to the async
stream implementation.
libbladeRF: Hold lock while executing stream callbacks

Per the libusb documentation, the libusb async callbacks must be
executed atomically.

In half-duplex cases where one thread is sitting in a bladerf_stream()
call, this was a problem.  However, in full-duplex cases, we can have
two threads, each calling a libusb handle_events fn, enter the callback
for a single module. This would result in:
    - Buffers being passed to user callbacks in the wrong order
    - Stream state and error conditions being corrupted
libbladeRF: Refactored async stream implementation, non-callback buf submission

To support cases where callbacks would need to block (which they can't),
the async stream implementation has been modified to support
bladerf_submit_stream_buffer(), which allows buffers to be submitted for
transfer outside of the callback functions.

There are some caveats to using this; the documentation has been updated
to note where care should be taken with lock acquisition.
libbladeRF: Don't hold buffer lock while submitting a TX buffer

The stream callbacks hold a stream lock when executed. This
stream lock is obtained in bladerf_submit_stream_buffer() calls.

If the sync_tx call does not release its buffer lock before submitting a
buffer via bladerf_submit_stream_buffer(), deadlock can occur:
    - sync_tx is called and we're ready to submit data
        + the sync buffer lock is acquired
        + In bladerf_submit_stream_buffer() the stream lock is acquired
    - libusb callback fires, and the stream lock is acquired
        + The user (sync tx) callback is then called, which acquires the
        buffer lock
    - Deadlock
libbladeRF: Documentation touch-ups
libbladeRF: Removed dead code, fixed error value check, comment touch-up
libbladeRF: Fixed potential uninitialized value and incorrect status value

A status variable was potentially unassigned. However, this case is
unlikely, and should only occur under bizarre circumstances.

Additionally, a status value could have incorrectly been treated as a
libusb code.
libbladeRF: Changed overflow log message to debug level
libbladeRF: Split up some sync states, sync_rx now recovers from timeouts

Split up CHECK_AND_START_WORKER state into two states, allowing us to
reset the API side consumer index before restarting the worker.

Added logic to reset the RX worker state prior to executing
bladerf_stream call.
hdl: add RX and TX meta FIFOs

These FIFOs will be used to store timestamp, modulation, and coding data
on a per packet basis. The meta header format is described in the
following commit.
hdl: timed RX and TX

Timed RX and TX is enabled when nios_gpio bit 9 is set. RX and TX samples
are now packetized so now the first 16 bytes of every 512 byte or 1024
byte GPIF transcations contain metadata. The HDL state machine will not
wait for the TX time to match that of any TX packet, and it will insert
timestamps into RX packet streams.
hdl: add time tamer

This tamer is an Avalon compatible core that snapshots the RX and TX timestamp
counters whenever the least significant byte of the 64bit registers is read.
The RX LSB is at offset 0, and the TX LSB is at offset 8. If any register within
the time tamer address space is writen to, the core will output a sync signal
that the rest of the system will interpret as a signal to synchronize resetting
the RX and TX timestamp counters to 0.
hdl: minor corrections needed to get testbench working again
nios: rework register mapping

This commit adds support for time tamer register and introduces a command
parsing loop that allows for multiple reads/write per uart_cmd packet.
libbladeRF: add variable length memory register reads/writes

This commit adds support for performing an arbitrary number of reads/writes when
accessing memory mapped registers inside of Nios.
The 8 byte timestamp counters can now be read in 2 uart_cmd packets instead of 8.
libbladeRF: add the ability to query RX and TX timestamp counters
hdl: Cleanup timing issues and synchronization.

libbladeRF: Fix bad merge resolution.
hdl: Fixing time comparisons and meta_enable

Removed calls to to_integer() for 64-bit numbers since they don't work correctly.

Added the meta_enable bit to the GPIO pins for simulation.
meta_tx_fifo: enable fifo underflow and overflow checking
hdl: fix off by ones in packet counters and position ot timestamp in header