mirror of
git://projects.qi-hardware.com/ben-blinkenlights.git
synced 2024-11-23 22:42:49 +02:00
ubb-patgen/ubb-patgen.c: "ubb-patgen -f FREQ" calculates the frequency
This can then be used by generators to generate an oversampled pattern.
This commit is contained in:
parent
1111156a97
commit
eedb0f0106
@ -443,8 +443,9 @@ static void usage(const char *name)
|
||||
{
|
||||
fprintf(stderr,
|
||||
"usage: %s\n"
|
||||
" %s [-f freq_hz] -c [-q] [active_s]\n"
|
||||
" %s [-f freq_hz] [-C] [-q] pattern\n\n"
|
||||
" %s -f freq_hz\n"
|
||||
" %s [-f freq_hz] [-q] -c [active_s]\n"
|
||||
" %s [-f freq_hz] [-q] [-C] pattern\n\n"
|
||||
" -c output bus clock on CLK without sending a pattern\n"
|
||||
" -C temporarily output bus clock on CLK (for debugging)\n"
|
||||
" -f freq_hz set bus clock to the specified frequency (default: 1 MHz)\n"
|
||||
@ -458,7 +459,7 @@ static void usage(const char *name)
|
||||
" Without +/-, the closest available frequency is selected.\n"
|
||||
"Pattern: hex digits corresponding to 1 for DAT0, 2 for DAT1, etc.\n"
|
||||
" {n} repeats the preceding digit n times, e.g., 1{3} is equivalent to 111.\n"
|
||||
, name, name, name);
|
||||
, name, name, name, name);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@ -483,7 +484,7 @@ int main(int argc, char **argv)
|
||||
break;
|
||||
case 'c':
|
||||
clk_only = 1;
|
||||
/* fall through */
|
||||
break;
|
||||
case 'C':
|
||||
clkout = 1;
|
||||
break;
|
||||
@ -494,15 +495,28 @@ int main(int argc, char **argv)
|
||||
usage(*argv);
|
||||
}
|
||||
|
||||
if (clkout && clk_only)
|
||||
usage(*argv);
|
||||
|
||||
switch (argc-optind) {
|
||||
case 0:
|
||||
if (clk_only)
|
||||
break;
|
||||
if (bus_hz || clkout || quiet)
|
||||
if (clkout || quiet)
|
||||
usage(*argv);
|
||||
|
||||
ubb_open(UBB_ALL);
|
||||
show_frequencies();
|
||||
return 1;
|
||||
if (bus_hz) {
|
||||
if (!select_freq(&clk, bus_hz, bus_rel)) {
|
||||
fprintf(stderr,
|
||||
"no suitable frequency found\n");
|
||||
exit(1);
|
||||
}
|
||||
printf("%f\n", clk.bus_clk_hz);
|
||||
} else {
|
||||
show_frequencies();
|
||||
}
|
||||
return 0;
|
||||
case 1:
|
||||
if (clk_only) {
|
||||
active_s = strtod(argv[argc-1], &end);
|
||||
@ -542,7 +556,7 @@ int main(int argc, char **argv)
|
||||
fprintf(stderr, " (%+d ppm)\n", (int) (err*1000000));
|
||||
}
|
||||
|
||||
if (clkout)
|
||||
if (clkout || clk_only)
|
||||
PDFUNS = UBB_CLK;
|
||||
mmcclk_start(&clk);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user