source: rtems/c/src/exec/rtems/src/semtranslatereturncode.c @ c06d8f64

4.104.114.84.95
Last change on this file since c06d8f64 was c06d8f64, checked in by Joel Sherrill <joel.sherrill@…>, on 05/17/99 at 22:58:30

Split the Semaphore Manager into one routine per file.

  • Property mode set to 100644
File size: 3.0 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-1998.
19 *  On-Line Applications Research Corporation (OAR).
20 *  Copyright assigned to U.S. Government, 1994.
21 *
22 *  The license and distribution terms for this file may be
23 *  found in the file LICENSE in this distribution or at
24 *  http://www.OARcorp.com/rtems/license.html.
25 *
26 *  $Id$
27 */
28
29#include <rtems/system.h>
30#include <rtems/rtems/status.h>
31#include <rtems/rtems/support.h>
32#include <rtems/rtems/attr.h>
33#include <rtems/score/isr.h>
34#include <rtems/score/object.h>
35#include <rtems/rtems/options.h>
36#include <rtems/rtems/sem.h>
37#include <rtems/score/coremutex.h>
38#include <rtems/score/coresem.h>
39#include <rtems/score/states.h>
40#include <rtems/score/thread.h>
41#include <rtems/score/threadq.h>
42#if defined(RTEMS_MULTIPROCESSING)
43#include <rtems/score/mpci.h>
44#endif
45#include <rtems/score/sysstate.h>
46
47#include <rtems/score/interr.h>
48
49/*PAGE
50 *
51 *  _Semaphore_Translate_core_mutex_return_code
52 *
53 *  Input parameters:
54 *    the_mutex_status - mutex status code to translate
55 *
56 *  Output parameters:
57 *    rtems status code - translated RTEMS status code
58 *
59 */
60 
61rtems_status_code _Semaphore_Translate_core_mutex_return_code (
62  unsigned32 the_mutex_status
63)
64{
65  switch ( the_mutex_status ) {
66    case  CORE_MUTEX_STATUS_SUCCESSFUL:
67      return RTEMS_SUCCESSFUL;
68    case CORE_MUTEX_STATUS_UNSATISFIED_NOWAIT:
69      return RTEMS_UNSATISFIED;
70    case CORE_MUTEX_STATUS_NESTING_NOT_ALLOWED:
71      return RTEMS_INTERNAL_ERROR;
72    case CORE_MUTEX_STATUS_NOT_OWNER_OF_RESOURCE:
73      return RTEMS_NOT_OWNER_OF_RESOURCE;
74    case CORE_MUTEX_WAS_DELETED:
75      return RTEMS_OBJECT_WAS_DELETED;
76    case CORE_MUTEX_TIMEOUT:
77      return RTEMS_TIMEOUT;
78    case THREAD_STATUS_PROXY_BLOCKING:
79      return THREAD_STATUS_PROXY_BLOCKING;
80  }
81  return RTEMS_INTERNAL_ERROR;   /* unreached - only to remove warnings */
82}
83
84/*PAGE
85 *
86 *  _Semaphore_Translate_core_semaphore_return_code
87 *
88 *  Input parameters:
89 *    the_semaphore_status - semaphore status code to translate
90 *
91 *  Output parameters:
92 *    rtems status code - translated RTEMS status code
93 *
94 */
95 
96rtems_status_code _Semaphore_Translate_core_semaphore_return_code (
97  unsigned32 the_semaphore_status
98)
99{
100  switch ( the_semaphore_status ) {
101    case  CORE_SEMAPHORE_STATUS_SUCCESSFUL:
102      return RTEMS_SUCCESSFUL;
103    case CORE_SEMAPHORE_STATUS_UNSATISFIED_NOWAIT:
104      return RTEMS_UNSATISFIED;
105    case CORE_SEMAPHORE_WAS_DELETED:
106      return RTEMS_OBJECT_WAS_DELETED;
107    case CORE_SEMAPHORE_TIMEOUT:
108      return RTEMS_TIMEOUT;
109    case THREAD_STATUS_PROXY_BLOCKING:
110      return THREAD_STATUS_PROXY_BLOCKING;
111  }
112  return RTEMS_INTERNAL_ERROR;   /* unreached - only to remove warnings */
113}
Note: See TracBrowser for help on using the repository browser.