Half-pulse details
mtap2 generally records half-pulses, in the form of uint16 time stamps: Each time stamp represents the time elapsed between the last half-pulse transition and the current one.
Exception: If there is an overflow, a time stamp value of 0xffff is written. In order to not mix up overflow with normal timestamps, the range for normal time stamps is limited to a maximum value of 0x0fff.
In a second step, these timestamps are either combined into normal pulses (TAP formats 0 and 1) or half-pulses.
big bug
mtap.tmp can start with overflow values (0xffff).
However, mtap2.c expects it to start with an actual timer value.
Therefore, mtap2 assumes it read the first low->high transition when in fact this didn't occur yet. The next transition is then interpreted as a high->low transition, which skews the overall timing.
Wrong interpretation of timestamps:
16 19: 2f
16 1a: 30
18 2d: 45
29 22: 4b
1f 23: 42
1f 1a: 39
15 19: 2e
16 22: 38
1e 1a: 38
16 23: 39
Right interpretation of timestamps:
19 16: 2f
1a 18: 32
2d 29: 56
22 1f: 41
23 1f: 42
1a 15: 2f
19 16: 2f
22 1e: 40
1a 16: 30
23 1f: 42