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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [rtems-20020807/] [cpukit/] [rtems/] [src/] [semtranslatereturncode.c] - Blame information for rev 1780

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

Line No. Rev Author Line
1 1026 ivang
/*
2
 *  Semaphore Manager
3
 *
4
 *  DESCRIPTION:
5
 *
6
 *  This package is the implementation of the Semaphore Manager.
7
 *  This manager utilizes standard Dijkstra counting semaphores to provide
8
 *  synchronization and mutual exclusion capabilities.
9
 *
10
 *  Directives provided are:
11
 *
12
 *     + create a semaphore
13
 *     + get an ID of a semaphore
14
 *     + delete a semaphore
15
 *     + acquire a semaphore
16
 *     + release a semaphore
17
 *
18
 *  COPYRIGHT (c) 1989-1999.
19
 *  On-Line Applications Research Corporation (OAR).
20
 *
21
 *  The license and distribution terms for this file may be
22
 *  found in the file LICENSE in this distribution or at
23
 *  http://www.OARcorp.com/rtems/license.html.
24
 *
25
 *  semtranslatereturncode.c,v 1.7 2000/07/06 20:00:44 joel Exp
26
 */
27
 
28
#include <rtems/system.h>
29
#include <rtems/rtems/status.h>
30
#include <rtems/rtems/support.h>
31
#include <rtems/rtems/attr.h>
32
#include <rtems/score/isr.h>
33
#include <rtems/score/object.h>
34
#include <rtems/rtems/options.h>
35
#include <rtems/rtems/sem.h>
36
#include <rtems/score/coremutex.h>
37
#include <rtems/score/coresem.h>
38
#include <rtems/score/states.h>
39
#include <rtems/score/thread.h>
40
#include <rtems/score/threadq.h>
41
#if defined(RTEMS_MULTIPROCESSING)
42
#include <rtems/score/mpci.h>
43
#endif
44
#include <rtems/score/sysstate.h>
45
 
46
#include <rtems/score/interr.h>
47
 
48
/*PAGE
49
 *
50
 *  _Semaphore_Translate_core_mutex_return_code
51
 *
52
 *  Input parameters:
53
 *    the_mutex_status - mutex status code to translate
54
 *
55
 *  Output parameters:
56
 *    rtems status code - translated RTEMS status code
57
 *
58
 */
59
 
60
rtems_status_code _Semaphore_Translate_core_mutex_return_code_[] = {
61
  RTEMS_SUCCESSFUL,         /* CORE_MUTEX_STATUS_SUCCESSFUL */
62
  RTEMS_UNSATISFIED,        /* CORE_MUTEX_STATUS_UNSATISFIED_NOWAIT */
63
  RTEMS_UNSATISFIED,        /* CORE_MUTEX_STATUS_NESTING_NOT_ALLOWED */
64
  RTEMS_NOT_OWNER_OF_RESOURCE, /* CORE_MUTEX_STATUS_NOT_OWNER_OF_RESOURCE */
65
  RTEMS_OBJECT_WAS_DELETED, /* CORE_MUTEX_WAS_DELETED */
66
  RTEMS_TIMEOUT,            /* CORE_MUTEX_TIMEOUT */
67
  RTEMS_INTERNAL_ERROR,     /* CORE_MUTEX_STATUS_CEILING_VIOLATED */
68
};
69
 
70
 
71
rtems_status_code _Semaphore_Translate_core_mutex_return_code (
72
  unsigned32 the_mutex_status
73
)
74
{
75
#if defined(RTEMS_MULTIPROCESSING)
76
  if ( the_mutex_status == THREAD_STATUS_PROXY_BLOCKING )
77
    return RTEMS_PROXY_BLOCKING;
78
  else
79
#endif
80
  if ( the_mutex_status > CORE_MUTEX_STATUS_CEILING_VIOLATED )
81
    return RTEMS_INTERNAL_ERROR;
82
  else
83
    return _Semaphore_Translate_core_mutex_return_code_[the_mutex_status];
84
}
85
 
86
/*PAGE
87
 *
88
 *  _Semaphore_Translate_core_semaphore_return_code
89
 *
90
 *  Input parameters:
91
 *    the_semaphore_status - semaphore status code to translate
92
 *
93
 *  Output parameters:
94
 *    rtems status code - translated RTEMS status code
95
 *
96
 */
97
 
98
rtems_status_code _Semaphore_Translate_core_semaphore_return_code_[] = {
99
  RTEMS_SUCCESSFUL,         /* CORE_SEMAPHORE_STATUS_SUCCESSFUL */
100
  RTEMS_UNSATISFIED,        /* CORE_SEMAPHORE_STATUS_UNSATISFIED_NOWAIT */
101
  RTEMS_OBJECT_WAS_DELETED, /* CORE_SEMAPHORE_WAS_DELETED */
102
  RTEMS_TIMEOUT,            /* CORE_SEMAPHORE_TIMEOUT  */
103
  RTEMS_INTERNAL_ERROR,     /* CORE_SEMAPHORE_MAXIMUM_COUNT_EXCEEDED */
104
 
105
};
106
 
107
rtems_status_code _Semaphore_Translate_core_semaphore_return_code (
108
  unsigned32 the_semaphore_status
109
)
110
{
111
#if defined(RTEMS_MULTIPROCESSING)
112
  if ( the_semaphore_status == THREAD_STATUS_PROXY_BLOCKING )
113
    return RTEMS_PROXY_BLOCKING;
114
  else
115
#endif
116
  if ( the_semaphore_status > CORE_MUTEX_STATUS_CEILING_VIOLATED )
117
    return RTEMS_INTERNAL_ERROR;
118
  else
119
    return _Semaphore_Translate_core_semaphore_return_code_[the_semaphore_status];
120
}

powered by: WebSVN 2.1.0

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