Commit Graph

2404 Commits

Author SHA1 Message Date
Marek Vasut fd830beb67 asix-sigma: Remove stack-based alloc in download_capture()
Avoid allocating 32KiB of data on stack in download_capture(). Instead,
do a glib-variant of calloc(1, ) to allocate the data for the samples
which will be downloaded. This avoids explosions of stack on systems
with tight stack limits.

Furthermore, define structures describing the organisation of Sigma's
DRAM memory and start using those instead of ad-hoc preprocessor macros
defining the sizes of various structures in memory.

Signed-off-by: Marek Vasut <marex@denx.de>
2014-04-30 09:45:51 -07:00
Marek Vasut 462fe78664 asix-sigma: Localize variables
The trigger position, stop position and chunk in which the trigger happened
are no longer needed in the global scope. Make those variables local to the
download_capture() function.

Signed-off-by: Marek Vasut <marex@denx.de>
2014-04-30 09:45:51 -07:00
Marek Vasut 6057d9fa54 asix-sigma: Move all register I/O into download_capture()
Move all the register I/O that is necessary to do the download of samples
from Sigma into download_capture() function. This makes the downloading
code contained a bit more again.

Signed-off-by: Marek Vasut <marex@denx.de>
2014-04-30 09:45:51 -07:00
Marek Vasut 00c8650877 asix-sigma: Clearly separate the sample download
Reorder the sigma_capture_mode() function so that the part which handles
the download of samples from Sigma is clearly separated from the tests if
the download should be started.

