+ /* Triggertype: event. */
+ lut->params.selres = 3;
+
+ return SR_OK;
+}
+
+static int hw_dev_acquisition_start(int dev_index, void *cb_data)
+{
+ struct sr_dev_inst *sdi;
+ struct context *ctx;
+ struct sr_datafeed_packet *packet;
+ struct sr_datafeed_header *header;
+ struct sr_datafeed_meta_logic meta;
+ struct clockselect_50 clockselect;
+ int frac, triggerpin, ret;
+ uint8_t triggerselect;
+ struct triggerinout triggerinout_conf;
+ struct triggerlut lut;
+
+ if (!(sdi = sr_dev_inst_get(adi->instances, dev_index)))
+ return SR_ERR;
+
+ ctx = sdi->priv;
+
+ /* If the samplerate has not been set, default to 200 kHz. */
+ if (ctx->cur_firmware == -1) {
+ if ((ret = set_samplerate(sdi, SR_KHZ(200))) != SR_OK)
+ return ret;
+ }
+
+ /* Enter trigger programming mode. */
+ sigma_set_register(WRITE_TRIGGER_SELECT1, 0x20, ctx);
+
+ /* 100 and 200 MHz mode. */
+ if (ctx->cur_samplerate >= SR_MHZ(100)) {
+ sigma_set_register(WRITE_TRIGGER_SELECT1, 0x81, ctx);
+
+ /* Find which pin to trigger on from mask. */
+ for (triggerpin = 0; triggerpin < 8; ++triggerpin)
+ if ((ctx->trigger.risingmask | ctx->trigger.fallingmask) &
+ (1 << triggerpin))
+ break;
+
+ /* Set trigger pin and light LED on trigger. */
+ triggerselect = (1 << LEDSEL1) | (triggerpin & 0x7);
+
+ /* Default rising edge. */
+ if (ctx->trigger.fallingmask)
+ triggerselect |= 1 << 3;
+
+ /* All other modes. */
+ } else if (ctx->cur_samplerate <= SR_MHZ(50)) {
+ build_basic_trigger(&lut, ctx);