Sigma: Merge storage of rise/fall triggers.
This commit is contained in:
parent
4ae1f45136
commit
a42aec7f6e
|
@ -576,11 +576,13 @@ static int configure_probes(GSList *probes)
|
||||||
struct probe *probe;
|
struct probe *probe;
|
||||||
GSList *l;
|
GSList *l;
|
||||||
int trigger_set = 0;
|
int trigger_set = 0;
|
||||||
|
int probebit;
|
||||||
|
|
||||||
memset(&trigger, 0, sizeof(struct sigma_trigger));
|
memset(&trigger, 0, sizeof(struct sigma_trigger));
|
||||||
|
|
||||||
for (l = probes; l; l = l->next) {
|
for (l = probes; l; l = l->next) {
|
||||||
probe = (struct probe *)l->data;
|
probe = (struct probe *)l->data;
|
||||||
|
probebit = 1 << (probe->index - 1);
|
||||||
|
|
||||||
if (!probe->enabled || !probe->trigger)
|
if (!probe->enabled || !probe->trigger)
|
||||||
continue;
|
continue;
|
||||||
|
@ -593,9 +595,9 @@ static int configure_probes(GSList *probes)
|
||||||
return SIGROK_ERR;
|
return SIGROK_ERR;
|
||||||
}
|
}
|
||||||
if (probe->trigger[0] == 'f')
|
if (probe->trigger[0] == 'f')
|
||||||
trigger.fast_fall = 1;
|
trigger.fallingmask |= probebit;
|
||||||
else if (probe->trigger[0] == 'r')
|
else if (probe->trigger[0] == 'r')
|
||||||
trigger.fast_fall = 0;
|
trigger.risingmask |= probebit;
|
||||||
else {
|
else {
|
||||||
g_warning("Asix Sigma only supports "
|
g_warning("Asix Sigma only supports "
|
||||||
"rising/falling trigger in 100 "
|
"rising/falling trigger in 100 "
|
||||||
|
@ -603,25 +605,23 @@ static int configure_probes(GSList *probes)
|
||||||
return SIGROK_ERR;
|
return SIGROK_ERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
trigger.fast_pin = probe->index - 1;
|
|
||||||
|
|
||||||
++trigger_set;
|
++trigger_set;
|
||||||
} else {
|
} else {
|
||||||
/* Simple trigger support (event). */
|
/* Simple trigger support (event). */
|
||||||
if (probe->trigger[0] == '1') {
|
if (probe->trigger[0] == '1') {
|
||||||
trigger.simplevalue |= 1 << (probe->index - 1);
|
trigger.simplevalue |= probebit;
|
||||||
trigger.simplemask |= 1 << (probe->index - 1);
|
trigger.simplemask |= probebit;
|
||||||
}
|
}
|
||||||
else if (probe->trigger[0] == '0') {
|
else if (probe->trigger[0] == '0') {
|
||||||
trigger.simplevalue |= 0 << (probe->index - 1);
|
trigger.simplevalue &= ~probebit;
|
||||||
trigger.simplemask |= 1 << (probe->index - 1);
|
trigger.simplemask |= probebit;
|
||||||
}
|
}
|
||||||
else if (probe->trigger[0] == 'f') {
|
else if (probe->trigger[0] == 'f') {
|
||||||
trigger.fallingmask |= 1 << (probe->index - 1);
|
trigger.fallingmask |= probebit;
|
||||||
++trigger_set;
|
++trigger_set;
|
||||||
}
|
}
|
||||||
else if (probe->trigger[0] == 'r') {
|
else if (probe->trigger[0] == 'r') {
|
||||||
trigger.risingmask |= 1 << (probe->index - 1);
|
trigger.risingmask |= probebit;
|
||||||
++trigger_set;
|
++trigger_set;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1092,6 +1092,7 @@ static int hw_start_acquisition(int device_index, gpointer session_device_id)
|
||||||
uint8_t triggerselect;
|
uint8_t triggerselect;
|
||||||
struct triggerinout triggerinout_conf;
|
struct triggerinout triggerinout_conf;
|
||||||
struct triggerlut lut;
|
struct triggerlut lut;
|
||||||
|
int triggerpin;
|
||||||
|
|
||||||
session_device_id = session_device_id;
|
session_device_id = session_device_id;
|
||||||
|
|
||||||
|
@ -1111,8 +1112,18 @@ static int hw_start_acquisition(int device_index, gpointer session_device_id)
|
||||||
if (cur_samplerate >= MHZ(100)) {
|
if (cur_samplerate >= MHZ(100)) {
|
||||||
sigma_set_register(WRITE_TRIGGER_SELECT1, 0x81);
|
sigma_set_register(WRITE_TRIGGER_SELECT1, 0x81);
|
||||||
|
|
||||||
triggerselect = (1 << LEDSEL1) | (trigger.fast_fall << 3) |
|
/* Find which pin to trigger on from mask. */
|
||||||
(trigger.fast_pin & 0x7);
|
for (triggerpin = 0; triggerpin < 8; ++triggerpin)
|
||||||
|
if ((trigger.risingmask | trigger.fallingmask) &
|
||||||
|
(1 << triggerpin))
|
||||||
|
break;
|
||||||
|
|
||||||
|
/* Set trigger pin and light LED on trigger. */
|
||||||
|
triggerselect = (1 << LEDSEL1) | (triggerpin & 0x7);
|
||||||
|
|
||||||
|
/* Default rising edge. */
|
||||||
|
if (trigger.fallingmask)
|
||||||
|
triggerselect |= 1 << 3;
|
||||||
|
|
||||||
/* All other modes. */
|
/* All other modes. */
|
||||||
} else if (cur_samplerate <= MHZ(50)) {
|
} else if (cur_samplerate <= MHZ(50)) {
|
||||||
|
|
|
@ -124,18 +124,14 @@ struct triggerlut {
|
||||||
|
|
||||||
/* Trigger configuration */
|
/* Trigger configuration */
|
||||||
struct sigma_trigger {
|
struct sigma_trigger {
|
||||||
/* Single-pin trigger support (100 and 200 MHz).*/
|
/* Only two probes can be used in mask. */
|
||||||
uint8_t fast_pin;
|
uint16_t risingmask;
|
||||||
uint8_t fast_fall;
|
uint16_t fallingmask;
|
||||||
|
|
||||||
/* Simple trigger support (<= 50 MHz). */
|
/* Simple trigger support (<= 50 MHz). */
|
||||||
uint16_t simplemask;
|
uint16_t simplemask;
|
||||||
uint16_t simplevalue;
|
uint16_t simplevalue;
|
||||||
|
|
||||||
/* Only two probes can be used in mask */
|
|
||||||
uint16_t risingmask;
|
|
||||||
uint16_t fallingmask;
|
|
||||||
|
|
||||||
/* TODO: Advanced trigger support (boolean expressions). */
|
/* TODO: Advanced trigger support (boolean expressions). */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue