diff --git a/acdx/test/Makefile b/acdx/test/Makefile index 79c1e5a0ad5b04dc9b9cd3c21e5d2c1017313cda..d0e088652a64034ff1d967a6d353eedd82538e6f 100755 --- a/acdx/test/Makefile +++ b/acdx/test/Makefile @@ -14,6 +14,7 @@ ACCS=oplhc CFLAGS= -g -Wall CFLAGS+= -I../driver CFLAGS+= -DCOMPILE_TIME=$(COMPILE_TIME) +CFLAGS += -DGIT_VERSION=\"$(GIT_VERSION)\" LDLIBS = -lm diff --git a/acdx/test/acdxtest.c b/acdx/test/acdxtest.c index b3e2d8c45b1ffa6f7a672df371bc8587c73cb976..4e15c0916062209ac5436fed18029ac9f3a42e7f 100755 --- a/acdx/test/acdxtest.c +++ b/acdx/test/acdxtest.c @@ -45,6 +45,7 @@ static int acdx; #include "AcdxOpen.c" #include "AcdxCmds.c" +static char git_version[] = "git_version: " GIT_VERSION; /**************************************************************************/ /* Prompt and do commands in a loop */ /**************************************************************************/ @@ -60,6 +61,7 @@ char tmpb[CMD_BUF_SIZE]; pname = argv[0]; printf("%s: Compiled %s %s\n",pname,__DATE__,__TIME__); + printf("%s: %s\n",pname, git_version); acdx = AcdxOpen(); if (acdx == 0) { diff --git a/ctc/test/Makefile b/ctc/test/Makefile index 15a2f50109536fc0312530acfdf3313d218bd91a..9628294b935a5d76c687090e5be55ccb1149735d 100644 --- a/ctc/test/Makefile +++ b/ctc/test/Makefile @@ -4,6 +4,8 @@ include ../../common.mk CFLAGS=-g -Wall CFLAGS += -I../ +CFLAGS += -DGIT_VERSION=\"$(GIT_VERSION)\" + LDLIBS=../libctc.$(CPU).a all: set_clk.$(CPU) set_delay_counter1.$(CPU) set_delay_counter2.$(CPU) set_mode.$(CPU) set_enable.$(CPU) diff --git a/ctc/test/set_clk.c b/ctc/test/set_clk.c index b8c10ee6ca0bc31c2e0d0d456c9b180b72276c42..fcb84ea5d85bd07c286d4e67cb795ac59ed1ff59 100644 --- a/ctc/test/set_clk.c +++ b/ctc/test/set_clk.c @@ -6,6 +6,8 @@ #include <libctc.h> +static char git_version[] = "git_version: " GIT_VERSION; + /* doing two levels of stringification allows us to stringify a macro */ #define my_stringify_l(x...) #x #define my_stringify(x...) my_stringify_l(x) @@ -27,14 +29,15 @@ extern char *optarg; static const char usage_string[] = "Setup clk source on a channel \n" - " " PROGNAME " [-h] [-c<CHAN>] [-m<LUN>] [-s<CLK>]"; + " " PROGNAME " [-h] [-v] [-c<CHAN>] [-m<LUN>] [-s<CLK>]"; static const char commands_string[] = "options:\n" " -c = channel number (default: " my_stringify(CHANNEL_NR) ")\n" " -h = show this help text\n" " -m = Module number (default: " my_stringify(MODULE_NR) ")\n" - " -s = Set source clock (default: " my_stringify(CLK_SRC) ")"; + " -s = Set source clock (default: " my_stringify(CLK_SRC) ")\n" + " -v = version"; static void usage_complete(void) { @@ -42,12 +45,18 @@ static void usage_complete(void) printf("%s\n", commands_string); } +static void print_version(void) +{ + printf("%s\n", git_version); + printf("%s\n", libctc_version_s); +} + static void parse_args(int argc, char *argv[]) { int c; for (;;) { - c = getopt(argc, argv, "c:hm:s:"); + c = getopt(argc, argv, "c:hvm:s:"); if (c < 0) break; switch (c) { @@ -61,6 +70,9 @@ static void parse_args(int argc, char *argv[]) case 'h': usage_complete(); exit(EXIT_SUCCESS); + case 'v': + print_version(); + exit(EXIT_SUCCESS); case 'm': module_nr = atoi(optarg); break; diff --git a/ctc/test/set_delay_counter1.c b/ctc/test/set_delay_counter1.c index a4cce4842b4662c4bc437e2a7c4e2f8718076d8e..e627d815e067c7e9e9762be2ee36e7ba78bef0b2 100644 --- a/ctc/test/set_delay_counter1.c +++ b/ctc/test/set_delay_counter1.c @@ -6,6 +6,8 @@ #include <libctc.h> +static char git_version[] = "git_version: " GIT_VERSION; + /* doing two levels of stringification allows us to stringify a macro */ #define my_stringify_l(x...) #x #define my_stringify(x...) my_stringify_l(x) @@ -27,14 +29,15 @@ extern char *optarg; static const char usage_string[] = "Setup delay counter 1 on a channel \n" - " " PROGNAME " [-h] [-c<CHAN>] [-m<LUN>] [-s<CLK>]"; + " " PROGNAME " [-h] [-v] [-c<CHAN>] [-m<LUN>] [-s<CLK>]"; static const char commands_string[] = "options:\n" " -c = channel number (default: " my_stringify(CHANNEL_NR) ")\n" " -h = show this help text\n" " -m = Module number (default: " my_stringify(MODULE_NR) ")\n" - " -s = Set delay counter 1(default: " my_stringify(DELAY) ")"; + " -s = Set delay counter 1(default: " my_stringify(DELAY) ")\n" + " -v = version"; static void usage_complete(void) { @@ -42,12 +45,18 @@ static void usage_complete(void) printf("%s\n", commands_string); } +static void print_version(void) +{ + printf("%s\n", git_version); + printf("%s\n", libctc_version_s); +} + static void parse_args(int argc, char *argv[]) { int c; for (;;) { - c = getopt(argc, argv, "c:hm:s:"); + c = getopt(argc, argv, "c:hvm:s:"); if (c < 0) break; switch (c) { @@ -61,6 +70,9 @@ static void parse_args(int argc, char *argv[]) case 'h': usage_complete(); exit(EXIT_SUCCESS); + case 'v': + print_version(); + exit(EXIT_SUCCESS); case 'm': module_nr = atoi(optarg); break; diff --git a/ctc/test/set_delay_counter2.c b/ctc/test/set_delay_counter2.c index 62de3f2ea3dddf74f15d97ee31ac688af2c50e4f..763f0f530ff748723ce40bf4d846440de18ff7f9 100644 --- a/ctc/test/set_delay_counter2.c +++ b/ctc/test/set_delay_counter2.c @@ -6,6 +6,8 @@ #include <libctc.h> +static char git_version[] = "git_version: " GIT_VERSION; + /* doing two levels of stringification allows us to stringify a macro */ #define my_stringify_l(x...) #x #define my_stringify(x...) my_stringify_l(x) @@ -27,14 +29,15 @@ extern char *optarg; static const char usage_string[] = "Setup delay counter 2 on a channel \n" - " " PROGNAME " [-h] [-c<CHAN>] [-m<LUN>] [-s<CLK>]"; + " " PROGNAME " [-h] [-v] [-c<CHAN>] [-m<LUN>] [-s<CLK>]"; static const char commands_string[] = "options:\n" " -c = channel number (default: " my_stringify(CHANNEL_NR) ")\n" " -h = show this help text\n" " -m = Module number (default: " my_stringify(MODULE_NR) ")\n" - " -s = Set delay counter 2(default: " my_stringify(DELAY) ")"; + " -s = Set delay counter 2(default: " my_stringify(DELAY) ")\n" + " -v = version"; static void usage_complete(void) { @@ -42,12 +45,18 @@ static void usage_complete(void) printf("%s\n", commands_string); } +static void print_version(void) +{ + printf("%s\n", git_version); + printf("%s\n", libctc_version_s); +} + static void parse_args(int argc, char *argv[]) { int c; for (;;) { - c = getopt(argc, argv, "c:hm:s:"); + c = getopt(argc, argv, "c:hvm:s:"); if (c < 0) break; switch (c) { @@ -61,6 +70,9 @@ static void parse_args(int argc, char *argv[]) case 'h': usage_complete(); exit(EXIT_SUCCESS); + case 'v': + print_version(); + exit(EXIT_SUCCESS); case 'm': module_nr = atoi(optarg); break; diff --git a/ctc/test/set_enable.c b/ctc/test/set_enable.c index b7d6978b86f610dac365857c6a016595b3426d00..b72a9e72cf07ccdd23fd9b14963a8c59f3c955af 100644 --- a/ctc/test/set_enable.c +++ b/ctc/test/set_enable.c @@ -6,6 +6,8 @@ #include <libctc.h> +static char git_version[] = "git_version: " GIT_VERSION; + /* doing two levels of stringification allows us to stringify a macro */ #define my_stringify_l(x...) #x #define my_stringify(x...) my_stringify_l(x) @@ -25,13 +27,14 @@ extern char *optarg; static const char usage_string[] = "Setup status on a channel \n" - " " PROGNAME " [-h] [-c<CHAN>] [-m<LUN>] [-s<CLK>]"; + " " PROGNAME " [-h] [-v] [-c<CHAN>] [-m<LUN>] [-s<CLK>]"; static const char commands_string[] = "options:\n" " -c = channel number (default: " my_stringify(CHANNEL_NR) ")\n" " -h = show this help text\n" - " -m = Module number (default: " my_stringify(MODULE_NR) ")"; + " -m = Module number (default: " my_stringify(MODULE_NR) ")\n" + " -v = version"; static void usage_complete(void) { @@ -39,12 +42,18 @@ static void usage_complete(void) printf("%s\n", commands_string); } +static void print_version(void) +{ + printf("%s\n", git_version); + printf("%s\n", libctc_version_s); +} + static void parse_args(int argc, char *argv[]) { int c; for (;;) { - c = getopt(argc, argv, "c:hm:"); + c = getopt(argc, argv, "c:hvm:"); if (c < 0) break; switch (c) { @@ -58,6 +67,10 @@ static void parse_args(int argc, char *argv[]) case 'h': usage_complete(); exit(EXIT_SUCCESS); + case 'v': + print_version(); + exit(EXIT_SUCCESS); + case 'm': module_nr = atoi(optarg); break; diff --git a/ctc/test/set_mode.c b/ctc/test/set_mode.c index 92c4b29a97665e5e47e852fc8370f5d088414a3b..7e155cbe770d3fdb8ca30f92d44d9cedba6ccf39 100644 --- a/ctc/test/set_mode.c +++ b/ctc/test/set_mode.c @@ -6,6 +6,8 @@ #include <libctc.h> +static char git_version[] = "git_version: " GIT_VERSION; + /* doing two levels of stringification allows us to stringify a macro */ #define my_stringify_l(x...) #x #define my_stringify(x...) my_stringify_l(x) @@ -30,7 +32,7 @@ extern char *optarg; static const char usage_string[] = "Setup mode on a channel \n" - " " PROGNAME " [-h] [-c<CHAN>] [-m<LUN>] [-s<MODE>] [-d<DIR>"; + " " PROGNAME " [-h] [-v] [-c<CHAN>] [-m<LUN>] [-s<MODE>] [-d<DIR>"; static const char commands_string[] = "options:\n" @@ -38,7 +40,8 @@ static const char commands_string[] = " -h = show this help text\n" " -m = Module number (default: " my_stringify(MODULE_NR) ")\n" " -s = Set mode (default: " my_stringify(MODE) ")\n" - " -d = Set direction (default: " my_stringify(DIRECTION) ")"; + " -d = Set direction (default: " my_stringify(DIRECTION) ")\n" + " -v = version"; static void usage_complete(void) { @@ -46,12 +49,18 @@ static void usage_complete(void) printf("%s\n", commands_string); } +static void print_version(void) +{ + printf("%s\n", git_version); + printf("%s\n", libctc_version_s); +} + static void parse_args(int argc, char *argv[]) { int c; for (;;) { - c = getopt(argc, argv, "c:hm:s:d:"); + c = getopt(argc, argv, "c:hvm:s:d:"); if (c < 0) break; switch (c) { @@ -65,6 +74,9 @@ static void parse_args(int argc, char *argv[]) case 'h': usage_complete(); exit(EXIT_SUCCESS); + case 'v': + print_version(); + exit(EXIT_SUCCESS); case 'm': module_nr = atoi(optarg); break; diff --git a/ctr-2.0 b/ctr-2.0 index 7148a2cd34b1f22bb68291246e56bcd8e12eee2a..943ec3beb7059338a8fac47f55e54aa3c0e0e52a 160000 --- a/ctr-2.0 +++ b/ctr-2.0 @@ -1 +1 @@ -Subproject commit 7148a2cd34b1f22bb68291246e56bcd8e12eee2a +Subproject commit 943ec3beb7059338a8fac47f55e54aa3c0e0e52a diff --git a/cvorb/test/cvorbtest.c b/cvorb/test/cvorbtest.c index 81b86ee2cca0c6fdf8a6d18f9f5acdfe913ff940..653c58b2939a5b7c051ef084efde2296ab0a85d8 100644 --- a/cvorb/test/cvorbtest.c +++ b/cvorb/test/cvorbtest.c @@ -29,6 +29,8 @@ #include "time_stamp_counter.h" #endif +static char git_version[] = "git_version: " GIT_VERSION; + /* mandatory external global variables */ int use_builtin_cmds = 0; char xmlfile[128] = "cvorb.xml"; @@ -1126,6 +1128,11 @@ int h_load_and_play(struct cmd_desc *cmdd, struct atom *atoms) int main(int argc, char *argv[], char *envp[]) { + char *pname; + pname = argv[0]; + printf("%s: Compiled %s %s\n", pname,__DATE__,__TIME__); + printf("%s: %s\n", pname, git_version); + printf("%s\n", libvd80_version_s); #if __CVORB_DEBUG__ ts_calibrateCountPeriod(50, 10); #endif diff --git a/cvorg/test/Makefile b/cvorg/test/Makefile index 0f36ff122c409e4da50ceacdd6cf32b1c9cc1698..d548cbc0a86da8e5176203bc672d0c7f8628b833 100644 --- a/cvorg/test/Makefile +++ b/cvorg/test/Makefile @@ -8,6 +8,7 @@ CFLAGS+= -Iextest/ \ -I../lib \ -I../include/ \ -I../../include/ +CFLAGS += -DGIT_VERSION=\"$(GIT_VERSION)\" LOADLIBES := -L../lib/ -L../ad9516 LDLIBS=-lcvorg.$(CPU) -lreadline -lad9516.$(CPU) -lrt -lm diff --git a/cvorg/test/cvorgtest.c b/cvorg/test/cvorgtest.c index 393f870b96a0f581853952f6f343ef2b67a6d2ba..419fecb3e0de1e603e236450a34b7cefc2df57cb 100644 --- a/cvorg/test/cvorgtest.c +++ b/cvorg/test/cvorgtest.c @@ -23,6 +23,8 @@ #include "libinternal.h" #include "libad9516.h" +static char git_version[] = "git_version: " GIT_VERSION; + /* this compilation flag enables printing the test waveform before it's sent */ /* #define DEBUG_CVORG_WVSHAPES */ @@ -1455,6 +1457,12 @@ int h_hw_version(struct cmd_desc *cmdd, struct atom *atoms) return 1; } +void print_version(void) +{ + printf("%s\n", git_version); + printf("%s\n", libcvorg_version_s); +} + int main(int argc, char *argv[], char *envp[]) { diff --git a/cvorg/test/extest/extest.c b/cvorg/test/extest/extest.c index eed2216f4512ff4f2d4b54826118daa8d303fde8..b3f10f40ab7beb4f9d8e398c7c95d33037e84db2 100644 --- a/cvorg/test/extest/extest.c +++ b/cvorg/test/extest/extest.c @@ -726,6 +726,8 @@ static void usage_error() printf("Try '%s -h' for more information.\n", __progname); } +extern void print_version(void); + static void usage() { usage_short(); @@ -734,6 +736,7 @@ static void usage() " (default: '" DRIVER_NAME "')\n"); printf( " -h display this help message\n\n"); printf( "[ %s: Compiled on %s %s ]\n\n", __progname, __DATE__, __TIME__); + print_version(); } /** diff --git a/fmc/fine-delay-sw b/fmc/fine-delay-sw index b028731f07d87d62ed850d869326d3eee52c9bb3..f76a08be59896dd8b1ab8c79f872d2eb474d97e9 160000 --- a/fmc/fine-delay-sw +++ b/fmc/fine-delay-sw @@ -1 +1 @@ -Subproject commit b028731f07d87d62ed850d869326d3eee52c9bb3 +Subproject commit f76a08be59896dd8b1ab8c79f872d2eb474d97e9 diff --git a/fmc/fmc-adc-100m14b4cha-sw b/fmc/fmc-adc-100m14b4cha-sw index 52a78da9926b45a9394a9347348181c20aa60501..f2569509b686b10c9a8bb14682c3118ebd7e243e 160000 --- a/fmc/fmc-adc-100m14b4cha-sw +++ b/fmc/fmc-adc-100m14b4cha-sw @@ -1 +1 @@ -Subproject commit 52a78da9926b45a9394a9347348181c20aa60501 +Subproject commit f2569509b686b10c9a8bb14682c3118ebd7e243e diff --git a/fmc/fmc-bus b/fmc/fmc-bus index 73b49de18933517783098f860aaab1ab12a0e33b..acb6fd69c5b88ac3ad4face89a9feed415ba9c19 160000 --- a/fmc/fmc-bus +++ b/fmc/fmc-bus @@ -1 +1 @@ -Subproject commit 73b49de18933517783098f860aaab1ab12a0e33b +Subproject commit acb6fd69c5b88ac3ad4face89a9feed415ba9c19 diff --git a/fmc/fmc-tdc-sw b/fmc/fmc-tdc-sw index 11054181e1c2f1a982b8463f1f414e8968c2b64b..364e8a67e8a8b90f5566b2a6f2fd8ab454d2e4b0 160000 --- a/fmc/fmc-tdc-sw +++ b/fmc/fmc-tdc-sw @@ -1 +1 @@ -Subproject commit 11054181e1c2f1a982b8463f1f414e8968c2b64b +Subproject commit 364e8a67e8a8b90f5566b2a6f2fd8ab454d2e4b0 diff --git a/fmc/obsbox b/fmc/obsbox index 465a0243171a723ce30be80c3dc5016028fbdf47..2d49db5ca1397bc020de071116a0d5080f6f580c 160000 --- a/fmc/obsbox +++ b/fmc/obsbox @@ -1 +1 @@ -Subproject commit 465a0243171a723ce30be80c3dc5016028fbdf47 +Subproject commit 2d49db5ca1397bc020de071116a0d5080f6f580c diff --git a/fmc/spec-sw b/fmc/spec-sw index bc0e12b9badfacc34fa55cf9f11ebfcb0aaa74d3..08b08c1b725921cf0ba7551b45313d3ad2bec8c0 160000 --- a/fmc/spec-sw +++ b/fmc/spec-sw @@ -1 +1 @@ -Subproject commit bc0e12b9badfacc34fa55cf9f11ebfcb0aaa74d3 +Subproject commit 08b08c1b725921cf0ba7551b45313d3ad2bec8c0 diff --git a/fmc/svec-sw b/fmc/svec-sw index 1cab8ad3f21c380b36c7c0c848124ee01fc44e93..33c6880c5056527d2d54fcf67be42fa5a2877426 160000 --- a/fmc/svec-sw +++ b/fmc/svec-sw @@ -1 +1 @@ -Subproject commit 1cab8ad3f21c380b36c7c0c848124ee01fc44e93 +Subproject commit 33c6880c5056527d2d54fcf67be42fa5a2877426 diff --git a/fmc/zio b/fmc/zio index 07da04701a0abf22c36730db38fe294c9f579be7..0aea6955d010ac9f4e5983cad36bdfa438b63888 160000 --- a/fmc/zio +++ b/fmc/zio @@ -1 +1 @@ -Subproject commit 07da04701a0abf22c36730db38fe294c9f579be7 +Subproject commit 0aea6955d010ac9f4e5983cad36bdfa438b63888 diff --git a/icv196/test/Makefile b/icv196/test/Makefile index d7312abf9c5ce25963596554a5a5e66dc2e9a632..701989a8e7eefdf57a9562fc25a5c7004c310bd1 100644 --- a/icv196/test/Makefile +++ b/icv196/test/Makefile @@ -7,6 +7,7 @@ DRIVER:=../driver ICV196LB:=../lib CFLAGS = -g -Wall -I$(ICV196LB) -I$(DRIVER) -DCOMPILE_TIME=$(COMPILE_TIME) +CFLAGS += -DGIT_VERSION=\"$(GIT_VERSION)\" LDLIBS = $(ICV196LB)/libicv196.$(CPU).a diff --git a/icv196/test/icv196test.c b/icv196/test/icv196test.c index edfc438b27dd59f5e8e9b25445ad458859014791..ffcc8d9ce0e4289de66af4afb6ed339a45d334b0 100644 --- a/icv196/test/icv196test.c +++ b/icv196/test/icv196test.c @@ -23,6 +23,8 @@ #define HISTORIES 24 #define CMD_BUF_SIZE 128 +static char git_version[] = "git_version: " GIT_VERSION; + static char history[HISTORIES][CMD_BUF_SIZE]; static char *cmdbuf = &(history[0][0]); static int cmdindx = 0; @@ -49,6 +51,8 @@ int main(int argc,char *argv[]) pname = argv[0]; printf("%s: Compiled %s %s\n",pname,__DATE__,__TIME__); + printf("%s: %s\n", pname, git_version); + printf("%s\n", libicv196_version_s); if (argc > 1) dev = strtoul(argv[1],&cp,0); diff --git a/jtag/Makefile b/jtag/Makefile index 17d1afed1459dfeac01e62070d106d394f008a45..9872ba1a8136d50a1f5e0f37a1634064cca68662 100644 --- a/jtag/Makefile +++ b/jtag/Makefile @@ -2,6 +2,7 @@ include ../common.mk CFLAGS = -g -I../vmebridge/include +CFLAGS += -DGIT_VERSION=\"$(GIT_VERSION)\" LDLIBS = -lvmebus.$(CPU) LDFLAGS = -L../vmebridge/lib ALL = jtag.$(CPU) diff --git a/jtag/jtag.c b/jtag/jtag.c index af6381a62a49a55f681a70329440f6fc3f57fd54..eea7a345a6c363e71f484069d448e530834331f7 100644 --- a/jtag/jtag.c +++ b/jtag/jtag.c @@ -8,11 +8,14 @@ #include <stdlib.h> #include <string.h> #include <sys/file.h> +#include <libvmebus.h> #include "lenval.h" #include "micro.h" #include "ports.h" +static char git_version[] = "git_version: " GIT_VERSION; + void setPort(short p,short val); void readByte(unsigned char *data); unsigned char readTDOBit(); @@ -38,6 +41,8 @@ int cc; printf("Examples:\n"); printf(" nouchi.xsvf 0x1000\n"); printf(" nouchi.xsvf 0x1000 4\n"); + printf("\n%s\n", git_version); + printf("%s\n", libvmebus_version_s); exit(0); } diff --git a/mil1553 b/mil1553 index faa6557efa4e076ccf4446dff96784138f54caaa..8f0db2e2b80f77490ef98e64c9d1f77066fe32d9 160000 --- a/mil1553 +++ b/mil1553 @@ -1 +1 @@ -Subproject commit faa6557efa4e076ccf4446dff96784138f54caaa +Subproject commit 8f0db2e2b80f77490ef98e64c9d1f77066fe32d9 diff --git a/msatt/test/Makefile b/msatt/test/Makefile index 904ab36430caa5c21f10b67339654bd3263d939e..5a97c017414c943c143f6ccbd71eb6a0dee0385a 100644 --- a/msatt/test/Makefile +++ b/msatt/test/Makefile @@ -3,6 +3,7 @@ include ../../common.mk CFLAGS=-g -Wall CFLAGS+=-I../lib -I../driver +CFLAGS += -DGIT_VERSION=\"$(GIT_VERSION)\" LDFLAGS += -L../lib LDLIBS += -lmsatt.$(CPU) diff --git a/msatt/test/msattntst.c b/msatt/test/msattntst.c index ec66c44a1f89a7f4685db245ef6cb3b6690854cc..1b3358ade1994ce35603b2173bdee4d168741691 100644 --- a/msatt/test/msattntst.c +++ b/msatt/test/msattntst.c @@ -14,6 +14,8 @@ #include "msatt.h" #include "libmsatt.h" +static char git_version[] = "git_version: " GIT_VERSION; + int device; int selected_channel; int relay_register; @@ -115,6 +117,12 @@ void change_channel () } } +static void print_version(char *pname) +{ + printf("%s %s\n", pname, git_version); + printf("%s\n", libmsatt_version_s); +} + int main (int argc, char *argv[]) { int fd; @@ -122,21 +130,26 @@ int main (int argc, char *argv[]) selected_channel = 1; - if (argc == 2) - { - device = atoi(argv[1]); - } - else + if (argc != 2) { printf("Insufficient number of arguments\n"); printf("\nPlease use: %s <lun_of_the_device>\n", argv[0]); + printf("or: %s -v for version info\n", argv[0]); exit(-1); - } + } + if(!strcmp("-v", argv[1])) { + print_version(argv[0]); + exit(0); + } + else + { + device = atoi(argv[1]); + } if ((fd = msatt_open(device)) < 0) { perror ("open failed\n"); return -1; - } + } /* Check for channel count*/ num_channels = msatt_get_nchannels(fd); diff --git a/mtt b/mtt index 02a5b02c3f8b1417bbc9e8aa4ebf3f787eb8d026..e879c3a9c25f51d1b9b3c1fb45559b6150c8b63d 160000 --- a/mtt +++ b/mtt @@ -1 +1 @@ -Subproject commit 02a5b02c3f8b1417bbc9e8aa4ebf3f787eb8d026 +Subproject commit e879c3a9c25f51d1b9b3c1fb45559b6150c8b63d diff --git a/pciioconfig/test/Makefile b/pciioconfig/test/Makefile index 3158d99aa7675e030323a28c172f4d8b3cb6a914..166e94c6b863ff1056a63e00b8630347747283b2 100644 --- a/pciioconfig/test/Makefile +++ b/pciioconfig/test/Makefile @@ -4,6 +4,7 @@ include ../../common.mk # Flags to compile test program and lib CFLAGS=-Wall -g CFLAGS+=-I../lib +CFLAGS += -DGIT_VERSION=\"$(GIT_VERSION)\" LDFLAGS+=-L../lib LDLIBS+=-lpciioconfig.$(CPU) diff --git a/pciioconfig/test/test_pciioconfig.c b/pciioconfig/test/test_pciioconfig.c index 46ebd91ff8057b695866d10cecda091a2ed1c39c..9ebcd8ae0f3174accf56df3efddd71fd829935f3 100644 --- a/pciioconfig/test/test_pciioconfig.c +++ b/pciioconfig/test/test_pciioconfig.c @@ -1,13 +1,18 @@ #include <stdio.h> #include "crateconfig.h" +static char git_version[] = "git_version: " GIT_VERSION; + int main(int argc, char *argv[]) { int slot; int bus; int device; int rc; - + + printf("%s: %s\n", argv[0], git_version); + printf("%s\n", libpciioconfig_version_s); + printf("\n"); printf("Testing slot -> bus-device\n"); for(slot = 1; slot <= CPCI_CRATE_MAX_SLOT; slot++) { diff --git a/pickeringmux/test/test_driver.c b/pickeringmux/test/test_driver.c index f8693d0166ec895043e876bfdb0153e4db1ae278..e6cb63599c38a562ccb4f6521aac00c3a06f4476 100644 --- a/pickeringmux/test/test_driver.c +++ b/pickeringmux/test/test_driver.c @@ -1,6 +1,3 @@ - -static __attribute__((unused)) char test_version[] = "version: " GIT_VERSION; - #include <unistd.h> #include <stdlib.h> #include <stdio.h> @@ -11,7 +8,9 @@ static __attribute__((unused)) char test_version[] = "version: " GIT_VERSION; #include <fcntl.h> #include <time.h> #include "pickeringmuxdrv.h" -#include "pciioconfig/crateconfig.h" +#include "crateconfig.h" + +static char git_version[] = "git_version: " GIT_VERSION; static void printUsage(char *basename); static void printStatus(int *status, int size); @@ -27,6 +26,11 @@ static int resetMode; static int closeMode; static int openMode; +static void print_version(void) +{ + printf("%s\n", git_version); + printf("%s\n", libpciioconfig_version_s); +} int main(int argc, char *argv[]) { @@ -48,7 +52,13 @@ int main(int argc, char *argv[]) printUsage(argv[0]); exit(0); } - + /* print version */ + if(!strcmp(argv[1], "-v")) + { + print_version(); + exit(0); + } + rc = sscanf(argv[1], "%d\n", &slot); if(rc != 1) /* We should decode just one character */ { @@ -353,6 +363,7 @@ static void printUsage(char *basename) printf("the -c <input> <output> option closes the <input> on <output>\n"); printf("the -o <output> option opens the <output>\n"); printf("the -a <ch> <attn> option sets the <attn> attenuation on channel <ch>\n"); + printf("the -v version info\n"); } /****************************************************************************** diff --git a/rawio/Makefile b/rawio/Makefile index 867cfd17058269de915f764e7c7f27915dbfea84..5227bf6bb6200ac36809b2d05684a7bd8bfbe1a5 100644 --- a/rawio/Makefile +++ b/rawio/Makefile @@ -2,6 +2,8 @@ include ../common.mk CFLAGS+=-I../vmebridge/include +CFLAGS += -DGIT_VERSION=\"$(GIT_VERSION)\" + all: vmeio.$(CPU) clean: diff --git a/rawio/vmeio.c b/rawio/vmeio.c index 3c69f395df29f4e0ff93780f20051af46c1d06f5..9be39b996048e79dac681ee4dff441828a77fd5b 100644 --- a/rawio/vmeio.c +++ b/rawio/vmeio.c @@ -26,6 +26,8 @@ #include <sys/stat.h> #include <vmebus.h> +static char git_version[] = "git_version: " GIT_VERSION; + /* error handling */ #define TSI148_LCSR_DSTA_VBE (1<<28) /* Error */ #define TSI148_LCSR_DSTA_ABT (1<<27) /* Abort */ @@ -474,9 +476,17 @@ int main(int argc, char *argv[], char *envp[]) exit(1); } + if (argc<2) { + printf("Not enough parameters\n"); + exit(EXIT_FAILURE); + } sscanf(argv[1], "%c", &op); + if (op=='-') { + sscanf(argv[1]+1, "%c", &op); + } + switch (op) { case 'r': do_read(argc, argv, envp); @@ -484,8 +494,16 @@ int main(int argc, char *argv[], char *envp[]) case 'w': do_write(argc, argv, envp); break; + case 'v': + printf("%s\n", git_version); + exit(EXIT_SUCCESS); default: printf("Wrong optype (%c)\n", op); + case 'h': + printf("Use:\n", op); + printf(" r - read\n", op); + printf(" w - write\n", op); + printf(" v - version\n", op); exit(EXIT_FAILURE); } diff --git a/sis33/lib/examples/Makefile b/sis33/lib/examples/Makefile index 399190799ba70fe8beacc7be0671d97940b114fa..dfefabaf711434e19afa1aceed1e0e8b630b9f4e 100644 --- a/sis33/lib/examples/Makefile +++ b/sis33/lib/examples/Makefile @@ -22,6 +22,7 @@ SRCS := \ INCDIR := ../../include LDFLAGS := -lm CFLAGS := -Wall -D_GNU_SOURCE -g -I$(INCDIR) +CFLAGS += -DGIT_VERSION=\"$(GIT_VERSION)\" HLIBSIS33 := $(INCDIR)/libsis33.h LIBSIS33 := ../libsis33.$(CPU).a MYSTR := my_stringify.h diff --git a/sis33/lib/examples/acquire.c b/sis33/lib/examples/acquire.c index e022d83ee9019983425499b44a05c5c5d231dd95..5511b9c1eb1d81bd5849f7fc16933b7884c75650 100644 --- a/sis33/lib/examples/acquire.c +++ b/sis33/lib/examples/acquire.c @@ -9,9 +9,11 @@ #include <stdio.h> #include <inttypes.h> -#include <libsis33.h> +#include "libsis33.h" #include "my_stringify.h" +static char git_version[] = "git_version: " GIT_VERSION; + #define MODULE_NR 0 #define SEGMENT_NR 0 #define CHANNEL_NR 0 @@ -33,7 +35,7 @@ extern char *optarg; static const char usage_string[] = "Sample from two sis33 segments\n" - " " PROGNAME "[-a] [-c<CHANNEL>] [-e<EVENTS>] [-f] [-h] [-l<LENGTH>] [-m<LUN>] [-n] [-s<SEGMENT>] [-t]"; + " " PROGNAME "[-a] [-c<CHANNEL>] [-e<EVENTS>] [-f] [-h] [-v] [-l<LENGTH>] [-m<LUN>] [-n] [-s<SEGMENT>] [-t]"; static const char commands_string[] = "options:\n" @@ -47,7 +49,8 @@ static const char commands_string[] = " -m = Module. Default: " my_stringify(MODULE_NR) "\n" " -n = No wait\n" " -s = segment. Default: " my_stringify(SEGMENT_NR) "\n" - " -t = Fetch and only print timestamps (if supported)"; + " -t = Fetch and only print timestamps (if supported)\n" + " -v = version"; static void usage_complete(void) { @@ -55,12 +58,18 @@ static void usage_complete(void) printf("%s\n", commands_string); } +static void print_version(void) +{ + printf("%s\n", git_version); + printf("%s\n", libsis33_version_s); +} + static void parse_args(int argc, char *argv[]) { int c; for (;;) { - c = getopt(argc, argv, "ac:e:fhl:m:ns:t"); + c = getopt(argc, argv, "ac:e:fhvl:m:ns:t"); if (c < 0) break; switch (c) { @@ -81,6 +90,9 @@ static void parse_args(int argc, char *argv[]) case 'h': usage_complete(); exit(EXIT_SUCCESS); + case 'v': + print_version(); + exit(EXIT_SUCCESS); case 'l': ev_length = strtoul(optarg, NULL, 0); break; diff --git a/sis33/lib/examples/available_event_lengths.c b/sis33/lib/examples/available_event_lengths.c index bdba7da8f7f0bbac7740a4d19e8a52dbca5255da..53aa70d055562062358f220673ff7799bfaed25b 100644 --- a/sis33/lib/examples/available_event_lengths.c +++ b/sis33/lib/examples/available_event_lengths.c @@ -8,9 +8,11 @@ #include <stdlib.h> #include <unistd.h> -#include <libsis33.h> +#include "libsis33.h" #include "my_stringify.h" +static char git_version[] = "git_version: " GIT_VERSION; + /* default module number (LUN) */ #define MODULE_NR 0 @@ -22,13 +24,14 @@ extern char *optarg; static const char usage_string[] = "Show the available event lengths of an sis33 device\n" - " " PROGNAME " [-h] [-m<LUN>]"; + " " PROGNAME " [-h] [-v] [-m<LUN>]"; static const char commands_string[] = "options:\n" " -h = show this help text\n" " -m = Module number (default: " my_stringify(MODULE_NR) ")\n" - " -r = show raw values (all values in bytes)"; + " -r = show raw values (all values in bytes)\n" + " -v = version"; static void usage_complete(void) { @@ -36,18 +39,27 @@ static void usage_complete(void) printf("%s\n", commands_string); } +static void print_version(void) +{ + printf("%s\n", git_version); + printf("%s\n", libsis33_version_s); +} + static void parse_args(int argc, char *argv[]) { int c; for (;;) { - c = getopt(argc, argv, "hm:r"); + c = getopt(argc, argv, "hvm:r"); if (c < 0) break; switch (c) { case 'h': usage_complete(); exit(EXIT_SUCCESS); + case 'v': + print_version(); + exit(EXIT_SUCCESS); case 'm': module_nr = strtol(optarg, NULL, 0); break; diff --git a/sis33/lib/examples/available_freqs.c b/sis33/lib/examples/available_freqs.c index c4dfd5ab1b2ef7d60bc14134faaf1e010ab5a974..06899502b5ad4a81f1fe3c73eaf2ba011dd57ef0 100644 --- a/sis33/lib/examples/available_freqs.c +++ b/sis33/lib/examples/available_freqs.c @@ -8,9 +8,11 @@ #include <stdlib.h> #include <unistd.h> -#include <libsis33.h> +#include "libsis33.h" #include "my_stringify.h" +static char git_version[] = "git_version: " GIT_VERSION; + /* default module number (LUN) */ #define MODULE_NR 0 @@ -21,12 +23,13 @@ extern char *optarg; static const char usage_string[] = "Show the available sampling frequencies of an sis33 device\n" - " " PROGNAME " [-h] [-m<LUN>]"; + " " PROGNAME " [-h] [-v] [-m<LUN>]"; static const char commands_string[] = "options:\n" " -h = show this help text\n" - " -m = Module number (default: " my_stringify(MODULE_NR) ")"; + " -m = Module number (default: " my_stringify(MODULE_NR) ")\n" + " -v = version"; static void usage_complete(void) { @@ -34,18 +37,27 @@ static void usage_complete(void) printf("%s\n", commands_string); } +static void print_version(void) +{ + printf("%s\n", git_version); + printf("%s\n", libsis33_version_s); +} + static void parse_args(int argc, char *argv[]) { int c; for (;;) { - c = getopt(argc, argv, "hm:"); + c = getopt(argc, argv, "hvm:"); if (c < 0) break; switch (c) { case 'h': usage_complete(); exit(EXIT_SUCCESS); + case 'v': + print_version(); + exit(EXIT_SUCCESS); case 'm': module_nr = strtol(optarg, NULL, 0); break; diff --git a/sis33/lib/examples/clock.c b/sis33/lib/examples/clock.c index ff3f4f3b672186ea3c07d7fc97930374817f0f57..e736df99d31d751ab66b55811d4cc5308f2c1554 100644 --- a/sis33/lib/examples/clock.c +++ b/sis33/lib/examples/clock.c @@ -9,9 +9,11 @@ #include <unistd.h> #include <stdio.h> -#include <libsis33.h> +#include "libsis33.h" #include "my_stringify.h" +static char git_version[] = "git_version: " GIT_VERSION; + /* default module number (LUN) */ #define MODULE_NR 0 @@ -24,14 +26,15 @@ extern char *optarg; static const char usage_string[] = "Operate on the clock configuration of an sis33 device\n" - " " PROGNAME " [-f<MHz>] [-h] [-m<LUN>]"; + " " PROGNAME " [-f<MHz>] [-h] [-v] [-m<LUN>]"; static const char commands_string[] = "options:\n" " -f = Frequency (MHz)\n" " -h = show this help text\n" " -m = Module number (default: " my_stringify(MODULE_NR) ")\n" - " -s = Source: \"internal\" or \"external\""; + " -s = Source: \"internal\" or \"external\"\n" + " -v = version"; static void usage_complete(void) { @@ -39,13 +42,19 @@ static void usage_complete(void) printf("%s\n", commands_string); } +static void print_version(void) +{ + printf("%s\n", git_version); + printf("%s\n", libsis33_version_s); +} + static void parse_args(int argc, char *argv[]) { float freq; int c; for (;;) { - c = getopt(argc, argv, "f:hm:s:"); + c = getopt(argc, argv, "f:hvm:s:"); if (c < 0) break; switch (c) { @@ -59,6 +68,9 @@ static void parse_args(int argc, char *argv[]) case 'h': usage_complete(); exit(EXIT_SUCCESS); + case 'v': + print_version(); + exit(EXIT_SUCCESS); case 'm': module_nr = strtol(optarg, NULL, 0); break; diff --git a/sis33/lib/examples/event_timestamping.c b/sis33/lib/examples/event_timestamping.c index 006c7cbf265358030d63f8cc906569bc9501d3d8..5783074686e6de2083672eff975fb7cc1ab2699b 100644 --- a/sis33/lib/examples/event_timestamping.c +++ b/sis33/lib/examples/event_timestamping.c @@ -9,9 +9,11 @@ #include <unistd.h> #include <stdio.h> -#include <libsis33.h> +#include "libsis33.h" #include "my_stringify.h" +static char git_version[] = "git_version: " GIT_VERSION; + /* default module number (LUN) */ #define MODULE_NR 0 @@ -24,13 +26,14 @@ extern char *optarg; static const char usage_string[] = "Operate on the event timestamping configuration of an sis33 device\n" - " " PROGNAME " [-d<DIVIDER>] [-h] [-m<LUN>]"; + " " PROGNAME " [-d<DIVIDER>] [-h] [-v] [-m<LUN>]"; static const char commands_string[] = "options:\n" " -d = Set event timestamping divider\n" " -h = show this help text\n" - " -m = Module number (default: " my_stringify(MODULE_NR) ")"; + " -m = Module number (default: " my_stringify(MODULE_NR) ")\n" + " -v = version"; static void usage_complete(void) { @@ -38,12 +41,18 @@ static void usage_complete(void) printf("%s\n", commands_string); } +static void print_version(void) +{ + printf("%s\n", git_version); + printf("%s\n", libsis33_version_s); +} + static void parse_args(int argc, char *argv[]) { int c; for (;;) { - c = getopt(argc, argv, "d:hm:"); + c = getopt(argc, argv, "d:hvm:"); if (c < 0) break; switch (c) { @@ -54,6 +63,9 @@ static void parse_args(int argc, char *argv[]) case 'h': usage_complete(); exit(EXIT_SUCCESS); + case 'v': + print_version(); + exit(EXIT_SUCCESS); case 'm': module_nr = strtol(optarg, NULL, 0); break; diff --git a/sis33/lib/examples/fourier1.c b/sis33/lib/examples/fourier1.c index 67f12e4ffd75571e1278e4ba9037f135770da74a..0ed13a5478b61d6d03f836f82a90a366ac9235a8 100644 --- a/sis33/lib/examples/fourier1.c +++ b/sis33/lib/examples/fourier1.c @@ -18,6 +18,8 @@ #include <stdio.h> #include <math.h> +static char git_version[] = "git_version: " GIT_VERSION; + #define PROGNAME "fourier1" static double origfreq; @@ -27,14 +29,15 @@ static float *buf; static const char usage_string[] = "Calculate the first pair of Fourier Coefficients of an acquisition data set\n" - " " PROGNAME " [-f<file>] [-h] [-o<ORIGFREQ>] [-s<SAMPFREQ>]"; + " " PROGNAME " [-f<file>] [-h][-v] [-o<ORIGFREQ>] [-s<SAMPFREQ>]"; static const char commands_string[] = "options:\n" " -f = path to acquisition data file (default: stdin)\n" " -h = show this help text\n" " -o = Original waveform's frequency (MHz)\n" - " -s = Sampling frequency (MHz)"; + " -s = Sampling frequency (MHz)\n" + " -v = version"; static void usage_complete(void) { @@ -42,12 +45,17 @@ static void usage_complete(void) printf("%s\n", commands_string); } +static void print_version(void) +{ + printf("%s\n", git_version); +} + static void parse_args(int argc, char *argv[]) { int c; for (;;) { - c = getopt(argc, argv, "f:ho:s:"); + c = getopt(argc, argv, "f:hvo:s:"); if (c < 0) break; switch (c) { @@ -58,6 +66,9 @@ static void parse_args(int argc, char *argv[]) case 'h': usage_complete(); exit(EXIT_SUCCESS); + case 'v': + print_version(); + exit(EXIT_SUCCESS); case 'o': origfreq = strtod(optarg, NULL); origfreq *= 1000000; /* convert to Hz */ diff --git a/sis33/lib/examples/n_bits.c b/sis33/lib/examples/n_bits.c index 4db3a9b0a0d54be9d3acb0b1a73508e5b7ae6847..74a6f773b0635c57e53b254b4e15132b77352d77 100644 --- a/sis33/lib/examples/n_bits.c +++ b/sis33/lib/examples/n_bits.c @@ -8,9 +8,11 @@ #include <stdlib.h> #include <unistd.h> -#include <libsis33.h> +#include "libsis33.h" #include "my_stringify.h" +static char git_version[] = "git_version: " GIT_VERSION; + /* default module number (LUN) */ #define MODULE_NR 0 @@ -21,12 +23,13 @@ extern char *optarg; static const char usage_string[] = "Show the number of bits of a device\n" - " " PROGNAME " [-h] [-m<LUN>]"; + " " PROGNAME " [-h] [-v] [-m<LUN>]"; static const char commands_string[] = "options:\n" " -h = show this help text\n" - " -m = Module number (default: " my_stringify(MODULE_NR) ")"; + " -m = Module number (default: " my_stringify(MODULE_NR) ")\n" + " -v = version"; static void usage_complete(void) { @@ -34,18 +37,27 @@ static void usage_complete(void) printf("%s\n", commands_string); } +static void print_version(void) +{ + printf("%s\n", git_version); + printf("%s\n", libsis33_version_s); +} + static void parse_args(int argc, char *argv[]) { int c; for (;;) { - c = getopt(argc, argv, "hm:"); + c = getopt(argc, argv, "hvm:"); if (c < 0) break; switch (c) { case 'h': usage_complete(); exit(EXIT_SUCCESS); + case 'v': + print_version(); + exit(EXIT_SUCCESS); case 'm': module_nr = strtol(optarg, NULL, 0); break; diff --git a/sis33/lib/examples/n_events_max.c b/sis33/lib/examples/n_events_max.c index 612b124a2b0d757ded2476cc1bc85e0e5fb44ca1..6c7530fc5eb08f990e5bd3dcf58340dc3d7e4c44 100644 --- a/sis33/lib/examples/n_events_max.c +++ b/sis33/lib/examples/n_events_max.c @@ -8,9 +8,11 @@ #include <stdlib.h> #include <unistd.h> -#include <libsis33.h> +#include "libsis33.h" #include "my_stringify.h" +static char git_version[] = "git_version: " GIT_VERSION; + /* default module number (LUN) */ #define MODULE_NR 0 @@ -21,7 +23,7 @@ extern char *optarg; static const char usage_string[] = "Show the number of events of a device\n" - " " PROGNAME " [-h] [-m<LUN>]"; + " " PROGNAME " [-h] [-h] [-m<LUN>]"; static const char commands_string[] = "options:\n" @@ -34,18 +36,27 @@ static void usage_complete(void) printf("%s\n", commands_string); } +static void print_version(void) +{ + printf("%s\n", git_version); + printf("%s\n", libsis33_version_s); +} + static void parse_args(int argc, char *argv[]) { int c; for (;;) { - c = getopt(argc, argv, "hm:"); + c = getopt(argc, argv, "hvm:"); if (c < 0) break; switch (c) { case 'h': usage_complete(); exit(EXIT_SUCCESS); + case 'v': + print_version(); + exit(EXIT_SUCCESS); case 'm': module_nr = strtol(optarg, NULL, 0); break; diff --git a/sis33/lib/examples/offset.c b/sis33/lib/examples/offset.c index a90cace5bbd0057c75478027ed85b35fe992bb8a..ea4e0297df7cbf26b972079f6b2fab32f1383a9b 100644 --- a/sis33/lib/examples/offset.c +++ b/sis33/lib/examples/offset.c @@ -8,9 +8,11 @@ #include <unistd.h> #include <stdio.h> -#include <libsis33.h> +#include "libsis33.h" #include "my_stringify.h" +static char git_version[] = "git_version: " GIT_VERSION; + #define PROGNAME "offset" /* default module number (LUN) */ @@ -23,14 +25,15 @@ extern char *optarg; static const char usage_string[] = "configure and send triggers on an sis33 device.\n" - " " PROGNAME " [-c<CHANNEL>] [-h] [-m<LUN>] [o<OFFSET>]"; + " " PROGNAME " [-c<CHANNEL>] [-h] [-v] [-m<LUN>] [o<OFFSET>]"; static const char commands_string[] = "options:\n" " -c = channel index (0 to n-1)\n" " -h = show this help text\n" " -m = Module number (default: " my_stringify(MODULE_NR) ")\n" - " -o = offset"; + " -o = offset\n" + " -v = version"; static void usage_complete(void) { @@ -38,12 +41,18 @@ static void usage_complete(void) printf("%s\n", commands_string); } +static void print_version(void) +{ + printf("%s\n", git_version); + printf("%s\n", libsis33_version_s); +} + static void parse_args(int argc, char *argv[]) { int c; for (;;) { - c = getopt(argc, argv, "c:hm:o:"); + c = getopt(argc, argv, "c:hvm:o:"); if (c < 0) break; switch (c) { @@ -53,6 +62,9 @@ static void parse_args(int argc, char *argv[]) case 'h': usage_complete(); exit(EXIT_SUCCESS); + case 'v': + print_version(); + exit(EXIT_SUCCESS); case 'm': module_nr = strtol(optarg, NULL, 0); break; diff --git a/sis33/lib/examples/segments.c b/sis33/lib/examples/segments.c index d5afb32e555781e2006039fd47ce8a29330961d4..337233e0af9253b36973146f9a723630fa8d0bc5 100644 --- a/sis33/lib/examples/segments.c +++ b/sis33/lib/examples/segments.c @@ -8,9 +8,11 @@ #include <unistd.h> #include <stdio.h> -#include <libsis33.h> +#include "libsis33.h" #include "my_stringify.h" +static char git_version[] = "git_version: " GIT_VERSION; + #define PROGNAME "segments" /* default module number (LUN) */ @@ -22,13 +24,14 @@ extern char *optarg; static const char usage_string[] = "configure the number of segments of an sis33 device.\n" - " " PROGNAME " [-h] [-m<LUN>] [-n<NR_SEGMENTS>]"; + " " PROGNAME " [-h] [-v] [-m<LUN>] [-n<NR_SEGMENTS>]"; static const char commands_string[] = "options:\n" " -h = show this help text\n" " -m = Module number (default: " my_stringify(MODULE_NR) ")\n" - " -n = Number of segments"; + " -n = Number of segments\n" + " -v = version"; static void usage_complete(void) { @@ -36,18 +39,27 @@ static void usage_complete(void) printf("%s\n", commands_string); } +static void print_version(void) +{ + printf("%s\n", git_version); + printf("%s\n", libsis33_version_s); +} + static void parse_args(int argc, char *argv[]) { int c; for (;;) { - c = getopt(argc, argv, "hm:n:"); + c = getopt(argc, argv, "hvm:n:"); if (c < 0) break; switch (c) { case 'h': usage_complete(); exit(EXIT_SUCCESS); + case 'v': + print_version(); + exit(EXIT_SUCCESS); case 'm': module_nr = strtol(optarg, NULL, 0); break; diff --git a/sis33/lib/examples/start.c b/sis33/lib/examples/start.c index 837b1eaa61b3ec2c71d4fcb1743e79f8361fd460..e0706c7ebc61b776e12516a19b77a6cc4370eabe 100644 --- a/sis33/lib/examples/start.c +++ b/sis33/lib/examples/start.c @@ -12,6 +12,8 @@ #include <libsis33.h> #include "my_stringify.h" +static char git_version[] = "git_version: " GIT_VERSION; + #define PROGNAME "start" /* default module number (LUN) */ @@ -24,27 +26,33 @@ extern char *optarg; static const char usage_string[] = "configure the 'start' of an sis33 device.\n" - " " PROGNAME " [-a] [-d] [-h] [-m<LUN>]"; + " " PROGNAME " [-a] [-d] [-h] [-v] [-m<LUN>]"; static const char commands_string[] = "options:\n" " -a = enable/disable auto mode (bool)\n" " -d = delay\n" " -h = show this help text\n" - " -m = Module number (default: " my_stringify(MODULE_NR) ")"; + " -m = Module number (default: " my_stringify(MODULE_NR) ")\n" + " -v = version"; static void usage_complete(void) { printf("%s\n", usage_string); printf("%s\n", commands_string); } +static void print_version(void) +{ + printf("%s\n", git_version); + printf("%s\n", libsis33_version_s); +} static void parse_args(int argc, char *argv[]) { int c; for (;;) { - c = getopt(argc, argv, "a:d:hm:"); + c = getopt(argc, argv, "a:d:hvm:"); if (c < 0) break; switch (c) { @@ -57,6 +65,9 @@ static void parse_args(int argc, char *argv[]) case 'h': usage_complete(); exit(EXIT_SUCCESS); + case 'v': + print_version(); + exit(EXIT_SUCCESS); case 'm': module_nr = strtol(optarg, NULL, 0); break; diff --git a/sis33/lib/examples/stop.c b/sis33/lib/examples/stop.c index 6b030f22a2a5be5c972adfd35463db2d054b4a62..601845eac2cbb65966206693fb8e40a7f7f0b2a6 100644 --- a/sis33/lib/examples/stop.c +++ b/sis33/lib/examples/stop.c @@ -11,9 +11,11 @@ #include <unistd.h> #include <stdio.h> -#include <libsis33.h> +#include "libsis33.h" #include "my_stringify.h" +static char git_version[] = "git_version: " GIT_VERSION; + #define PROGNAME "stop" /* default module number (LUN) */ @@ -33,7 +35,8 @@ static const char commands_string[] = " -a = enable/disable auto mode (bool)\n" " -d = delay\n" " -h = show this help text\n" - " -m = Module number (default: " my_stringify(MODULE_NR) ")"; + " -m = Module number (default: " my_stringify(MODULE_NR) ")\n" + " -v = version"; static void usage_complete(void) { @@ -41,12 +44,18 @@ static void usage_complete(void) printf("%s\n", commands_string); } +static void print_version(void) +{ + printf("%s\n", git_version); + printf("%s\n", libsis33_version_s); +} + static void parse_args(int argc, char *argv[]) { int c; for (;;) { - c = getopt(argc, argv, "a:d:hm:"); + c = getopt(argc, argv, "a:d:hvm:"); if (c < 0) break; switch (c) { @@ -59,6 +68,9 @@ static void parse_args(int argc, char *argv[]) case 'h': usage_complete(); exit(EXIT_SUCCESS); + case 'v': + print_version(); + exit(EXIT_SUCCESS); case 'm': module_nr = strtol(optarg, NULL, 0); break; diff --git a/sis33/lib/examples/stress.c b/sis33/lib/examples/stress.c index 1adfe9e94c046436e627a29339bc09c1a3db4086..9151c54ebd7818da6830c723fdddca5801df9cd3 100644 --- a/sis33/lib/examples/stress.c +++ b/sis33/lib/examples/stress.c @@ -10,9 +10,11 @@ #include <unistd.h> #include <stdio.h> -#include <libsis33.h> +#include "libsis33.h" #include "my_stringify.h" +static char git_version[] = "git_version: " GIT_VERSION; + #define MODULE_NR 0 #define SEGMENT_NR 0 #define EV_LENGTH 64 @@ -33,7 +35,7 @@ extern char *optarg; static const char usage_string[] = "Fetch samples until a timeout expires or a signal arrives\n" - " " PROGNAME " [e<EVENTS>] [-h] [-l<LENGTH>] [-m<LUN>] [-s<SEGMENT>] [-t<TIMEOUT>]"; + " " PROGNAME " [e<EVENTS>] [-h] [-v] [-l<LENGTH>] [-m<LUN>] [-s<SEGMENT>] [-t<TIMEOUT>]"; static const char commands_string[] = "options:\n" @@ -43,7 +45,8 @@ static const char commands_string[] = my_stringify(EV_LENGTH) "\n" " -m = Module. Default: " my_stringify(MODULE_NR) "\n" " -s = segment. Default: " my_stringify(SEGMENT_NR) "\n" - " -t = timeout (duration). 0 (default) to acquire forever\n"; + " -t = timeout (duration). 0 (default) to acquire forever\n" + " -v = version"; static void usage_complete(void) { @@ -51,12 +54,18 @@ static void usage_complete(void) printf("%s\n", commands_string); } +static void print_version(void) +{ + printf("%s\n", git_version); + printf("%s\n", libsis33_version_s); +} + static void parse_args(int argc, char *argv[]) { int c; for (;;) { - c = getopt(argc, argv, "e:hl:m:s:t:"); + c = getopt(argc, argv, "e:hvl:m:s:t:"); if (c < 0) break; switch (c) { @@ -66,6 +75,9 @@ static void parse_args(int argc, char *argv[]) case 'h': usage_complete(); exit(EXIT_SUCCESS); + case 'v': + print_version(); + exit(EXIT_SUCCESS); case 'l': ev_length = strtoul(optarg, NULL, 0); break; diff --git a/sis33/lib/examples/trigger.c b/sis33/lib/examples/trigger.c index 1be940efd691c581ab018ef53853e276718ce72e..c5db2a17cd69c5e196edf19e073c103ba929d487 100644 --- a/sis33/lib/examples/trigger.c +++ b/sis33/lib/examples/trigger.c @@ -9,9 +9,11 @@ #include <unistd.h> #include <stdio.h> -#include <libsis33.h> +#include "libsis33.h" #include "my_stringify.h" +static char git_version[] = "git_version: " GIT_VERSION; + #define PROGNAME "trigger" /* default module number (LUN) */ @@ -24,7 +26,7 @@ extern char *optarg; static const char usage_string[] = "configure and send triggers on an sis33 device.\n" - " " PROGNAME " [-e<BOOL>] [-h] [-m<LUN>] [-s<TRIGGER>]"; + " " PROGNAME " [-e<BOOL>] [-h] [-v] [-m<LUN>] [-s<TRIGGER>]"; static const char commands_string[] = "options:\n" @@ -32,7 +34,8 @@ static const char commands_string[] = " -d = delay\n" " -h = show this help text\n" " -m = Module number (default: " my_stringify(MODULE_NR) ")\n" - " -s = Send trigger (valid: \"start\" and \"stop\")"; + " -s = Send trigger (valid: \"start\" and \"stop\")\n" + " -v = version"; static void usage_complete(void) { @@ -40,12 +43,18 @@ static void usage_complete(void) printf("%s\n", commands_string); } +static void print_version(void) +{ + printf("%s\n", git_version); + printf("%s\n", libsis33_version_s); +} + static void parse_args(int argc, char *argv[]) { int c; for (;;) { - c = getopt(argc, argv, "e:hm:s:"); + c = getopt(argc, argv, "e:hvm:s:"); if (c < 0) break; switch (c) { @@ -55,6 +64,9 @@ static void parse_args(int argc, char *argv[]) case 'h': usage_complete(); exit(EXIT_SUCCESS); + case 'v': + print_version(); + exit(EXIT_SUCCESS); case 'm': module_nr = strtol(optarg, NULL, 0); break; diff --git a/sis33/lib/examples/two_segments.c b/sis33/lib/examples/two_segments.c index 58ff6d8b387fbebd20f16174f6f94bde8837f81c..acfae9180126442bf25e882f346aba4f408b72f4 100644 --- a/sis33/lib/examples/two_segments.c +++ b/sis33/lib/examples/two_segments.c @@ -9,9 +9,11 @@ #include <string.h> #include <unistd.h> -#include <libsis33.h> +#include "libsis33.h" #include "my_stringify.h" +static char git_version[] = "git_version: " GIT_VERSION; + /* default module number (LUN) */ #define MODULE_NR 0 @@ -23,13 +25,14 @@ extern char *optarg; static const char usage_string[] = "Sample from two sis33 segments\n" - " " PROGNAME " [-h] [-l<LENGTH>] [-m<LUN>]"; + " " PROGNAME " [-h] [-v] [-l<LENGTH>] [-m<LUN>]"; static const char commands_string[] = "options:\n" " -h = show this help text\n" " -l = event length (number of samples per event)\n" - " -m = Module number (default: " my_stringify(MODULE_NR) ")"; + " -m = Module number (default: " my_stringify(MODULE_NR) ")\n" + " -v = version"; static void usage_complete(void) { @@ -37,18 +40,27 @@ static void usage_complete(void) printf("%s\n", commands_string); } +static void print_version(void) +{ + printf("%s\n", git_version); + printf("%s\n", libsis33_version_s); +} + static void parse_args(int argc, char *argv[]) { int c; for (;;) { - c = getopt(argc, argv, "hl:m:"); + c = getopt(argc, argv, "hvl:m:"); if (c < 0) break; switch (c) { case 'h': usage_complete(); exit(EXIT_SUCCESS); + case 'v': + print_version(); + exit(EXIT_SUCCESS); case 'l': ev_length = strtoul(optarg, NULL, 0); break; diff --git a/sis33/lib/examples/version.c b/sis33/lib/examples/version.c index 5b8153924297052e0d8d8434edc496c7ed160ca0..08fa294df775ac84c0038b9063d9202e7f267640 100644 --- a/sis33/lib/examples/version.c +++ b/sis33/lib/examples/version.c @@ -6,11 +6,15 @@ #include <stdio.h> -#include <libsis33.h> +#include "libsis33.h" #include "my_stringify.h" +static char git_version[] = "git_version: " GIT_VERSION; + int main(int argc, char *argv[]) { printf("%s\n", libsis33_version ? libsis33_version : "Unknown"); + printf("%s\n", git_version); + printf("%s\n", libsis33_version_s); return 0; } diff --git a/sis33/lib/sis33.c b/sis33/lib/sis33.c index 92c6e45af63f4debfde7e7d835ec28472403104c..23e9e66b744e090b03d83744741e8b3e1692f739 100644 --- a/sis33/lib/sis33.c +++ b/sis33/lib/sis33.c @@ -18,7 +18,7 @@ #include <fcntl.h> #include <stdio.h> -#include <libsis33.h> +#include "libsis33.h" #include "sis33acq.h" #include "sis33dev.h" #include "libinternal.h" diff --git a/sis33/test/Makefile b/sis33/test/Makefile index 5d3ae5936084784a368573e0a374b97ed15e5509..c008c514e2c074e0f350b28eea94f3b1a8d18d8f 100644 --- a/sis33/test/Makefile +++ b/sis33/test/Makefile @@ -5,6 +5,7 @@ VPATH = ../../utils/extest ../lib INCDIR := ../include CFLAGS := -Wall -g -I$(INCDIR) -I../../include -I../../utils/extest -I../lib \ -I../../utils/user -DDRIVER_NAME=\"sis33\" +CFLAGS += -DGIT_VERSION=\"$(GIT_VERSION)\" LIBUTILSPATH := ../../utils/user LIBUTILS := $(LIBUTILSPATH)/libutils.$(CPU).a LDLIBS := -lxml2 -lreadline -lrt diff --git a/sis33/test/sis33test.c b/sis33/test/sis33test.c index f003c99cf4890222e072af04e6109d6e4812d607..8a271584abc248eb1d8a11c3464704b229432291 100644 --- a/sis33/test/sis33test.c +++ b/sis33/test/sis33test.c @@ -16,6 +16,8 @@ #include "sis33acq.h" #include "sis33dev.h" +static char git_version[] = "sis33test version: " GIT_VERSION; + #define SIS33T_MAX_NR_SEGMENTS 8 int use_builtin_cmds = 0; @@ -1057,6 +1059,7 @@ int main(int argc, char *argv[], char *envp[]) int *indexes; int ndevs; + printf("%s\n", git_version); /* try to control the first device */ ndevs = sis33dev_get_nr_devices(); if (!ndevs) diff --git a/vd80-2/lib/test/Makefile b/vd80-2/lib/test/Makefile index 3334b6ad443ca20c07d78c74508671c5341174f5..941ef58ac02a1a233d4a62c320e082825fa93bff 100644 --- a/vd80-2/lib/test/Makefile +++ b/vd80-2/lib/test/Makefile @@ -11,6 +11,7 @@ DRIVER = $(VD80LB)/../driver CFLAGS = -g -Wall -I $(VD80LB) -I $(DRIVER) -DCOMPILE_TIME=$(COMPILE_TIME) +CFLAGS += -DGIT_VERSION=\"$(GIT_VERSION)\" LDLIBS = $(VD80LB)/libvd80.$(CPU).a diff --git a/vd80-2/lib/test/vd80test.c b/vd80-2/lib/test/vd80test.c index 3ac2d2b65afa4d663bfb46d9182edf4b2b214d1e..3475f20963ce54278ea9ba2726bf3645cc48b77c 100644 --- a/vd80-2/lib/test/vd80test.c +++ b/vd80-2/lib/test/vd80test.c @@ -16,8 +16,10 @@ #include <stdint.h> #include <sys/mman.h> -#include <vd80.h> -#include <libvd80.h> +#include "vd80.h" +#include "libvd80.h" + +static char git_version[] = "git_version: " GIT_VERSION; #define NEWS 1 #define HISTORIES 24 @@ -48,7 +50,9 @@ int main(int argc,char *argv[]) char tmpb[CMD_BUF_SIZE]; pname = argv[0]; - printf("%s: Compiled %s %s\n",pname,__DATE__,__TIME__); + printf("%s: Compiled %s %s\n", pname,__DATE__,__TIME__); + printf("%s: %s\n", pname, git_version); + printf("%s\n", libvd80_version_s); if (argc > 1) dev = strtoul(argv[1],&cp,0); diff --git a/vmebridge/test/berrtest.c b/vmebridge/test/berrtest.c index e102f5f55d58f265a0acf57b3a9c98951a61bf8c..77ad8a24cdb5fc3b3fc6604c03a962780f8bb7af 100644 --- a/vmebridge/test/berrtest.c +++ b/vmebridge/test/berrtest.c @@ -12,6 +12,8 @@ #include <libvmebus.h> +static char git_version[] = "git_version: " GIT_VERSION; + /* Number of (faulty) accesses to be done */ #define ACCESSES 4 @@ -28,6 +30,9 @@ int main(int argc, char *argv[]) int berr; int i; + printf("%s: %s\n", argv[0], git_version); + printf("%s\n", libvmebus_version_s); + memset(&mapping, 0, sizeof(struct vme_mapping)); mapping.sizel = MAP_SIZE; diff --git a/vmebridge/test/create_window.c b/vmebridge/test/create_window.c index e8dfd943904bf0ae31a5dd6035707c128a449224..d1485286b379295be9177ab29766b420a96035d7 100644 --- a/vmebridge/test/create_window.c +++ b/vmebridge/test/create_window.c @@ -22,6 +22,8 @@ int am, dsize, vmeaddr, length; #define VME_MWINDOW_DEV "/dev/vme_mwindow" +static char git_version[] = "git_version: " GIT_VERSION; + void usage(char * prgname) { printf("Usage: %s winnum am dwidth vmeaddr size\n", prgname); @@ -30,6 +32,7 @@ void usage(char * prgname) printf(" data width: 16 or 32\n"); printf(" VME address: VME start address\n"); printf(" size: window size\n"); + printf("\n%s\n", git_version); } void parse_args(int argc, char **argv) diff --git a/vmebridge/test/destroy_window.c b/vmebridge/test/destroy_window.c index ec28feb8792d0ac2958e865ef941cf14d1445733..dd7e537dd437733cb573c5a529114876a7075ac7 100644 --- a/vmebridge/test/destroy_window.c +++ b/vmebridge/test/destroy_window.c @@ -15,6 +15,8 @@ #include <vmebus.h> +static char git_version[] = "git_version: " GIT_VERSION; + int window_num; #define VME_MWINDOW_DEV "/dev/vme_mwindow" @@ -23,6 +25,7 @@ void usage(char * prgname) { printf("Usage: %s winnum\n", prgname); printf(" window: 0..7\n"); + printf("\n%s\n", git_version); } void parse_args(int argc, char **argv) diff --git a/vmebridge/test/hsm-dma.c b/vmebridge/test/hsm-dma.c index ca513800a22b6673fb51fede69afd20309a27c32..222fafb4764300d78d8861ebb269cb0cd10f6384 100644 --- a/vmebridge/test/hsm-dma.c +++ b/vmebridge/test/hsm-dma.c @@ -29,6 +29,8 @@ #define HSM_AM VME_A32_USER_BLT #define HSM_DW VME_D32 +static char git_version[] = "git_version: " GIT_VERSION; + struct stats { int cycles; double delta; @@ -225,6 +227,8 @@ int main(int argc, char *argv[]) " default: 0 (loop forever.)\n" "This program can be interrupted anytime with the " "TERM or INT signals\n"); + printf("\n%s\n", git_version); + printf("%s\n", libvmebus_version_s); exit(EXIT_FAILURE); } sscanf(argv[1], "%d", &duration); diff --git a/vmebridge/test/mm6390-dma.c b/vmebridge/test/mm6390-dma.c index 563cd5ee58c2c4fc2b5bdabcb9fa98258f219393..f0c3241372dfd0f3aabb34dcdbea03dd71fbdf99 100644 --- a/vmebridge/test/mm6390-dma.c +++ b/vmebridge/test/mm6390-dma.c @@ -15,6 +15,8 @@ #include <libvmebus.h> +static char git_version[] = "git_version: " GIT_VERSION; + /* Registers address space */ #define REGS_BASE 0 #define REGS_OFFSET 0xbe00 @@ -57,6 +59,9 @@ int main(int argc, char **argv) double delta; double throughput; + printf("%s %s\n", argv[0], git_version); + printf("%s\n", libvmebus_version_s); + /* Open a mapping for the CSR register */ memset(®s_desc, 0, sizeof(struct vme_mapping)); diff --git a/vmebridge/test/setflag.c b/vmebridge/test/setflag.c index 0c08c45eff0bc8989f1ae91d1080e16b7d89a404..9578899ba6803eae284bec066cb9ae8b98e13208 100644 --- a/vmebridge/test/setflag.c +++ b/vmebridge/test/setflag.c @@ -15,6 +15,8 @@ #include <vmebus.h> +static char git_version[] = "git_version: " GIT_VERSION; + char *prgname; int force_create = -1; int force_destroy = -1; @@ -29,6 +31,7 @@ void usage() printf(" -c: Set or clear force create flag\n"); printf(" -d: Set or clear force destroy flag\n"); printf(" -s: Show the current flags status\n"); + printf("\n%s\n", git_version); printf("\n"); } diff --git a/vmebridge/test/test_mapping.c b/vmebridge/test/test_mapping.c index 4e9a16bdbab21d87bf4972644c0bf71a1d4e2c0a..2269b49181978dc3d1238d7dabe7f204635c0763 100644 --- a/vmebridge/test/test_mapping.c +++ b/vmebridge/test/test_mapping.c @@ -16,6 +16,7 @@ #include <vmebus.h> +static char git_version[] = "git_version: " GIT_VERSION; char *prgname; struct vme_mapping mapping; int am = -1; @@ -40,6 +41,7 @@ void usage() printf(" -w dwidth: Data width 16 or 32\n"); printf(" -a vmeaddr: VME start address (in hex)\n"); printf(" -s size: mapping size (in hex)\n"); + printf("\n%s\n", git_version); printf("\n"); } diff --git a/vmebridge/test/testctr.c b/vmebridge/test/testctr.c index 90b2c4b375994f805fe504b1aa5aad6753170b6d..d4160aa18bd958195f8eb2b58b0e7c909e67f0d0 100644 --- a/vmebridge/test/testctr.c +++ b/vmebridge/test/testctr.c @@ -57,6 +57,8 @@ #include <vmebus.h> +static char git_version[] = "git_version: " GIT_VERSION; + #define VME_MWINDOW_DEV "/dev/vme_mwindow" #define MODULE_AM VME_A24_USER_DATA_SCT @@ -84,6 +86,8 @@ int main(int argc, char **argv) unsigned int test; int bus_err; + printf("%s: %s\n\n", argv[0], git_version); + /* Setup the mapping descriptor */ memset(&desc, 0, sizeof(struct vme_mapping)); diff --git a/vmebridge/test/testctr2.c b/vmebridge/test/testctr2.c index 0fbfd064c109c544b06c41a46227196e5a81cc84..46945c5bad7d8407a614b1a6c42d1569a28c184d 100644 --- a/vmebridge/test/testctr2.c +++ b/vmebridge/test/testctr2.c @@ -53,6 +53,7 @@ #include <libvmebus.h> +static char git_version[] = "git_version: " GIT_VERSION; #define MODULE_AM VME_A24_USER_DATA_SCT #define MODULE_DW VME_D32 @@ -66,6 +67,9 @@ int main(int argc, char **argv) unsigned int *vme_buf; unsigned int val; + printf("%s: %s\n", argv[0], git_version); + printf("%s\n\n", libvmebus_version_s); + memset(¶m, 0, sizeof(struct pdparam_master)); if ((vme_buf = (unsigned int *)find_controller(MODULE_VME_ADDR, diff --git a/vmebridge/test/testctr_ces.c b/vmebridge/test/testctr_ces.c index 8f483493856372c67fe1285fe17182a3e4acf30c..23e655599d845eff00bdc6e41fd9b04e5c82c661 100644 --- a/vmebridge/test/testctr_ces.c +++ b/vmebridge/test/testctr_ces.c @@ -52,6 +52,7 @@ #include <libvmebus.h> +static char git_version[] = "git_version: " GIT_VERSION; #define MODULE_AM VME_A24_USER_DATA_SCT #define MODULE_DW VME_D32 @@ -67,6 +68,9 @@ int main(int argc, char **argv) unsigned int val; unsigned int saved; + printf("%s: %s\n", argv[0], git_version); + printf("%s\n\n", libvmebus_version_s); + memset(¶m, 0, sizeof(struct pdparam_master)); if ((vme_buf = (unsigned int *)find_controller(MODULE_VME_ADDR, diff --git a/vmebridge/test/testvd80.c b/vmebridge/test/testvd80.c index b382848d6e7720305f1e290de0852014b989c86e..fbe6790eb0e261191ce2a4b8e54724a196c6f2aa 100644 --- a/vmebridge/test/testvd80.c +++ b/vmebridge/test/testvd80.c @@ -14,6 +14,8 @@ #include <libvmebus.h> #include "libvd80.h" +static char git_version[] = "git_version: " GIT_VERSION; + #define CHAN_USED 1 unsigned int shot_samples; @@ -294,6 +296,10 @@ int main(int argc, char **argv) { int rc = 0; + printf("%s: %s\n", argv[0], git_version); + printf("%s\n", libvmebus_version_s); + printf("%s\n\n", libvd80vmebridge_version_s); + if (vd80_map()) exit(1); diff --git a/vmebridge/test/testvd802.c b/vmebridge/test/testvd802.c index ef289348a40efc64b6ea1c2397b2aef25576dd1d..557949628f94a2eeed6b53a7d3f09863cd5bd2d7 100644 --- a/vmebridge/test/testvd802.c +++ b/vmebridge/test/testvd802.c @@ -14,6 +14,8 @@ #include <libvmebus.h> #include "vd80.h" +static char git_version[] = "git_version: " GIT_VERSION; + #define VD80_SETUP_BASE 0x580000 #define VD80_SETUP_SIZE 0x80000 #define VD80_SETUP_AM VME_CR_CSR @@ -991,6 +993,9 @@ int main(int argc, char **argv) { int rc = 0; + printf("%s: %s\n", argv[0], git_version); + printf("%s\n\n", libvmebus_version_s); + if (vd80_map()) exit(1); diff --git a/vmebridge/test/vd80spd-dma.c b/vmebridge/test/vd80spd-dma.c index a27baede136ff0db3ff1b264e1c0b1c4b210f4ab..44e5f97f68471f6cae26ed00ecc08c6f5a0e381a 100644 --- a/vmebridge/test/vd80spd-dma.c +++ b/vmebridge/test/vd80spd-dma.c @@ -15,6 +15,8 @@ #include <libvmebus.h> #include "libvd80.h" +static char git_version[] = "git_version: " GIT_VERSION; + #define CHAN_USED 16 #define MAX_MBLT_FRAMES 492 #define MAX_BLT_FRAMES 44 @@ -279,6 +281,10 @@ int main(int argc, char **argv) { int rc = 0; + printf("%s: %s\n", argv[0], git_version); + printf("%s\n", libvmebus_version_s); + printf("%s\n\n", libvd80vmebridge_version_s); + if (vd80_map()) exit(1); diff --git a/vmebridge/test/vd80spd.c b/vmebridge/test/vd80spd.c index 5465516a3325cd9aefbe2463dc4a0ffa39c88c6d..951d4322940e8d6ea0282b5b71a77f343292c348 100644 --- a/vmebridge/test/vd80spd.c +++ b/vmebridge/test/vd80spd.c @@ -14,6 +14,8 @@ #include <libvmebus.h> #include "libvd80.h" +static char git_version[] = "git_version: " GIT_VERSION; + #define CHAN_USED 16 unsigned int shot_samples; @@ -166,6 +168,10 @@ int main(int argc, char **argv) { int rc = 0; + printf("%s: %s\n", argv[0], git_version); + printf("%s\n", libvmebus_version_s); + printf("%s\n\n", libvd80vmebridge_version_s); + if (vd80_map()) exit(1); diff --git a/vmebridge/tools/Makefile b/vmebridge/tools/Makefile index aedff80c30a69d6b003ee742835e3b1cfde9baa4..7d2fc350620a052e1ba8b3e7ad7c41ec4f8cbe70 100644 --- a/vmebridge/tools/Makefile +++ b/vmebridge/tools/Makefile @@ -2,6 +2,7 @@ include ../../common.mk CFLAGS = -Wall -I../include $(EXTRACFLAGS) +CFLAGS += -DGIT_VERSION=\"$(GIT_VERSION)\" LDFLAGS = -L../lib LDLIBS = -lvmebus.$(CPU) diff --git a/vmebridge/tools/vme.c b/vmebridge/tools/vme.c index 9e9319210edfb2db09d42a8d0ba38b727d790327..79d6f64d2a4d5ba13dc1dc00ebd267b777892b16 100644 --- a/vmebridge/tools/vme.c +++ b/vmebridge/tools/vme.c @@ -6,8 +6,13 @@ #include <arpa/inet.h> #include <libvmebus.h> +static char git_version[] = "git_version: " GIT_VERSION; + +void print_version(void); + void usage(char *prog) { + fprintf(stderr, "usage: %s [-v vme_address][options]\n\n", prog); fprintf(stderr, @@ -36,6 +41,8 @@ void usage(char *prog) " -H : hide the address\n"); fprintf(stderr, " -h : print this help\n"); + fprintf(stderr, + " -V : version\n"); fprintf(stderr, "\n"); fprintf(stderr, "Data Width\n"); @@ -51,9 +58,16 @@ void usage(char *prog) fprintf(stderr, " 0x29 A16 user data\n"); fprintf(stderr, " 0x39 A24 user data\n"); fprintf(stderr, "\n"); + print_version(); exit(1); } +void print_version(void) +{ + fprintf(stderr, "%s\n", git_version); + fprintf(stderr, "%s\n", libvmebus_version_s); +} + int is_invalid_width(int data_width) { return (data_width != 8 && @@ -113,7 +127,7 @@ int main(int argc, char *argv[]) offsets_on = 1; offset = 0; length = 0x80000; - while ((c = getopt(argc, argv, "Hv:s:D:d:a:n:w:l:h")) != -1) { + while ((c = getopt(argc, argv, "Hv:s:D:d:a:n:w:l:hV")) != -1) { switch (c) { case 'H': offsets_on = 0; @@ -153,6 +167,9 @@ int main(int argc, char *argv[]) case 'h': usage(argv[0]); break; + case 'V': + print_version(); + exit(1); default: break; } diff --git a/vmod/test/Makefile b/vmod/test/Makefile index 1691eaa6bf42f25d95ed9514f14102a444d3ec39..50c29ad4d0e9de64ca74063ddf728846ea540cba 100644 --- a/vmod/test/Makefile +++ b/vmod/test/Makefile @@ -2,6 +2,7 @@ include ../../common.mk CFLAGS += -I ../include/ -I./ -I../driver/ +CFLAGS += -DGIT_VERSION=\"$(GIT_VERSION)\" LDFLAGS += -L ../lib LDLIBS += -lvmodttl.$(CPU) -lvmoddor.$(CPU) -lpthread -lvmod.$(CPU) diff --git a/vmod/test/load_test.c b/vmod/test/load_test.c index ed1943fdfb943f091580b6392cb1d1f590a79325..3c892d80aff9071727297967b9a5be91d94cee82 100644 --- a/vmod/test/load_test.c +++ b/vmod/test/load_test.c @@ -41,6 +41,8 @@ #include "libvmodttl.h" +static char git_version[] = "git_version: " GIT_VERSION; + int device; void *annoying_thread(void *thd) @@ -74,6 +76,9 @@ int main (int argc, char *argv[]) printf(" | Created by: Samuel I. Gonsalvez | \n"); printf(" | Email: siglesia@cern.ch | \n"); printf(" |______________________________________| \n"); + printf("\n"); + printf("%s\n", git_version); + printf("%s\n", libvmodttl_version_s); if (argc == 2) { diff --git a/vmod/test/tstlib12a2.c b/vmod/test/tstlib12a2.c index 513041d760e0a64bf3fbcee9ad62bb3ba967fb98..4563aa6d9fbe976ddf393082614fef6807dabe20 100644 --- a/vmod/test/tstlib12a2.c +++ b/vmod/test/tstlib12a2.c @@ -11,6 +11,7 @@ #include "libvmod12a2.h" #endif +static char git_version[] = "git_version: " GIT_VERSION; /* VMOD 12A2 precision */ #define VMOD_DAC_INPUT_RANGE (1<<12) @@ -27,7 +28,9 @@ int volts2digital(float volts) void usage(char *progname) { - fprintf(stderr, "usage: %s lun channel volts\n", progname); + fprintf(stderr, "usage: %s lun channel volts\n\n", progname); + fprintf(stderr, "%s\n", git_version); + fprintf(stderr, "%s\n", libvmod_version_s); } int main(int argc, char *argv[]) diff --git a/vmod/test/tstlib12a4.c b/vmod/test/tstlib12a4.c index d447fcb03b26252bfa1e67ef2dd5f6b3193655b2..ee5b94ff8a4ebb70f041227f96e543d418d7350a 100644 --- a/vmod/test/tstlib12a4.c +++ b/vmod/test/tstlib12a4.c @@ -11,6 +11,7 @@ #include "libvmod12a4.h" #endif +static char git_version[] = "git_version: " GIT_VERSION; /* VMOD 12A4 precision */ #define VMOD_DAC_INPUT_RANGE (1<<12) @@ -27,7 +28,9 @@ int volts2digital(float volts) void usage(char *progname) { - fprintf(stderr, "usage: %s lun channel volts\n", progname); + fprintf(stderr, "usage: %s lun channel volts\n\n", progname); + fprintf(stderr, "%s\n", git_version); + fprintf(stderr, "%s\n", libvmod_version_s); } int main(int argc, char *argv[]) diff --git a/vmod/test/tstlib12e16.c b/vmod/test/tstlib12e16.c index a5bf309d8f5bd77dc50910f2a4c44b03a6a692cd..f4860973e250064eaff92ddceb08b1a0eefd7260 100644 --- a/vmod/test/tstlib12e16.c +++ b/vmod/test/tstlib12e16.c @@ -7,6 +7,7 @@ #include "libvmod12e16.h" #endif +static char git_version[] = "git_version: " GIT_VERSION; int main(int argc, char *argv[]) { @@ -15,7 +16,9 @@ int main(int argc, char *argv[]) float decimal; if (argc != 4) { - fprintf(stderr, "usage: %s lun channel ampli\n", argv[0]); + fprintf(stderr, "usage: %s lun channel ampli\n\n", argv[0]); + fprintf(stderr, "%s\n", git_version); + fprintf(stderr, "%s\n", libvmod_version_s); return 1; } diff --git a/vmod/test/tstlib16a2.c b/vmod/test/tstlib16a2.c index a16297e5156a9fc815573fc727fd663bdf691026..e33d97e88c258d768a812f3f10000c5534229f82 100644 --- a/vmod/test/tstlib16a2.c +++ b/vmod/test/tstlib16a2.c @@ -11,6 +11,8 @@ #include "libvmod16a2.h" #endif +static char git_version[] = "git_version: " GIT_VERSION; + /* VMOD 16A2 precision */ #define VMOD_DAC_INPUT_RANGE (1<<16) @@ -26,7 +28,9 @@ int volts2digital(float volts) void usage(void) { - fprintf(stderr, "usage: pp lun channel volts\n"); + fprintf(stderr, "usage: pp lun channel volts\n\n"); + fprintf(stderr, "%s\n", git_version); + fprintf(stderr, "%s\n", libvmod_version_s); } int main(int argc, char *argv[]) diff --git a/vmod/test/tstlibdor.c b/vmod/test/tstlibdor.c index 503db4a32b5c88fdd0dedde5e4c161fd646faac4..90d4c19367755152c47607ce1c841e7ee76d5ec0 100644 --- a/vmod/test/tstlibdor.c +++ b/vmod/test/tstlibdor.c @@ -13,6 +13,8 @@ #include "libvmoddor.h" #endif +static char git_version[] = "git_version: " GIT_VERSION; + int main (int argc, char *argv[]) { int lun = -1; @@ -25,7 +27,8 @@ int main (int argc, char *argv[]) "<offset> value of the offset (first channel) applied.\n" "<size> size of the data (4, 8, 16 channels).\n" "<value> integer value to be written (dec, hex and oct accepted).\n"); - + printf("\n%s\n", git_version); + printf("%s\n", libvmoddor_version_s); exit(-1); } else diff --git a/vmod/test/tstlibttl.c b/vmod/test/tstlibttl.c index 8bfa3f5ed2e8d7297e240d0cdba84397dae517dd..3e919be0ec52f5215d28843987cb5d96a4eb1de3 100644 --- a/vmod/test/tstlibttl.c +++ b/vmod/test/tstlibttl.c @@ -42,6 +42,8 @@ #include "libvmodttl.h" #endif +static char git_version[] = "git_version: " GIT_VERSION; + int device; void write_channel(int pd) @@ -89,6 +91,9 @@ int main (int argc, char *argv[]) printf(" | Created by: Samuel I. Gonsalvez | \n"); printf(" | Email: siglesia@cern.ch | \n"); printf(" |______________________________________| \n"); + printf("\n"); + printf("%s\n", git_version); + printf("%s\n", libvmodttl_version_s); if (argc == 2) { diff --git a/vmod/test/tstlibttl_quick_read.c b/vmod/test/tstlibttl_quick_read.c index fcbb7a1bc6f536d12453a9ff5db3b4522c295a11..0765da9a9c57f741b27ecd35b3ea4629dab63f4d 100644 --- a/vmod/test/tstlibttl_quick_read.c +++ b/vmod/test/tstlibttl_quick_read.c @@ -42,6 +42,8 @@ #include "libvmodttl.h" #endif +static char git_version[] = "git_version: " GIT_VERSION; + int device; void write_channel(int pd) @@ -87,7 +89,9 @@ int main (int argc, char *argv[]) printf(" | Created by: Samuel I. Gonsalvez | \n"); printf(" | Email: siglesia@cern.ch | \n"); printf(" |______________________________________| \n"); - + printf("\n"); + printf("%s\n", git_version); + printf("%s\n", libvmodttl_version_s); if (argc == 2) { device = atoi(argv[1]); diff --git a/vmod/test/tstlibttl_quick_write.c b/vmod/test/tstlibttl_quick_write.c index ea47f7b79a7e8f9de7ee78e163dda4e568b3424d..82989da1d44608d2c6aa2f7192546351adb6b6fc 100644 --- a/vmod/test/tstlibttl_quick_write.c +++ b/vmod/test/tstlibttl_quick_write.c @@ -42,6 +42,8 @@ #include "libvmodttl.h" #endif +static char git_version[] = "git_version: " GIT_VERSION; + int device; int main (int argc, char *argv[]) @@ -57,6 +59,9 @@ int main (int argc, char *argv[]) printf(" | Created by: Samuel I. Gonsalvez | \n"); printf(" | Email: siglesia@cern.ch | \n"); printf(" |______________________________________| \n"); + printf("\n"); + printf("%s\n", git_version); + printf("%s\n", libvmodttl_version_s); if (argc == 2) { diff --git a/vmod/test/tstlibttl_read_device.c b/vmod/test/tstlibttl_read_device.c old mode 100755 new mode 100644 index 87dc3184e17923c69937c10fa1c69263e22e0b59..7f2d4bdea910d188fc9a54379301c5505e313817 --- a/vmod/test/tstlibttl_read_device.c +++ b/vmod/test/tstlibttl_read_device.c @@ -45,6 +45,8 @@ #include "libvmodttl.h" #endif +static char git_version[] = "git_version: " GIT_VERSION; + int device; /* Thread for incomming messages */ @@ -123,6 +125,9 @@ int main (int argc, char *argv[]) printf(" | Created by: Samuel I. Gonsalvez | \n"); printf(" | Email: siglesia@cern.ch | \n"); printf(" |______________________________________| \n"); + printf("\n"); + printf("%s\n", git_version); + printf("%s\n", libvmodttl_version_s); if (argc == 2) {