1 | /* |
---|
2 | * RTEMS Monitor region 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 | #include <rtems/rtems/attrimpl.h> |
---|
12 | #include <stdio.h> |
---|
13 | #include <string.h> /* memcpy() */ |
---|
14 | |
---|
15 | void |
---|
16 | rtems_monitor_region_canonical( |
---|
17 | rtems_monitor_region_t *canonical_region, |
---|
18 | const void *region_void |
---|
19 | ) |
---|
20 | { |
---|
21 | const Region_Control *rtems_region = (const Region_Control *) region_void; |
---|
22 | const Heap_Control *heap = &rtems_region->Memory; |
---|
23 | |
---|
24 | canonical_region->attribute = rtems_region->attribute_set; |
---|
25 | canonical_region->start_addr = (void *) heap->area_begin; |
---|
26 | canonical_region->length = heap->area_end - heap->area_begin; |
---|
27 | canonical_region->page_size = heap->page_size; |
---|
28 | canonical_region->max_seg_size = rtems_region->maximum_segment_size; |
---|
29 | canonical_region->used_blocks = heap->stats.used_blocks; |
---|
30 | } |
---|
31 | |
---|
32 | |
---|
33 | void |
---|
34 | rtems_monitor_region_dump_header( |
---|
35 | bool verbose RTEMS_UNUSED |
---|
36 | ) |
---|
37 | { |
---|
38 | printf("\ |
---|
39 | ID NAME ATTR STARTADDR LENGTH PAGE_SIZE USED_BLOCKS\n"); |
---|
40 | /*23456789 123456789 123456789 123456789 123456789 123456789 123456789 1234 |
---|
41 | 1 2 3 4 5 6 7 */ |
---|
42 | |
---|
43 | rtems_monitor_separator(); |
---|
44 | } |
---|
45 | |
---|
46 | /* |
---|
47 | */ |
---|
48 | |
---|
49 | void |
---|
50 | rtems_monitor_region_dump( |
---|
51 | rtems_monitor_region_t *monitor_region, |
---|
52 | bool verbose RTEMS_UNUSED |
---|
53 | ) |
---|
54 | { |
---|
55 | int length = 0; |
---|
56 | |
---|
57 | length += rtems_monitor_dump_id(monitor_region->id); |
---|
58 | length += rtems_monitor_pad(11, length); |
---|
59 | length += rtems_monitor_dump_name(monitor_region->id); |
---|
60 | length += rtems_monitor_pad(18, length); |
---|
61 | length += rtems_monitor_dump_attributes(monitor_region->attribute); |
---|
62 | length += rtems_monitor_pad(30, length); |
---|
63 | length += rtems_monitor_dump_addr(monitor_region->start_addr); |
---|
64 | length += rtems_monitor_pad(40, length); |
---|
65 | length += rtems_monitor_dump_hex(monitor_region->length); |
---|
66 | length += rtems_monitor_pad(50, length); |
---|
67 | length += rtems_monitor_dump_hex(monitor_region->page_size); |
---|
68 | length += rtems_monitor_pad(60, length); |
---|
69 | length += rtems_monitor_dump_hex(monitor_region->used_blocks); |
---|
70 | printf("\n"); |
---|
71 | } |
---|
72 | |
---|