task1.c 1.18 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
#include "system.h"
#include <stdio.h>

rtems_task Task1_EntryPoint(rtems_task_argument argument)
{
    int task_no = (int) argument;
    task_begin(task_no);

    int j;
    double d=task_no;
    for(j=0; j<10000; j++) {
        int k;
        for(k=0; k<10000; k++)
            d+=1.001;
        d*=1.0001;
    }
    {
        long result = (long) d;
        long target = 0;
        switch(task_no) {
        case 0:
            target = 172003605L;
            break;
        case 2:
            target = 172003611L;
            break;
        default:
            printf(
                "[TASK %d] Failed! Unexpected task number for FPU tests...\n",
                task_no);
            fflush(stdout);
            all_OK = 0;
            task_end(task_no);
            return;
        }
        if (target != result) {
            printf(
                "[TASK %d] Failed! Computed value was %ld instead of %ld\n",
                task_no, result, target);
            fflush(stdout);
            all_OK = 0;
            task_end(task_no);
            return;
        }
    }
    printf("[TASK %d] Computed the correct floating point result.\n", task_no); 
    fflush(stdout);
    task_end(task_no);
}