source: rtems/testsuites/samples/unlimited/init.c @ 9b4422a2

4.115
Last change on this file since 9b4422a2 was 9b4422a2, checked in by Joel Sherrill <joel.sherrill@…>, on 05/03/12 at 15:09:24

Remove All CVS Id Strings Possible Using a Script

Script does what is expected and tries to do it as
smartly as possible.

+ remove occurrences of two blank comment lines

next to each other after Id string line removed.

+ remove entire comment blocks which only exited to

contain CVS Ids

+ If the processing left a blank line at the top of

a file, it was removed.

  • Property mode set to 100644
File size: 2.5 KB
Line 
1/*  Init
2 *
3 *  This routine is the initialization task for this test program.
4 *  It is called from init_exec and has the responsibility for creating
5 *  and starting the tasks that make up the test.  If the time of day
6 *  clock is required for the test, it should also be set to a known
7 *  value by this function.
8 *
9 *  Input parameters:  NONE
10 *
11 *  Output parameters:  NONE
12 *
13 *  COPYRIGHT (c) 1989-1997.
14 *  On-Line Applications Research Corporation (OAR).
15 *
16 *  The license and distribution terms for this file may in
17 *  the file LICENSE in this distribution or at
18 *  http://www.rtems.com/license/LICENSE.
19 */
20
21#ifdef HAVE_CONFIG_H
22#include "config.h"
23#endif
24
25#define CONFIGURE_INIT
26
27#include "system.h"
28#include "tmacros.h"
29#include <stdio.h>
30#include <stdlib.h>
31
32rtems_id task_id[MAX_TASKS];
33
34rtems_task Init(
35  rtems_task_argument ignored
36)
37{
38  rtems_task_priority old_priority;
39  rtems_mode          old_mode;
40  uint32_t            task;
41
42  /* lower the task priority to allow created tasks to execute */
43
44  rtems_task_set_priority(
45    RTEMS_SELF, RTEMS_MAXIMUM_PRIORITY - 1, &old_priority);
46  rtems_task_mode(RTEMS_PREEMPT,  RTEMS_PREEMPT_MASK, &old_mode);
47
48  printf( "\n*** UNLIMITED TASK TEST ***\n" );
49
50  /*
51   * Invalid state if the task id is 0
52   */
53
54  for (task = 0; task < MAX_TASKS; task++)
55    task_id[task] = 0;
56
57  test1();
58  test2();
59  test3();
60
61  printf( "\n*** END OF UNLIMITED TASK TEST ***\n" );
62  exit( 0 );
63}
64
65rtems_task test_task(
66  rtems_task_argument my_number
67  )
68{
69  rtems_event_set out;
70
71  printf( "task %" PRIdrtems_task_argument " has started.\n",  my_number);
72
73  rtems_event_receive(1, RTEMS_WAIT | RTEMS_EVENT_ANY, 0, &out);
74
75  printf( "task %" PRIdrtems_task_argument " ending.\n",  my_number);
76
77  rtems_task_delete(RTEMS_SELF);
78}
79
80void destory_all_tasks(
81  const char *who
82)
83{
84  uint32_t   task;
85
86  /*
87   *  If the id is not zero, signal the task to delete.
88   */
89
90  for (task = 0; task < MAX_TASKS; task++)
91    if (task_id[task])
92    {
93      printf(" %s : signal task %08" PRIxrtems_id " to delete, ", who, task_id[task]);
94      fflush(stdout);
95      rtems_event_send(task_id[task], 1);
96      task_id[task] = 0;
97    }
98}
99
100bool status_code_bad(
101  rtems_status_code status_code
102  )
103{
104  if (status_code != RTEMS_SUCCESSFUL)
105  {
106    printf("failure, ");
107
108    if (status_code == RTEMS_TOO_MANY)
109    {
110      printf("too many.\n");
111      return TRUE;
112    }
113    if (status_code == RTEMS_UNSATISFIED)
114    {
115      printf("unsatisfied.\n");
116      return TRUE;
117    }
118
119    printf("error code = %i\n", status_code);
120    exit( 1 );
121  }
122  return FALSE;
123}
Note: See TracBrowser for help on using the repository browser.