source: rtems/cpukit/rtems/src/semtranslatereturncode.c @ 21242c2

4.115
Last change on this file since 21242c2 was 21242c2, checked in by Joel Sherrill <joel.sherrill@…>, on 06/24/11 at 17:52:58

2011-06-24 Joel Sherrill <joel.sherrill@…>

  • include/rtems/bspIo.h, include/rtems/concat.h, include/rtems/endian.h, include/rtems/fs.h, include/rtems/irq.h, include/rtems/pci.h, include/rtems/userenv.h, libblock/include/rtems/flashdisk.h, libblock/include/rtems/nvdisk-sram.h, libblock/include/rtems/nvdisk.h, libcsupport/include/clockdrv.h, libcsupport/include/console.h, libcsupport/include/iosupp.h, libcsupport/include/spurious.h, libcsupport/include/motorola/mc68230.h, libcsupport/include/rtems/assoc.h, libcsupport/include/rtems/error.h, libcsupport/include/rtems/framebuffer.h, libcsupport/include/rtems/gxx_wrappers.h, libcsupport/include/rtems/libcsupport.h, libcsupport/include/rtems/libio_.h, libcsupport/include/rtems/malloc.h, libcsupport/include/rtems/termiostypes.h, libcsupport/include/sys/statvfs.h, libcsupport/include/sys/termios.h, libcsupport/include/sys/utsname.h, libcsupport/include/zilog/z8036.h, libcsupport/include/zilog/z8530.h, libcsupport/include/zilog/z8536.h, libfs/src/imfs/imfs.h, libfs/src/pipe/pipe.h, libmisc/capture/capture-cli.h, libmisc/capture/capture.h, libmisc/cpuuse/cpuuse.h, libmisc/devnull/devnull.h, libmisc/devnull/devzero.h, libmisc/dumpbuf/dumpbuf.h, libmisc/fb/fb.h, libmisc/fb/mw_uid.h, libmisc/mouse/mouse_parser.h, libmisc/shell/shellconfig.h, libmisc/stringto/stringto.h, libmisc/untar/untar.h, libnetworking/memory.h, posix/include/aio.h, posix/include/mqueue.h, posix/include/semaphore.h, posix/include/rtems/posix/aio_misc.h, posix/include/rtems/posix/barrier.h, posix/include/rtems/posix/cond.h, posix/include/rtems/posix/config.h, posix/include/rtems/posix/key.h, posix/include/rtems/posix/mqueue.h, posix/include/rtems/posix/mutex.h, posix/include/rtems/posix/posixapi.h, posix/include/rtems/posix/priority.h, posix/include/rtems/posix/psignal.h, posix/include/rtems/posix/pthread.h, posix/include/rtems/posix/ptimer.h, posix/include/rtems/posix/rwlock.h, posix/include/rtems/posix/semaphore.h, posix/include/rtems/posix/sigset.h, posix/include/rtems/posix/spinlock.h, posix/include/rtems/posix/threadsup.h, posix/include/rtems/posix/time.h, posix/include/rtems/posix/timer.h, posix/inline/rtems/posix/barrier.inl, posix/inline/rtems/posix/cond.inl, posix/inline/rtems/posix/mqueue.inl, posix/inline/rtems/posix/mutex.inl, posix/inline/rtems/posix/priority.inl, posix/inline/rtems/posix/pthread.inl, posix/inline/rtems/posix/rwlock.inl, posix/inline/rtems/posix/semaphore.inl, posix/inline/rtems/posix/spinlock.inl, posix/inline/rtems/posix/timer.inl, rtems/mainpage.h, rtems/include/rtems/rtems/barrier.h, rtems/include/rtems/rtems/object.h, rtems/include/rtems/rtems/timer.h, rtems/inline/rtems/rtems/barrier.inl, rtems/inline/rtems/rtems/timer.inl, rtems/src/semtranslatereturncode.c, sapi/include/rtems/config.h, sapi/include/rtems/fatal.h, sapi/include/rtems/mptables.h, score/include/rtems/score/object.h, score/include/rtems/score/priority.h, score/inline/rtems/score/object.inl, score/inline/rtems/score/priority.inl: Add @file Doxygen directives and descriptions to files which originated with RTEMS. This improves the file list page generated by Doxygen.
  • Property mode set to 100644