Signed-off-by: Marek Vasut <marex@denx.de>
2014-04-30 09:45:51 -07:00
Marek Vasut d405193074 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>
2014-04-30 09:45:51 -07:00
Marek Vasut 58d6f20748 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>
2014-04-30 09:45:51 -07:00
Marek Vasut 011f1091fa 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>
2014-04-30 09:45:51 -07:00
Marek Vasut 1c2736f909 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>
2014-04-30 09:45:51 -07:00
Marek Vasut 64fe661b87 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>
2014-04-30 09:45:51 -07:00
Marek Vasut 29b66a2eb0 asix-sigma: Squash yoda-condition in upload_firmware()
Signed-off-by: Marek Vasut <marex@denx.de>
2014-04-30 09:45:51 -07:00
Marek Vasut a80226bbb9 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>
2014-04-30 09:45:50 -07:00
Marek Vasut d485d44361 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>
2014-04-30 09:45:50 -07:00
Marek Vasut 8bbf7627df 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>
2014-04-30 09:45:50 -07:00
Marek Vasut 499b17e9c0 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>
2014-04-30 09:45:50 -07:00
Marek Vasut d5fa188ac9 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>
2014-04-30 09:45:50 -07:00
Marek Vasut 790c7ccc88 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>
2014-04-30 09:45:50 -07:00
Marek Vasut b1648dea88 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>
2014-04-30 09:45:50 -07:00
Bert Vermeulen 6868626bd3 asix-sigma: Acquisition fixes. 2014-04-30 09:45:50 -07:00
Bert Vermeulen 6cb45d96c8 output/vcd: Support getting samplerate from meta packets. 2014-04-30 07:40:56 -07:00
Bert Vermeulen 83023573d9 output/gnuplot: Support getting samplerate from meta packets. 2014-04-29 15:41:08 -07:00
Bert Vermeulen 0f3d8c8967 output/csv: Support getting samplerate from meta packets. 2014-04-28 19:09:32 -07:00
Bert Vermeulen 787e9bc970 output/ascii: Support getting samplerate from meta packets. 2014-04-28 15:11:17 -07:00
Bert Vermeulen 7bcbbfae3e output/hex: Support getting samplerate from meta packets. 2014-04-28 15:06:36 -07:00
Bert Vermeulen 35159a6b28 output/bits: Support getting samplerate from meta packets. 2014-04-28 14:54:47 -07:00
Uwe Hermann 7ea458625c session: Show unitsize of the received data. 2014-04-25 19:34:41 +02:00
Uwe Hermann bdf6c50c93 Don't include NO_LOG_WRAPPERS in the Doxygen output. 2014-04-25 18:44:45 +02:00
Uwe Hermann 2ad1deb89d Don't include LOG_PREFIX in the Doxygen output.
(files in hardware/, input/, and output/ don't need this since none of
those directories contain API stuff and are thus not included in the
list of input files for Doxygen at all).
2014-04-25 18:44:40 +02:00
Martin Ling 4f10853e67 configure.ac: Separate library flags from other CFLAGS. 2014-04-25 18:15:48 +02:00
Martin Ling e958f9217c Give type names to all enumerations. 2014-04-25 18:15:26 +02:00
Martin Ling d72b0cc898 Remove orphaned prototype for sr_filter_channels from proto.h. 2014-04-25 18:15:19 +02:00
Bert Vermeulen 06b5d7f70d fx2lafw: Don't send more samples than requested.
It's the new law.
2014-04-24 21:04:23 +02:00
Bert Vermeulen b0ccd64d02 WIP 2014-04-23 19:27:31 +02:00
Bert Vermeulen bda100ec0f output/ascii/bits/hex: Remove stray g_free(). 2014-04-21 23:35:26 +02:00
Bert Vermeulen 1e1dac0c07 ols: Allow disabling all channels.
This fixed bug 316.
2014-04-21 14:46:49 +02:00
Bert Vermeulen dba3e6826e output: Introduce output module API wrappers. 2014-04-21 01:50:43 +02:00
Bert Vermeulen 7e7b7fb7d3 Removed ALSA driver.
This driver has been unmaintained for years, and was never good code
to begin with. It's also questionable whether it was ever useful,
particularly with the demo driver now supporting various analog
signalling.
2014-04-19 13:37:53 +02:00
Bert Vermeulen 3b15586812 Removed obsolete sr_filter_channels(). 2014-04-19 13:34:46 +02:00
Bert Vermeulen 44559b2c3b Remove obsolete output API. 2014-04-19 13:28:17 +02:00
Bert Vermeulen 6f64ebb223 output/ascii: Rewrite for new output API. 2014-04-19 12:34:51 +02:00
Bert Vermeulen 8d3af2e868 output/hex: Rewrite for new output API. 2014-04-19 12:31:50 +02:00
Bert Vermeulen dbd0aeff35 output/bits: Rewrite for new output API.
This also fixes the performance problems in the old module.
2014-04-19 12:25:02 +02:00
Bert Vermeulen 71e16f47e3 output/binary: Use new output API. 2014-04-17 14:40:47 +02:00
Bert Vermeulen d42eb9d899 output/chronovu_la8: Use new output API.
This somewhat naively copies whatever it gets into the output, regardless
of how many channels are in there, or which ones are enabled. Not sure
what the best way to deal with that is, but for now you have to feed it
a channel setup the Chronovu software can read.
2014-04-17 14:10:49 +02:00
Bert Vermeulen 2a035e539a output/csv: Use the logic stream's unitsize.
This also fixes the channel index, instead of counting on the logic
data being arranged according to enabled channels only.
2014-04-16 20:05:43 +02:00
Bert Vermeulen 2b78ffea54 output/vcd: Use the logic stream's unitsize.
Also code cleanup and some memory leaks fixed.
2014-04-16 20:05:37 +02:00
Bert Vermeulen b240ee0856 output/gnuplot: Use new output API. 2014-04-16 20:05:09 +02:00
Uwe Hermann 1458018224 .gitignore: Add test-suite.log. 2014-04-13 18:59:08 +02:00
Uwe Hermann 55f98c6533 sr_dev_inst_new(): Use NULL (not "") if version unknown/nonexisting.
Unify the whole code-base to use NULL there, not a mix of "" and NULL.
2014-04-13 18:57:54 +02:00
Uwe Hermann cfe01d0607 chronovu-la: Show errors other than "device not found".
This can be useful for the user to see, e.g. for permission related
issues (device is there, but cannot be accessed).
2014-04-13 18:57:53 +02:00
Uwe Hermann 958326f8c6 configure.ac: Clearly mark required and optional libs. 2014-04-07 16:06:19 +02:00