1
0
mirror of git://projects.qi-hardware.com/ben-blinkenlights.git synced 2024-11-30 19:07:31 +02:00
Commit Graph

52 Commits

Author SHA1 Message Date
Werner Almesberger
5b050b4b36 ubb-la/gui.c (gui): move position display to show_position; add position in samples 2013-01-31 23:24:24 -03:00
Werner Almesberger
f9b3c36c6b ubb-la/gui.c (gui): the upper bound for "pos" is nibbles-skip-1, not "nibbles" 2013-01-31 14:48:26 -03:00
Werner Almesberger
709506e6d6 ubb-la/gui.c (show_map): fix calculation of middle point
Also here, we need to take into account that "pos" is zero-based.
2013-01-31 14:48:26 -03:00
Werner Almesberger
137ed18dc2 ubb-la/gui.c (show_buffer): fix calculation of the position offset (dp)
"pos" counts from zero so the middle point is (nibbles-skip)/2 while
the code assumed "pos" was an index into the actual buffer and the
middle point would therefore have been (nibbles+skip)/2
2013-01-31 14:43:33 -03:00
Werner Almesberger
8b69d26fa9 ubb-la/gui.c: make debug output clearer and more detailed 2013-01-31 10:51:44 -03:00
Werner Almesberger
af3c18ab19 ubb-la/try.c (main): use same buffer size and offset as the Ben 2013-01-31 10:02:31 -03:00
Werner Almesberger
f26fd3564a ubb-la/gui.c (show_map): keep view rectangle size constant
Before, we had rounding effects that could make the rectangle width vary by
one pixel, depending on position.
2013-01-31 04:03:31 -03:00
Werner Almesberger
db133f2cb6 ubb-la/gui.c: display time of center (from start of buffer) 2013-01-31 03:52:24 -03:00
Werner Almesberger
b0a576dd64 ubb-la/gui.c: mark the center of the view area 2013-01-31 03:25:21 -03:00
Werner Almesberger
a83d8bf323 ubb-la/gui.c: add small gap (UNIT_GAP) between numbers and units 2013-01-31 03:15:33 -03:00
Werner Almesberger
ba033cc27e ubb-la/gui.c: add section comments for color and layout definitions 2013-01-31 02:59:37 -03:00
Werner Almesberger
159a128d28 ubb-la.c/gui.c: show units in light blue to better separate them from numbers 2013-01-31 02:57:27 -03:00
Werner Almesberger
06c5f6b0fa ubb-la/gui.c (textf): use vsnprintf+valloca instead of vasprintf
This way, we don't malloc/free all the time, which could lead to more
memory fragmentation than alloca at roughly the same stack location.
2013-01-31 02:50:01 -03:00
Werner Almesberger
52c3dcc16a ubb-la/gui.c (textf): vasprintf ain't alloca, so we need to free() 2013-01-31 01:45:42 -03:00
Werner Almesberger
cdcfb6c181 ubb-la/gui.c: show division size (in samples and seconds) 2013-01-31 01:21:56 -03:00
Werner Almesberger
8d81b584a0 ubb-la/gui.c (XWIDTH): move view width into macro instead of open-coding it 2013-01-31 01:11:18 -03:00
Werner Almesberger
acd9fd6673 ubb-la/gui.c: show horizontal divisions 2013-01-31 01:09:42 -03:00
Werner Almesberger
5bb086e0e8 ubb-la/: display sample rate and sample interval in the GUI 2013-01-31 01:08:39 -03:00
Werner Almesberger
e1be0f242b ubb-la/gui.c: display a small map of buffer and view 2013-01-31 00:07:32 -03:00
Werner Almesberger
f99b62636f ubb-la/gui.c: label channels 2013-01-30 23:19:09 -03:00
Werner Almesberger
444e0811bf ubb-la/ubb-la.c: new option -g to use the GUI to display results
For now, only in single-buffer mode.
2013-01-30 22:07:55 -03:00
Werner Almesberger
0925b0f060 ubb-la/gui.c: add section titles and reorder some of the functions 2013-01-30 22:07:31 -03:00
Werner Almesberger
533e9643ac ubb-la/gui.c (DEBUG): make debugging fprintfs optional via DEBUG macro 2013-01-30 21:25:47 -03:00
Werner Almesberger
2d49a73aad ubb-la/try.c: run the GUI with fake data 2013-01-30 21:20:08 -03:00
Werner Almesberger
65a8578bd2 ubb-la/Makefile: add SDL (may break "static") 2013-01-30 21:19:09 -03:00
Werner Almesberger
435144223d ubb-la/gui.c (gui): make panning zoom-dependent (2 samples at maximum zoom) 2013-01-30 21:08:25 -03:00
Werner Almesberger
4fb2a8cbee ubb-la/gui.c (gui_init): enable keyboard repeat 2013-01-30 20:55:58 -03:00
Werner Almesberger
c702fc0e90 ubb-la/gui.c: add horizontal panning (WIP) 2013-01-30 20:51:22 -03:00
Werner Almesberger
12a1808e09 ubb-la/gui.c (gui): fix the event loop to properly ignore unrecognized events 2013-01-30 20:37:42 -03:00
Werner Almesberger
1b0a2cff51 ubb-la/gui.c: use powers of two for zoom and integer arithmetic (WIP)
This looks better and avoids the risk of math issues.
2013-01-30 20:37:10 -03:00
Werner Almesberger
94e099eebc ubb-la/gui.c: experimental GUI code (WIP) 2013-01-30 14:38:54 -03:00
Werner Almesberger
b7688f3abe ubb-la/ubb-la.c: add more section titles 2013-01-30 01:52:38 -03:00
Werner Almesberger
760e8a893a ubb-la/ubb-la.c (xfers): revert to "safe" end-of-command synchronization
This seems to be the best compromise between stability and performance.
2013-01-30 01:51:12 -03:00
Werner Almesberger
3b007ebaf1 ubb-la/ubb-la. (xfers): re-optimize the start bit
Combined with the 84 MHz speedup, this yields:

