1 | /* |
---|
2 | * Copyright (c) 2012 Deng Hengyi. |
---|
3 | * |
---|
4 | * This test case is to test atomic sub 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 | |
---|
18 | rtems_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 | |
---|
27 | /* Put start of test message */ |
---|
28 | puts( "\n\n*** spatomic04 TEST ***\n" ); |
---|
29 | |
---|
30 | /* Initialize the TaskRan array */ |
---|
31 | for ( i=0; i<TASK_NUMS ; i++ ) { |
---|
32 | TaskRan[i] = false; |
---|
33 | } |
---|
34 | |
---|
35 | /* Create and start tasks for each processor */ |
---|
36 | for ( i=0; i< TASK_NUMS ; i++ ) { |
---|
37 | ch = '0' + i; |
---|
38 | |
---|
39 | status = rtems_task_create( |
---|
40 | rtems_build_name( 'T', 'A', ch, ' ' ), |
---|
41 | 1, |
---|
42 | RTEMS_MINIMUM_STACK_SIZE, |
---|
43 | RTEMS_DEFAULT_MODES, |
---|
44 | RTEMS_DEFAULT_ATTRIBUTES, |
---|
45 | &id |
---|
46 | ); |
---|
47 | directive_failed( status, "task create" ); |
---|
48 | |
---|
49 | status = rtems_task_start( id, Test_task, i ); |
---|
50 | directive_failed( status, "task start" ); |
---|
51 | } |
---|
52 | |
---|
53 | status = rtems_task_create( |
---|
54 | rtems_build_name( 'A', 'T', '0', ' ' ), |
---|
55 | 1, |
---|
56 | RTEMS_MINIMUM_STACK_SIZE, |
---|
57 | RTEMS_DEFAULT_MODES, |
---|
58 | RTEMS_DEFAULT_ATTRIBUTES, |
---|
59 | &id |
---|
60 | ); |
---|
61 | directive_failed( status, "task create" ); |
---|
62 | |
---|
63 | status = rtems_task_start( id, Wait_task, 0 ); |
---|
64 | directive_failed( status, "task start" ); |
---|
65 | |
---|
66 | status = rtems_task_delete( RTEMS_SELF ); |
---|
67 | directive_failed( status, "delete" ); |
---|
68 | } |
---|