initial commit
authorroot <root@xenomailinux.localdomain>
Fri, 11 Sep 2015 14:30:21 +0000 (16:30 +0200)
committerroot <root@xenomailinux.localdomain>
Fri, 11 Sep 2015 14:30:21 +0000 (16:30 +0200)
mart/ex01/Makefile [new file with mode: 0644]
mart/ex01/ex01.c [new file with mode: 0644]
mart/ex01/ex01b.c [new file with mode: 0644]
mart/ex02/Makefile [new file with mode: 0644]
mart/ex02/ex02a.c [new file with mode: 0644]
mart/ex02/ex02b.c [new file with mode: 0644]
mart/ex02/ex02c.c [new file with mode: 0644]
mart/ex02/ex02d.c [new file with mode: 0644]

diff --git a/mart/ex01/Makefile b/mart/ex01/Makefile
new file mode 100644 (file)
index 0000000..eb643f0
--- /dev/null
@@ -0,0 +1,9 @@
+CFLAGS=$(shell xeno-config --xeno-cflags) -lnative -lrtdk
+LDFLAGS=$(shell xeno-config --xeno-ldflags)
+
+BINARIES=ex01 ex01b
+
+all: $(BINARIES)
+
+clean:
+       $(RM) -v $(BINARIES) *.o
diff --git a/mart/ex01/ex01.c b/mart/ex01/ex01.c
new file mode 100644 (file)
index 0000000..13742a7
--- /dev/null
@@ -0,0 +1,56 @@
+#include <stdio.h>
+#include <signal.h>
+#include <unistd.h>
+#include <sys/mman.h>
+
+#include <native/task.h>
+#include <native/timer.h>
+
+#include  <rtdk.h>
+RT_TASK demo_task;
+
+void demo(void *arg)
+{
+  RT_TASK *curtask;
+  RT_TASK_INFO curtaskinfo;
+
+  // hello world
+  rt_printf("Hello World!\n");
+
+  // inquire current task
+  curtask=rt_task_self();
+  rt_task_inquire(curtask,&curtaskinfo);
+
+  // print task name
+  rt_printf("Task name : %s \n", curtaskinfo.name);
+}
+
+int main(int argc, char* argv[])
+{
+  char  str[10] ;
+
+  // Perform auto-init of rt_print buffers if the task doesn't do so
+  rt_print_auto_init(1);
+
+  // Lock memory : avoid memory swapping for this program
+  mlockall(MCL_CURRENT|MCL_FUTURE);
+
+  rt_printf("start task\n");
+
+  /*
+   * Arguments: &task,
+   *            name,
+   *            stack size (0=default),
+   *            priority,
+   *            mode (FPU, start suspended, ...)
+   */
+  sprintf(str,"hello");
+  rt_task_create(&demo_task, str, 0, 50, 0);
+
+  /*
+   * Arguments: &task,
+   *            task function,
+   *            function argument
+   */
+  rt_task_start(&demo_task, &demo, 0);
+}
diff --git a/mart/ex01/ex01b.c b/mart/ex01/ex01b.c
new file mode 100644 (file)
index 0000000..bf6baa5
--- /dev/null
@@ -0,0 +1,56 @@
+#include <stdio.h>
+#include <signal.h>
+#include <unistd.h>
+#include <sys/mman.h>
+
+#include <native/task.h>
+#include <native/timer.h>
+
+#include  <rtdk.h>
+RT_TASK demo_task;
+
+void demo(void *arg)
+{
+  RT_TASK *curtask;
+  RT_TASK_INFO curtaskinfo;
+
+  // hello world
+  rt_printf("Hello World!\n");
+
+  // inquire current task
+//  curtask=rt_task_self();
+  rt_task_inquire(curtask,&curtaskinfo);
+
+  // print task name
+  rt_printf("Task name : %s \n", curtaskinfo.name);
+}
+
+int main(int argc, char* argv[])
+{
+  char  str[10] ;
+
+  // Perform auto-init of rt_print buffers if the task doesn't do so
+  rt_print_auto_init(1);
+
+  // Lock memory : avoid memory swapping for this program
+  mlockall(MCL_CURRENT|MCL_FUTURE);
+
+  rt_printf("start task\n");
+
+  /*
+   * Arguments: &task,
+   *            name,
+   *            stack size (0=default),
+   *            priority,
+   *            mode (FPU, start suspended, ...)
+   */
+  sprintf(str,"hello");
+  rt_task_create(&demo_task, str, 0, 50, 0);
+
+  /*
+   * Arguments: &task,
+   *            task function,
+   *            function argument
+   */
+  rt_task_start(&demo_task, &demo, 0);
+}
diff --git a/mart/ex02/Makefile b/mart/ex02/Makefile
new file mode 100644 (file)
index 0000000..0511f0e
--- /dev/null
@@ -0,0 +1,9 @@
+CFLAGS=$(shell xeno-config --xeno-cflags) -lnative -lrtdk
+LDFLAGS=$(shell xeno-config --xeno-ldflags)
+
+BINARIES=$(addprefix ex02,a b c d)
+
+all: $(BINARIES)
+
+clean:
+       $(RM) -v $(BINARIES) *.o
diff --git a/mart/ex02/ex02a.c b/mart/ex02/ex02a.c
new file mode 100644 (file)
index 0000000..f8d059f
--- /dev/null
@@ -0,0 +1,43 @@
+#include <stdio.h>
+#include <signal.h>
+#include <unistd.h>
+#include <sys/mman.h>
+
+#include <native/task.h>
+#include <native/timer.h>
+
+#include       <rtdk.h>
+
+RT_TASK task1;
+RT_TASK task2;
+RT_TASK task3;
+RT_TASK task4;
+RT_TASK task5;
+
+void demo(void *arg)
+{
+       RT_TASK *curtask;
+       RT_TASK_INFO curtaskinfo;
+       curtask=rt_task_self();
+       rt_task_inquire(curtask,&curtaskinfo);
+       rt_printf("Task name: %s\n", curtaskinfo.name);
+}
+
+int main(int argc, char* argv[])
+{
+       rt_print_auto_init(1);
+       mlockall(MCL_CURRENT|MCL_FUTURE);
+       rt_printf("start task\n");
+
+       rt_task_create(&task1, "t1", 0, 50, 0);
+       rt_task_create(&task2, "t2", 0, 50, 0);
+       rt_task_create(&task3, "t3", 0, 50, 0);
+       rt_task_create(&task4, "t4", 0, 50, 0);
+       rt_task_create(&task5, "t5", 0, 50, 0);
+
+       rt_task_start(&task1, &demo, 0);
+       rt_task_start(&task2, &demo, 0);
+       rt_task_start(&task3, &demo, 0);
+       rt_task_start(&task4, &demo, 0);
+       rt_task_start(&task5, &demo, 0);
+}
diff --git a/mart/ex02/ex02b.c b/mart/ex02/ex02b.c
new file mode 100644 (file)
index 0000000..42dd63e
--- /dev/null
@@ -0,0 +1,51 @@
+#include <stdio.h>
+#include <signal.h>
+#include <unistd.h>
+#include <sys/mman.h>
+
+#include <native/task.h>
+#include <native/timer.h>
+
+#include       <rtdk.h>
+
+RT_TASK task1;
+RT_TASK task2;
+RT_TASK task3;
+RT_TASK task4;
+RT_TASK task5;
+
+void demo(void *arg)
+{
+       int num = *(int *)arg;
+       RT_TASK *curtask;
+       RT_TASK_INFO curtaskinfo;
+       curtask=rt_task_self();
+       rt_task_inquire(curtask,&curtaskinfo);
+       rt_printf("Task name: %s with num %d \n",
+               curtaskinfo.name, num);
+}
+
+int main(int argc, char* argv[])
+{
+       rt_print_auto_init(1);
+       mlockall(MCL_CURRENT|MCL_FUTURE);
+       rt_printf("start task\n");
+
+       rt_task_create(&task1, "t1", 0, 50, 0);
+       rt_task_create(&task2, "t2", 0, 50, 0);
+       rt_task_create(&task3, "t3", 0, 50, 0);
+       rt_task_create(&task4, "t4", 0, 50, 0);
+       rt_task_create(&task5, "t5", 0, 50, 0);
+
+       int num1 = 42;
+       int num2 = 43;
+       int num3 = 44;
+       int num4 = 45;
+       int num5 = 46;
+
+       rt_task_start(&task1, &demo, (void *)&num1);
+       rt_task_start(&task2, &demo, (void *)&num2);
+       rt_task_start(&task3, &demo, (void *)&num3);
+       rt_task_start(&task4, &demo, (void *)&num4);
+       rt_task_start(&task5, &demo, (void *)&num5);
+}
diff --git a/mart/ex02/ex02c.c b/mart/ex02/ex02c.c
new file mode 100644 (file)
index 0000000..1fdf708
--- /dev/null
@@ -0,0 +1,51 @@
+#include <stdio.h>
+#include <signal.h>
+#include <unistd.h>
+#include <sys/mman.h>
+
+#include <native/task.h>
+#include <native/timer.h>
+
+#include       <rtdk.h>
+
+RT_TASK task1;
+RT_TASK task2;
+RT_TASK task3;
+RT_TASK task4;
+RT_TASK task5;
+
+void demo(void *arg)
+{
+       int num = *(int *)arg;
+       RT_TASK *curtask;
+       RT_TASK_INFO curtaskinfo;
+       curtask=rt_task_self();
+       rt_task_inquire(curtask,&curtaskinfo);
+       rt_printf("Task name: %s with num %d \n",
+               curtaskinfo.name, num);
+}
+
+int main(int argc, char* argv[])
+{
+       rt_print_auto_init(1);
+       mlockall(MCL_CURRENT|MCL_FUTURE);
+       rt_printf("start task\n");
+
+       rt_task_create(&task1, "t1", 0, 50, 0);
+       rt_task_create(&task2, "t2", 0, 49, 0);
+       rt_task_create(&task3, "t3", 0, 48, 0);
+       rt_task_create(&task4, "t4", 0, 47, 0);
+       rt_task_create(&task5, "t5", 0, 46, 0);
+
+       int num1 = 42;
+       int num2 = 43;
+       int num3 = 44;
+       int num4 = 45;
+       int num5 = 46;
+
+       rt_task_start(&task1, &demo, (void *)&num1);
+       rt_task_start(&task2, &demo, (void *)&num2);
+       rt_task_start(&task3, &demo, (void *)&num3);
+       rt_task_start(&task4, &demo, (void *)&num4);
+       rt_task_start(&task5, &demo, (void *)&num5);
+}
diff --git a/mart/ex02/ex02d.c b/mart/ex02/ex02d.c
new file mode 100644 (file)
index 0000000..8549055
--- /dev/null
@@ -0,0 +1,51 @@
+#include <stdio.h>
+#include <signal.h>
+#include <unistd.h>
+#include <sys/mman.h>
+
+#include <native/task.h>
+#include <native/timer.h>
+
+#include <rtdk.h>
+
+RT_TASK task1;
+RT_TASK task2;
+RT_TASK task3;
+RT_TASK task4;
+RT_TASK task5;
+
+void demo(void *arg)
+{
+       int num = *(int *)arg;
+       RT_TASK *curtask;
+       RT_TASK_INFO curtaskinfo;
+       curtask=rt_task_self();
+       rt_task_inquire(curtask,&curtaskinfo);
+       rt_printf("Task name: %s with num %d \n",
+               curtaskinfo.name, num);
+}
+
+int main(int argc, char* argv[])
+{
+       rt_print_auto_init(1);
+       mlockall(MCL_CURRENT|MCL_FUTURE);
+       rt_printf("start task\n");
+
+       rt_task_create(&task1, "t1", 0, 50, 0);
+       rt_task_create(&task2, "t2", 0, 50, 0);
+       rt_task_create(&task3, "t3", 0, 50, 0);
+       rt_task_create(&task4, "t4", 0, 50, 0);
+       rt_task_create(&task5, "t5", 0, 50, 0);
+
+       int num1 = 42;
+       int num2 = 43;
+       int num3 = 44;
+       int num4 = 45;
+       int num5 = 46;
+
+       rt_task_start(&task1, &demo, (void *)&num1);
+       rt_task_start(&task2, &demo, (void *)&num2);
+       rt_task_start(&task3, &demo, (void *)&num3);
+       rt_task_start(&task4, &demo, (void *)&num4);
+       rt_task_start(&task5, &demo, (void *)&num5);
+}