Commit a03d9fbf authored by Thanassis Tsiodras's avatar Thanassis Tsiodras

Added a non-FPU task in the example

parent f03cf5d7
......@@ -43,8 +43,9 @@ NONFPU_SRC= \
init.c \
${EDISOFT_SRC}
FPU_SRC= \
task1.c
FPU_SRC= \
task1.c \
task2.c
# Build a Dependency list and an Object list, by replacing the .c
# extension to .d for dependency files, and .o for object files.
......
......@@ -25,8 +25,9 @@ rtems_task Init(rtems_task_argument argument)
Task_name[i],
(rtems_task_priority) 2,
RTEMS_MINIMUM_STACK_SIZE,
RTEMS_DEFAULT_MODES,
RTEMS_FLOATING_POINT, // use RTEMS_DEFAULT_ATTRIBUTES for non-native FPU tasks
RTEMS_DEFAULT_MODES, // use RTEMS_DEFAULT_MODES | RTEMS_TIMESLICE for Linux/Windows like
// handling of tasks with same priority (i.e. pre-emption)
i == 0 ? RTEMS_FLOATING_POINT : RTEMS_DEFAULT_ATTRIBUTES,
&Task_id[i]);
if (status != RTEMS_SUCCESSFUL) {
printk("Failed to rtems_task_create... status:%0x\n", status);
......@@ -36,7 +37,7 @@ rtems_task Init(rtems_task_argument argument)
// Start Task
status = rtems_task_start(
Task_id[i],
Task_EntryPoint,
i == 0 ? Task1_EntryPoint : Task2_EntryPoint,
i);
}
printk("Parent task sleeps for a second...\n");
......
......@@ -3,7 +3,8 @@
#include <rtems/rtems/tasks.h>
rtems_task Init(rtems_task_argument argument);
rtems_task Task_EntryPoint(rtems_task_argument argument);
rtems_task Task1_EntryPoint(rtems_task_argument argument);
rtems_task Task2_EntryPoint(rtems_task_argument argument);
#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
#define CONFIGURE_MAXIMUM_TASKS 64
......
#include "system.h"
#include "printk.h"
rtems_task Task_EntryPoint(rtems_task_argument argument)
rtems_task Task1_EntryPoint(rtems_task_argument argument)
{
int task_no = (int) argument;
printk("Inside task %d...\n", task_no);
......
#include "system.h"
#include "printk.h"
rtems_task Task2_EntryPoint(rtems_task_argument argument)
{
int task_no = (int) argument;
printk("Inside task %d...\n", task_no);
int j;
long long int dummy = 0;
for(j=0; j<100000; j++) {
int k;
for(k=0; k<100; k++)
dummy ^= k;
dummy++;
}
printk("Computed value by task %d was %d,%d\n", task_no, dummy&0xffffffff, dummy>>32);
rtems_task_delete(RTEMS_SELF);
}
......@@ -25,11 +25,12 @@ endif
# Your source files: regardless of where they reside in the source tree,
# VPATH will locate them...
NONFPU_SRC= \
NONFPU_SRC= \
init.c
FPU_SRC= \
task1.c
FPU_SRC= \
task1.c \
task2.c
# Build a Dependency list and an Object list, by replacing the .c
# extension to .d for dependency files, and .o for object files.
......
......@@ -25,9 +25,9 @@ rtems_task Init(rtems_task_argument argument)
Task_name[i],
(rtems_task_priority) 2,
RTEMS_MINIMUM_STACK_SIZE,
RTEMS_DEFAULT_MODES, // use RTEMS_DEFAULT_MODES | RTEMS_TIMESLICE for Linux/Windows like
// handling of tasks with same priority (i.e. pre-emption)
RTEMS_FLOATING_POINT, // use RTEMS_DEFAULT_ATTRIBUTES for non-native FPU tasks
RTEMS_DEFAULT_MODES, // use RTEMS_DEFAULT_MODES | RTEMS_TIMESLICE for Linux/Windows like
// handling of tasks with same priority (i.e. pre-emption)
i == 0 ? RTEMS_FLOATING_POINT : RTEMS_DEFAULT_ATTRIBUTES,
&Task_id[i]);
if (status != RTEMS_SUCCESSFUL) {
printf("Failed to rtems_task_create... status:%0x\n", status);
......@@ -37,7 +37,7 @@ rtems_task Init(rtems_task_argument argument)
// Start Task
status = rtems_task_start(
Task_id[i],
Task_EntryPoint,
i == 0 ? Task1_EntryPoint : Task2_EntryPoint,
i);
}
printf("Parent task sleeps for a second...\n");
......
......@@ -3,7 +3,8 @@
#include <rtems/rtems/tasks.h>
rtems_task Init(rtems_task_argument argument);
rtems_task Task_EntryPoint(rtems_task_argument argument);
rtems_task Task1_EntryPoint(rtems_task_argument argument);
rtems_task Task2_EntryPoint(rtems_task_argument argument);
#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
#define CONFIGURE_MAXIMUM_TASKS 64
......
#include "system.h"
#include <stdio.h>
rtems_task Task_EntryPoint(rtems_task_argument argument)
rtems_task Task1_EntryPoint(rtems_task_argument argument)
{
int task_no = (int) argument;
printf("Inside task %d...\n", task_no);
......
#include "system.h"
#include <stdio.h>
rtems_task Task2_EntryPoint(rtems_task_argument argument)
{
int task_no = (int) argument;
printf("Inside task %d...\n", task_no);
fflush(stdout);
//rtems_task_wake_after(100);
int j;
long long int dummy = 0;
for(j=0; j<100000; j++) {
int k;
for(k=0; k<100; k++)
dummy ^= k;
dummy++;
}
printf("Computed value by task %d was %lld\n", task_no, dummy);
rtems_task_delete(RTEMS_SELF);
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment