source: rtems/cpukit/rtems/src/rtemsobjectgetapiclassname.c @ 3d7d2a37

5
Last change on this file since 3d7d2a37 was de59c065, checked in by Sebastian Huber <sebastian.huber@…>, on 09/27/17 at 13:08:33

posix: Implement self-contained POSIX mutex

POSIX mutexes are now available in all configurations and no longer
depend on --enable-posix.

Update #2514.
Update #3112.

  • Property mode set to 100644
File size: 2.5 KB
Line 
1/**
2 *  @file
3 *
4 *  @brief Get Class Name
5 *  @ingroup ClassicClassInfo
6 */
7
8/*
9 *  COPYRIGHT (c) 1989-2008.
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.rtems.org/license/LICENSE.
15 */
16
17#ifdef HAVE_CONFIG_H
18#include "config.h"
19#endif
20
21#include <rtems/rtems/object.h>
22#include <rtems/score/objectimpl.h>
23
24#include <rtems/assoc.h>
25
26static const rtems_assoc_t rtems_object_api_internal_assoc[] = {
27  { "Thread",                  OBJECTS_INTERNAL_THREADS, 0},
28  { "Mutex",                   OBJECTS_INTERNAL_MUTEXES, 0},
29  { NULL,                      0, 0}
30};
31
32static const rtems_assoc_t rtems_object_api_classic_assoc[] = {
33  { "Task",                    OBJECTS_RTEMS_TASKS, 0},
34  { "Timer",                   OBJECTS_RTEMS_TIMERS, 0},
35  { "Semaphore",               OBJECTS_RTEMS_SEMAPHORES, 0},
36  { "Message Queue",           OBJECTS_RTEMS_MESSAGE_QUEUES, 0},
37  { "Partition",               OBJECTS_RTEMS_PARTITIONS, 0},
38  { "Region",                  OBJECTS_RTEMS_REGIONS, 0},
39  { "Port",                    OBJECTS_RTEMS_PORTS, 0},
40  { "Period",                  OBJECTS_RTEMS_PERIODS, 0},
41  { "Extension",               OBJECTS_RTEMS_EXTENSIONS, 0},
42  { "Barrier",                 OBJECTS_RTEMS_BARRIERS, 0},
43  { NULL,                      0, 0}
44};
45
46#ifdef RTEMS_POSIX_API
47static const rtems_assoc_t rtems_object_api_posix_assoc[] = {
48  { "Thread",                  OBJECTS_POSIX_THREADS, 0},
49  { "Key",                     OBJECTS_POSIX_KEYS, 0},
50  { "Interrupt",               OBJECTS_POSIX_INTERRUPTS, 0},
51  { "Message Queue",           OBJECTS_POSIX_MESSAGE_QUEUES, 0},
52  { "Semaphore",               OBJECTS_POSIX_SEMAPHORES, 0},
53  { "Timer",                   OBJECTS_POSIX_TIMERS, 0},
54  { "Shared Memory",           OBJECTS_POSIX_SHMS, 0},
55  { NULL,                      0, 0}
56};
57#endif
58
59const char *rtems_object_get_api_class_name(
60  int the_api,
61  int the_class
62)
63{
64  const rtems_assoc_t *api_assoc;
65  const rtems_assoc_t *class_assoc;
66
67  if ( the_api == OBJECTS_INTERNAL_API )
68    api_assoc = rtems_object_api_internal_assoc;
69  else if ( the_api == OBJECTS_CLASSIC_API )
70    api_assoc = rtems_object_api_classic_assoc;
71#ifdef RTEMS_POSIX_API
72  else if ( the_api == OBJECTS_POSIX_API )
73    api_assoc = rtems_object_api_posix_assoc;
74#endif
75  else
76    return "BAD API";
77  class_assoc = rtems_assoc_ptr_by_local( api_assoc, the_class );
78  if ( class_assoc )
79    return class_assoc->name;
80  return "BAD CLASS";
81}
Note: See TracBrowser for help on using the repository browser.