demo: add convenient bit mask for "all logic channels"

Keep a context variable around with a bit mask for all logic channels.
This is convenient in setup and generation routines, to avoid garbage
in unassigned bit positions of session feed packets.
This commit is contained in:
Gerhard Sittig 2018-05-13 19:40:00 +02:00
parent 817e759ddc
commit 015f09702a
2 changed files with 4 additions and 0 deletions

View File

@ -119,6 +119,9 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
devc->cur_samplerate = SR_KHZ(200);
devc->num_logic_channels = num_logic_channels;
devc->logic_unitsize = (devc->num_logic_channels + 7) / 8;
devc->all_logic_channels_mask = 1UL << 0;
devc->all_logic_channels_mask <<= devc->num_logic_channels;
devc->all_logic_channels_mask--;
devc->logic_pattern = DEFAULT_LOGIC_PATTERN;
devc->num_analog_channels = num_analog_channels;

View File

@ -99,6 +99,7 @@ struct dev_context {
/* Logic */
int32_t num_logic_channels;
size_t logic_unitsize;
uint64_t all_logic_channels_mask;
/* There is only ever one logic channel group, so its pattern goes here. */
enum logic_pattern_type logic_pattern;
uint8_t logic_data[LOGIC_BUFSIZE];