1       3       gap+0   2       0       1       3
------- ------- ------- ------- ------- ------- -------
        118     36              1       138
        89      35      1                       22
        59      36      1                       51
        30      36      1                       80

So in this case we gain only about 3 samples or 10% by making this risky
optimization. (The gain would be higher at higher sample rates, lower at
lower rates.)
2013-01-29 00:15:24 -03:00
Werner Almesberger
bf62b209e5 ubb-la/ubb-la.c: raise MMC bus clock to 84 MHz during overhead
We also de-optimize the start bit (DAT0=0) phase for now. In the
12 MHz scenario, this produces the following results:

1       3       gap+0   2       0       1       3
------- ------- ------- ------- ------- ------- -------
8               38              26      100     146
        102     38      26                      6
        52      39      26                      55
        147     41      26                      105
97              39              26      10      146

Note that the gap now includes the start bit phase, since the clock
change may complicate the calculation of how many 12 MHz samples
it corresponds to.
2013-01-28 23:24:29 -03:00
Werner Almesberger
f862a82a2d ubb-la/ubb-la.c: new option -F freq_MHz to select "unsafe" frequencies 2013-01-28 21:06:00 -03:00
Werner Almesberger
85bda4c41d ubb-la/ubb-la.c (frequency): adapt use of mmcclk for API change 2013-01-28 21:05:01 -03:00
Werner Almesberger
14b7a9cdee ubb-la/ubb-la.c (xfers): instead of waiting for event, use hand-optimized delay loop
The gap is just as long as when waiting for an event but the "start bit"
on DAT0 has vanished completely:

1       3       gap     2       0       1       3
------- ------- ------- ------- ------- ------- -------
53              77                      16      146
66              79                      1       146
81              79                              132
96              79                              117
2013-01-28 16:43:29 -03:00
Werner Almesberger
18a822b845 ubb-la/ubb-la.c (xfers): wait for END_CMD_RES instead of DATA_FIFO_EMPTY
This seems to make no difference for the gap but the "start bit" (DAT0
pulled low) seem to get 1-2 samples shorter:

