Date:2013-01-29 01:06:00 (11 years 2 months ago)
Author:Werner Almesberger
Commit:f862a82a2da9c7d15912d99264ab211863e16bec
Message:ubb-la/ubb-la.c: new option -F freq_MHz to select "unsafe" frequencies

Files: ubb-la/README (1 diff)
ubb-la/ubb-la.c (5 diffs)

Change Details

ubb-la/README
2626modes to select. ubb-la simply picks the frequency closest to the one
2727specified.
2828
29The option -F works like -f but also allows frequencies that may
30exceed the hardware's capabilities. As a consequence, the MMC
31controller may hang.
32
2933A list of available frequencies can be obtained with
3034
3135# ubb-patgen -q
ubb-la/ubb-la.c
331331 * It'll save a few nanoseconds.
332332 */
333333
334static void frequency(struct mmcclk *clk, int hz)
334static void frequency(struct mmcclk *clk, int hz, int all)
335335{
336336    struct mmcclk mmc;
337337
338    mmcclk_first(&mmc, 0, MMCCLK_FLAG_RD_ONLY);
338    mmcclk_first(&mmc, 0,
339        MMCCLK_FLAG_RD_ONLY | (all ? MMCCLK_FLAG_ALL : 0));
339340    *clk = mmc;
340341    while (mmcclk_next(&mmc))
341342        if (fabs(clk->bus_clk_hz-hz) > fabs(mmc.bus_clk_hz-hz) ||
...... 
361362static void usage(const char *name)
362363{
363364    fprintf(stderr,
364"usage: %s [-C] [-t pattern/mask] [-f frequency_MHz] [-n N]\n\n"
365"usage: %s [-C] [-t pattern/mask] [(-f|-F) frequency_MHz] [-n N]\n\n"
365366" -C output the MMC clock on CLK/TRIG (for debugging)\n"
366367" -f freq_MHz select the specified frequency (default; 1 MHz)\n"
368" -F freq_MHz like -f, but also allow \"overclocking\"\n"
367369" -n N capture N buffers worth of samples without waiting for a\n"
368370" trigger\n"
369371" -t pattern/mask start capture at the specified pattern (DAT0 = 1, etc.,\n"
...... 
376378int main(int argc, char **argv)
377379{
378380    double freq_mhz = 1;
381    int all = 0;
379382    unsigned long trigger = 1, mask = 0;
380383    unsigned long multi = 0;
381384    int clkout = 0;
...... 
383386    char *end;
384387    int c, res;
385388
386    while ((c = getopt(argc, argv, "Cf:n:t:")) != EOF)
389    while ((c = getopt(argc, argv, "Cf:F:n:t:")) != EOF)
387390        switch (c) {
388391        case 'C':
389392            clkout = 1;
390393            break;
394        case 'F':
395            all = 1;
396            /* fall through */
391397        case 'f':
392398            freq_mhz = strtod(optarg, &end);
393399            if (*end)
...... 
423429    CLR(UBB_CMD);
424430    PDFUNC = UBB_CMD;
425431
426    frequency(&clk, 1e6*freq_mhz);
432    frequency(&clk, 1e6*freq_mhz, all);
427433    fprintf(stderr, "bus %g MHz controller %g MHz\n", clk.bus_clk_hz/1e6,
428434        clk.sys_clk_hz/(clk.clkdiv+1.0)/1e6);
429435    mmcclk_start(&clk);

Archive Download the corresponding diff file

Branches:
master



interactive