source: rtems/testsuites/sptests/sp12/task2.c @ 3a4ae6c

4.104.114.84.95
Last change on this file since 3a4ae6c was ac7d5ef0, checked in by Joel Sherrill <joel.sherrill@…>, on 05/11/95 at 17:39:37

Initial revision

  • Property mode set to 100644
File size: 2.0 KB
Line 
1/*  Task_2
2 *
3 *  This routine serves as a test task.  It simply obtains semaphores
4 *  1 and 2, the later when it is a high priority task.
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
23#include "system.h"
24
25rtems_task Task_2(
26  rtems_task_argument argument
27)
28{
29  rtems_status_code   status;
30  rtems_task_priority previous_priority;
31
32  puts( "TA2 - rtems_semaphore_obtain - wait forever on SM1" );
33  status = rtems_semaphore_obtain(
34    Semaphore_id[ 1 ],
35    RTEMS_DEFAULT_OPTIONS,
36    RTEMS_NO_TIMEOUT
37  );
38  puts( "TA2 - got SM1" );
39  directive_failed( status, "rtems_semaphore_obtain on SM1" );
40
41  puts( "TA2 - rtems_semaphore_release - release SM1" );
42  status = rtems_semaphore_release( Semaphore_id[ 1 ] );
43  directive_failed( status, "rtems_semaphore_release on SM1" );
44
45  puts( "TA2 - rtems_task_set_priority - make self highest priority task" );
46  status = rtems_task_set_priority( RTEMS_SELF, 3, &previous_priority );
47  directive_failed( status, "rtems_task_set_priority on TA2" );
48
49  puts( "TA2 - rtems_semaphore_obtain - wait forever on SM2" );
50  status = rtems_semaphore_obtain(
51    Semaphore_id[ 2 ],
52    RTEMS_DEFAULT_OPTIONS,
53    RTEMS_NO_TIMEOUT
54  );
55  puts( "TA2 - got SM2" );
56  directive_failed( status, "rtems_semaphore_obtain on SM2" );
57
58  puts( "TA2 - rtems_semaphore_release - release SM2" );
59  status = rtems_semaphore_release( Semaphore_id[ 2 ] );
60  directive_failed( status, "rtems_semaphore_release on SM2" );
61
62  puts( "TA2 - rtems_task_delete - delete self" );
63  status = rtems_task_delete( RTEMS_SELF );
64  directive_failed( status, "rtems_task_delete of TA2" );
65}
Note: See TracBrowser for help on using the repository browser.