RTEMS 6.1-rc4
Loading...
Searching...
No Matches
assoc.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: BSD-2-Clause */
2
11/*
12 * Copyright (C) 1995 Tony Bennett <tbennett@divnc.com>
13 *
14 * Redistribution and use in source and binary forms, with or without
15 * modification, are permitted provided that the following conditions
16 * are met:
17 * 1. Redistributions of source code must retain the above copyright
18 * notice, this list of conditions and the following disclaimer.
19 * 2. Redistributions in binary form must reproduce the above copyright
20 * notice, this list of conditions and the following disclaimer in the
21 * documentation and/or other materials provided with the distribution.
22 *
23 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
24 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
27 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
31 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33 * POSSIBILITY OF SUCH DAMAGE.
34 */
35
36#ifndef _RTEMS_RTEMS_ASSOC_H
37#define _RTEMS_RTEMS_ASSOC_H
38
39#include <stddef.h>
40#include <stdint.h>
41
42#ifdef __cplusplus
43extern "C" {
44#endif
45
57typedef struct {
58 const char *name;
59 uint32_t local_value;
60 uint32_t remote_value;
62
63/*
64 * Flag/marker for optional default value in each table
65 */
66
67#define RTEMS_ASSOC_DEFAULT_NAME "(default)"
68
73 const rtems_assoc_t *,
74 const char *
75);
76
81 const rtems_assoc_t *,
82 uint32_t
83);
84
85uint32_t rtems_assoc_remote_by_local(
86 const rtems_assoc_t *,
87 uint32_t
88);
89
94 const rtems_assoc_t *,
95 uint32_t
96);
97
102 const rtems_assoc_t *,
103 const char *
104);
105
110 const rtems_assoc_t *,
111 const char *
112);
113
117const char *rtems_assoc_name_by_local(
118 const rtems_assoc_t *,
119 uint32_t
120);
121
126 const rtems_assoc_t *,
127 uint32_t
128);
129
134 const rtems_assoc_t *,
135 uint32_t
136);
137
142 const rtems_assoc_t *,
143 uint32_t ,
144 char *
145);
146
151 const rtems_assoc_t *,
152 uint32_t ,
153 char *
154);
155
156uint32_t rtems_assoc_local_by_remote_bitfield(
157 const rtems_assoc_t *,
158 uint32_t
159);
160
165 const rtems_assoc_t *ap,
166 uint32_t local_value
167);
168
169#if defined(INSIDE_ASSOC)
170
171#define rtems_assoc_is_default(_ap) \
172 ((_ap)->name && !strcmp((_ap)->name, RTEMS_ASSOC_DEFAULT_NAME))
173
180const char *rtems_assoc_name_bad(
181 uint32_t bad_value
182);
183#endif
184
185typedef struct {
186 uint32_t bits;
187 const char *name;
189
206 uint32_t value,
207 char *buffer,
208 size_t buffer_size,
209 const rtems_assoc_32_pair *pairs,
210 size_t pair_count,
211 const char *separator,
212 const char *fallback
213);
214
226 uint32_t states,
227 char *buffer,
228 size_t buffer_size
229);
230
233#ifdef __cplusplus
234}
235#endif
236
237#endif /* ! _RTEMS_RTEMS_ASSOC_H */
char * rtems_assoc_name_by_local_bitfield(const rtems_assoc_t *, uint32_t, char *)
RTEMS Associate Name by Local Bitfield.
Definition: assocnamebylocalbitfield.c:47
uint32_t rtems_assoc_local_by_remote(const rtems_assoc_t *, uint32_t)
RTEMS Associate Local by Remote.
Definition: assoclocalbyremote.c:47
char * rtems_assoc_name_by_remote_bitfield(const rtems_assoc_t *, uint32_t, char *)
RTEMS Associate Name by Remote Bitfield.
Definition: assocnamebyremotebitfield.c:48
uint32_t rtems_assoc_local_by_name(const rtems_assoc_t *, const char *)
RTEMS Associate Local by Name.
Definition: assoclocalbyname.c:48
const char * rtems_assoc_name_by_remote(const rtems_assoc_t *, uint32_t)
RTEMS Associate Name by Remote.
Definition: assocnamebyremote.c:48
size_t rtems_assoc_thread_states_to_string(uint32_t states, char *buffer, size_t buffer_size)
Converts the specified thread states into a text representation.
Definition: assocthreadstatestostring.c:61
uint32_t rtems_assoc_remote_by_local_bitfield(const rtems_assoc_t *, uint32_t)
RTEMS Assoc Routines.
Definition: assocremotebylocalbitfield.c:49
const rtems_assoc_t * rtems_assoc_ptr_by_remote(const rtems_assoc_t *, uint32_t)
RTEMS Associate Pointer by Remote.
Definition: assocptrbyremote.c:47
const rtems_assoc_t * rtems_assoc_ptr_by_name(const rtems_assoc_t *, const char *)
RTEMS Associate Pointer by Name.
Definition: assocptrbyname.c:48
size_t rtems_assoc_32_to_string(uint32_t value, char *buffer, size_t buffer_size, const rtems_assoc_32_pair *pairs, size_t pair_count, const char *separator, const char *fallback)
Converts the specified value into a text representation.
Definition: assoc32tostring.c:46
const rtems_assoc_t * rtems_assoc_ptr_by_local(const rtems_assoc_t *ap, uint32_t local_value)
RTEMS Associate Pointer by Local.
Definition: assocptrbylocal.c:47
const char * rtems_assoc_name_by_local(const rtems_assoc_t *, uint32_t)
RTEMS Associate Name by Local.
Definition: assocnamebylocal.c:47
uint32_t rtems_assoc_remote_by_name(const rtems_assoc_t *, const char *)
RTEMS Associate Remote by Name.
Definition: assocremotebyname.c:47
Definition: assoc.h:185
Definition: assoc.h:57