source: rtems/testsuites/sptests/spatomic05/init.c @ fb9fa15

4.115
Last change on this file since fb9fa15 was fb9fa15, checked in by WeiY <wei.a.yang@…>, on 01/25/13 at 15:59:49

tests: atomic support for RTEMS. Uniprocessor tests for atomic ops.

  • Property mode set to 100644
File size: 1.6 KB
Line 
1/*
2 * Copyright (c) 2012 Deng Hengyi.
3 *
4 *  This test case is to test atomic and operation.
5 *
6 *  The license and distribution terms for this file may be
7 *  found in the file LICENSE in this distribution or at
8 *  http://www.rtems.com/license/LICENSE.
9 *
10 */
11#ifdef HAVE_CONFIG_H
12#include "config.h"
13#endif
14
15#define CONFIGURE_INIT
16#include "system.h"
17
18rtems_task Init(
19  rtems_task_argument argument
20)
21{
22  int                i;
23  char               ch;
24  rtems_id           id;
25  rtems_status_code  status;
26  bool               allDone;
27
28  /* Put start of test message */
29  puts( "\n\n***  spatomic05 TEST ***\n" );
30
31  /* Initialize the TaskRan array */
32  for ( i=0; i<TASK_NUMS ; i++ ) {
33    TaskRan[i] = false;
34  }
35
36  /* Create and start tasks for each processor */
37  for ( i=0; i< TASK_NUMS ; i++ ) {
38    ch = '0' + i;
39
40    status = rtems_task_create(
41      rtems_build_name( 'T', 'A', ch, ' ' ),
42      1,
43      RTEMS_MINIMUM_STACK_SIZE,
44      RTEMS_DEFAULT_MODES,
45      RTEMS_DEFAULT_ATTRIBUTES,
46      &id
47    );
48    directive_failed( status, "task create" );
49
50    status = rtems_task_start( id, Test_task, i );
51    directive_failed( status, "task start" );
52  }
53
54  status = rtems_task_create(
55      rtems_build_name( 'A', 'T', '0', ' ' ),
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  status = rtems_task_start( id, Wait_task, 0 );
65  directive_failed( status, "task start" );
66
67  status = rtems_task_delete( RTEMS_SELF );
68  directive_failed( status, "delete" );
69}
Note: See TracBrowser for help on using the repository browser.