source: rtems/cpukit/include/rtems/monitor.h @ 2afb22b

Last change on this file since 2afb22b was 2afb22b, checked in by Chris Johns <chrisj@…>, on Dec 23, 2017 at 7:18:56 AM

Remove make preinstall

A speciality of the RTEMS build system was the make preinstall step. It
copied header files from arbitrary locations into the build tree. The
header files were included via the -Bsome/build/tree/path GCC command
line option.

This has at least seven problems:

  • The make preinstall step itself needs time and disk space.
  • Errors in header files show up in the build tree copy. This makes it hard for editors to open the right file to fix the error.
  • There is no clear relationship between source and build tree header files. This makes an audit of the build process difficult.
  • The visibility of all header files in the build tree makes it difficult to enforce API barriers. For example it is discouraged to use BSP-specifics in the cpukit.
  • An introduction of a new build system is difficult.
  • Include paths specified by the -B option are system headers. This may suppress warnings.
  • The parallel build had sporadic failures on some hosts.

This patch removes the make preinstall step. All installed header
files are moved to dedicated include directories in the source tree.
Let @RTEMS_CPU@ be the target architecture, e.g. arm, powerpc, sparc,
etc. Let @RTEMS_BSP_FAMILIY@ be a BSP family base directory, e.g.
erc32, imx, qoriq, etc.

The new cpukit include directories are:

  • cpukit/include
  • cpukit/score/cpu/@RTEMS_CPU@/include
  • cpukit/libnetworking

The new BSP include directories are:

  • bsps/include
  • bsps/@RTEMS_CPU@/include
  • bsps/@RTEMS_CPU@/@RTEMS_BSP_FAMILIY@/include

There are build tree include directories for generated files.

The include directory order favours the most general header file, e.g.
it is not possible to override general header files via the include path
order.

The "bootstrap -p" option was removed. The new "bootstrap -H" option
should be used to regenerate the "headers.am" files.

Update #3254.

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