File size: 3.7 KB
Line 
1/*
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-2009.
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.rtems.com/license/LICENSE.
24 *
25 *  $Id$
26 */
27
28#if HAVE_CONFIG_H
29#include "config.h"
30#endif
31
32#include <rtems/system.h>
33#include <rtems/rtems/status.h>
34#include <rtems/rtems/support.h>
35#include <rtems/rtems/attr.h>
36#include <rtems/score/isr.h>
37#include <rtems/score/object.h>
38#include <rtems/rtems/options.h>
39#include <rtems/rtems/sem.h>
40#include <rtems/score/coremutex.h>
41#include <rtems/score/coresem.h>
42#include <rtems/score/states.h>
43#include <rtems/score/thread.h>
44#include <rtems/score/threadq.h>
45#if defined(RTEMS_MULTIPROCESSING)
46#include <rtems/score/mpci.h>
47#endif
48#include <rtems/score/sysstate.h>
49
50#include <rtems/score/interr.h>
51
52/*PAGE
53 *
54 *  _Semaphore_Translate_core_mutex_return_code
55 *
56 *  Input parameters:
57 *    status - mutex status code to translate
58 *
59 *  Output parameters:
60 *    rtems status code - translated RTEMS status code
61 *
62 */
63
64const rtems_status_code _Semaphore_Translate_core_mutex_return_code_[] = {
65  RTEMS_SUCCESSFUL,         /* CORE_MUTEX_STATUS_SUCCESSFUL */
66  RTEMS_UNSATISFIED,        /* CORE_MUTEX_STATUS_UNSATISFIED_NOWAIT */
67#if defined(RTEMS_POSIX_API)
68  RTEMS_UNSATISFIED,        /* CORE_MUTEX_STATUS_NESTING_NOT_ALLOWED */
69#endif
70  RTEMS_NOT_OWNER_OF_RESOURCE, /* CORE_MUTEX_STATUS_NOT_OWNER_OF_RESOURCE */
71  RTEMS_OBJECT_WAS_DELETED, /* CORE_MUTEX_WAS_DELETED */
72  RTEMS_TIMEOUT,            /* CORE_MUTEX_TIMEOUT */
73#if defined(__RTEMS_STRICT_ORDER_MUTEX__)
74    123,
75#endif
76  RTEMS_INVALID_PRIORITY   /* CORE_MUTEX_STATUS_CEILING_VIOLATED */
77};
78
79rtems_status_code _Semaphore_Translate_core_mutex_return_code (
80  uint32_t   status
81)
82{
83  /*
84   *  If this thread is blocking waiting for a result on a remote operation.
85   */
86  #if defined(RTEMS_MULTIPROCESSING)
87    if ( _Thread_Is_proxy_blocking(status) )
88      return RTEMS_PROXY_BLOCKING;
89  #endif
90
91  /*
92   *  Internal consistency check for bad status from SuperCore
93   */
94  #if defined(RTEMS_DEBUG)
95    if ( status > CORE_MUTEX_STATUS_LAST )
96      return RTEMS_INTERNAL_ERROR;
97  #endif
98  return _Semaphore_Translate_core_mutex_return_code_[status];
99}
100
101/*PAGE
102 *
103 *  _Semaphore_Translate_core_semaphore_return_code
104 *
105 *  Input parameters:
106 *    status - semaphore status code to translate
107 *
108 *  Output parameters:
109 *    rtems status code - translated RTEMS status code
110 *
111 */
112
113const rtems_status_code _Semaphore_Translate_core_semaphore_return_code_[] = {
114  RTEMS_SUCCESSFUL,         /* CORE_SEMAPHORE_STATUS_SUCCESSFUL */
115  RTEMS_UNSATISFIED,        /* CORE_SEMAPHORE_STATUS_UNSATISFIED_NOWAIT */
116  RTEMS_OBJECT_WAS_DELETED, /* CORE_SEMAPHORE_WAS_DELETED */
117  RTEMS_TIMEOUT,            /* CORE_SEMAPHORE_TIMEOUT  */
118  RTEMS_INTERNAL_ERROR,     /* CORE_SEMAPHORE_MAXIMUM_COUNT_EXCEEDED */
119};
120
121rtems_status_code _Semaphore_Translate_core_semaphore_return_code (
122  uint32_t   status
123)
124{
125  #if defined(RTEMS_MULTIPROCESSING)
126    if ( _Thread_Is_proxy_blocking(status) )
127      return RTEMS_PROXY_BLOCKING;
128  #endif
129  /*
130   *  Internal consistency check for bad status from SuperCore
131   */
132  #if defined(RTEMS_DEBUG)
133    if ( status > CORE_SEMAPHORE_STATUS_LAST )
134      return RTEMS_INTERNAL_ERROR;
135  #endif
136  return _Semaphore_Translate_core_semaphore_return_code_[status];
137}
Note: See TracBrowser for help on using the repository browser.