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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [rtos/] [rtems/] [c/] [src/] [tests/] [sptests/] [sp12/] [task2.c] - Blame information for rev 173

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 30 unneback
/*  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: task2.c,v 1.2 2001-09-27 12:02:32 chris Exp $
19
 */
20
 
21
 
22
#include "system.h"
23
 
24
rtems_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
}

powered by: WebSVN 2.1.0

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