source: rtems/cpukit/libmisc/monitor/mon-itask.c @ df91dd9

Last change on this file since df91dd9 was df91dd9, checked in by Sebastian Huber <sebastian.huber@…>, on Mar 14, 2016 at 11:31:12 AM

monitor: Use object allocator lock

Use object allocator lock instead of disabled thread dispatching.

Update #2555.

  • Property mode set to 100644
File size: 3.0 KB
Line 
1/*
2 * RTEMS Monitor init task support
3 */
4
5#ifdef HAVE_CONFIG_H
6#include "config.h"
7#endif
8
9#include <rtems.h>
10#include <rtems/monitor.h>
11
12#include <inttypes.h>
13#include <stdio.h>
14
15/*
16 * As above, but just for init tasks
17 */
18void
19rtems_monitor_init_task_canonical(
20    rtems_monitor_init_task_t *canonical_itask,
21    const void                *itask_void
22)
23{
24    const rtems_initialization_tasks_table *rtems_itask = itask_void;
25
26    rtems_monitor_symbol_canonical_by_value(&canonical_itask->entry,
27                                            (void *) rtems_itask->entry_point);
28
29    canonical_itask->argument = rtems_itask->argument;
30    canonical_itask->stack_size = rtems_itask->stack_size;
31    canonical_itask->priority = rtems_itask->initial_priority;
32    canonical_itask->modes = rtems_itask->mode_set;
33    canonical_itask->attributes = rtems_itask->attribute_set;
34}
35
36const void *
37rtems_monitor_init_task_next(
38    void                  *object_info RTEMS_UNUSED,
39    rtems_monitor_init_task_t *canonical_init_task,
40    rtems_id              *next_id
41)
42{
43    rtems_initialization_tasks_table *itask;
44    uint32_t   n = rtems_object_id_get_index(*next_id);
45
46    if (n >= Configuration_RTEMS_API.number_of_initialization_tasks)
47        goto failed;
48
49    _Objects_Allocator_lock();
50
51    itask = Configuration_RTEMS_API.User_initialization_tasks_table + n;
52
53    /*
54     * dummy up a fake id and name for this item
55     */
56
57    canonical_init_task->id = n;
58    canonical_init_task->name = itask->name;
59
60    *next_id += 1;
61    return (const void *) itask;
62
63failed:
64    *next_id = RTEMS_OBJECT_ID_FINAL;
65    return 0;
66}
67
68
69void
70rtems_monitor_init_task_dump_header(
71    bool verbose RTEMS_UNUSED
72)
73{
74    fprintf(stdout,"\
75  #    NAME   ENTRY        ARGUMENT    PRIO   MODES  ATTRIBUTES   STACK SIZE\n");
76/*23456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789
770         1         2         3         4         5         6         7       */
78    rtems_monitor_separator();
79}
80
81/*
82 */
83
84void
85rtems_monitor_init_task_dump(
86    rtems_monitor_init_task_t *monitor_itask,
87    bool  verbose
88)
89{
90    int length = 0;
91
92    length += rtems_monitor_dump_decimal(monitor_itask->id);
93
94    length += rtems_monitor_pad(7, length);
95    length += rtems_monitor_dump_name(monitor_itask->id);
96
97    length += rtems_monitor_pad(14, length);
98    length += rtems_monitor_symbol_dump(&monitor_itask->entry, verbose);
99
100    length += rtems_monitor_pad(25, length);
101    length += fprintf(stdout,"%" PRId32 " [0x%" PRIx32 "]",
102      monitor_itask->argument, monitor_itask->argument);
103
104    length += rtems_monitor_pad(39, length);
105    length += rtems_monitor_dump_priority(monitor_itask->priority);
106
107    length += rtems_monitor_pad(46, length);
108    length += rtems_monitor_dump_modes(monitor_itask->modes);
109
110    length += rtems_monitor_pad(54, length);
111    length += rtems_monitor_dump_attributes(monitor_itask->attributes);
112
113    length += rtems_monitor_pad(66, length);
114    length += fprintf(stdout,"%" PRId32 " [0x%" PRIx32 "]",
115      monitor_itask->stack_size, monitor_itask->stack_size);
116
117    fprintf(stdout,"\n");
118}
Note: See TracBrowser for help on using the repository browser.