[Xenomai-git] Alexis Berlemont : analogy: update cmd_read and cmd_write with a wake-count option
Module: xenomai-head Branch: master Commit: 94240ab0d426d359d73caa64e41802a8b4697130 URL: http://git.xenomai.org/?p=xenomai-head.git;a=commit;h=94240ab0d426d359d73caa64e41802a8b4697130 Author: Alexis Berlemont alexis.berlem...@gmail.com Date: Tue May 10 23:55:29 2011 +0200 analogy: update cmd_read and cmd_write with a wake-count option --- src/utils/analogy/cmd_read.c | 22 +- src/utils/analogy/cmd_write.c | 32 +--- 2 files changed, 46 insertions(+), 8 deletions(-) diff --git a/src/utils/analogy/cmd_read.c b/src/utils/analogy/cmd_read.c index e23bf9b..ff8bb48 100644 --- a/src/utils/analogy/cmd_read.c +++ b/src/utils/analogy/cmd_read.c @@ -54,6 +54,7 @@ static unsigned int chans[MAX_NB_CHAN]; static int verbose = 0; static int real_time = 0; static int use_mmap = 0; +static unsigned long wake_count = 0; static RT_TASK rt_task_desc; @@ -84,6 +85,7 @@ struct option cmd_read_opts[] = { {channels, required_argument, NULL, 'c'}, {mmap, no_argument, NULL, 'm'}, {raw, no_argument, NULL, 'w'}, + {wake-count, required_argument, NULL, 'k'}, {help, no_argument, NULL, 'h'}, {0}, }; @@ -101,6 +103,9 @@ void do_print_usage(void) 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 -w, --raw: dump data in raw format\n); + fprintf(stdout, + \t\t -k, --wake-count: + space available before waking up the process\n); fprintf(stdout, \t\t -h, --help: print this help\n); } @@ -193,7 +198,8 @@ int main(int argc, char *argv[]) /* Compute arguments */ while ((ret = getopt_long(argc, argv, - vrd:s:S:c:mwh, cmd_read_opts, NULL)) = 0) { + vrd:s:S:c:mwk:h, + cmd_read_opts, NULL)) = 0) { switch (ret) { case 'v': verbose = 1; @@ -219,6 +225,9 @@ int main(int argc, char *argv[]) case 'w': dump_function = dump_raw; break; + case 'k': + wake_count = strtoul(optarg, NULL, 0); + break; case 'h': default: do_print_usage(); @@ -368,6 +377,17 @@ int main(int argc, char *argv[]) map); } + ret = a4l_set_wakesize(dsc, wake_count); + if (ret 0) { + fprintf(stderr, + cmd_read: a4l_set_wakesize failed (ret=%d)\n, ret); + goto out_main; + } + + if (verbose != 0) + printf(cmd_read: wake size successfully set (%lu)\n, + wake_count); + /* Send the command to the input device */ ret = a4l_snd_command(dsc, cmd); if (ret 0) { diff --git a/src/utils/analogy/cmd_write.c b/src/utils/analogy/cmd_write.c index 43926fd..453c033 100644 --- a/src/utils/analogy/cmd_write.c +++ b/src/utils/analogy/cmd_write.c @@ -44,7 +44,8 @@ struct config { unsigned int *chans; int chans_count; char *str_ranges; - int scans_count; + unsigned long scans_count; + unsigned long wake_count; char *filename; FILE *input; @@ -70,6 +71,7 @@ struct option options[] = { {scans-count, required_argument, NULL, 'S'}, {channels, required_argument, NULL, 'c'}, {range, required_argument, NULL, 'c'}, + {wake-count, required_argument, NULL, 'k'}, {help, no_argument, NULL, 'h'}, {0}, }; @@ -84,11 +86,15 @@ void print_usage(void) fprintf(stdout, \t\t -s, --subdevice: subdevice index\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); + \t\t -c, --channels: + channels to use i,j,... (ex.: -c 0,1)\n); fprintf(stdout, - \t\t -R, --range: range to use - min,max,unit (ex.: -R 0,1,V)\n); + \t\t -R, --range: + range to use min,max,unit (ex.: -R 0,1,V)\n); + fprintf(stdout, + \t\t -k, --wake-count: + space available before waking up the process\n); + fprintf(stdout, \t\t -h, --help: print this help\n); } @@ -242,7 +248,8 @@ void print_config(struct config *cfg) printf(\tSubdevice index: %d\n, cfg-subd); printf(\tSelected channels: %s\n, cfg-str_chans); printf(\tSelected range: %s\n, cfg-str_ranges); - printf(\tScans count: %d\n, cfg-scans_count); + printf(\tScans count: %lu\n, cfg-scans_count); + printf(\tWake count: %lu\n, cfg-wake_count);
[Xenomai-git] Alexis Berlemont : analogy: update cmd_read and cmd_write with a wake-count option
Module: xenomai-abe Branch: experimental Commit: efdc97352d8f32db4f5cb0460ab0953b05b10e12 URL: http://git.xenomai.org/?p=xenomai-abe.git;a=commit;h=efdc97352d8f32db4f5cb0460ab0953b05b10e12 Author: Alexis Berlemont alexis.berlem...@gmail.com Date: Tue May 10 23:55:29 2011 +0200 analogy: update cmd_read and cmd_write with a wake-count option --- src/utils/analogy/cmd_read.c | 22 +- src/utils/analogy/cmd_write.c | 32 +--- 2 files changed, 46 insertions(+), 8 deletions(-) diff --git a/src/utils/analogy/cmd_read.c b/src/utils/analogy/cmd_read.c index e23bf9b..ff8bb48 100644 --- a/src/utils/analogy/cmd_read.c +++ b/src/utils/analogy/cmd_read.c @@ -54,6 +54,7 @@ static unsigned int chans[MAX_NB_CHAN]; static int verbose = 0; static int real_time = 0; static int use_mmap = 0; +static unsigned long wake_count = 0; static RT_TASK rt_task_desc; @@ -84,6 +85,7 @@ struct option cmd_read_opts[] = { {channels, required_argument, NULL, 'c'}, {mmap, no_argument, NULL, 'm'}, {raw, no_argument, NULL, 'w'}, + {wake-count, required_argument, NULL, 'k'}, {help, no_argument, NULL, 'h'}, {0}, }; @@ -101,6 +103,9 @@ void do_print_usage(void) 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 -w, --raw: dump data in raw format\n); + fprintf(stdout, + \t\t -k, --wake-count: + space available before waking up the process\n); fprintf(stdout, \t\t -h, --help: print this help\n); } @@ -193,7 +198,8 @@ int main(int argc, char *argv[]) /* Compute arguments */ while ((ret = getopt_long(argc, argv, - vrd:s:S:c:mwh, cmd_read_opts, NULL)) = 0) { + vrd:s:S:c:mwk:h, + cmd_read_opts, NULL)) = 0) { switch (ret) { case 'v': verbose = 1; @@ -219,6 +225,9 @@ int main(int argc, char *argv[]) case 'w': dump_function = dump_raw; break; + case 'k': + wake_count = strtoul(optarg, NULL, 0); + break; case 'h': default: do_print_usage(); @@ -368,6 +377,17 @@ int main(int argc, char *argv[]) map); } + ret = a4l_set_wakesize(dsc, wake_count); + if (ret 0) { + fprintf(stderr, + cmd_read: a4l_set_wakesize failed (ret=%d)\n, ret); + goto out_main; + } + + if (verbose != 0) + printf(cmd_read: wake size successfully set (%lu)\n, + wake_count); + /* Send the command to the input device */ ret = a4l_snd_command(dsc, cmd); if (ret 0) { diff --git a/src/utils/analogy/cmd_write.c b/src/utils/analogy/cmd_write.c index 43926fd..453c033 100644 --- a/src/utils/analogy/cmd_write.c +++ b/src/utils/analogy/cmd_write.c @@ -44,7 +44,8 @@ struct config { unsigned int *chans; int chans_count; char *str_ranges; - int scans_count; + unsigned long scans_count; + unsigned long wake_count; char *filename; FILE *input; @@ -70,6 +71,7 @@ struct option options[] = { {scans-count, required_argument, NULL, 'S'}, {channels, required_argument, NULL, 'c'}, {range, required_argument, NULL, 'c'}, + {wake-count, required_argument, NULL, 'k'}, {help, no_argument, NULL, 'h'}, {0}, }; @@ -84,11 +86,15 @@ void print_usage(void) fprintf(stdout, \t\t -s, --subdevice: subdevice index\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); + \t\t -c, --channels: + channels to use i,j,... (ex.: -c 0,1)\n); fprintf(stdout, - \t\t -R, --range: range to use - min,max,unit (ex.: -R 0,1,V)\n); + \t\t -R, --range: + range to use min,max,unit (ex.: -R 0,1,V)\n); + fprintf(stdout, + \t\t -k, --wake-count: + space available before waking up the process\n); + fprintf(stdout, \t\t -h, --help: print this help\n); } @@ -242,7 +248,8 @@ void print_config(struct config *cfg) printf(\tSubdevice index: %d\n, cfg-subd); printf(\tSelected channels: %s\n, cfg-str_chans); printf(\tSelected range: %s\n, cfg-str_ranges); - printf(\tScans count: %d\n, cfg-scans_count); + printf(\tScans count: %lu\n, cfg-scans_count); + printf(\tWake count: %lu\n,
[Xenomai-git] Alexis Berlemont : analogy: update cmd_read and cmd_write with a wake-count option
Module: xenomai-abe Branch: experimental Commit: c80f2862b4b969a2df8957f8879241fa95731bf4 URL: http://git.xenomai.org/?p=xenomai-abe.git;a=commit;h=c80f2862b4b969a2df8957f8879241fa95731bf4 Author: Alexis Berlemont alexis.berlem...@gmail.com Date: Tue May 10 23:55:29 2011 +0200 analogy: update cmd_read and cmd_write with a wake-count option --- src/utils/analogy/cmd_read.c | 22 +- src/utils/analogy/cmd_write.c | 32 +--- 2 files changed, 46 insertions(+), 8 deletions(-) diff --git a/src/utils/analogy/cmd_read.c b/src/utils/analogy/cmd_read.c index e23bf9b..ff8bb48 100644 --- a/src/utils/analogy/cmd_read.c +++ b/src/utils/analogy/cmd_read.c @@ -54,6 +54,7 @@ static unsigned int chans[MAX_NB_CHAN]; static int verbose = 0; static int real_time = 0; static int use_mmap = 0; +static unsigned long wake_count = 0; static RT_TASK rt_task_desc; @@ -84,6 +85,7 @@ struct option cmd_read_opts[] = { {channels, required_argument, NULL, 'c'}, {mmap, no_argument, NULL, 'm'}, {raw, no_argument, NULL, 'w'}, + {wake-count, required_argument, NULL, 'k'}, {help, no_argument, NULL, 'h'}, {0}, }; @@ -101,6 +103,9 @@ void do_print_usage(void) 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 -w, --raw: dump data in raw format\n); + fprintf(stdout, + \t\t -k, --wake-count: + space available before waking up the process\n); fprintf(stdout, \t\t -h, --help: print this help\n); } @@ -193,7 +198,8 @@ int main(int argc, char *argv[]) /* Compute arguments */ while ((ret = getopt_long(argc, argv, - vrd:s:S:c:mwh, cmd_read_opts, NULL)) = 0) { + vrd:s:S:c:mwk:h, + cmd_read_opts, NULL)) = 0) { switch (ret) { case 'v': verbose = 1; @@ -219,6 +225,9 @@ int main(int argc, char *argv[]) case 'w': dump_function = dump_raw; break; + case 'k': + wake_count = strtoul(optarg, NULL, 0); + break; case 'h': default: do_print_usage(); @@ -368,6 +377,17 @@ int main(int argc, char *argv[]) map); } + ret = a4l_set_wakesize(dsc, wake_count); + if (ret 0) { + fprintf(stderr, + cmd_read: a4l_set_wakesize failed (ret=%d)\n, ret); + goto out_main; + } + + if (verbose != 0) + printf(cmd_read: wake size successfully set (%lu)\n, + wake_count); + /* Send the command to the input device */ ret = a4l_snd_command(dsc, cmd); if (ret 0) { diff --git a/src/utils/analogy/cmd_write.c b/src/utils/analogy/cmd_write.c index 43926fd..453c033 100644 --- a/src/utils/analogy/cmd_write.c +++ b/src/utils/analogy/cmd_write.c @@ -44,7 +44,8 @@ struct config { unsigned int *chans; int chans_count; char *str_ranges; - int scans_count; + unsigned long scans_count; + unsigned long wake_count; char *filename; FILE *input; @@ -70,6 +71,7 @@ struct option options[] = { {scans-count, required_argument, NULL, 'S'}, {channels, required_argument, NULL, 'c'}, {range, required_argument, NULL, 'c'}, + {wake-count, required_argument, NULL, 'k'}, {help, no_argument, NULL, 'h'}, {0}, }; @@ -84,11 +86,15 @@ void print_usage(void) fprintf(stdout, \t\t -s, --subdevice: subdevice index\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); + \t\t -c, --channels: + channels to use i,j,... (ex.: -c 0,1)\n); fprintf(stdout, - \t\t -R, --range: range to use - min,max,unit (ex.: -R 0,1,V)\n); + \t\t -R, --range: + range to use min,max,unit (ex.: -R 0,1,V)\n); + fprintf(stdout, + \t\t -k, --wake-count: + space available before waking up the process\n); + fprintf(stdout, \t\t -h, --help: print this help\n); } @@ -242,7 +248,8 @@ void print_config(struct config *cfg) printf(\tSubdevice index: %d\n, cfg-subd); printf(\tSelected channels: %s\n, cfg-str_chans); printf(\tSelected range: %s\n, cfg-str_ranges); - printf(\tScans count: %d\n, cfg-scans_count); + printf(\tScans count: %lu\n, cfg-scans_count); + printf(\tWake count: %lu\n,
[Xenomai-git] Alexis Berlemont : analogy: update cmd_read and cmd_write with a wake-count option
Module: xenomai-abe Branch: experimental Commit: 931c2717d2501db60f59864f29bacd35b8da38b6 URL: http://git.xenomai.org/?p=xenomai-abe.git;a=commit;h=931c2717d2501db60f59864f29bacd35b8da38b6 Author: Alexis Berlemont alexis.berlem...@gmail.com Date: Tue May 10 23:55:29 2011 +0200 analogy: update cmd_read and cmd_write with a wake-count option --- src/utils/analogy/cmd_read.c | 22 +- src/utils/analogy/cmd_write.c | 32 +--- 2 files changed, 46 insertions(+), 8 deletions(-) diff --git a/src/utils/analogy/cmd_read.c b/src/utils/analogy/cmd_read.c index 47208c5..db5b1ec 100644 --- a/src/utils/analogy/cmd_read.c +++ b/src/utils/analogy/cmd_read.c @@ -54,6 +54,7 @@ static unsigned int chans[MAX_NB_CHAN]; static int verbose = 0; static int real_time = 0; static int use_mmap = 0; +static unsigned long wake_count = 0; static RT_TASK rt_task_desc; @@ -84,6 +85,7 @@ struct option cmd_read_opts[] = { {channels, required_argument, NULL, 'c'}, {mmap, no_argument, NULL, 'm'}, {raw, no_argument, NULL, 'w'}, + {wake-count, required_argument, NULL, 'k'}, {help, no_argument, NULL, 'h'}, {0}, }; @@ -101,6 +103,9 @@ void do_print_usage(void) 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 -w, --raw: dump data in raw format\n); + fprintf(stdout, + \t\t -k, --wake-count: + space available before waking up the process\n); fprintf(stdout, \t\t -h, --help: print this help\n); } @@ -193,7 +198,8 @@ int main(int argc, char *argv[]) /* Compute arguments */ while ((ret = getopt_long(argc, argv, - vrd:s:S:c:mwh, cmd_read_opts, NULL)) = 0) { + vrd:s:S:c:mwk:h, + cmd_read_opts, NULL)) = 0) { switch (ret) { case 'v': verbose = 1; @@ -219,6 +225,9 @@ int main(int argc, char *argv[]) case 'w': dump_function = dump_raw; break; + case 'k': + wake_count = strtoul(optarg, NULL, 0); + break; case 'h': default: do_print_usage(); @@ -368,6 +377,17 @@ int main(int argc, char *argv[]) map); } + ret = a4l_set_wakesize(dsc, wake_count); + if (ret 0) { + fprintf(stderr, + cmd_read: a4l_set_wakesize failed (ret=%d)\n, ret); + goto out_main; + } + + if (verbose != 0) + printf(cmd_read: wake size successfully set (%lu)\n, + wake_count); + /* Send the command to the input device */ ret = a4l_snd_command(dsc, cmd); if (ret 0) { diff --git a/src/utils/analogy/cmd_write.c b/src/utils/analogy/cmd_write.c index 05ac08a..fc5e4d8 100644 --- a/src/utils/analogy/cmd_write.c +++ b/src/utils/analogy/cmd_write.c @@ -44,7 +44,8 @@ struct config { unsigned int *chans; int chans_count; char *str_ranges; - int scans_count; + unsigned long scans_count; + unsigned long wake_count; char *filename; FILE *input; @@ -70,6 +71,7 @@ struct option options[] = { {scans-count, required_argument, NULL, 'S'}, {channels, required_argument, NULL, 'c'}, {range, required_argument, NULL, 'c'}, + {wake-count, required_argument, NULL, 'k'}, {help, no_argument, NULL, 'h'}, {0}, }; @@ -84,11 +86,15 @@ void print_usage(void) fprintf(stdout, \t\t -s, --subdevice: subdevice index\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); + \t\t -c, --channels: + channels to use i,j,... (ex.: -c 0,1)\n); fprintf(stdout, - \t\t -R, --range: range to use - min,max,unit (ex.: -R 0,1,V)\n); + \t\t -R, --range: + range to use min,max,unit (ex.: -R 0,1,V)\n); + fprintf(stdout, + \t\t -k, --wake-count: + space available before waking up the process\n); + fprintf(stdout, \t\t -h, --help: print this help\n); } @@ -242,7 +248,8 @@ void print_config(struct config *cfg) printf(\tSubdevice index: %d\n, cfg-subd); printf(\tSelected channels: %s\n, cfg-str_chans); printf(\tSelected range: %s\n, cfg-str_ranges); - printf(\tScans count: %d\n, cfg-scans_count); + printf(\tScans count: %lu\n, cfg-scans_count); + printf(\tWake count: %lu\n,