Module: xenomai-forge
Branch: master
Commit: 4b59c1457b9791f19e16108ce634ddeec2f01374
URL:    
http://git.xenomai.org/?p=xenomai-forge.git;a=commit;h=4b59c1457b9791f19e16108ce634ddeec2f01374

Author: Philippe Gerum <r...@xenomai.org>
Date:   Thu May 31 16:42:53 2012 +0200

psos: introduce --psos-time-slice

This option allows to specify the count of pSOS ticks forming a
round-robin time-slice.

---

 lib/psos/init.c |   19 ++++++++++++++++---
 1 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/lib/psos/init.c b/lib/psos/init.c
index 8120eae..45476da 100644
--- a/lib/psos/init.c
+++ b/lib/psos/init.c
@@ -39,6 +39,8 @@ unsigned int psos_long_names;
 
 static unsigned int clock_resolution = 1000000; /* 1ms */
 
+static unsigned int time_slice = 1000000; /* 1ms */
+
 static const struct option psos_options[] = {
        {
 #define clock_resolution_opt   0
@@ -48,6 +50,13 @@ static const struct option psos_options[] = {
                .val = 0
        },
        {
+#define time_slice_opt 1
+               .name = "psos-time-slice",
+               .has_arg = 1,
+               .flag = NULL,
+               .val = 0
+       },
+       {
                .name = NULL,
                .has_arg = 0,
                .flag = NULL,
@@ -61,6 +70,9 @@ static int psos_parse_option(int optnum, const char *optarg)
        case clock_resolution_opt:
                clock_resolution = atoi(optarg);
                break;
+       case time_slice_opt:
+               time_slice = atoi(optarg);
+               break;
        default:
                /* Paranoid, can't happen. */
                return -EINVAL;
@@ -71,7 +83,8 @@ static int psos_parse_option(int optnum, const char *optarg)
 
 static void psos_help(void)
 {
-        fprintf(stderr, "--psos-clock-resolution=<ns>  tick value (default 
1ms)\n");
+        fprintf(stderr, "--psos-clock-resolution=<ns>    tick value (default 
1ms)\n");
+        fprintf(stderr, "--psos-time-slice=<psos-ticks>  round-robin time 
slice\n");
 }
 
 static int psos_init(void)
@@ -99,8 +112,8 @@ static int psos_init(void)
                return __bt(ret);
        }
 
-       /* FIXME: this default 10-ticks value should be user-settable */
-       clockobj_ticks_to_timespec(&psos_clock, 10, &psos_rrperiod);
+       /* Convert pSOS ticks to timespec. */
+       clockobj_ticks_to_timespec(&psos_clock, time_slice, &psos_rrperiod);
 
        return 0;
 }


_______________________________________________
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://www.xenomai.org/mailman/listinfo/xenomai-git

Reply via email to