source: rtems/testsuites/sptests/sp09/screen06.c @ ac7d5ef0

4.104.114.84.95
Last change on this file since ac7d5ef0 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: 3.6 KB
Line 
1/*  Screen6
2 *
3 *  This routine generates error screen 6 for test 9.
4 *
5 *  Input parameters:  NONE
6 *
7 *  Output parameters:  NONE
8 *
9 *  COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
10 *  On-Line Applications Research Corporation (OAR).
11 *  All rights assigned to U.S. Government, 1994.
12 *
13 *  This material may be reproduced by or for the U.S. Government pursuant
14 *  to the copyright license under the clause at DFARS 252.227-7013.  This
15 *  notice must appear in all copies of this file and its derivatives.
16 *
17 *  $Id$
18 */
19
20#include "system.h"
21
22void Screen6()
23{
24  rtems_status_code status;
25
26  status = rtems_semaphore_obtain(
27    100,
28    RTEMS_DEFAULT_OPTIONS,
29    RTEMS_NO_TIMEOUT
30  );
31  fatal_directive_status(
32    status,
33    RTEMS_INVALID_ID,
34    "rtems_semaphore_obtain with illegal id"
35  );
36  puts( "TA1 - rtems_semaphore_obtain - RTEMS_INVALID_ID" );
37
38  status = rtems_semaphore_obtain(
39    Semaphore_id[ 1 ],
40    RTEMS_DEFAULT_OPTIONS,
41    RTEMS_NO_TIMEOUT
42  );
43  directive_failed( status, "rtems_semaphore_obtain successful" );
44  puts( "TA1 - rtems_semaphore_obtain - got sem 1 - RTEMS_SUCCESSFUL" );
45
46  status = rtems_semaphore_obtain(
47    Semaphore_id[ 1 ],
48    RTEMS_NO_WAIT,
49    RTEMS_NO_TIMEOUT
50  );
51  fatal_directive_status(
52    status,
53    RTEMS_UNSATISFIED,
54    "rtems_semaphore_obtain not available"
55  );
56  puts( "TA1 - rtems_semaphore_obtain - RTEMS_UNSATISFIED" );
57
58  puts( "TA1 - rtems_semaphore_obtain - timeout in 3 seconds" );
59  status = rtems_semaphore_obtain(
60    Semaphore_id[ 1 ],
61    RTEMS_DEFAULT_OPTIONS,
62    3 * TICKS_PER_SECOND
63  );
64  fatal_directive_status(
65    status,
66    RTEMS_TIMEOUT,
67    "rtems_semaphore_obtain timeout"
68  );
69  puts( "TA1 - rtems_semaphore_obtain - woke up with RTEMS_TIMEOUT" );
70
71  status = rtems_semaphore_release( Semaphore_id[ 2 ] );
72  fatal_directive_status(
73    status,
74    RTEMS_NOT_OWNER_OF_RESOURCE,
75    "rtems_semaphore_release and not owner"
76  );
77  puts( "TA1 - rtems_semaphore_release - RTEMS_NOT_OWNER_OF_RESOURCE" );
78
79  status = rtems_semaphore_release( 100 );
80  fatal_directive_status(
81    status,
82    RTEMS_INVALID_ID,
83    "rtems_semaphore_release with illegal id"
84  );
85  puts( "TA1 - rtems_semaphore_release - RTEMS_INVALID_ID" );
86
87  puts( "TA1 - rtems_task_start - start TA2 - RTEMS_SUCCESSFUL" );
88  status = rtems_task_start( Task_id[ 2 ], Task_2, 0 );
89  directive_failed( status, "rtems_task_start of TA2" );
90
91  puts( "TA1 - rtems_task_wake_after - yield processor - RTEMS_SUCCESSFUL" );
92  status = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR );
93  directive_failed( status, "rtems_task_wake_after (yield)" );
94
95  puts( "TA1 - rtems_semaphore_delete - delete sem 1 - RTEMS_SUCCESSFUL" );
96  status = rtems_semaphore_delete( Semaphore_id[ 1 ] );
97  directive_failed( status, "rtems_semaphore_delete of SM1" );
98
99  puts( "TA1 - rtems_semaphore_obtain - binary semaphore" );
100  status = rtems_semaphore_obtain(
101    Semaphore_id[ 2 ],
102    RTEMS_DEFAULT_OPTIONS,
103    RTEMS_NO_TIMEOUT
104  );
105  directive_failed( status, "rtems_semaphore_obtain");
106
107  puts( "TA1 - rtems_semaphore_delete - delete sem 2 - RTEMS_RESOURCE_IN_USE" );
108  status = rtems_semaphore_delete( Semaphore_id[ 2 ] );
109  fatal_directive_status(
110     status,
111     RTEMS_RESOURCE_IN_USE,
112     "rtems_semaphore_delete of SM2"
113  );
114
115  puts( "TA1 - rtems_task_wake_after - yield processor - RTEMS_SUCCESSFUL" );
116  status = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR );
117  directive_failed( status, "rtems_task_wake_after (yield)" );
118
119  status = rtems_task_delete( Task_id[ 2 ] );
120  fatal_directive_status(
121    status,
122    RTEMS_INVALID_ID,
123    "rtems_task_delete after the task has been deleted"
124  );
125}
Note: See TracBrowser for help on using the repository browser.