source: rtems/testsuites/smptests/smp03/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: 1.9 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#define CONFIGURE_INIT
17#include "system.h"
18
19#include <stdio.h>
20
21void Loop() {
22  volatile int i;
23
24  for (i=0; i<300000; i++);
25}
26
27void PrintTaskInfo(
28  const char *task_name
29)
30{
31  int               cpu_num;
32
33  cpu_num = bsp_smp_processor_id();
34
35  locked_printf("  CPU %d running task %s\n", cpu_num, task_name );
36}
37
38rtems_task Init(
39  rtems_task_argument argument
40)
41{
42  int               i;
43  char              ch = '0';
44  rtems_id          id;
45  rtems_status_code status;
46
47  Loop();
48  locked_print_initialize();
49
50  locked_printf( "\n\n***  SMP03 TEST ***\n" );
51
52
53  /* Show that the init task is running on this cpu */
54  PrintTaskInfo( "Init" );
55
56  /* for each remaining cpu create and start a task */
57  for ( i=1; i < rtems_smp_get_number_of_processors(); i++ ){
58
59    ch = '0' + i;
60
61    status = rtems_task_create(
62      rtems_build_name( 'T', 'A', ch, ' ' ),
63      CONFIGURE_INIT_TASK_PRIORITY + (2*i),
64      RTEMS_MINIMUM_STACK_SIZE,
65      RTEMS_PREEMPT,
66      RTEMS_DEFAULT_ATTRIBUTES,
67      &id
68    );
69    status = rtems_task_start( id, Test_task, i );
70
71    Loop();
72  }
73
74  /* Create/Start an aditional task with the highest priority */
75  status = rtems_task_create(
76    rtems_build_name( 'T', 'A', ch, ' ' ),
77    3,
78    RTEMS_MINIMUM_STACK_SIZE,
79    RTEMS_PREEMPT,
80    RTEMS_DEFAULT_ATTRIBUTES,
81    &id
82  );
83  TestFinished = false;
84  status = rtems_task_start(id,Test_task,rtems_smp_get_number_of_processors());
85
86  /* Wait on the last task to run */
87  while(!TestFinished)
88    ;
89
90  /* End the test */
91  Loop();
92  locked_printf( "*** END OF TEST SMP03 ***\n" );
93  Loop();
94  rtems_test_exit( 0 );   
95}
Note: See TracBrowser for help on using the repository browser.