summaryrefslogtreecommitdiff
path: root/cesar/maximus/stationtest/src/one_thread.c
diff options
context:
space:
mode:
Diffstat (limited to 'cesar/maximus/stationtest/src/one_thread.c')
-rw-r--r--cesar/maximus/stationtest/src/one_thread.c47
1 files changed, 47 insertions, 0 deletions
diff --git a/cesar/maximus/stationtest/src/one_thread.c b/cesar/maximus/stationtest/src/one_thread.c
new file mode 100644
index 0000000000..794bacfcb8
--- /dev/null
+++ b/cesar/maximus/stationtest/src/one_thread.c
@@ -0,0 +1,47 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2007 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file one_thread.c
+ * \brief test program with only one thread
+ * \ingroup
+ *
+ * this is a test program to check eCos well work
+ */
+
+#include <cyg/kernel/kapi.h>
+#include <cyg/infra/diag.h>
+
+#define MY_THREAD_STACK_SIZE (2048 / sizeof(int))
+
+int my_thread_stack[MY_THREAD_STACK_SIZE];
+cyg_handle_t my_thread_handle;
+cyg_thread my_thread_obj;
+
+void my_thread(cyg_addrword_t index)
+{
+ unsigned int my_counter = 0;
+ while(1)
+ {
+ diag_printf("hello, count=%d\n",my_counter);
+ my_counter++;
+ }
+}
+
+void cyg_user_start(void)
+{
+
+ cyg_thread_create(12, my_thread, (cyg_addrword_t) 0,
+ "My Thread", &my_thread_stack, MY_THREAD_STACK_SIZE,
+ &my_thread_handle, &my_thread_obj);
+
+ cyg_thread_resume(my_thread_handle);
+ diag_write_string("scheduler starting...\n");
+
+ cyg_scheduler_start();
+}
+