source: rtems/testsuites/smptests/smp08/init.c @ e049eea

4.115
Last change on this file since e049eea was e049eea, checked in by Joel Sherrill <joel.sherrill@…>, on Jun 28, 2011 at 9:08:48 PM

2011-06-28 Joel Sherrill <joel.sherrill@…>

  • .configure.ac.swp, ChangeLog?, Makefile.am, README, config.h.in, configure.ac, smp01/.cvsignore, smp01/Makefile.am, smp01/init.c, smp01/smp01.doc, smp01/smp01.scn, smp01/system.h, smp01/tasks.c, smp02/.cvsignore, smp02/Makefile.am, smp02/init.c, smp02/smp02.doc, smp02/smp02.scn, smp02/system.h, smp02/tasks.c, smp03/.cvsignore, smp03/Makefile.am, smp03/init.c, smp03/smp03.doc, smp03/smp03.scn, smp03/system.h, smp03/tasks.c, smp04/.cvsignore, smp04/Makefile.am, smp04/init.c, smp04/smp04.doc, smp04/smp04.scn, smp04/system.h, smp04/tasks.c, smp05/.cvsignore, smp05/Makefile.am, smp05/init.c, smp05/smp05.doc, smp05/smp05.scn, smp06/.cvsignore, smp06/Makefile.am, smp06/init.c, smp06/smp06.doc, smp06/smp06.scn, smp07/.cvsignore, smp07/Makefile.am, smp07/init.c, smp07/smp07.doc, smp07/smp07.scn, smp08/.cvsignore, smp08/Makefile.am, smp08/init.c, smp08/smp08.doc, smp08/smp08.scn, smp08/system.h, smp08/tasks.c, smp09/.cvsignore, smp09/Makefile.am, smp09/init.c, smp09/smp09.doc, smp09/smp09.scn: New files.
  • 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.com/license/LICENSE.
8 *
9 *  $Id$
10 */
11
12#ifdef HAVE_CONFIG_H
13#include "config.h"
14#endif
15
16#define CONFIGURE_INIT
17#include "system.h"
18
19void PrintTaskInfo(
20  const char         *task_name,
21  rtems_time_of_day  *_tb
22)
23{
24  int               cpu_num;
25  rtems_status_code sc;
26
27  cpu_num = bsp_smp_processor_id();
28
29  /* Print the cpu number and task name */
30  locked_printf(
31    "  CPU %d running task %s - rtems_clock_get_tod "
32    "%02" PRId32 ":%02" PRId32 ":%02" PRId32 "   %02" PRId32
33        "/%02" PRId32 "/%04" PRId32 "\n",
34    cpu_num,
35    task_name,
36    _tb->hour, _tb->minute, _tb->second, 
37    _tb->month, _tb->day, _tb->year
38  ); 
39}
40
41rtems_task Init(
42  rtems_task_argument argument
43)
44{
45  rtems_status_code status;
46  rtems_time_of_day time;
47  int               i;
48  char              ch;
49  rtems_id          id;
50 
51  locked_print_initialize();
52  locked_printf( "\n\n*** SMP08 TEST ***\n" );
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_smp_get_number_of_processors() *3; i++ ) {
80    ch = '0' + i;
81
82    status = rtems_task_create(
83      rtems_build_name( 'T', 'A', ch, ' ' ),
84      1,
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  status = rtems_task_delete( RTEMS_SELF );
97}
Note: See TracBrowser for help on using the repository browser.