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

4.115
Last change on this file since e049eea was e049eea, checked in by Joel Sherrill <joel.sherrill@…>, on 06/28/11 at 21:08:48

2011-06-28 Joel Sherrill <joel.sherrill@…>

  • .configure.ac.swp, ChangeLog?, Makefile.am, README, config.h.in, configure.ac, smp01/.cvsignore, smp01/Makefile.am, smp01/init.c, smp01/smp01.doc, smp01/smp01.scn, smp01/system.h, smp01/tasks.c, smp02/.cvsignore, smp02/Makefile.am, smp02/init.c, smp02/smp02.doc, smp02/smp02.scn, smp02/system.h, smp02/tasks.c, smp03/.cvsignore, smp03/Makefile.am, smp03/init.c, smp03/smp03.doc, smp03/smp03.scn, smp03/system.h, smp03/tasks.c, smp04/.cvsignore, smp04/Makefile.am, smp04/init.c, smp04/smp04.doc, smp04/smp04.scn, smp04/system.h, smp04/tasks.c, smp05/.cvsignore, smp05/Makefile.am, smp05/init.c, smp05/smp05.doc, smp05/smp05.scn, smp06/.cvsignore, smp06/Makefile.am, smp06/init.c, smp06/smp06.doc, smp06/smp06.scn, smp07/.cvsignore, smp07/Makefile.am, smp07/init.c, smp07/smp07.doc, smp07/smp07.scn, smp08/.cvsignore, smp08/Makefile.am, smp08/init.c, smp08/smp08.doc, smp08/smp08.scn, smp08/system.h, smp08/tasks.c, smp09/.cvsignore, smp09/Makefile.am, smp09/init.c, smp09/smp09.doc, smp09/smp09.scn: New files.
  • 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#include <tmacros.h>
13#include "test_support.h"
14
15volatile bool Ran;
16
17rtems_task Test_task(
18  rtems_task_argument do_exit
19)
20{
21  int               cpu_num;
22  char              name[5];
23  char             *p;
24
25  p = rtems_object_get_name( RTEMS_SELF, 5, name );
26  rtems_test_assert( p != NULL );
27
28  cpu_num = bsp_smp_processor_id();
29  locked_printf(" CPU %d running Task %s\n", cpu_num, name);
30
31  Ran = true;
32
33  if ( do_exit ) {
34    locked_printf( "*** END OF TEST SMP06 ***" );
35    rtems_test_exit(0);
36  }
37  while(1)
38    ;
39}
40
41rtems_task Init(
42  rtems_task_argument argument
43)
44{
45  int                i;
46  char               ch;
47  int                cpu_num;
48  rtems_id           id;
49  rtems_status_code  status;
50
51  locked_print_initialize();
52  locked_printf( "\n\n*** TEST SMP06 ***\n" );
53  locked_printf( "rtems_clock_tick - so this task has run longer\n" );
54  status = rtems_clock_tick();
55  directive_failed( status, "clock tick" );
56
57  rtems_test_assert( rtems_smp_get_number_of_processors()  > 1 );
58
59  cpu_num = bsp_smp_processor_id();
60
61  /*
62   * Create a task at equal priority.
63   */
64  Ran = false;
65  status = rtems_task_create(
66    rtems_build_name( 'T', 'A', '1', ' ' ),
67    2,
68    RTEMS_MINIMUM_STACK_SIZE,
69    RTEMS_PREEMPT,
70    RTEMS_DEFAULT_ATTRIBUTES,
71    &id
72  );
73  directive_failed( status, "task create" );
74
75  locked_printf(" CPU %d start task TA1\n", cpu_num );
76
77  status = rtems_task_start( id, Test_task, 0 );
78  directive_failed( status, "task start" );
79
80  while ( Ran == false )
81    ;
82
83  /*
84   * Create a task at greater priority.
85   */
86  Ran = false;
87  status = rtems_task_create(
88    rtems_build_name( 'T', 'A', '2', ' ' ),
89    1,
90    RTEMS_MINIMUM_STACK_SIZE,
91    RTEMS_PREEMPT,
92    RTEMS_DEFAULT_ATTRIBUTES,
93    &id
94  );
95  directive_failed( status, "task create" );
96
97  cpu_num = bsp_smp_processor_id();
98  locked_printf(" CPU %d start task TA2\n", cpu_num );
99
100  status = rtems_task_start( id, Test_task, 1 );
101  directive_failed( status, "task start" );
102
103  while ( 1 )
104    ;
105}
106
107/* configuration information */
108
109#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
110#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER
111
112#define CONFIGURE_SMP_APPLICATION
113#define CONFIGURE_SMP_MAXIMUM_PROCESSORS  2
114
115#define CONFIGURE_MAXIMUM_TASKS           4
116
117#define CONFIGURE_INIT_TASK_PRIORITY      2
118#define CONFIGURE_INIT_TASK_MODES         RTEMS_PREEMPT
119#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
120
121#define CONFIGURE_INIT
122
123#include <rtems/confdefs.h>
124/* end of file */
Note: See TracBrowser for help on using the repository browser.