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
2424#include <ubb/mmcclk.h>
2525#include <ubb/physmem.h>
2626
27#include "gui.h"
28
2729
2830#define DMA 5
2931
...... 
266268/* ----- Capture ----------------------------------------------------------- */
267269
268270
269static int do_buf(int nibbles, uint32_t trigger, uint32_t mask)
271static int do_buf(int nibbles, uint32_t trigger, uint32_t mask, int use_gui)
270272{
271273    uint8_t *buf = physmem_malloc(4096);
272274    struct physmem_vec vec;
...... 
288290    if (!xfer(vec.addr, nibbles, trigger, mask))
289291        return 0;
290292
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);
292297
293298    return 1;
294299}
...... 
367372static void usage(const char *name)
368373{
369374    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"
371376" -C output the MMC clock on CLK/TRIG (for debugging)\n"
372377" -f freq_MHz select the specified frequency (default; 1 MHz)\n"
373378" -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"
374381" -n N capture N buffers worth of samples without waiting for a\n"
375382" trigger\n"
376383" -t pattern/mask start capture at the specified pattern (DAT0 = 1, etc.,\n"
...... 
387394    unsigned long trigger = 1, mask = 0;
388395    unsigned long multi = 0;
389396    int clkout = 0;
397    int use_gui = 0;
390398    struct mmcclk clk, fast_clk;
391399    char *end;
392400    int c, res;
393401
394    while ((c = getopt(argc, argv, "Cf:F:n:t:")) != EOF)
402    while ((c = getopt(argc, argv, "Cf:F:gn:t:")) != EOF)
395403        switch (c) {
396404        case 'C':
397405            clkout = 1;
...... 
404412            if (*end)
405413                usage(*argv);
406414            break;
415        case 'g':
416            use_gui = 1;
417            break;
407418        case 'n':
408419            multi = strtoul(optarg, &end, 0);
409420            if (*end)
...... 
444455        mask = UBB_CLK;
445456    }
446457
458    if (use_gui)
459        gui_init();
460
447461    if (!multi) {
448        res = !do_buf(8128, trigger, mask);
462        res = !do_buf(8128, trigger, mask, use_gui);
449463    } else {
450464        frequency(&fast_clk, 84e6, 1);
451465        do_bufs(multi, 8128, &clk, &fast_clk);

Archive Download the corresponding diff file

Branches:
master



interactive