source: rtems/testsuites/sptests/sp12/task2.c @ 8fbdf07

4.104.114.84.95
Last change on this file since 8fbdf07 was 08311cc3, checked in by Joel Sherrill <joel.sherrill@…>, on 11/17/99 at 17:51:34

Updated copyright notice.

  • Property mode set to 100644
File size: 1.9 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-1999.
12 *  On-Line Applications Research Corporation (OAR).
13 *
14 *  The license and distribution terms for this file may be
15 *  found in the file LICENSE in this distribution or at
16 *  http://www.OARcorp.com/rtems/license.html.
17 *
18 *  $Id$
19 */
20
21
22#include "system.h"
23
24rtems_task Task_2(
25  rtems_task_argument argument
26)
27{
28  rtems_status_code   status;
29  rtems_task_priority previous_priority;
30
31  puts( "TA2 - rtems_semaphore_obtain - wait forever on SM1" );
32  status = rtems_semaphore_obtain(
33    Semaphore_id[ 1 ],
34    RTEMS_DEFAULT_OPTIONS,
35    RTEMS_NO_TIMEOUT
36  );
37  puts( "TA2 - got SM1" );
38  directive_failed( status, "rtems_semaphore_obtain on SM1" );
39
40  puts( "TA2 - rtems_semaphore_release - release SM1" );
41  status = rtems_semaphore_release( Semaphore_id[ 1 ] );
42  directive_failed( status, "rtems_semaphore_release on SM1" );
43
44  puts( "TA2 - rtems_task_set_priority - make self highest priority task" );
45  status = rtems_task_set_priority( RTEMS_SELF, 3, &previous_priority );
46  directive_failed( status, "rtems_task_set_priority on TA2" );
47
48  puts( "TA2 - rtems_semaphore_obtain - wait forever on SM2" );
49  status = rtems_semaphore_obtain(
50    Semaphore_id[ 2 ],
51    RTEMS_DEFAULT_OPTIONS,
52    RTEMS_NO_TIMEOUT
53  );
54  puts( "TA2 - got SM2" );
55  directive_failed( status, "rtems_semaphore_obtain on SM2" );
56
57  puts( "TA2 - rtems_semaphore_release - release SM2" );
58  status = rtems_semaphore_release( Semaphore_id[ 2 ] );
59  directive_failed( status, "rtems_semaphore_release on SM2" );
60
61  puts( "TA2 - rtems_task_delete - delete self" );
62  status = rtems_task_delete( RTEMS_SELF );
63  directive_failed( status, "rtems_task_delete of TA2" );
64}
Note: See TracBrowser for help on using the repository browser.