source: rtems/testsuites/smptests/smp08/init.c @ 239dd35f

5
Last change on this file since 239dd35f was 239dd35f, checked in by Sebastian Huber <sebastian.huber@…>, on 02/03/17 at 10:24:30

smptests: Fix warnings

  • Property mode set to 100644
File size: 2.2 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#define CONFIGURE_INIT
15#include "system.h"
16
17const char rtems_test_name[] = "SMP 8";
18
19void PrintTaskInfo(
20  const char         *task_name,
21  rtems_time_of_day  *_tb
22)
23{
24  uint32_t cpu_num;
25
26  cpu_num = rtems_get_current_processor();
27
28  /* Print the cpu number and task name */
29  locked_printf(
30    "  CPU %" PRIu32 " running task %s - rtems_clock_get_tod "
31    "%02" PRId32 ":%02" PRId32 ":%02" PRId32 "   %02" PRId32
32        "/%02" PRId32 "/%04" PRId32 "\n",
33    cpu_num,
34    task_name,
35    _tb->hour, _tb->minute, _tb->second,
36    _tb->month, _tb->day, _tb->year
37  );
38}
39
40rtems_task Init(
41  rtems_task_argument argument
42)
43{
44  rtems_status_code status;
45  rtems_time_of_day time;
46  uint32_t          i;
47  char              ch[4];
48  rtems_id          id;
49
50  TEST_BEGIN();
51 
52  locked_print_initialize();
53
54  time.year   = 1988;
55  time.month  = 12;
56  time.day    = 31;
57  time.hour   = 9;
58  time.minute = 0;
59  time.second = 0;
60  time.ticks  = 0;
61
62  status = rtems_clock_set( &time );
63
64  /* Create/verify synchronisation semaphore */
65  status = rtems_semaphore_create(
66    rtems_build_name ('S', 'E', 'M', '1'),
67    1,                                             
68    RTEMS_LOCAL                   |
69    RTEMS_SIMPLE_BINARY_SEMAPHORE |
70    RTEMS_PRIORITY,
71    1,
72    &Semaphore
73  );
74  directive_failed( status, "rtems_semaphore_create" );
75
76  /* Show that the init task is running on this cpu */
77  PrintTaskInfo( "Init", &time );
78
79  for ( i=1; i <= rtems_get_processor_count() *3; i++ ) {
80
81    sprintf(ch, "%02" PRIu32, i );
82    status = rtems_task_create(
83      rtems_build_name( 'T', 'A', ch[0], ch[1] ),
84      2,
85      RTEMS_MINIMUM_STACK_SIZE,
86      RTEMS_DEFAULT_MODES,
87      RTEMS_DEFAULT_ATTRIBUTES,
88      &id
89    );
90    directive_failed( status, "task create" );
91
92    status = rtems_task_start( id, Test_task, i+1 );
93    directive_failed( status, "task start" );
94  }
95
96  /* FIXME: Task deletion currently not supported */
97  (void) rtems_task_suspend( RTEMS_SELF );
98}
Note: See TracBrowser for help on using the repository browser.