source: rtems/testsuites/sptests/sp07/task1.c @ ba39113

4.104.114.84.95
Last change on this file since ba39113 was ba39113, checked in by Joel Sherrill <joel.sherrill@…>, on 02/22/96 at 20:14:36

The name of the test support routine pause was changed to rtems_test_pause
to avoid conflict with the standard POSIX routine pause(2).

  • Property mode set to 100644
File size: 2.6 KB
Line 
1/*  Task_1
2 *
3 *  This routine serves as a test task.  It verifies intertask communication
4 *  using task notepads and verifies the the user extensions (tcreate, etc).
5 *
6 *  Input parameters:
7 *    argument - task argument
8 *
9 *  Output parameters:  NONE
10 *
11 *  COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
12 *  On-Line Applications Research Corporation (OAR).
13 *  All rights assigned to U.S. Government, 1994.
14 *
15 *  This material may be reproduced by or for the U.S. Government pursuant
16 *  to the copyright license under the clause at DFARS 252.227-7013.  This
17 *  notice must appear in all copies of this file and its derivatives.
18 *
19 *  $Id$
20 */
21
22#include "system.h"
23
24rtems_task Task_1(
25  rtems_task_argument argument
26)
27{
28  rtems_status_code   status;
29  rtems_task_priority the_priority;
30  rtems_task_priority previous_priority;
31
32  rtems_test_pause();
33
34  status = rtems_task_set_priority(
35    RTEMS_SELF,
36    RTEMS_CURRENT_PRIORITY,
37    &the_priority
38  );
39  directive_failed( status, "rtems_task_set_priority" );
40  printf(
41    "TA1 - rtems_task_set_priority - get initial priority of self: %02d\n",
42    the_priority
43  );
44
45  while( FOREVER ) {
46    status = rtems_task_get_note( RTEMS_SELF, RTEMS_NOTEPAD_8, &the_priority );
47    directive_failed( status, "rtems_task_get_note" );
48    printf(
49"TA1 - rtems_task_get_note - get RTEMS_NOTEPAD_8 - current priority: %02d\n",
50       the_priority
51    );
52
53    if ( --the_priority == 0 ) {
54      puts( "TA1 - rtems_task_suspend - suspend TA2" );
55      status = rtems_task_suspend( Task_id[ 2 ] );
56      directive_failed( status, "rtems_task_suspend" );
57
58      puts( "TA1 - rtems_task_set_priority - set priority of TA2 ( blocked )" );
59      status = rtems_task_set_priority( Task_id[ 2 ], 5, &previous_priority );
60      directive_failed( status, "rtems_task_set_priority" );
61
62      status = rtems_task_delete( Task_id[ 2 ] );
63      directive_failed( status, "rtems_task_delete of TA2" );
64
65      status = rtems_task_delete( RTEMS_SELF );
66      directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
67    }
68
69    printf( "TA1 - rtems_task_set_note - set TA2's RTEMS_NOTEPAD_8: %02d\n",
70            the_priority
71    );
72    status = rtems_task_set_note( Task_id[ 2 ], RTEMS_NOTEPAD_8, the_priority );
73    directive_failed( status, "rtems_task_set_note" );
74
75    printf( "TA1 - rtems_task_set_priority - set TA2's priority: %02d\n",
76            the_priority
77    );
78    status = rtems_task_set_priority(
79               Task_id[ 2 ],
80               the_priority,
81               &previous_priority
82    );
83    directive_failed( status, "rtems_task_set_priority" );
84  }
85}
Note: See TracBrowser for help on using the repository browser.