output/vcd: assume packed input data image, unbreak 2nd+ channel

The previous implementation only emitted data for the first enabled
channels, and "saw no changes" after emission of the initial value for
channels on positions that followed a disabled channel.

Assume that the received data from the session bus communicates the bits
of enabled channels in a packed representation. Skip the mapping of
output bit indices to sigrok channel numbers.

This fixes the remaining part of bug #519.

Tested by inspecting in gtkwave the result of command:
  $ sigrok-cli -d demo -C D1,D3,D6 -c samplerate=2M --samples 2500 -O vcd -o trace.vcd

When we find that all input sources (device drivers, and input modules)
provide a dense bit field, all of the mapping logic can get removed
here. This commit just quickly disables the logic.
This commit is contained in:
Gerhard Sittig 2018-02-04 23:17:39 +01:00 committed by Uwe Hermann
parent a299a95413
commit aa0979482f
1 changed files with 10 additions and 1 deletions

View File

@ -200,7 +200,16 @@ static int receive(const struct sr_output *o, const struct sr_datafeed_packet *p
timestamp_written = FALSE; timestamp_written = FALSE;
for (p = 0; p < ctx->num_enabled_channels; p++) { for (p = 0; p < ctx->num_enabled_channels; p++) {
index = ctx->channel_index[p]; /*
* TODO Check whether the mapping from
* data image positions to channel numbers
* is required. Experiments suggest that
* the data image "is dense", and packs
* bits of enabled channels, and leaves no
* room for positions of disabled channels.
*/
/* index = ctx->channel_index[p]; */
index = p;
curbit = ((unsigned)sample[index / 8] curbit = ((unsigned)sample[index / 8]
>> (index % 8)) & 1; >> (index % 8)) & 1;