Add a comment on the logic which skips the upper 64 bytes of a 512 bytes
chunk in the Asix Sigma's sample memory. Move the initial assignment and
the subsequent update from a value which was retrieved from a hardware
register closer together for awareness during maintenance. Pre-setting a
high position value that will never match when the feature is not in use
is very appropriate.
Adjust the sigma_read_pos() routine to handle triggerpos identically to
stoppos. The test condition's intention is to check whether a decrement
of the position ends up in the meta data section of a chunk. The previous
implementation tested whether a pointer to the position variable ended in
0x1ff when decremented -- which is unrelated to the driver's operation.
It's assumed that no harm was done because the trigger feature is
unsupported (see bug #359).
This silences the compiler warning reported in bug #1411.
*triggerpos = result[0] | (result[1] << 8) | (result[2] << 16);
*stoppos = result[3] | (result[4] << 8) | (result[5] << 16);
*triggerpos = result[0] | (result[1] << 8) | (result[2] << 16);
*stoppos = result[3] | (result[4] << 8) | (result[5] << 16);
- /* Not really sure why this must be done, but according to spec. */
+ /*
+ * These "position" values point to after the event (end of
+ * capture data, trigger condition matched). This is why they
+ * get decremented here. Sample memory consists of 512-byte
+ * chunks with meta data in the upper 64 bytes. Thus when the
+ * decrements takes us into this upper part of the chunk, then
+ * further move backwards to the end of the chunk's data part.
+ */
if ((--*stoppos & 0x1ff) == 0x1ff)
*stoppos -= 64;
if ((--*stoppos & 0x1ff) == 0x1ff)
*stoppos -= 64;
-
- if ((*--triggerpos & 0x1ff) == 0x1ff)
+ if ((--*triggerpos & 0x1ff) == 0x1ff)
*triggerpos -= 64;
return 1;
*triggerpos -= 64;
return 1;
devc = sdi->priv;
dl_events_in_line = 64 * 7;
devc = sdi->priv;
dl_events_in_line = 64 * 7;
- trg_line = ~0;
- trg_event = ~0;
dram_line = g_try_malloc0(chunks_per_read * sizeof(*dram_line));
if (!dram_line)
dram_line = g_try_malloc0(chunks_per_read * sizeof(*dram_line));
if (!dram_line)
/* Check if trigger has fired. */
modestatus = sigma_get_register(READ_MODE, devc);
/* Check if trigger has fired. */
modestatus = sigma_get_register(READ_MODE, devc);
+ trg_line = ~0;
+ trg_event = ~0;
if (modestatus & RMR_TRIGGERED) {
trg_line = triggerpos >> 9;
trg_event = triggerpos & 0x1ff;
if (modestatus & RMR_TRIGGERED) {
trg_line = triggerpos >> 9;
trg_event = triggerpos & 0x1ff;