diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 1999-03-17 16:01:03 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 1999-03-17 16:01:03 +0000 |
commit | f4a8ee1c55788aeb053ede7571b07906a9847a45 (patch) | |
tree | 7417825a9a351aaf100374b08d314756523bef5f /testsuites/samples/unlimited/init.c | |
parent | Suggested rephrasing of inline versus macros option by Chris Johns (diff) | |
download | rtems-f4a8ee1c55788aeb053ede7571b07906a9847a45.tar.bz2 |
Unlimited objects patch from Chris Johns <ccj@acm.org>. Email follows:
First, the unlimited patch. I have compiled the unlmited patch for the
Linux posix BSP only and it seems to work cleanly. I would like a really
major application run on this change before commiting as the changes are
very core and significant. I am currently building all the tests to run.
I have no targets suitable to test on at the moment.
I have tested the patch for inline functions and macros.
Turning macros on has found some core bugs. I have fixed these but have
not run all the tests. Please review the patch for these changes. They
are:
1) The conditional compilation for MP support broke the core messages
code. You cannot embed a conditional macro in another macro. The Send
and Urgent Send calls are macros.
2) User extensions handler initialisation now has two parameters. I have
updated the macros to support the extra parameter.
The patch also contains the gcc-target-default.cfg fix required to build
the kernel. More of a by product than a fix for you.
Diffstat (limited to 'testsuites/samples/unlimited/init.c')
-rw-r--r-- | testsuites/samples/unlimited/init.c | 126 |
1 files changed, 126 insertions, 0 deletions
diff --git a/testsuites/samples/unlimited/init.c b/testsuites/samples/unlimited/init.c new file mode 100644 index 0000000000..40614efaa7 --- /dev/null +++ b/testsuites/samples/unlimited/init.c @@ -0,0 +1,126 @@ +/* Init + * + * This routine is the initialization task for this test program. + * It is called from init_exec and has the responsibility for creating + * and starting the tasks that make up the test. If the time of day + * clock is required for the test, it should also be set to a known + * value by this function. + * + * Input parameters: NONE + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989-1997. + * On-Line Applications Research Corporation (OAR). + * Copyright assigned to U.S. Government, 1994. + * + * The license and distribution terms for this file may in + * the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#define TEST_INIT + +#include "system.h" +#include <stdio.h> + +rtems_id task_id[MAX_TASKS]; + +void test1(); +void test2(); + +rtems_task Init( + rtems_task_argument ignored +) +{ + rtems_task_priority old_priority; + rtems_mode old_mode; + rtems_unsigned32 task; + + /* lower the task priority to allow created tasks to execute */ + + rtems_task_set_priority(RTEMS_SELF, 20, &old_priority); + rtems_task_mode(RTEMS_PREEMPT, RTEMS_PREEMPT_MASK, &old_mode); + + printf( "\n*** UNLIMITED TASK TEST ***\n" ); + + /* + * Invalid state if the task id is 0 + */ + + for (task = 0; task < MAX_TASKS; task++) + task_id[task] = 0; + + test1(); + test2(); + test3(); + + printf( "\n*** END OF UNLIMITED TASK TEST ***\n" ); + exit( 0 ); +} + +rtems_task test_task( + rtems_task_argument my_number + ) +{ + rtems_event_set out; + + printf( "task %i has started.\n", my_number); + + rtems_event_receive(1, RTEMS_WAIT | RTEMS_EVENT_ANY, 0, &out); + + printf( "task %i ending.\n", my_number); + + rtems_task_delete(RTEMS_SELF); +} + +void destory_all_tasks( + const char *who +) +{ + rtems_unsigned32 task; + + /* + * If the id is not zero, signal the task to delete. + */ + + for (task = 0; task < MAX_TASKS; task++) + if (task_id[task]) + { + printf(" %s : signal task %08x to delete, ", who, task_id[task]); + rtems_event_send(task_id[task], 1); + task_id[task] = 0; + } +} + +boolean status_code_bad( + rtems_status_code status_code + ) +{ + if (status_code != RTEMS_SUCCESSFUL) + { + printf("failure, "); + + if (status_code == RTEMS_TOO_MANY) + { + printf("too many.\n"); + return TRUE; + } + if (status_code == RTEMS_UNSATISFIED) + { + printf("unsatisfied.\n"); + return TRUE; + } + + printf("error code = %i\n", status_code); + exit( 1 ); + } + return FALSE; +} + + + + + |