1 | /** |
---|
2 | * @file rtems/assoc.h |
---|
3 | */ |
---|
4 | |
---|
5 | /* |
---|
6 | * |
---|
7 | * Rtems associativity routines. Mainly used to convert a value from |
---|
8 | * one space to another (eg: our errno's to host errno's and v.v) |
---|
9 | * |
---|
10 | * |
---|
11 | * $Id$ |
---|
12 | */ |
---|
13 | |
---|
14 | #ifndef _RTEMS_RTEMS_ASSOC_H |
---|
15 | #define _RTEMS_RTEMS_ASSOC_H |
---|
16 | |
---|
17 | typedef struct { |
---|
18 | const char *name; |
---|
19 | uint32_t local_value; |
---|
20 | uint32_t remote_value; |
---|
21 | } rtems_assoc_t; |
---|
22 | |
---|
23 | /* |
---|
24 | * Flag/marker for optional default value in each table |
---|
25 | */ |
---|
26 | |
---|
27 | #define RTEMS_ASSOC_DEFAULT_NAME "(default)" |
---|
28 | |
---|
29 | const rtems_assoc_t *rtems_assoc_ptr_by_name( |
---|
30 | const rtems_assoc_t *, |
---|
31 | const char * |
---|
32 | ); |
---|
33 | |
---|
34 | const rtems_assoc_t *rtems_assoc_ptr_by_remote( |
---|
35 | const rtems_assoc_t *, |
---|
36 | uint32_t |
---|
37 | ); |
---|
38 | |
---|
39 | uint32_t rtems_assoc_remote_by_local( |
---|
40 | const rtems_assoc_t *, |
---|
41 | uint32_t |
---|
42 | ); |
---|
43 | |
---|
44 | uint32_t rtems_assoc_local_by_remote( |
---|
45 | const rtems_assoc_t *, |
---|
46 | uint32_t |
---|
47 | ); |
---|
48 | |
---|
49 | uint32_t rtems_assoc_remote_by_name( |
---|
50 | const rtems_assoc_t *, |
---|
51 | const char * |
---|
52 | ); |
---|
53 | uint32_t rtems_assoc_local_by_name( |
---|
54 | const rtems_assoc_t *, |
---|
55 | const char * |
---|
56 | ); |
---|
57 | |
---|
58 | const char *rtems_assoc_name_by_local( |
---|
59 | const rtems_assoc_t *, |
---|
60 | uint32_t |
---|
61 | ); |
---|
62 | |
---|
63 | const char *rtems_assoc_name_by_remote( |
---|
64 | const rtems_assoc_t *, |
---|
65 | uint32_t |
---|
66 | ); |
---|
67 | |
---|
68 | uint32_t rtems_assoc_remote_by_local_bitfield( |
---|
69 | const rtems_assoc_t *, |
---|
70 | uint32_t |
---|
71 | ); |
---|
72 | |
---|
73 | char *rtems_assoc_name_by_local_bitfield( |
---|
74 | const rtems_assoc_t *, |
---|
75 | uint32_t , |
---|
76 | char * |
---|
77 | ); |
---|
78 | |
---|
79 | char *rtems_assoc_name_by_remote_bitfield( |
---|
80 | const rtems_assoc_t *, |
---|
81 | uint32_t , |
---|
82 | char * |
---|
83 | ); |
---|
84 | |
---|
85 | uint32_t rtems_assoc_local_by_remote_bitfield( |
---|
86 | const rtems_assoc_t *, |
---|
87 | uint32_t |
---|
88 | ); |
---|
89 | |
---|
90 | #if defined(INSIDE_ASSOC) |
---|
91 | |
---|
92 | #define rtems_assoc_is_default(_ap) \ |
---|
93 | ((_ap)->name && !strcmp((_ap)->name, RTEMS_ASSOC_DEFAULT_NAME)) |
---|
94 | |
---|
95 | /* |
---|
96 | * what to return if a value is not found |
---|
97 | * this is not reentrant, but it really shouldn't be invoked anyway |
---|
98 | */ |
---|
99 | |
---|
100 | const char *rtems_assoc_name_bad( |
---|
101 | uint32_t bad_value |
---|
102 | ); |
---|
103 | |
---|
104 | const rtems_assoc_t *rtems_assoc_ptr_by_local( |
---|
105 | const rtems_assoc_t *ap, |
---|
106 | uint32_t local_value |
---|
107 | ); |
---|
108 | |
---|
109 | #endif |
---|
110 | |
---|
111 | #endif /* ! _INCLUDE_ASSOC_H */ |
---|