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

4.104.114.84.95
Last change on this file since aed742c was aed742c, checked in by Ralf Corsepius <ralf.corsepius@…>, on Apr 16, 2004 at 12:06:28 PM

Remove stray white spaces.

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