source: rtems/testsuites/smptests/smp09/init.c @ c499856

4.115
Last change on this file since c499856 was c499856, checked in by Chris Johns <chrisj@…>, on 03/20/14 at 21:10:47

Change all references of rtems.com to rtems.org.

  • Property mode set to 100644
File size: 2.0 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.org/license/LICENSE.
8 */
9
10#ifdef HAVE_CONFIG_H
11#include "config.h"
12#endif
13
14#include <tmacros.h>
15#include "test_support.h"
16#include <rtems/cpuuse.h>
17
18const char rtems_test_name[] = "SMP 9";
19
20volatile int killtime;
21
22rtems_task Test_task(
23  rtems_task_argument argument
24)
25{
26  while (1)
27    ;
28  /* XXX something goes here */
29}
30
31rtems_task Init(
32  rtems_task_argument argument
33)
34{
35  uint32_t           i;
36  char               ch;
37  uint32_t           cpu_num;
38  rtems_id           id;
39  rtems_status_code  status;
40
41  TEST_BEGIN();
42
43  locked_print_initialize();
44
45  for ( killtime=0; killtime<1000000; killtime++ )
46    ;
47 
48  for ( i=0; i<rtems_smp_get_processor_count() -1; i++ ) {
49    ch = '1' + i;
50
51    status = rtems_task_create(
52      rtems_build_name( 'T', 'A', ch, ' ' ),
53      1,
54      RTEMS_MINIMUM_STACK_SIZE,
55      RTEMS_DEFAULT_MODES,
56      RTEMS_DEFAULT_ATTRIBUTES,
57      &id
58    );
59    directive_failed( status, "task create" );
60
61    cpu_num = rtems_smp_get_current_processor();
62    locked_printf(" CPU %" PRIu32 " start task TA%c\n", cpu_num, ch);
63
64    status = rtems_task_start( id, Test_task, i+1 );
65    directive_failed( status, "task start" );
66  }
67
68  locked_printf(" kill 10 clock ticks\n" );
69  while ( rtems_clock_get_ticks_since_boot() < 10 )
70    ;
71
72  rtems_cpu_usage_report();
73
74  TEST_END();
75  rtems_test_exit(0);
76}
77
78/* configuration information */
79
80#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
81#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
82
83#define CONFIGURE_SMP_APPLICATION
84#define CONFIGURE_SMP_MAXIMUM_PROCESSORS   4
85
86#define CONFIGURE_MAXIMUM_TASKS            \
87    (1 + CONFIGURE_SMP_MAXIMUM_PROCESSORS)
88#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
89
90#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
91
92#define CONFIGURE_MAXIMUM_SEMAPHORES 1
93
94#define CONFIGURE_INIT
95
96#include <rtems/confdefs.h>
97/* end of file */
Note: See TracBrowser for help on using the repository browser.