1
0
mirror of git://projects.qi-hardware.com/ben-blinkenlights.git synced 2024-11-24 01:55:21 +02:00

ubb-patgen/ubb-patgen.c: remove pattern frequency and use -f for bus clock

Let's leave fancy oversampling calculations to the user.
This commit is contained in:
Werner Almesberger 2013-01-15 14:24:00 -03:00
parent 6e6767175f
commit 1111156a97

View File

@ -443,12 +443,11 @@ static void usage(const char *name)
{ {
fprintf(stderr, fprintf(stderr,
"usage: %s\n" "usage: %s\n"
" %s [-b freq_hz] [-f freq_hz] -c [-q] [active_s]\n" " %s [-f freq_hz] -c [-q] [active_s]\n"
" %s [-b freq_hz] [-f freq_hz] [-C] [-q] pattern\n\n" " %s [-f freq_hz] [-C] [-q] pattern\n\n"
" -b freq_hz set bus clock to the specified frequency (default: 1 MHz)\n"
" -c output bus clock on CLK without sending a pattern\n" " -c output bus clock on CLK without sending a pattern\n"
" -C temporarily output bus clock on CLK (for debugging)\n" " -C temporarily output bus clock on CLK (for debugging)\n"
" -f freq_hz set pattern rate (default: same as bus clock)\n" " -f freq_hz set bus clock to the specified frequency (default: 1 MHz)\n"
" -q quiet. Don't report clock differences.\n\n" " -q quiet. Don't report clock differences.\n\n"
" active_s keep running that many seconds after setting the clock\n" " active_s keep running that many seconds after setting the clock\n"
" (default: exit immediately but leave the clock on)\n" " (default: exit immediately but leave the clock on)\n"
@ -468,7 +467,6 @@ int main(int argc, char **argv)
{ {
struct mmcclk clk; struct mmcclk clk;
int bus_hz = 0, clk_only = 0, clkout = 0, bus_rel = 0; int bus_hz = 0, clk_only = 0, clkout = 0, bus_rel = 0;
int pattern_hz = 0, pattern_rel = 0;
const char *pattern = NULL; const char *pattern = NULL;
int quiet = 0; int quiet = 0;
double active_s = 0; double active_s = 0;
@ -477,14 +475,10 @@ int main(int argc, char **argv)
char *end; char *end;
int c; int c;
while ((c = getopt(argc, argv, "b:cCq")) != EOF) while ((c = getopt(argc, argv, "cCf:q")) != EOF)
switch (c) { switch (c) {
case 'b':
if (!frequency(optarg, &bus_hz, &bus_rel))
usage(*argv);
break;
case 'f': case 'f':
if (!frequency(optarg, &pattern_hz, &pattern_rel)) if (!frequency(optarg, &bus_hz, &bus_rel))
usage(*argv); usage(*argv);
break; break;
case 'c': case 'c':
@ -504,7 +498,7 @@ int main(int argc, char **argv)
case 0: case 0:
if (clk_only) if (clk_only)
break; break;
if (bus_hz || pattern_hz || clkout || quiet) if (bus_hz || clkout || quiet)
usage(*argv); usage(*argv);
ubb_open(UBB_ALL); ubb_open(UBB_ALL);
show_frequencies(); show_frequencies();