source: rtems/cpukit/libmisc/monitor/mon-prmisc.c @ 59e7209f

Last change on this file since 59e7209f was 59e7209f, checked in by Sebastian Huber <sebastian.huber@…>, on Nov 16, 2018 at 6:06:12 AM

score: Remove support for RTEMS_USE_16_BIT_OBJECT

The RTEMS_USE_16_BIT_OBJECT define is not set by an RTEMS port. Remove
support for 16-bit object identifiers. If someone really wants to use
RTEMS on a 16-bit target, then it is better to use self-contained
objects instead of playing around with object identifier optimizations.

Update #3603.

  • Property mode set to 100644
File size: 3.8 KB
Line 
1/*
2 * Print misc stuff for the monitor dump routines
3 * Each routine returns the number of characters it output.
4 *
5 * TODO:
6 */
7
8#ifdef HAVE_CONFIG_H
9#include "config.h"
10#endif
11
12#include <rtems.h>
13#include <rtems/monitor.h>
14#include <rtems/assoc.h>
15
16#include <stdio.h>
17#include <ctype.h>
18#include <inttypes.h>
19
20void
21rtems_monitor_separator(void)
22{
23    fprintf(stdout,"------------------------------------------------------------------------------\n");
24}
25
26uint32_t
27rtems_monitor_pad(
28    uint32_t    destination_column,
29    uint32_t    current_column
30)
31{
32    int pad_length;
33
34    if (destination_column <= current_column)
35        pad_length = 1;
36    else
37        pad_length = destination_column - current_column;
38
39    return fprintf(stdout,"%*s", pad_length, "");
40}
41
42int
43rtems_monitor_dump_decimal(uint32_t   num)
44{
45    return fprintf(stdout,"%4" PRId32, num);
46}
47
48int
49rtems_monitor_dump_addr(const void *addr)
50{
51    return fprintf(stdout,"%08" PRIxPTR, (intptr_t) addr);
52}
53
54int
55rtems_monitor_dump_hex(uint32_t   num)
56{
57    return fprintf(stdout,"0x%" PRIx32, num);
58}
59
60static int
61rtems_monitor_dump_assoc_bitfield(
62    const rtems_assoc_t *ap,
63    const char          *separator,
64    uint32_t             value
65  )
66{
67    uint32_t   b;
68    uint32_t   length = 0;
69    const char *name;
70
71    for (b = 1; b; b <<= 1)
72        if (b & value)
73        {
74            if (length)
75                length += fprintf(stdout,"%s", separator);
76
77            name = rtems_assoc_name_by_local(ap, b);
78
79            if (name)
80                length += fprintf(stdout,"%s", name);
81            else
82                length += fprintf(stdout,"0x%" PRIx32, b);
83        }
84
85    return length;
86}
87
88int
89rtems_monitor_dump_id(rtems_id id)
90{
91    return fprintf(stdout,"%08" PRIx32, id);
92}
93
94int
95rtems_monitor_dump_name(rtems_id id)
96{
97    char name_buffer[18] = "????";
98
99    rtems_object_get_name( id, sizeof(name_buffer), name_buffer );
100
101    return fprintf(stdout, "%s", name_buffer);
102}
103
104int
105rtems_monitor_dump_priority(rtems_task_priority priority)
106{
107    return fprintf(stdout,"%3" PRId32, priority);
108}
109
110int
111rtems_monitor_dump_state(States_Control state)
112{
113    char buf[16];
114
115    rtems_assoc_thread_states_to_string(state, buf, sizeof(buf));
116    return fprintf(stdout, "%s", buf);
117}
118
119static const rtems_assoc_t rtems_monitor_attribute_assoc[] = {
120    { "GL",  RTEMS_GLOBAL, 0 },
121    { "PR",  RTEMS_PRIORITY, 0 },
122    { "FL",  RTEMS_FLOATING_POINT, 0 },
123    { "BI",  RTEMS_BINARY_SEMAPHORE, 0 },
124    { "SB",  RTEMS_SIMPLE_BINARY_SEMAPHORE, 0 },
125    { "IN",  RTEMS_INHERIT_PRIORITY, 0 },
126    { "CE",  RTEMS_PRIORITY_CEILING, 0 },
127    { "AR",  RTEMS_BARRIER_AUTOMATIC_RELEASE, 0 },
128    { "ST",  RTEMS_SYSTEM_TASK, 0 },
129    { 0, 0, 0 },
130};
131
132int
133rtems_monitor_dump_attributes(rtems_attribute attributes)
134{
135    int   length = 0;
136
137    if (attributes == RTEMS_DEFAULT_ATTRIBUTES)  /* value is 0 */
138        length += fprintf(stdout,"DEFAULT");
139
140    length += rtems_monitor_dump_assoc_bitfield(rtems_monitor_attribute_assoc,
141                                                ":",
142                                                attributes);
143    return length;
144}
145
146static const rtems_assoc_t rtems_monitor_modes_assoc[] = {
147    { "nP",     RTEMS_NO_PREEMPT, 0 },
148    { "T",      RTEMS_TIMESLICE, 0 },
149    { "nA",     RTEMS_NO_ASR, 0 },
150    { 0, 0, 0 },
151};
152
153int
154rtems_monitor_dump_modes(rtems_mode modes)
155{
156    uint32_t   length = 0;
157
158    if (modes == RTEMS_DEFAULT_MODES)  /* value is 0 */
159        length += fprintf(stdout,"P:T:nA");
160
161    length += rtems_monitor_dump_assoc_bitfield(rtems_monitor_modes_assoc,
162                                                ":",
163                                                modes);
164    return length;
165}
166
167int
168rtems_monitor_dump_events(rtems_event_set events)
169{
170    if (events == 0)
171        return fprintf(stdout,"  NONE  ");
172
173    return fprintf(stdout,"%08" PRIx32, events);
174}
Note: See TracBrowser for help on using the repository browser.