ubb-la/ubb-la.c |
331 | 331 | * It'll save a few nanoseconds. |
332 | 332 | */ |
333 | 333 | |
334 | | static void frequency(struct mmcclk *clk, int hz) |
| 334 | static void frequency(struct mmcclk *clk, int hz, int all) |
335 | 335 | { |
336 | 336 | struct mmcclk mmc; |
337 | 337 | |
338 | | mmcclk_first(&mmc, 0, MMCCLK_FLAG_RD_ONLY); |
| 338 | mmcclk_first(&mmc, 0, |
| 339 | MMCCLK_FLAG_RD_ONLY | (all ? MMCCLK_FLAG_ALL : 0)); |
339 | 340 | *clk = mmc; |
340 | 341 | while (mmcclk_next(&mmc)) |
341 | 342 | if (fabs(clk->bus_clk_hz-hz) > fabs(mmc.bus_clk_hz-hz) || |
... | ... | |
361 | 362 | static void usage(const char *name) |
362 | 363 | { |
363 | 364 | 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" |
365 | 366 | " -C output the MMC clock on CLK/TRIG (for debugging)\n" |
366 | 367 | " -f freq_MHz select the specified frequency (default; 1 MHz)\n" |
| 368 | " -F freq_MHz like -f, but also allow \"overclocking\"\n" |
367 | 369 | " -n N capture N buffers worth of samples without waiting for a\n" |
368 | 370 | " trigger\n" |
369 | 371 | " -t pattern/mask start capture at the specified pattern (DAT0 = 1, etc.,\n" |
... | ... | |
376 | 378 | int main(int argc, char **argv) |
377 | 379 | { |
378 | 380 | double freq_mhz = 1; |
| 381 | int all = 0; |
379 | 382 | unsigned long trigger = 1, mask = 0; |
380 | 383 | unsigned long multi = 0; |
381 | 384 | int clkout = 0; |
... | ... | |
383 | 386 | char *end; |
384 | 387 | int c, res; |
385 | 388 | |
386 | | while ((c = getopt(argc, argv, "Cf:n:t:")) != EOF) |
| 389 | while ((c = getopt(argc, argv, "Cf:F:n:t:")) != EOF) |
387 | 390 | switch (c) { |
388 | 391 | case 'C': |
389 | 392 | clkout = 1; |
390 | 393 | break; |
| 394 | case 'F': |
| 395 | all = 1; |
| 396 | /* fall through */ |
391 | 397 | case 'f': |
392 | 398 | freq_mhz = strtod(optarg, &end); |
393 | 399 | if (*end) |
... | ... | |
423 | 429 | CLR(UBB_CMD); |
424 | 430 | PDFUNC = UBB_CMD; |
425 | 431 | |
426 | | frequency(&clk, 1e6*freq_mhz); |
| 432 | frequency(&clk, 1e6*freq_mhz, all); |
427 | 433 | fprintf(stderr, "bus %g MHz controller %g MHz\n", clk.bus_clk_hz/1e6, |
428 | 434 | clk.sys_clk_hz/(clk.clkdiv+1.0)/1e6); |
429 | 435 | mmcclk_start(&clk); |