output/bits: Support getting samplerate from meta packets.
output/hex: Support getting samplerate from meta packets.
output/ascii: Support getting samplerate from meta packets.
output/csv: Support getting samplerate from meta packets.
output/gnuplot: Support getting samplerate from meta packets.
output/vcd: Support getting samplerate from meta packets.
asix-sigma: Acquisition fixes.
asix-sigma: Document sampling rate table

Add comments to the sampling rate table explaining how the frequencies
are selected and where do those numbers come from.

Signed-off-by: Marek Vasut <marex@denx.de>
asix-sigma: Remove NUM_CHANNELS macro

The NUM_CHANNELS macro is inflexible, since in 100MHz and 200MHz modes
we don't support 16 channels. Moreover, it's only used to limit the size
of array of channel labels, which can be done in much cleaner way.

Signed-off-by: Marek Vasut <marex@denx.de>
asix-sigma: Cleanup FPGA initialization

Rework the pre-firmware-upload FPGA initialization sequence so it matches
the documentation. Also, since this sequence is documented in a separate
section, wrap it into separate function.

Signed-off-by: Marek Vasut <marex@denx.de>
asix-sigma: Fix firmware path construction

The code silently assumed the firmware path can be no longer than 128 bytes.
This doesn't scale. This patch fixes it in such a way that it completely
rips out the run-time computation of firmware path and instead replaces it
with compile-time computation. It's true this makes the library grow by a
couple bytes, but makes the code cleaner.

Signed-off-by: Marek Vasut <marex@denx.de>
asix-sigma: Weed out in-condition assignments

Remove all those if ((ret = foo(bar)) < 0) constructs from upload_firmware()
function. This is just a confusing programming practice, kill it. While at it,
replace all the uses of &devc->ftdic with plain ftdic , which is defined at
the begining.

Signed-off-by: Marek Vasut <marex@denx.de>
asix-sigma: Cleanup the bit2bitbang

Rework the bit2bitbang function. Remarkable changes are:
- The function was renamed to sigma_fw_2_bitbang()
- We use glib function calls to work with the file
- We mmap the file containing firmware instead of opening the file
  and then reading it into a buffer.
- The magic firmware transformation is now type-safe.
- Documentation and comments were added where applicable.

Signed-off-by: Marek Vasut <marex@denx.de>
asix-sigma: Move the sigma_fw_2_bitbang()

Move the sigma_fw_2_bitbang() function closer to the upload_firmware()
function so there's not such a horrible mess in the file.

Signed-off-by: Marek Vasut <marex@denx.de>
asix-sigma: Squash yoda-condition in upload_firmware()

Signed-off-by: Marek Vasut <marex@denx.de>
asix-sigma: Pull out the logic-mode switching

Pull out the code which switches Sigma from the FPGA programming mode
into Logic-Analyzer mode into separate function. Also, given the reply
is only ever 3-byte long, do not allocate 32 byte big buffer, but only
a 3-byte long one.

Signed-off-by: Marek Vasut <marex@denx.de>
asix-sigma: Encode the opcodes as hex values

Just encode the opcodes as hexadecimal values. This makes for better
readability when mapping the communication dump with the sigma to the
code.

Signed-off-by: Marek Vasut <marex@denx.de>
asix-sigma: Decrypt the LA mode switch sequence

Decode the logic mode start sequence into a series of FPGA instructions
instead and get rid of this sequence of magic numbers.

Signed-off-by: Marek Vasut <marex@denx.de>
asix-sigma: Read position only in CAPTURE state

Check the position of ForceStop and Trigger events only in case we
are in CAPTURE state, it's useless to do this unconditionally when
receive_data() is called.

Signed-off-by: Marek Vasut <marex@denx.de>
asix-sigma: Pull out the CAPTURE mode handler

Pull out the code handling the Sigma which is in CAPTURE mode into
a separate function. This is so we can start reworking this entire
code easily soon.

Signed-off-by: Marek Vasut <marex@denx.de>