[Xenomai-git] Alexis Berlemont : analogy: add signal injection in the cmd_write tool
Module: xenomai-head Branch: master Commit: 4dc31cbcfd8f426644112ec566f5a928488fa58c URL: http://git.xenomai.org/?p=xenomai-head.git;a=commit;h=4dc31cbcfd8f426644112ec566f5a928488fa58c Author: Alexis Berlemont alexis.berlem...@gmail.com Date: Sun Apr 24 19:41:56 2011 +0200 analogy: add signal injection in the cmd_write tool --- src/utils/analogy/Makefile.am|7 - src/utils/analogy/cmd_write.c| 707 +- src/utils/analogy/wf_cmd_write.c | 501 --- src/utils/analogy/wf_generate.c |3 +- 4 files changed, 401 insertions(+), 817 deletions(-) diff --git a/src/utils/analogy/Makefile.am b/src/utils/analogy/Makefile.am index a2c3e96..8e7734f 100644 --- a/src/utils/analogy/Makefile.am +++ b/src/utils/analogy/Makefile.am @@ -3,7 +3,6 @@ sbin_PROGRAMS = analogy_config bin_PROGRAMS = \ cmd_read \ cmd_write \ - wf_cmd_write \ cmd_bits \ insn_read \ insn_write \ @@ -43,12 +42,6 @@ cmd_write_LDADD = \ ../../skins/rtdm/librtdm.la \ ../../skins/common/libxenomai.la -wf_cmd_write_SOURCES = wf_cmd_write.c -wf_cmd_write_LDADD = \ - ../../drvlib/analogy/libanalogy.la \ - ../../skins/rtdm/librtdm.la \ - ../../skins/common/libxenomai.la - cmd_bits_SOURCES = cmd_bits.c cmd_bits_LDADD = \ ../../drvlib/analogy/libanalogy.la \ diff --git a/src/utils/analogy/cmd_write.c b/src/utils/analogy/cmd_write.c index 3b3f1ab..43926fd 100644 --- a/src/utils/analogy/cmd_write.c +++ b/src/utils/analogy/cmd_write.c @@ -28,74 +28,53 @@ #include getopt.h #include string.h -#include native/task.h - #include analogy/analogy.h -/* Default command's parameters */ - -/* For write operation, we consider - the default subdevice index is 1 */ -#define ID_SUBD 1 -/* For simplicity sake, a maximum channel - count is defined */ -#define MAX_NB_CHAN 10 -/* Four channels used by default */ -#define NB_CHAN 4 -/* One hundred triggered scans by default */ -#define NB_SCAN 100 - -#define FILENAME analogy0 - -#define BUF_SIZE 1 - -static unsigned char buf[BUF_SIZE]; -static char *filename = FILENAME; -static char *str_chans = 0,1; -static unsigned int chans[MAX_NB_CHAN]; -static int verbose = 0; -static int real_time = 0; -static int use_mmap = 0; - -static RT_TASK rt_task_desc; - -/* The command to send by default */ -a4l_cmd_t cmd = { - .idx_subd = ID_SUBD, - .flags = 0, - .start_src = TRIG_INT, - .start_arg = 0, - .scan_begin_src = TRIG_TIMER, - .scan_begin_arg = 200, /* in ns */ - .convert_src = TRIG_NOW, - .convert_arg = 0, /* in ns */ - .scan_end_src = TRIG_COUNT, - .scan_end_arg = 0, - .stop_src = TRIG_COUNT, - .stop_arg = NB_SCAN, - .nb_chan = 0, - .chan_descs = chans, -}; +#define BUFFER_DEPTH 1024 + +struct config { + + /* Configuration parameters + TODO: add real_time and use_mmap*/ + + int verbose; + + int subd; + char *str_chans; + unsigned int *chans; + int chans_count; + char *str_ranges; + int scans_count; + + char *filename; + FILE *input; + + /* Analogy stuff */ + + a4l_desc_t dsc; + a4l_chinfo_t *cinfo; + a4l_rnginfo_t *rinfo; + + /* Buffer stuff + TODO: add buffer depth / size (useful for mmap) */ + void *buffer; -a4l_insn_t insn = { - .type = A4L_INSN_INTTRIG, - .idx_subd = ID_SUBD, - .data_size = 0, }; -struct option cmd_write_opts[] = { +/* --- Options / arguments part --- */ + +struct option options[] = { {verbose, no_argument, NULL, 'v'}, - {real-time, no_argument, NULL, 'r'}, {device, required_argument, NULL, 'd'}, {subdevice, required_argument, NULL, 's'}, - {scan-count, required_argument, NULL, 'S'}, + {scans-count, required_argument, NULL, 'S'}, {channels, required_argument, NULL, 'c'}, - {mmap, no_argument, NULL, 'm'}, + {range, required_argument, NULL, 'c'}, {help, no_argument, NULL, 'h'}, {0}, }; -void do_print_usage(void) +void print_usage(void) { fprintf(stdout, usage:\tcmd_write [OPTS]\n); fprintf(stdout, \tOPTS:\t -v, --verbose: verbose output\n); @@ -103,305 +82,419 @@ void do_print_usage(void) \t\t -d, --device: device filename (analogy0, analogy1, ...)\n); fprintf(stdout, \t\t -s, --subdevice: subdevice index\n); - fprintf(stdout, \t\t -S, --scan-count: count of scan to perform\n); - fprintf(stdout, \t\t -c, --channels: channels to use (ex.: -c 0,1)\n); - fprintf(stdout, \t\t -m, --mmap: mmap the buffer\n); + fprintf(stdout, \t\t -S, --scans-count: count of scan to perform\n); + fprintf(stdout, + \t\t -c, --channels: channels to use + i,j,... (ex.: -c 0,1)\n); + fprintf(stdout, + \t\t -R,
[Xenomai-git] Alexis Berlemont : analogy: add signal injection in the cmd_write tool
Module: xenomai-abe Branch: analogy Commit: 21cca6f3d93ac5515787b62113213dc555ad63cd URL: http://git.xenomai.org/?p=xenomai-abe.git;a=commit;h=21cca6f3d93ac5515787b62113213dc555ad63cd Author: Alexis Berlemont alexis.berlem...@gmail.com Date: Sun Apr 24 19:41:56 2011 +0200 analogy: add signal injection in the cmd_write tool --- src/utils/analogy/Makefile.am|7 - src/utils/analogy/cmd_write.c| 707 +- src/utils/analogy/wf_cmd_write.c | 501 --- src/utils/analogy/wf_generate.c |3 +- 4 files changed, 401 insertions(+), 817 deletions(-) diff --git a/src/utils/analogy/Makefile.am b/src/utils/analogy/Makefile.am index a2c3e96..8e7734f 100644 --- a/src/utils/analogy/Makefile.am +++ b/src/utils/analogy/Makefile.am @@ -3,7 +3,6 @@ sbin_PROGRAMS = analogy_config bin_PROGRAMS = \ cmd_read \ cmd_write \ - wf_cmd_write \ cmd_bits \ insn_read \ insn_write \ @@ -43,12 +42,6 @@ cmd_write_LDADD = \ ../../skins/rtdm/librtdm.la \ ../../skins/common/libxenomai.la -wf_cmd_write_SOURCES = wf_cmd_write.c -wf_cmd_write_LDADD = \ - ../../drvlib/analogy/libanalogy.la \ - ../../skins/rtdm/librtdm.la \ - ../../skins/common/libxenomai.la - cmd_bits_SOURCES = cmd_bits.c cmd_bits_LDADD = \ ../../drvlib/analogy/libanalogy.la \ diff --git a/src/utils/analogy/cmd_write.c b/src/utils/analogy/cmd_write.c index 3b3f1ab..43926fd 100644 --- a/src/utils/analogy/cmd_write.c +++ b/src/utils/analogy/cmd_write.c @@ -28,74 +28,53 @@ #include getopt.h #include string.h -#include native/task.h - #include analogy/analogy.h -/* Default command's parameters */ - -/* For write operation, we consider - the default subdevice index is 1 */ -#define ID_SUBD 1 -/* For simplicity sake, a maximum channel - count is defined */ -#define MAX_NB_CHAN 10 -/* Four channels used by default */ -#define NB_CHAN 4 -/* One hundred triggered scans by default */ -#define NB_SCAN 100 - -#define FILENAME analogy0 - -#define BUF_SIZE 1 - -static unsigned char buf[BUF_SIZE]; -static char *filename = FILENAME; -static char *str_chans = 0,1; -static unsigned int chans[MAX_NB_CHAN]; -static int verbose = 0; -static int real_time = 0; -static int use_mmap = 0; - -static RT_TASK rt_task_desc; - -/* The command to send by default */ -a4l_cmd_t cmd = { - .idx_subd = ID_SUBD, - .flags = 0, - .start_src = TRIG_INT, - .start_arg = 0, - .scan_begin_src = TRIG_TIMER, - .scan_begin_arg = 200, /* in ns */ - .convert_src = TRIG_NOW, - .convert_arg = 0, /* in ns */ - .scan_end_src = TRIG_COUNT, - .scan_end_arg = 0, - .stop_src = TRIG_COUNT, - .stop_arg = NB_SCAN, - .nb_chan = 0, - .chan_descs = chans, -}; +#define BUFFER_DEPTH 1024 + +struct config { + + /* Configuration parameters + TODO: add real_time and use_mmap*/ + + int verbose; + + int subd; + char *str_chans; + unsigned int *chans; + int chans_count; + char *str_ranges; + int scans_count; + + char *filename; + FILE *input; + + /* Analogy stuff */ + + a4l_desc_t dsc; + a4l_chinfo_t *cinfo; + a4l_rnginfo_t *rinfo; + + /* Buffer stuff + TODO: add buffer depth / size (useful for mmap) */ + void *buffer; -a4l_insn_t insn = { - .type = A4L_INSN_INTTRIG, - .idx_subd = ID_SUBD, - .data_size = 0, }; -struct option cmd_write_opts[] = { +/* --- Options / arguments part --- */ + +struct option options[] = { {verbose, no_argument, NULL, 'v'}, - {real-time, no_argument, NULL, 'r'}, {device, required_argument, NULL, 'd'}, {subdevice, required_argument, NULL, 's'}, - {scan-count, required_argument, NULL, 'S'}, + {scans-count, required_argument, NULL, 'S'}, {channels, required_argument, NULL, 'c'}, - {mmap, no_argument, NULL, 'm'}, + {range, required_argument, NULL, 'c'}, {help, no_argument, NULL, 'h'}, {0}, }; -void do_print_usage(void) +void print_usage(void) { fprintf(stdout, usage:\tcmd_write [OPTS]\n); fprintf(stdout, \tOPTS:\t -v, --verbose: verbose output\n); @@ -103,305 +82,419 @@ void do_print_usage(void) \t\t -d, --device: device filename (analogy0, analogy1, ...)\n); fprintf(stdout, \t\t -s, --subdevice: subdevice index\n); - fprintf(stdout, \t\t -S, --scan-count: count of scan to perform\n); - fprintf(stdout, \t\t -c, --channels: channels to use (ex.: -c 0,1)\n); - fprintf(stdout, \t\t -m, --mmap: mmap the buffer\n); + fprintf(stdout, \t\t -S, --scans-count: count of scan to perform\n); + fprintf(stdout, + \t\t -c, --channels: channels to use + i,j,... (ex.: -c 0,1)\n); + fprintf(stdout, + \t\t -R,
[Xenomai-git] Alexis Berlemont : analogy: add signal injection in the cmd_write tool
Module: xenomai-abe Branch: experimental Commit: 645d28c40ef2f285354d964baa420014352c3ad6 URL: http://git.xenomai.org/?p=xenomai-abe.git;a=commit;h=645d28c40ef2f285354d964baa420014352c3ad6 Author: Alexis Berlemont alexis.berlem...@gmail.com Date: Sun Apr 24 19:41:56 2011 +0200 analogy: add signal injection in the cmd_write tool --- src/utils/analogy/Makefile.am|7 - src/utils/analogy/cmd_write.c| 707 +- src/utils/analogy/wf_cmd_write.c | 501 --- src/utils/analogy/wf_generate.c |3 +- 4 files changed, 401 insertions(+), 817 deletions(-) diff --git a/src/utils/analogy/Makefile.am b/src/utils/analogy/Makefile.am index a2c3e96..8e7734f 100644 --- a/src/utils/analogy/Makefile.am +++ b/src/utils/analogy/Makefile.am @@ -3,7 +3,6 @@ sbin_PROGRAMS = analogy_config bin_PROGRAMS = \ cmd_read \ cmd_write \ - wf_cmd_write \ cmd_bits \ insn_read \ insn_write \ @@ -43,12 +42,6 @@ cmd_write_LDADD = \ ../../skins/rtdm/librtdm.la \ ../../skins/common/libxenomai.la -wf_cmd_write_SOURCES = wf_cmd_write.c -wf_cmd_write_LDADD = \ - ../../drvlib/analogy/libanalogy.la \ - ../../skins/rtdm/librtdm.la \ - ../../skins/common/libxenomai.la - cmd_bits_SOURCES = cmd_bits.c cmd_bits_LDADD = \ ../../drvlib/analogy/libanalogy.la \ diff --git a/src/utils/analogy/cmd_write.c b/src/utils/analogy/cmd_write.c index 3b3f1ab..43926fd 100644 --- a/src/utils/analogy/cmd_write.c +++ b/src/utils/analogy/cmd_write.c @@ -28,74 +28,53 @@ #include getopt.h #include string.h -#include native/task.h - #include analogy/analogy.h -/* Default command's parameters */ - -/* For write operation, we consider - the default subdevice index is 1 */ -#define ID_SUBD 1 -/* For simplicity sake, a maximum channel - count is defined */ -#define MAX_NB_CHAN 10 -/* Four channels used by default */ -#define NB_CHAN 4 -/* One hundred triggered scans by default */ -#define NB_SCAN 100 - -#define FILENAME analogy0 - -#define BUF_SIZE 1 - -static unsigned char buf[BUF_SIZE]; -static char *filename = FILENAME; -static char *str_chans = 0,1; -static unsigned int chans[MAX_NB_CHAN]; -static int verbose = 0; -static int real_time = 0; -static int use_mmap = 0; - -static RT_TASK rt_task_desc; - -/* The command to send by default */ -a4l_cmd_t cmd = { - .idx_subd = ID_SUBD, - .flags = 0, - .start_src = TRIG_INT, - .start_arg = 0, - .scan_begin_src = TRIG_TIMER, - .scan_begin_arg = 200, /* in ns */ - .convert_src = TRIG_NOW, - .convert_arg = 0, /* in ns */ - .scan_end_src = TRIG_COUNT, - .scan_end_arg = 0, - .stop_src = TRIG_COUNT, - .stop_arg = NB_SCAN, - .nb_chan = 0, - .chan_descs = chans, -}; +#define BUFFER_DEPTH 1024 + +struct config { + + /* Configuration parameters + TODO: add real_time and use_mmap*/ + + int verbose; + + int subd; + char *str_chans; + unsigned int *chans; + int chans_count; + char *str_ranges; + int scans_count; + + char *filename; + FILE *input; + + /* Analogy stuff */ + + a4l_desc_t dsc; + a4l_chinfo_t *cinfo; + a4l_rnginfo_t *rinfo; + + /* Buffer stuff + TODO: add buffer depth / size (useful for mmap) */ + void *buffer; -a4l_insn_t insn = { - .type = A4L_INSN_INTTRIG, - .idx_subd = ID_SUBD, - .data_size = 0, }; -struct option cmd_write_opts[] = { +/* --- Options / arguments part --- */ + +struct option options[] = { {verbose, no_argument, NULL, 'v'}, - {real-time, no_argument, NULL, 'r'}, {device, required_argument, NULL, 'd'}, {subdevice, required_argument, NULL, 's'}, - {scan-count, required_argument, NULL, 'S'}, + {scans-count, required_argument, NULL, 'S'}, {channels, required_argument, NULL, 'c'}, - {mmap, no_argument, NULL, 'm'}, + {range, required_argument, NULL, 'c'}, {help, no_argument, NULL, 'h'}, {0}, }; -void do_print_usage(void) +void print_usage(void) { fprintf(stdout, usage:\tcmd_write [OPTS]\n); fprintf(stdout, \tOPTS:\t -v, --verbose: verbose output\n); @@ -103,305 +82,419 @@ void do_print_usage(void) \t\t -d, --device: device filename (analogy0, analogy1, ...)\n); fprintf(stdout, \t\t -s, --subdevice: subdevice index\n); - fprintf(stdout, \t\t -S, --scan-count: count of scan to perform\n); - fprintf(stdout, \t\t -c, --channels: channels to use (ex.: -c 0,1)\n); - fprintf(stdout, \t\t -m, --mmap: mmap the buffer\n); + fprintf(stdout, \t\t -S, --scans-count: count of scan to perform\n); + fprintf(stdout, + \t\t -c, --channels: channels to use + i,j,... (ex.: -c 0,1)\n); + fprintf(stdout, + \t\t -R,
[Xenomai-git] Alexis Berlemont : analogy: add signal injection in the cmd_write tool
Module: xenomai-abe Branch: experimental Commit: 8eaf57fdb7242c4dba2cc820bc3f3228c74f2690 URL: http://git.xenomai.org/?p=xenomai-abe.git;a=commit;h=8eaf57fdb7242c4dba2cc820bc3f3228c74f2690 Author: Alexis Berlemont alexis.berlem...@gmail.com Date: Sun Apr 24 19:41:56 2011 +0200 analogy: add signal injection in the cmd_write tool --- src/utils/analogy/Makefile.am|7 - src/utils/analogy/cmd_write.c| 707 +- src/utils/analogy/wf_cmd_write.c | 501 --- src/utils/analogy/wf_generate.c |3 +- 4 files changed, 401 insertions(+), 817 deletions(-) diff --git a/src/utils/analogy/Makefile.am b/src/utils/analogy/Makefile.am index a2c3e96..8e7734f 100644 --- a/src/utils/analogy/Makefile.am +++ b/src/utils/analogy/Makefile.am @@ -3,7 +3,6 @@ sbin_PROGRAMS = analogy_config bin_PROGRAMS = \ cmd_read \ cmd_write \ - wf_cmd_write \ cmd_bits \ insn_read \ insn_write \ @@ -43,12 +42,6 @@ cmd_write_LDADD = \ ../../skins/rtdm/librtdm.la \ ../../skins/common/libxenomai.la -wf_cmd_write_SOURCES = wf_cmd_write.c -wf_cmd_write_LDADD = \ - ../../drvlib/analogy/libanalogy.la \ - ../../skins/rtdm/librtdm.la \ - ../../skins/common/libxenomai.la - cmd_bits_SOURCES = cmd_bits.c cmd_bits_LDADD = \ ../../drvlib/analogy/libanalogy.la \ diff --git a/src/utils/analogy/cmd_write.c b/src/utils/analogy/cmd_write.c index 3b3f1ab..43926fd 100644 --- a/src/utils/analogy/cmd_write.c +++ b/src/utils/analogy/cmd_write.c @@ -28,74 +28,53 @@ #include getopt.h #include string.h -#include native/task.h - #include analogy/analogy.h -/* Default command's parameters */ - -/* For write operation, we consider - the default subdevice index is 1 */ -#define ID_SUBD 1 -/* For simplicity sake, a maximum channel - count is defined */ -#define MAX_NB_CHAN 10 -/* Four channels used by default */ -#define NB_CHAN 4 -/* One hundred triggered scans by default */ -#define NB_SCAN 100 - -#define FILENAME analogy0 - -#define BUF_SIZE 1 - -static unsigned char buf[BUF_SIZE]; -static char *filename = FILENAME; -static char *str_chans = 0,1; -static unsigned int chans[MAX_NB_CHAN]; -static int verbose = 0; -static int real_time = 0; -static int use_mmap = 0; - -static RT_TASK rt_task_desc; - -/* The command to send by default */ -a4l_cmd_t cmd = { - .idx_subd = ID_SUBD, - .flags = 0, - .start_src = TRIG_INT, - .start_arg = 0, - .scan_begin_src = TRIG_TIMER, - .scan_begin_arg = 200, /* in ns */ - .convert_src = TRIG_NOW, - .convert_arg = 0, /* in ns */ - .scan_end_src = TRIG_COUNT, - .scan_end_arg = 0, - .stop_src = TRIG_COUNT, - .stop_arg = NB_SCAN, - .nb_chan = 0, - .chan_descs = chans, -}; +#define BUFFER_DEPTH 1024 + +struct config { + + /* Configuration parameters + TODO: add real_time and use_mmap*/ + + int verbose; + + int subd; + char *str_chans; + unsigned int *chans; + int chans_count; + char *str_ranges; + int scans_count; + + char *filename; + FILE *input; + + /* Analogy stuff */ + + a4l_desc_t dsc; + a4l_chinfo_t *cinfo; + a4l_rnginfo_t *rinfo; + + /* Buffer stuff + TODO: add buffer depth / size (useful for mmap) */ + void *buffer; -a4l_insn_t insn = { - .type = A4L_INSN_INTTRIG, - .idx_subd = ID_SUBD, - .data_size = 0, }; -struct option cmd_write_opts[] = { +/* --- Options / arguments part --- */ + +struct option options[] = { {verbose, no_argument, NULL, 'v'}, - {real-time, no_argument, NULL, 'r'}, {device, required_argument, NULL, 'd'}, {subdevice, required_argument, NULL, 's'}, - {scan-count, required_argument, NULL, 'S'}, + {scans-count, required_argument, NULL, 'S'}, {channels, required_argument, NULL, 'c'}, - {mmap, no_argument, NULL, 'm'}, + {range, required_argument, NULL, 'c'}, {help, no_argument, NULL, 'h'}, {0}, }; -void do_print_usage(void) +void print_usage(void) { fprintf(stdout, usage:\tcmd_write [OPTS]\n); fprintf(stdout, \tOPTS:\t -v, --verbose: verbose output\n); @@ -103,305 +82,419 @@ void do_print_usage(void) \t\t -d, --device: device filename (analogy0, analogy1, ...)\n); fprintf(stdout, \t\t -s, --subdevice: subdevice index\n); - fprintf(stdout, \t\t -S, --scan-count: count of scan to perform\n); - fprintf(stdout, \t\t -c, --channels: channels to use (ex.: -c 0,1)\n); - fprintf(stdout, \t\t -m, --mmap: mmap the buffer\n); + fprintf(stdout, \t\t -S, --scans-count: count of scan to perform\n); + fprintf(stdout, + \t\t -c, --channels: channels to use + i,j,... (ex.: -c 0,1)\n); + fprintf(stdout, + \t\t -R,