source: rtems/cpukit/libmisc/monitor/monitor.h @ f26145b

4.104.114.84.95
Last change on this file since f26145b was cbd7691, checked in by Ralf Corsepius <ralf.corsepius@…>, on 12/02/04 at 18:20:51

2004-12-02 Ralf Corsepius <ralf.corsepius@…>

  • libmisc/capture/capture-cli.h, libmisc/capture/capture.h, libmisc/monitor/monitor.h, libmisc/rtmonuse/rtmonuse.h, libmisc/shell/shell.h: Partial doxygenification.
  • libmisc/capture/capture.h: Use INT32_C for constants.
  • Property mode set to 100644
File size: 15.8 KB
Line 
1/**
2 * @file rtems/monitor.h
3 *
4 * The RTEMS monitor task.
5 */
6 
7/*
8 *  $Id$
9 */
10
11#ifndef __MONITOR_H
12#define __MONITOR_H
13
14#include <rtems/error.h>                /* rtems_error() */
15
16#ifdef __cplusplus
17extern "C" {
18#endif
19
20/* Forward decls from symbols.h */
21typedef struct _rtems_symbol_t rtems_symbol_t ;
22typedef struct _rtems_symbol_table_t rtems_symbol_table_t;
23
24/*
25 * Monitor types are derived from rtems object classes
26 */
27
28typedef enum {
29    RTEMS_MONITOR_OBJECT_INVALID   =  OBJECTS_NO_CLASS,
30    RTEMS_MONITOR_OBJECT_TASK      =  OBJECTS_RTEMS_TASKS,
31    RTEMS_MONITOR_OBJECT_EXTENSION =  OBJECTS_RTEMS_EXTENSIONS,
32    RTEMS_MONITOR_OBJECT_QUEUE     =  OBJECTS_RTEMS_MESSAGE_QUEUES,
33    RTEMS_MONITOR_OBJECT_SEMAPHORE =  OBJECTS_RTEMS_SEMAPHORES,
34    RTEMS_MONITOR_OBJECT_PARTITION =  OBJECTS_RTEMS_PARTITIONS,
35    RTEMS_MONITOR_OBJECT_REGION    =  OBJECTS_RTEMS_REGIONS,
36    RTEMS_MONITOR_OBJECT_PORT      =  OBJECTS_RTEMS_PORTS,
37
38    /* following monitor objects are not known to RTEMS, but
39     * we like to have "types" for them anyway */
40
41    RTEMS_MONITOR_OBJECT_DRIVER    =  OBJECTS_RTEMS_CLASSES_LAST+1,
42    RTEMS_MONITOR_OBJECT_DNAME,
43    RTEMS_MONITOR_OBJECT_CONFIG,
44    RTEMS_MONITOR_OBJECT_INIT_TASK,
45    RTEMS_MONITOR_OBJECT_MPCI,
46    RTEMS_MONITOR_OBJECT_SYMBOL
47} rtems_monitor_object_type_t;
48
49/*
50 * rtems_monitor_init() flags
51 */
52
53#define RTEMS_MONITOR_SUSPEND   0x0001          /* suspend monitor on startup */
54#define RTEMS_MONITOR_GLOBAL    0x0002          /* monitor should be global */
55
56
57/*
58 * Public interfaces for RTEMS data structures monitor is aware of.
59 * These are only used by the monitor.
60 *
61 * NOTE:
62 *  All the canonical objects that correspond to RTEMS managed "objects"
63 *  must have an identical first portion with 'id' and 'name' fields.
64 *
65 *  Others do not have that restriction, even tho we would like them to.
66 *  This is because some of the canonical structures are almost too big
67 *  for shared memory driver (eg: mpci) and we are nickel and diming it.
68 */
69
70/*
71 * Type of a pointer that may be a symbol
72 */
73
74#define MONITOR_SYMBOL_LEN 20
75typedef struct {
76    char       name[MONITOR_SYMBOL_LEN];
77    uint32_t   value;
78    uint32_t   offset;
79} rtems_monitor_symbol_t;
80
81typedef struct {
82    rtems_id            id;
83    rtems_name          name;
84  /* end of common portion */
85} rtems_monitor_generic_t;
86
87/*
88 * Task
89 */
90typedef struct {
91    rtems_id            id;
92    rtems_name          name;
93  /* end of common portion */
94    Thread_Entry        entry;
95    uint32_t            argument;
96    void               *stack;
97    uint32_t            stack_size;
98    rtems_task_priority priority;
99    States_Control      state;
100    rtems_event_set     events;
101    rtems_mode          modes;
102    rtems_attribute     attributes;
103    uint32_t            notepad[RTEMS_NUMBER_NOTEPADS];
104    rtems_id            wait_id;
105    uint32_t            wait_args;
106} rtems_monitor_task_t;
107
108/*
109 * Init task
110 */
111
112typedef struct {
113    rtems_id            id;             /* not really an id */
114    rtems_name          name;
115  /* end of common portion */
116    rtems_monitor_symbol_t entry;
117    uint32_t               argument;
118    uint32_t               stack_size;
119    rtems_task_priority    priority;
120    rtems_mode             modes;
121    rtems_attribute        attributes;
122} rtems_monitor_init_task_t;
123
124
125/*
126 * Message queue
127 */
128typedef struct {
129    rtems_id            id;
130    rtems_name          name;
131  /* end of common portion */
132    rtems_attribute     attributes;
133    uint32_t            number_of_pending_messages;
134    uint32_t            maximum_pending_messages;
135    uint32_t            maximum_message_size;
136} rtems_monitor_queue_t;
137
138/*
139 * Extension
140 */
141typedef struct {
142    rtems_id                 id;
143    rtems_name               name;
144  /* end of common portion */
145    rtems_monitor_symbol_t  e_create;
146    rtems_monitor_symbol_t  e_start;
147    rtems_monitor_symbol_t  e_restart;
148    rtems_monitor_symbol_t  e_delete;
149    rtems_monitor_symbol_t  e_tswitch;
150    rtems_monitor_symbol_t  e_begin;
151    rtems_monitor_symbol_t  e_exitted;
152    rtems_monitor_symbol_t  e_fatal;
153} rtems_monitor_extension_t;
154
155/*
156 * Device driver
157 */
158
159typedef struct {
160    rtems_id            id;                /* not really an id (should be tho) */
161    rtems_name          name;              /* ditto */
162  /* end of common portion */
163    rtems_monitor_symbol_t initialization; /* initialization procedure */
164    rtems_monitor_symbol_t open;           /* open request procedure */
165    rtems_monitor_symbol_t close;          /* close request procedure */
166    rtems_monitor_symbol_t read;           /* read request procedure */
167    rtems_monitor_symbol_t write;          /* write request procedure */
168    rtems_monitor_symbol_t control;        /* special functions procedure */
169} rtems_monitor_driver_t;
170
171typedef struct {
172    rtems_id            id;                 /* not used for drivers (yet) */
173    rtems_name          name;               /* not used for drivers (yet) */
174  /* end of common portion */
175    uint32_t            major;
176    uint32_t            minor;
177    char                name_string[64];
178} rtems_monitor_dname_t;
179
180/*
181 * System config
182 */
183
184typedef struct {
185    void               *work_space_start;
186    uint32_t            work_space_size;
187    uint32_t            maximum_tasks;
188    uint32_t            maximum_timers;
189    uint32_t            maximum_semaphores;
190    uint32_t            maximum_message_queues;
191    uint32_t            maximum_partitions;
192    uint32_t            maximum_regions;
193    uint32_t            maximum_ports;
194    uint32_t            maximum_periods;
195    uint32_t            maximum_extensions;
196    uint32_t            microseconds_per_tick;
197    uint32_t            ticks_per_timeslice;
198    uint32_t            number_of_initialization_tasks;
199} rtems_monitor_config_t;
200
201/*
202 * MPCI config
203 */
204
205#if defined(RTEMS_MULTIPROCESSING)
206typedef struct {
207    uint32_t    node;                   /* local node number */
208    uint32_t    maximum_nodes;          /* maximum # nodes in system */
209    uint32_t    maximum_global_objects; /* maximum # global objects */
210    uint32_t    maximum_proxies;        /* maximum # proxies */
211
212    uint32_t                 default_timeout;        /* in ticks */
213    uint32_t                 maximum_packet_size;
214    rtems_monitor_symbol_t   initialization;
215    rtems_monitor_symbol_t   get_packet;
216    rtems_monitor_symbol_t   return_packet;
217    rtems_monitor_symbol_t   send_packet;
218    rtems_monitor_symbol_t   receive_packet;
219} rtems_monitor_mpci_t;
220#endif
221
222/*
223 * The generic canonical information union
224 */
225
226typedef union {
227    rtems_monitor_generic_t    generic;
228    rtems_monitor_task_t       task;
229    rtems_monitor_queue_t      queue;
230    rtems_monitor_extension_t  extension;
231    rtems_monitor_driver_t     driver;
232    rtems_monitor_dname_t      dname;
233    rtems_monitor_config_t     config;
234#if defined(RTEMS_MULTIPROCESSING)
235    rtems_monitor_mpci_t       mpci;
236#endif
237    rtems_monitor_init_task_t  itask;
238} rtems_monitor_union_t;
239
240/*
241 * Support for talking to other monitors
242 */
243
244/*
245 * Names of other monitors
246 */
247
248#define RTEMS_MONITOR_NAME        (rtems_build_name('R', 'M', 'O', 'N'))
249#define RTEMS_MONITOR_SERVER_NAME (rtems_build_name('R', 'M', 'S', 'V'))
250#define RTEMS_MONITOR_QUEUE_NAME  (rtems_build_name('R', 'M', 'S', 'Q'))
251#define RTEMS_MONITOR_RESPONSE_QUEUE_NAME (rtems_build_name('R', 'M', 'R', 'Q'))
252
253#define RTEMS_MONITOR_SERVER_RESPONSE    0x0001
254#define RTEMS_MONITOR_SERVER_CANONICAL   0x0002
255
256typedef struct
257{
258    uint32_t    command;
259    rtems_id    return_id;
260    uint32_t    argument0;
261    uint32_t    argument1;
262    uint32_t    argument2;
263    uint32_t    argument3;
264    uint32_t    argument4;
265    uint32_t    argument5;
266} rtems_monitor_server_request_t;
267
268typedef struct
269{
270    uint32_t    command;
271    uint32_t    result0;
272    uint32_t    result1;
273    rtems_monitor_union_t payload;
274} rtems_monitor_server_response_t;
275
276extern rtems_id  rtems_monitor_task_id;
277
278extern uint32_t   rtems_monitor_node;          /* our node number */
279extern uint32_t   rtems_monitor_default_node;  /* current default for commands */
280
281/*
282 * Monitor command function and table entry
283 */
284
285typedef struct rtems_monitor_command_entry_s rtems_monitor_command_entry_t;
286typedef union _rtems_monitor_command_arg_t   rtems_monitor_command_arg_t;
287
288typedef void ( *rtems_monitor_command_function_t )(
289                 int         argc,
290                 char      **argv,
291                 rtems_monitor_command_arg_t *command_arg,
292                 boolean     verbose
293             );
294
295union _rtems_monitor_command_arg_t {
296  rtems_monitor_object_type_t   monitor_object ;
297  rtems_status_code             status_code ;
298  rtems_symbol_table_t          **symbol_table ;
299  rtems_monitor_command_entry_t *monitor_command_entry ;
300};
301
302struct rtems_monitor_command_entry_s {
303    char        *command;      /* command name */
304    char        *usage;        /* usage string for the command */
305    uint32_t     arguments_required;    /* # of required args */
306    rtems_monitor_command_function_t command_function;
307                               /* Some argument for the command */
308    rtems_monitor_command_arg_t   command_arg;
309    rtems_monitor_command_entry_t *next;
310};
311
312
313typedef void *(*rtems_monitor_object_next_fn)(void *, void *, rtems_id *);
314typedef void (*rtems_monitor_object_canonical_fn)(void *, void *);
315typedef void (*rtems_monitor_object_dump_header_fn)(boolean);
316typedef void (*rtems_monitor_object_dump_fn)(void *, boolean);
317
318typedef struct {
319    rtems_monitor_object_type_t         type;
320    void                               *object_information;
321    int                                 size;   /* of canonical object */
322    rtems_monitor_object_next_fn        next;
323    rtems_monitor_object_canonical_fn   canonical;
324    rtems_monitor_object_dump_header_fn dump_header;
325    rtems_monitor_object_dump_fn        dump;
326} rtems_monitor_object_info_t;
327
328
329/* monitor.c */
330void    rtems_monitor_kill(void);
331void    rtems_monitor_init(uint32_t  );
332void    rtems_monitor_wakeup(void);
333void    rtems_monitor_pause_cmd(int, char **, rtems_monitor_command_arg_t*, boolean);
334void    rtems_monitor_fatal_cmd(int, char **, rtems_monitor_command_arg_t*, boolean);
335void    rtems_monitor_continue_cmd(int, char **, rtems_monitor_command_arg_t*, boolean);
336void    rtems_monitor_debugger_cmd(int, char **, rtems_monitor_command_arg_t*, boolean);
337void    rtems_monitor_node_cmd(int, char **, rtems_monitor_command_arg_t*, boolean);
338void    rtems_monitor_symbols_loadup(void);
339int     rtems_monitor_insert_cmd(rtems_monitor_command_entry_t *);
340int     rtems_monitor_erase_cmd(rtems_monitor_command_entry_t *);
341
342void    rtems_monitor_task(rtems_task_argument);
343
344/* server.c */
345void    rtems_monitor_server_kill(void);
346rtems_status_code rtems_monitor_server_request(uint32_t  , rtems_monitor_server_request_t *, rtems_monitor_server_response_t *);
347void    rtems_monitor_server_task(rtems_task_argument);
348void    rtems_monitor_server_init(uint32_t  );
349
350/* command.c */
351int     rtems_monitor_make_argv(char *, int *, char **);
352int     rtems_monitor_command_read(char *, int *, char **);
353rtems_monitor_command_entry_t *rtems_monitor_command_lookup(
354    rtems_monitor_command_entry_t * table, int argc, char **argv);
355void    rtems_monitor_command_usage(rtems_monitor_command_entry_t *, char *);
356void    rtems_monitor_help_cmd(int, char **, rtems_monitor_command_arg_t *, boolean);
357
358/* prmisc.c */
359void       rtems_monitor_separator(void);
360uint32_t   rtems_monitor_pad(uint32_t   dest_col, uint32_t   curr_col);
361int        rtems_monitor_dump_char(char   ch);
362int        rtems_monitor_dump_decimal(uint32_t   num);
363int        rtems_monitor_dump_hex(uint32_t   num);
364int        rtems_monitor_dump_id(rtems_id id);
365int        rtems_monitor_dump_name(rtems_name name);
366int        rtems_monitor_dump_priority(rtems_task_priority priority);
367int        rtems_monitor_dump_state(States_Control state);
368int        rtems_monitor_dump_modes(rtems_mode modes);
369int        rtems_monitor_dump_attributes(rtems_attribute attributes);
370int        rtems_monitor_dump_events(rtems_event_set events);
371int        rtems_monitor_dump_notepad(uint32_t   *notepad);
372
373/* object.c */
374rtems_id   rtems_monitor_id_fixup(rtems_id, uint32_t  , rtems_monitor_object_type_t);
375rtems_id   rtems_monitor_object_canonical_get(rtems_monitor_object_type_t, rtems_id, void *, uint32_t   *size_p);
376rtems_id   rtems_monitor_object_canonical_next(rtems_monitor_object_info_t *, rtems_id, void *);
377void      *rtems_monitor_object_next(void *, void *, rtems_id, rtems_id *);
378rtems_id   rtems_monitor_object_canonical(rtems_id, void *);
379void       rtems_monitor_object_cmd(int, char **, rtems_monitor_command_arg_t*, boolean);
380
381/* manager.c */
382void      *rtems_monitor_manager_next(void *, void *, rtems_id *);
383
384/* config.c */
385void       rtems_monitor_config_canonical(rtems_monitor_config_t *, void *);
386void      *rtems_monitor_config_next(void *, rtems_monitor_config_t *, rtems_id *);
387void       rtems_monitor_config_dump_header(boolean);
388int        rtems_monitor_config_dump(rtems_monitor_config_t *, boolean verbose);
389
390/* mpci.c */
391#if defined(RTEMS_MULTIPROCESSING)
392void       rtems_monitor_mpci_canonical(rtems_monitor_mpci_t *, void *);
393void      *rtems_monitor_mpci_next(void *, rtems_monitor_mpci_t *, rtems_id *);
394void       rtems_monitor_mpci_dump_header(boolean);
395void       rtems_monitor_mpci_dump(rtems_monitor_mpci_t *, boolean verbose);
396#endif
397
398/* itask.c */
399void       rtems_monitor_init_task_canonical(rtems_monitor_init_task_t *, void *);
400void      *rtems_monitor_init_task_next(void *, rtems_monitor_init_task_t *, rtems_id *);
401void       rtems_monitor_init_task_dump_header(boolean);
402void       rtems_monitor_init_task_dump(rtems_monitor_init_task_t *, boolean verbose);
403
404/* extension.c */
405void       rtems_monitor_extension_canonical(rtems_monitor_extension_t *, void *);
406void       rtems_monitor_extension_dump_header(boolean verbose);
407void       rtems_monitor_extension_dump(rtems_monitor_extension_t *, boolean);
408
409/* task.c */
410void    rtems_monitor_task_canonical(rtems_monitor_task_t *, void *);
411void    rtems_monitor_task_dump_header(boolean verbose);
412void    rtems_monitor_task_dump(rtems_monitor_task_t *, boolean);
413
414/* queue.c */
415void    rtems_monitor_queue_canonical(rtems_monitor_queue_t *, void *);
416void    rtems_monitor_queue_dump_header(boolean verbose);
417void    rtems_monitor_queue_dump(rtems_monitor_queue_t *, boolean);
418
419/* driver.c */
420void    *rtems_monitor_driver_next(void *, rtems_monitor_driver_t *, rtems_id *);
421void     rtems_monitor_driver_canonical(rtems_monitor_driver_t *, void *);
422void     rtems_monitor_driver_dump_header(boolean);
423void     rtems_monitor_driver_dump(rtems_monitor_driver_t *, boolean);
424
425/* dname.c */
426void    *rtems_monitor_dname_next(void *, rtems_monitor_dname_t *, rtems_id *);
427void     rtems_monitor_dname_canonical(rtems_monitor_dname_t *, void *);
428void     rtems_monitor_dname_dump_header(boolean);
429void     rtems_monitor_dname_dump(rtems_monitor_dname_t *, boolean);
430
431/* symbols.c */
432rtems_symbol_table_t *rtems_symbol_table_create();
433void                  rtems_symbol_table_destroy(rtems_symbol_table_t *table);
434
435rtems_symbol_t *rtems_symbol_create(rtems_symbol_table_t *, char *, uint32_t  );
436rtems_symbol_t *rtems_symbol_value_lookup(rtems_symbol_table_t *, uint32_t  );
437const rtems_symbol_t *rtems_symbol_value_lookup_exact(rtems_symbol_table_t *, uint32_t  );
438rtems_symbol_t *rtems_symbol_name_lookup(rtems_symbol_table_t *, char *);
439void   *rtems_monitor_symbol_next(void *object_info, rtems_monitor_symbol_t *, rtems_id *);
440void    rtems_monitor_symbol_canonical(rtems_monitor_symbol_t *, rtems_symbol_t *);
441void    rtems_monitor_symbol_canonical_by_name(rtems_monitor_symbol_t *, char *);
442void    rtems_monitor_symbol_canonical_by_value(rtems_monitor_symbol_t *, void *);
443uint32_t   rtems_monitor_symbol_dump(rtems_monitor_symbol_t *, boolean);
444void    rtems_monitor_symbol_cmd(int, char **, rtems_monitor_command_arg_t*, boolean);
445
446
447extern rtems_symbol_table_t *rtems_monitor_symbols;
448
449/* FIXME: This should not be here */
450extern rtems_monitor_command_entry_t rtems_monitor_commands[];
451
452#define MONITOR_WAKEUP_EVENT   RTEMS_EVENT_0
453
454#ifdef __cplusplus
455}
456#endif
457
458#endif  /* ! __MONITOR_H */
Note: See TracBrowser for help on using the repository browser.