source: rtems/testsuites/smptests/smp05/init.c @ 03c9f24

5
Last change on this file since 03c9f24 was 03c9f24, checked in by Sebastian Huber <sebastian.huber@…>, on Apr 5, 2019 at 6:03:12 AM

rtems: Add rtems_scheduler_get_processor()

Add rtems_scheduler_get_processor() as a replacement for
rtems_get_current_processor(). The rtems_get_current_processor() is a
bit orphaned. Adopt it by the Scheduler Manager. This is in line with
the glibc sched_getcpu() function.

Deprecate rtems_get_current_processor().

Update #3731.

  • 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
17const char rtems_test_name[] = "SMP 5";
18
19rtems_task Init(
20  rtems_task_argument argument
21);
22
23rtems_task Test_task(
24  rtems_task_argument argument
25);
26
27
28static void success(void)
29{
30  TEST_END();
31  rtems_test_exit( 0 );
32}
33
34rtems_task Test_task(
35  rtems_task_argument argument
36)
37{
38  locked_printf( "Shut down from CPU %" PRIu32 "\n", rtems_scheduler_get_processor() );
39  success();
40}
41
42rtems_task Init(
43  rtems_task_argument argument
44)
45{
46  uint32_t           i;
47  char               ch;
48  uint32_t           cpu_num;
49  rtems_id           id;
50  rtems_status_code  status;
51
52  locked_print_initialize();
53  TEST_BEGIN();
54
55  if ( rtems_get_processor_count() == 1 ) {
56    success();
57  }
58
59  for ( i=0; i<rtems_get_processor_count() ; i++ ) {
60    ch = '1' + i;
61
62    status = rtems_task_create(
63      rtems_build_name( 'T', 'A', ch, ' ' ),
64      1,
65      RTEMS_MINIMUM_STACK_SIZE,
66      RTEMS_DEFAULT_MODES,
67      RTEMS_DEFAULT_ATTRIBUTES,
68      &id
69    );
70    directive_failed( status, "task create" );
71
72    cpu_num = rtems_scheduler_get_processor();
73    locked_printf(" CPU %" PRIu32 " start task TA%c\n", cpu_num, ch);
74
75    status = rtems_task_start( id, Test_task, i+1 );
76    directive_failed( status, "task start" );
77  }
78
79  while (1)
80    ;
81}
82
83/* configuration information */
84
85#define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER
86#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER
87
88#define CONFIGURE_MAXIMUM_PROCESSORS   2
89
90#define CONFIGURE_MAXIMUM_TASKS            \
91    (1 + CONFIGURE_MAXIMUM_PROCESSORS)
92#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
93
94#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
95
96#define CONFIGURE_MAXIMUM_SEMAPHORES 1
97
98#define CONFIGURE_INIT
99
100#include <rtems/confdefs.h>
101/* end of file */
Note: See TracBrowser for help on using the repository browser.