Date: | 2013-01-31 02:07:55 (11 years 1 month ago) |
---|---|
Author: | Werner Almesberger |
Commit: | 444e0811bfa91ff2f6279a67429262cb76f6aeaf |
Message: | ubb-la/ubb-la.c: new option -g to use the GUI to display results For now, only in single-buffer mode. |
Files: |
ubb-la/ubb-la.c (7 diffs) |
Change Details
ubb-la/ubb-la.c | ||
---|---|---|
24 | 24 | #include <ubb/mmcclk.h> |
25 | 25 | #include <ubb/physmem.h> |
26 | 26 | |
27 | #include "gui.h" | |
28 | ||
27 | 29 | |
28 | 30 | #define DMA 5 |
29 | 31 | |
... | ... | |
266 | 268 | /* ----- Capture ----------------------------------------------------------- */ |
267 | 269 | |
268 | 270 | |
269 | static int do_buf(int nibbles, uint32_t trigger, uint32_t mask) | |
271 | static int do_buf(int nibbles, uint32_t trigger, uint32_t mask, int use_gui) | |
270 | 272 | { |
271 | 273 | uint8_t *buf = physmem_malloc(4096); |
272 | 274 | struct physmem_vec vec; |
... | ... | |
288 | 290 | if (!xfer(vec.addr, nibbles, trigger, mask)) |
289 | 291 | return 0; |
290 | 292 | |
291 | print_samples(stdout, buf, INITIAL_SKIP, nibbles); | |
293 | if (use_gui) | |
294 | gui(buf, INITIAL_SKIP, nibbles); | |
295 | else | |
296 | print_samples(stdout, buf, INITIAL_SKIP, nibbles); | |
292 | 297 | |
293 | 298 | return 1; |
294 | 299 | } |
... | ... | |
367 | 372 | static void usage(const char *name) |
368 | 373 | { |
369 | 374 | fprintf(stderr, |
370 | "usage: %s [-C] [-t pattern/mask] [(-f|-F) frequency_MHz] [-n N]\n\n" | |
375 | "usage: %s [-C] [-t pattern/mask] [(-f|-F) frequency_MHz] [-g] [-n N]\n\n" | |
371 | 376 | " -C output the MMC clock on CLK/TRIG (for debugging)\n" |
372 | 377 | " -f freq_MHz select the specified frequency (default; 1 MHz)\n" |
373 | 378 | " -F freq_MHz like -f, but also allow \"overclocking\"\n" |
379 | " -g display the captured waveforms graphically (default:\n" | |
380 | " print as text to standard output)\n" | |
374 | 381 | " -n N capture N buffers worth of samples without waiting for a\n" |
375 | 382 | " trigger\n" |
376 | 383 | " -t pattern/mask start capture at the specified pattern (DAT0 = 1, etc.,\n" |
... | ... | |
387 | 394 | unsigned long trigger = 1, mask = 0; |
388 | 395 | unsigned long multi = 0; |
389 | 396 | int clkout = 0; |
397 | int use_gui = 0; | |
390 | 398 | struct mmcclk clk, fast_clk; |
391 | 399 | char *end; |
392 | 400 | int c, res; |
393 | 401 | |
394 | while ((c = getopt(argc, argv, "Cf:F:n:t:")) != EOF) | |
402 | while ((c = getopt(argc, argv, "Cf:F:gn:t:")) != EOF) | |
395 | 403 | switch (c) { |
396 | 404 | case 'C': |
397 | 405 | clkout = 1; |
... | ... | |
404 | 412 | if (*end) |
405 | 413 | usage(*argv); |
406 | 414 | break; |
415 | case 'g': | |
416 | use_gui = 1; | |
417 | break; | |
407 | 418 | case 'n': |
408 | 419 | multi = strtoul(optarg, &end, 0); |
409 | 420 | if (*end) |
... | ... | |
444 | 455 | mask = UBB_CLK; |
445 | 456 | } |
446 | 457 | |
458 | if (use_gui) | |
459 | gui_init(); | |
460 | ||
447 | 461 | if (!multi) { |
448 | res = !do_buf(8128, trigger, mask); | |
462 | res = !do_buf(8128, trigger, mask, use_gui); | |
449 | 463 | } else { |
450 | 464 | frequency(&fast_clk, 84e6, 1); |
451 | 465 | do_bufs(multi, 8128, &clk, &fast_clk); |
Branches:
master