1       3       gap     2       0       1       3
------- ------- ------- ------- ------- ------- -------
146             77      9                       60
147     13      79      9                       45
145     28      79      10                      29
146     43      79      9                       15
2013-01-28 16:43:23 -03:00
Werner Almesberger
4ffd61093b ubb-la/ubb-la.c (do_bufs): don't skip 122 nibbled (for evaluation)
A series of measurements of

A# ./ubb-patgen  -f 41kHz 1
A# ./ubb-patgen  -f 41kHz -c
B# ./ubb-la -f 12 -n 10

yielded these results:

1       3       gap     2       0       1       3
------- ------- ------- ------- ------- ------- -------
106             77      11                      98
120             78      11                      83
134             79      11                      68
        3       79      11                      53
        18      78      11                      39
        33      78      11                      24
        47      79      11                      9
        62      79      5       6       140     147
        77      79              11      125     147

Where for example the last entry corresponds to

...1{146}3{77}
0{11}1{125}3{147}...

Since this looks as if DAT1 was 1 for 77 samples before the first capture
ended, was 0 throughout the pulling low of DAT0 (11 cycles), stayed low
for another 125 cycles, and then went high for the 146.29 nominal
half-period, we thus get a gap length of 2*146-77-11-125 = 79
2013-01-27 18:23:38 -03:00
Werner Almesberger
37a219b0b9 ubb-la/ubb-la.c: option -n N to enter experimental multi-buffer mode (WIP) 2013-01-26 23:25:17 -03:00
Werner Almesberger
13f34170de ubb-la/ubb-la.c (do_buf): physmem_xlat doesn't need a cast
We inherited the cast from ubb-patgen where the buffer was "const" and thus
had to be cast for the the non-const argument of physmem_xlat. We never
needed a cast in ubb-la, though.

Since physmem_xlat now uses "const" as well, the cast is even doubly
superfluous.
2013-01-26 20:49:09 -03:00
Werner Almesberger
8316bc0070 ubb-la/ubb-la.c (do_buf): move pretty-printing to new function print_samples 2013-01-26 20:01:32 -03:00
Werner Almesberger
4ceee66c79 ubb-la/ubb-la.c (INITIAL_SKIP): describe how the value was obtained 2013-01-26 19:55:44 -03:00
Werner Almesberger
09de2454ef ubb-la/Makefile (CFLAGS): use more specific -O9 -fno-tree-cselim
Third time lucky, I hope. -fno-tree-cselim is much more specific than
disabling all optimization and results in a considerably less severe
performance reduction (about 30-40% of -O0).
2013-01-25 19:49:20 -03:00
Werner Almesberger
07026753de ubb-la/README: brief description of ubb-la 2013-01-24 20:04:40 -03:00
Werner Almesberger
4ce6866767 ubb-la/ubb-la.c (do_buf): skip over the first 122 samples
They are from the setup process and therefore invalid (DAT0) and/or out
of sync (DAT0-3) with the rest of the samples.
2013-01-24 20:00:59 -03:00
Werner Almesberger
62284fb78e ubb-la/ubb-la.c: add command-line options, keyboard abort 2013-01-24 18:26:34 -03:00
Werner Almesberger
bac21bf8cb ubb-la/Makefile (CFLAGS): even -O1 isn't safe; use -O0 instead
While -O1 gets rid of the unexpected read in the simple code of a synthetic
test, it's still there in the more complex environment we have in ubb-la.c
Turning off optimization completely seems to do the trick.
2013-01-24 17:35:52 -03:00
Werner Almesberger
e1eea4fa86 ubb-la/Makefile (CFLAGS): -O9 is currently unsafe; use -O1
Higher optimizations can cause the generation of code that unexpectedly
does the equivalent of  PDFUNS = PDFUNS;

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56098
2013-01-24 15:31:59 -03:00