source: rtems/testsuites/smptests/smp06/init.c @ ff33d076

4.115
Last change on this file since ff33d076 was ff33d076, checked in by Ralf Corsepius <ralf.corsepius@…>, on 09/29/11 at 15:57:14

2011-09-29 Ralf Corsépius <ralf.corsepius@…>

  • smp05/init.c, smp06/init.c, smp07/init.c, smp09/init.c: Add HAVE_CONFIG_H.
  • Property mode set to 100644
File size: 2.7 KB
Line 
1/*
2 *  COPYRIGHT (c) 1989-2011.
3 *  On-Line Applications Research Corporation (OAR).
4 *
5 *  The license and distribution terms for this file may be
6 *  found in the file LICENSE in this distribution or at
7 *  http://www.rtems.com/license/LICENSE.
8 *
9 *  $Id$
10 */
11
12#ifdef HAVE_CONFIG_H
13#include "config.h"
14#endif
15
16#include <tmacros.h>
17#include "test_support.h"
18
19volatile bool Ran;
20
21rtems_task Test_task(
22  rtems_task_argument do_exit
23)
24{
25  int               cpu_num;
26  char              name[5];
27  char             *p;
28
29  p = rtems_object_get_name( RTEMS_SELF, 5, name );
30  rtems_test_assert( p != NULL );
31
32  cpu_num = bsp_smp_processor_id();
33  locked_printf(" CPU %d running Task %s\n", cpu_num, name);
34
35  Ran = true;
36
37  if ( do_exit ) {
38    locked_printf( "*** END OF TEST SMP06 ***\n" );
39    rtems_test_exit(0);
40  }
41  while(1)
42    ;
43}
44
45rtems_task Init(
46  rtems_task_argument argument
47)
48{
49  int                cpu_num;
50  rtems_id           id;
51  rtems_status_code  status;
52
53  locked_print_initialize();
54  locked_printf( "\n\n*** TEST SMP06 ***\n" );
55  locked_printf( "rtems_clock_tick - so this task has run longer\n" );
56  status = rtems_clock_tick();
57  directive_failed( status, "clock tick" );
58
59  rtems_test_assert( rtems_smp_get_number_of_processors()  > 1 );
60
61  cpu_num = bsp_smp_processor_id();
62
63  /*
64   * Create a task at equal priority.
65   */
66  Ran = false;
67  status = rtems_task_create(
68    rtems_build_name( 'T', 'A', '1', ' ' ),
69    2,
70    RTEMS_MINIMUM_STACK_SIZE,
71    RTEMS_PREEMPT,
72    RTEMS_DEFAULT_ATTRIBUTES,
73    &id
74  );
75  directive_failed( status, "task create" );
76
77  locked_printf(" CPU %d start task TA1\n", cpu_num );
78
79  status = rtems_task_start( id, Test_task, 0 );
80  directive_failed( status, "task start" );
81
82  while ( Ran == false )
83    ;
84
85  /*
86   * Create a task at greater priority.
87   */
88  Ran = false;
89  status = rtems_task_create(
90    rtems_build_name( 'T', 'A', '2', ' ' ),
91    1,
92    RTEMS_MINIMUM_STACK_SIZE,
93    RTEMS_PREEMPT,
94    RTEMS_DEFAULT_ATTRIBUTES,
95    &id
96  );
97  directive_failed( status, "task create" );
98
99  cpu_num = bsp_smp_processor_id();
100  locked_printf(" CPU %d start task TA2\n", cpu_num );
101
102  status = rtems_task_start( id, Test_task, 1 );
103  directive_failed( status, "task start" );
104
105  while ( 1 )
106    ;
107}
108
109/* configuration information */
110
111#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
112#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER
113
114#define CONFIGURE_SMP_APPLICATION
115#define CONFIGURE_SMP_MAXIMUM_PROCESSORS  2
116
117#define CONFIGURE_MAXIMUM_TASKS           4
118
119#define CONFIGURE_INIT_TASK_PRIORITY      2
120#define CONFIGURE_INIT_TASK_INITIAL_MODES RTEMS_PREEMPT
121#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
122
123#define CONFIGURE_INIT
124
125#include <rtems/confdefs.h>
126/* end of file */
Note: See TracBrowser for help on using the repository browser.