[ac7d5ef0] | 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, 1990, 1991, 1992, 1993, 1994. |
---|
| 11 | * On-Line Applications Research Corporation (OAR). |
---|
| 12 | * All rights assigned to U.S. Government, 1994. |
---|
| 13 | * |
---|
| 14 | * This material may be reproduced by or for the U.S. Government pursuant |
---|
| 15 | * to the copyright license under the clause at DFARS 252.227-7013. This |
---|
| 16 | * notice must appear in all copies of this file and its derivatives. |
---|
| 17 | * |
---|
| 18 | * $Id$ |
---|
| 19 | */ |
---|
| 20 | |
---|
| 21 | #include "system.h" |
---|
| 22 | |
---|
| 23 | extern rtems_multiprocessing_table Multiprocessing_configuration; |
---|
| 24 | |
---|
| 25 | rtems_task Test_task( |
---|
| 26 | rtems_task_argument argument |
---|
| 27 | ) |
---|
| 28 | { |
---|
| 29 | rtems_id tid; |
---|
| 30 | rtems_status_code status; |
---|
| 31 | rtems_unsigned32 remote_node; |
---|
| 32 | rtems_id remote_tid; |
---|
| 33 | rtems_task_priority previous_priority; |
---|
| 34 | rtems_task_priority previous_priority_1; |
---|
| 35 | |
---|
| 36 | status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &tid ); |
---|
| 37 | directive_failed( status, "rtems_task_ident" ); |
---|
| 38 | |
---|
| 39 | puts( "Getting TID of remote task" ); |
---|
| 40 | remote_node = (Multiprocessing_configuration.node == 1) ? 2 : 1; |
---|
| 41 | puts_nocr( "Remote task's name is : " ); |
---|
| 42 | put_name( Task_name[ remote_node ], TRUE ); |
---|
| 43 | |
---|
| 44 | do { |
---|
| 45 | status = rtems_task_ident( |
---|
| 46 | Task_name[ remote_node ], |
---|
| 47 | RTEMS_SEARCH_ALL_NODES, |
---|
| 48 | &remote_tid |
---|
| 49 | ); |
---|
| 50 | } while ( status != RTEMS_SUCCESSFUL ); |
---|
| 51 | |
---|
| 52 | directive_failed( status, "rtems_task_ident" ); |
---|
| 53 | |
---|
| 54 | status = rtems_task_set_priority( |
---|
| 55 | remote_tid, |
---|
| 56 | Multiprocessing_configuration.node, |
---|
| 57 | &previous_priority |
---|
| 58 | ); |
---|
| 59 | directive_failed( status, "rtems_task_set_priority" ); |
---|
| 60 | |
---|
| 61 | if ( previous_priority != remote_node ) { |
---|
| 62 | printf( |
---|
| 63 | "Remote priority (0x%x) does not match remote node (0x%x)!!!\n", |
---|
| 64 | previous_priority, |
---|
| 65 | remote_node |
---|
| 66 | ); |
---|
| 67 | exit( 0xf0000 ); |
---|
| 68 | } |
---|
| 69 | |
---|
| 70 | do { |
---|
| 71 | status = rtems_task_set_priority( |
---|
| 72 | RTEMS_SELF, |
---|
| 73 | RTEMS_CURRENT_PRIORITY, |
---|
| 74 | &previous_priority_1 |
---|
| 75 | ); |
---|
| 76 | directive_failed( status, "rtems_task_set_priority" ); |
---|
| 77 | } while ( previous_priority_1 != remote_node ); |
---|
| 78 | |
---|
| 79 | puts( "Local task priority has been set" ); |
---|
| 80 | |
---|
| 81 | puts( "*** END OF TEST 4 ***" ); |
---|
| 82 | exit( 0 ); |
---|
| 83 | } |
---|