- command[0] = LWLA_WORD(CMD_CAP_SETUP);
- command[1] = LWLA_WORD(0); /* address */
- command[2] = LWLA_WORD(10); /* length */
-
- command[3] = LWLA_WORD_0(devc->channel_mask);
- command[4] = LWLA_WORD_1(devc->channel_mask);
- command[5] = LWLA_WORD_2(devc->channel_mask);
- command[6] = LWLA_WORD_3(devc->channel_mask);
-
- /* Set the clock divide counter maximum for samplerates of up to
- * 100 MHz. At the highest samplerate of 125 MHz the clock divider
- * is bypassed.
- */
- if (!acq->bypass_clockdiv && devc->samplerate > 0)
- divider_count = SR_MHZ(100) / devc->samplerate - 1;
- else
- divider_count = 0;
-
- command[7] = LWLA_WORD_0(divider_count);
- command[8] = LWLA_WORD_1(divider_count);
- command[9] = LWLA_WORD_2(divider_count);
- command[10] = LWLA_WORD_3(divider_count);
-
- command[11] = LWLA_WORD_0(devc->trigger_values);
- command[12] = LWLA_WORD_1(devc->trigger_values);
- command[13] = LWLA_WORD_2(devc->trigger_values);
- command[14] = LWLA_WORD_3(devc->trigger_values);
-
- command[15] = LWLA_WORD_0(devc->trigger_edge_mask);
- command[16] = LWLA_WORD_1(devc->trigger_edge_mask);
- command[17] = LWLA_WORD_2(devc->trigger_edge_mask);
- command[18] = LWLA_WORD_3(devc->trigger_edge_mask);
-
- trigger_mask = devc->trigger_mask;
- /* Set bits to select external TRG input edge. */
- if (devc->cfg_trigger_source == TRIGGER_EXT_TRG)
- switch (devc->cfg_trigger_slope) {
- case EDGE_POSITIVE:
- trigger_mask |= (uint64_t)1 << 35;
- break;
- case EDGE_NEGATIVE:
- trigger_mask |= (uint64_t)1 << 34;
- break;
- }
-
- command[19] = LWLA_WORD_0(trigger_mask);
- command[20] = LWLA_WORD_1(trigger_mask);
- command[21] = LWLA_WORD_2(trigger_mask);
- command[22] = LWLA_WORD_3(trigger_mask);
-
- /* Set the capture memory full threshold. This is slightly less
- * than the actual maximum, most likely in order to compensate for
- * pipeline latency.
- */
- memory_limit = MEMORY_DEPTH - 16;
-
- command[23] = LWLA_WORD_0(memory_limit);
- command[24] = LWLA_WORD_1(memory_limit);
- command[25] = LWLA_WORD_2(memory_limit);
- command[26] = LWLA_WORD_3(memory_limit);
-
- /* Fill remaining 64-bit words with zeroes. */
- memset(&command[27], 0, 16 * sizeof(uint16_t));
-
- return lwla_send_command(sdi->conn, command, G_N_ELEMENTS(command));
-}
-
-/* Issue a register write command as an asynchronous USB transfer.
- */
-static int issue_write_reg(const struct sr_dev_inst *sdi,
- unsigned int reg, unsigned int value)
-{
- struct dev_context *devc;
- struct acquisition_state *acq;
-
- devc = sdi->priv;
- acq = devc->acquisition;