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

4.115
Last change on this file since d1c5c01f was 39e51758, checked in by Sebastian Huber <sebastian.huber@…>, on 06/14/13 at 12:00:38

smp: Add and use _CPU_SMP_Get_current_processor()

Add and use _SMP_Get_current_processor() and
rtems_smp_get_current_processor().

Delete bsp_smp_interrupt_cpu().

Change type of current processor index from int to uint32_t to match
_SMP_Processor_count type.

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