]> sigrok.org Git - libsigrok.git/commitdiff
demo: add convenient bit mask for "all logic channels"
authorGerhard Sittig <redacted>
Sun, 13 May 2018 17:40:00 +0000 (19:40 +0200)
committerGerhard Sittig <redacted>
Sun, 13 May 2018 17:40:00 +0000 (19:40 +0200)
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.

src/hardware/demo/api.c
src/hardware/demo/protocol.h

index c5259b286144621d6f763ec611b7045df7ab49f2..7f2971db06c1a7992f12503eccb545790441b2b9 100644 (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;
 
index e2934980528e72a44930d725d2ba6fdaaaf26028..c35ea2d4c618db1a19da649f737e91c26d30e40e 100644 (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];