source: rtems/cpukit/libmisc/monitor/monitor.h @ 5e622a9

4.104.114.84.95
Last change on this file since 5e622a9 was 63977bb4, checked in by Joel Sherrill <joel.sherrill@…>, on Jul 1, 2002 at 10:19:33 PM

2002-07-01 Joel Sherrill <joel@…>

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