Commit 6c67531f authored by Alessandro Rubini's avatar Alessandro Rubini

tools: add fmc-fdelay-list

Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
parent ae601b1a
......@@ -2,7 +2,7 @@
.PHONY: all clean modules install modules_install
.PHONY: gitmodules prereq prereq_install prereq_install_warn
DIRS = kernel tools lib
DIRS = kernel lib tools
all clean modules install modules_install: gitmodules
@if echo $@ | grep -q install; then $(MAKE) prereq_install_warn; fi
......
......@@ -906,10 +906,43 @@ Example code: @code{fmc-fdelay-pulse} tool.
@end table
@c ##########################################################################
@node Command line tools
@chapter Command line tools
@node Command Line Tools
@chapter Command Line Tools
This chapter describes the command line tools that come with the driver and reside in the @code{tools/} subdirectory. They are provided as diagnostic utilities and to demonstrate how to use the library.
This chapter describes the command line tools that come with the
driver and reside in the @code{tools/} subdirectory. They are provided
as diagnostic utilities and to demonstrate how to use the library.
@c ==========================================================================
@node General Command Line Conventions
@section General Command Line Conventions
Most tools accept the following command-line options, in a
consistent way:
@table @code
@item -d <devid>
@itemx -i <index>
Used to select one board among several. See the description
of @i{fdelay_open} in @ref{Initialization and Cleanup}. If no
argument is given, the ``first'' board is used (index is 0).
@end table
@c ==========================================================================
@node fmc-fdelay-list
@section fmc-fdelay-list
The command takes no arguments. It reports the list of available
boards in the current system:
@smallexample
spusa# ./tools/fmc-fdelay-list
./tools/fmc-fdelay-list: found 1 board
dev_id 0200, /dev/zio/zio-fd-0200, /sys/bus/zio/devices/zio-fd-0200
@end smallexample
@c ##########################################################################
@node Troubleshooting
......
*.a
.depend
fdelay-list
fdelay-board-time
fdelay-term
fdelay-read
fdelay-fread
fdelay-pulse
fdelay-open-by-lun
fdelay-pulse-tom
\ No newline at end of file
fdelay-pulse-tom
......@@ -9,7 +9,7 @@ LOBJ += fdelay-output.o
CFLAGS = -Wall -ggdb -O2 -I../kernel -I../zio/include
LDFLAGS = -L. -lfdelay
DEMOSRC := fdelay-list.c
DEMOSRC :=
DEMOSRC += fdelay-board-time.c
DEMOSRC += fdelay-term.c
DEMOSRC += fdelay-read.c
......
fmc-fdelay-list
......@@ -2,11 +2,11 @@
M = $(shell /bin/pwd)/../kernel
HOST_EXTRACFLAGS += -I$(M) -I../zio/include -Wno-trigraphs -Wall -ggdb
HOST_EXTRACFLAGS += -I$(M) -I../lib -I../zio/include -Wno-trigraphs -Wall -ggdb
HOSTCC ?= gcc
hostprogs-y :=
hostprogs-y := fmc-fdelay-list
# we are not in the kernel, so we need to piggy-back on "make modules"
all modules: $(hostprogs-y)
......
......@@ -13,13 +13,19 @@ int main(int argc, char **argv)
struct __fdelay_board *b;
struct fdelay_board *ub;
if (argc > 1) {
fprintf(stderr, "%s: too many arguments (none expected)\n",
argv[0]);
exit(1);
}
i = fdelay_init();
if (i < 0) {
fprintf(stderr, "%s: fdelay_init(): %s\n", argv[0],
strerror(errno));
exit(1);
}
printf("%s: found %i boards\n", argv[0], i);
printf("%s: found %i board%s\n", argv[0], i, i ? "" : "s");
for (j = 0; j < i; j++) {
ub = fdelay_open(j, -1);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment