1 | /* Test_task |
---|
2 | * |
---|
3 | * This task tests the rtems_task_set_priority directive on a remote task. |
---|
4 | * |
---|
5 | * Input parameters: |
---|
6 | * argument - task argument |
---|
7 | * |
---|
8 | * Output parameters: NONE |
---|
9 | * |
---|
10 | * COPYRIGHT (c) 1989-1999. |
---|
11 | * On-Line Applications Research Corporation (OAR). |
---|
12 | * |
---|
13 | * The license and distribution terms for this file may be |
---|
14 | * found in the file LICENSE in this distribution or at |
---|
15 | * http://www.rtems.com/license/LICENSE. |
---|
16 | */ |
---|
17 | |
---|
18 | #ifdef HAVE_CONFIG_H |
---|
19 | #include "config.h" |
---|
20 | #endif |
---|
21 | |
---|
22 | #include "system.h" |
---|
23 | #include "tmacros.h" |
---|
24 | |
---|
25 | extern rtems_multiprocessing_table Multiprocessing_configuration; |
---|
26 | |
---|
27 | rtems_task Test_task( |
---|
28 | rtems_task_argument argument |
---|
29 | ) |
---|
30 | { |
---|
31 | rtems_id tid; |
---|
32 | rtems_status_code status; |
---|
33 | uint32_t remote_node; |
---|
34 | rtems_id remote_tid; |
---|
35 | rtems_task_priority previous_priority; |
---|
36 | rtems_task_priority previous_priority_1; |
---|
37 | |
---|
38 | status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &tid ); |
---|
39 | directive_failed( status, "rtems_task_ident" ); |
---|
40 | |
---|
41 | puts( "Getting TID of remote task" ); |
---|
42 | remote_node = (Multiprocessing_configuration.node == 1) ? 2 : 1; |
---|
43 | puts_nocr( "Remote task's name is : " ); |
---|
44 | put_name( Task_name[ remote_node ], TRUE ); |
---|
45 | |
---|
46 | do { |
---|
47 | status = rtems_task_ident( |
---|
48 | Task_name[ remote_node ], |
---|
49 | RTEMS_SEARCH_ALL_NODES, |
---|
50 | &remote_tid |
---|
51 | ); |
---|
52 | } while ( status != RTEMS_SUCCESSFUL ); |
---|
53 | |
---|
54 | directive_failed( status, "rtems_task_ident" ); |
---|
55 | |
---|
56 | status = rtems_task_set_priority( |
---|
57 | remote_tid, |
---|
58 | Multiprocessing_configuration.node, |
---|
59 | &previous_priority |
---|
60 | ); |
---|
61 | directive_failed( status, "rtems_task_set_priority" ); |
---|
62 | |
---|
63 | if ( previous_priority != remote_node ) { |
---|
64 | printf( |
---|
65 | "Remote priority (0x%" PRIxrtems_task_priority ") does not match remote node (0x%" PRIx32 ")!!!\n", |
---|
66 | previous_priority, |
---|
67 | remote_node |
---|
68 | ); |
---|
69 | rtems_test_exit( 0xf0000 ); |
---|
70 | } |
---|
71 | |
---|
72 | do { |
---|
73 | status = rtems_task_set_priority( |
---|
74 | RTEMS_SELF, |
---|
75 | RTEMS_CURRENT_PRIORITY, |
---|
76 | &previous_priority_1 |
---|
77 | ); |
---|
78 | directive_failed( status, "rtems_task_set_priority" ); |
---|
79 | } while ( previous_priority_1 != remote_node ); |
---|
80 | |
---|
81 | puts( "Local task priority has been set" ); |
---|
82 | |
---|
83 | puts( "*** END OF TEST 4 ***" ); |
---|
84 | rtems_test_exit( 0 ); |
---|
85 | } |
---|