source: rtems/testsuites/smptests/smp05/init.c @ cb5eaddf

4.115
Last change on this file since cb5eaddf was cb5eaddf, checked in by Sebastian Huber <sebastian.huber@…>, on 04/10/14 at 09:02:52

rtems: Rename rtems_smp_get_current_processor()

Rename rtems_smp_get_current_processor() in
rtems_get_current_processor(). Make rtems_get_current_processor() a
function in uni-processor configurations to enable ABI compatibility
with SMP configurations.

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