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

4.115
Last change on this file since cf288c38 was cf288c38, checked in by Jennifer Averett <Jennifer.Averett@…>, on 07/29/11 at 12:29:34

2011-07-29 Jennifer Averett <Jennifer.Averett@…>

  • smp01/init.c, smp02/init.c, smp02/tasks.c, smp03/init.c, smp03/tasks.c, smp04/Makefile.am, smp04/init.c, smp05/init.c, smp06/init.c, smp07/init.c, smp08/init.c: Cleaned up tests and fixed some print statement problems.
  • smp04/tasks.c: Removed.
  • Property mode set to 100644
File size: 2.6 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 ***\n" );
35    rtems_test_exit(0);
36  }
37  while(1)
38    ;
39}
40
41rtems_task Init(
42  rtems_task_argument argument
43)
44{
45  int                cpu_num;
46  rtems_id           id;
47  rtems_status_code  status;
48
49  locked_print_initialize();
50  locked_printf( "\n\n*** TEST SMP06 ***\n" );
51  locked_printf( "rtems_clock_tick - so this task has run longer\n" );
52  status = rtems_clock_tick();
53  directive_failed( status, "clock tick" );
54
55  rtems_test_assert( rtems_smp_get_number_of_processors()  > 1 );
56
57  cpu_num = bsp_smp_processor_id();
58
59  /*
60   * Create a task at equal priority.
61   */
62  Ran = false;
63  status = rtems_task_create(
64    rtems_build_name( 'T', 'A', '1', ' ' ),
65    2,
66    RTEMS_MINIMUM_STACK_SIZE,
67    RTEMS_PREEMPT,
68    RTEMS_DEFAULT_ATTRIBUTES,
69    &id
70  );
71  directive_failed( status, "task create" );
72
73  locked_printf(" CPU %d start task TA1\n", cpu_num );
74
75  status = rtems_task_start( id, Test_task, 0 );
76  directive_failed( status, "task start" );
77
78  while ( Ran == false )
79    ;
80
81  /*
82   * Create a task at greater priority.
83   */
84  Ran = false;
85  status = rtems_task_create(
86    rtems_build_name( 'T', 'A', '2', ' ' ),
87    1,
88    RTEMS_MINIMUM_STACK_SIZE,
89    RTEMS_PREEMPT,
90    RTEMS_DEFAULT_ATTRIBUTES,
91    &id
92  );
93  directive_failed( status, "task create" );
94
95  cpu_num = bsp_smp_processor_id();
96  locked_printf(" CPU %d start task TA2\n", cpu_num );
97
98  status = rtems_task_start( id, Test_task, 1 );
99  directive_failed( status, "task start" );
100
101  while ( 1 )
102    ;
103}
104
105/* configuration information */
106
107#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
108#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER
109
110#define CONFIGURE_SMP_APPLICATION
111#define CONFIGURE_SMP_MAXIMUM_PROCESSORS  2
112
113#define CONFIGURE_MAXIMUM_TASKS           4
114
115#define CONFIGURE_INIT_TASK_PRIORITY      2
116#define CONFIGURE_INIT_TASK_INITIAL_MODES RTEMS_PREEMPT
117#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
118
119#define CONFIGURE_INIT
120
121#include <rtems/confdefs.h>
122/* end of file */
Note: See TracBrowser for help on using the repository browser.