OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [rtos/] [rtems/] [c/] [src/] [tests/] [sptests/] [sp09/] [screen06.c] - Blame information for rev 30

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 30 unneback
/*  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-1999.
10
 *  On-Line Applications Research Corporation (OAR).
11
 *
12
 *  The license and distribution terms for this file may be
13
 *  found in the file LICENSE in this distribution or at
14
 *  http://www.OARcorp.com/rtems/license.html.
15
 *
16
 *  $Id: screen06.c,v 1.2 2001-09-27 12:02:31 chris Exp $
17
 */
18
 
19
#include "system.h"
20
 
21
void Screen6()
22
{
23
  rtems_status_code status;
24
 
25
  status = rtems_semaphore_obtain(
26
    100,
27
    RTEMS_DEFAULT_OPTIONS,
28
    RTEMS_NO_TIMEOUT
29
  );
30
  fatal_directive_status(
31
    status,
32
    RTEMS_INVALID_ID,
33
    "rtems_semaphore_obtain with illegal id"
34
  );
35
  puts( "TA1 - rtems_semaphore_obtain - RTEMS_INVALID_ID" );
36
 
37
  status = rtems_semaphore_obtain(
38
    Semaphore_id[ 1 ],
39
    RTEMS_DEFAULT_OPTIONS,
40
    RTEMS_NO_TIMEOUT
41
  );
42
  directive_failed( status, "rtems_semaphore_obtain successful" );
43
  puts( "TA1 - rtems_semaphore_obtain - got sem 1 - RTEMS_SUCCESSFUL" );
44
 
45
  status = rtems_semaphore_obtain(
46
    Semaphore_id[ 1 ],
47
    RTEMS_NO_WAIT,
48
    RTEMS_NO_TIMEOUT
49
  );
50
  fatal_directive_status(
51
    status,
52
    RTEMS_UNSATISFIED,
53
    "rtems_semaphore_obtain not available"
54
  );
55
  puts( "TA1 - rtems_semaphore_obtain - RTEMS_UNSATISFIED" );
56
 
57
  puts( "TA1 - rtems_semaphore_obtain - timeout in 3 seconds" );
58
  status = rtems_semaphore_obtain(
59
    Semaphore_id[ 1 ],
60
    RTEMS_DEFAULT_OPTIONS,
61
    3 * TICKS_PER_SECOND
62
  );
63
  fatal_directive_status(
64
    status,
65
    RTEMS_TIMEOUT,
66
    "rtems_semaphore_obtain timeout"
67
  );
68
  puts( "TA1 - rtems_semaphore_obtain - woke up with RTEMS_TIMEOUT" );
69
 
70
  status = rtems_semaphore_release( Semaphore_id[ 2 ] );
71
  fatal_directive_status(
72
    status,
73
    RTEMS_NOT_OWNER_OF_RESOURCE,
74
    "rtems_semaphore_release and not owner"
75
  );
76
  puts( "TA1 - rtems_semaphore_release - RTEMS_NOT_OWNER_OF_RESOURCE" );
77
 
78
  status = rtems_semaphore_release( 100 );
79
  fatal_directive_status(
80
    status,
81
    RTEMS_INVALID_ID,
82
    "rtems_semaphore_release with illegal id"
83
  );
84
  puts( "TA1 - rtems_semaphore_release - RTEMS_INVALID_ID" );
85
 
86
  puts( "TA1 - rtems_task_start - start TA2 - RTEMS_SUCCESSFUL" );
87
  status = rtems_task_start( Task_id[ 2 ], Task_2, 0 );
88
  directive_failed( status, "rtems_task_start of TA2" );
89
 
90
  puts( "TA1 - rtems_task_wake_after - yield processor - RTEMS_SUCCESSFUL" );
91
  status = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR );
92
  directive_failed( status, "rtems_task_wake_after (yield)" );
93
 
94
  puts( "TA1 - rtems_semaphore_delete - delete sem 1 - RTEMS_SUCCESSFUL" );
95
  status = rtems_semaphore_delete( Semaphore_id[ 1 ] );
96
  directive_failed( status, "rtems_semaphore_delete of SM1" );
97
 
98
  puts( "TA1 - rtems_semaphore_obtain - binary semaphore" );
99
  status = rtems_semaphore_obtain(
100
    Semaphore_id[ 2 ],
101
    RTEMS_DEFAULT_OPTIONS,
102
    RTEMS_NO_TIMEOUT
103
  );
104
  directive_failed( status, "rtems_semaphore_obtain");
105
 
106
  puts( "TA1 - rtems_semaphore_delete - delete sem 2 - RTEMS_RESOURCE_IN_USE" );
107
  status = rtems_semaphore_delete( Semaphore_id[ 2 ] );
108
  fatal_directive_status(
109
     status,
110
     RTEMS_RESOURCE_IN_USE,
111
     "rtems_semaphore_delete of SM2"
112
  );
113
 
114
  puts( "TA1 - rtems_task_wake_after - yield processor - RTEMS_SUCCESSFUL" );
115
  status = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR );
116
  directive_failed( status, "rtems_task_wake_after (yield)" );
117
 
118
  status = rtems_task_delete( Task_id[ 2 ] );
119
  fatal_directive_status(
120
    status,
121
    RTEMS_INVALID_ID,
122
    "rtems_task_delete after the task has been deleted"
123
  );
124
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.