1 | # RTEMS Tools Project (http://www.rtems.org/) |
---|
2 | # Copyright 2014 Chris Johns (chrisj@rtems.org) |
---|
3 | # All rights reserved. |
---|
4 | # |
---|
5 | # This file is part of the RTEMS Tools package in 'rtems-tools'. |
---|
6 | # |
---|
7 | # Redistribution and use in source and binary forms, with or without |
---|
8 | # modification, are permitted provided that the following conditions are met: |
---|
9 | # |
---|
10 | # 1. Redistributions of source code must retain the above copyright notice, |
---|
11 | # this list of conditions and the following disclaimer. |
---|
12 | # |
---|
13 | # 2. Redistributions in binary form must reproduce the above copyright notice, |
---|
14 | # this list of conditions and the following disclaimer in the documentation |
---|
15 | # and/or other materials provided with the distribution. |
---|
16 | # |
---|
17 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
---|
18 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
---|
19 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
---|
20 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE |
---|
21 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
---|
22 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
---|
23 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
---|
24 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
---|
25 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
---|
26 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
---|
27 | # POSSIBILITY OF SUCH DAMAGE. |
---|
28 | # |
---|
29 | |
---|
30 | # |
---|
31 | # RTEMS Configuration Table |
---|
32 | # |
---|
33 | |
---|
34 | import gdb |
---|
35 | |
---|
36 | def _table(): |
---|
37 | return gdb.parse_and_eval('Configuration') |
---|
38 | |
---|
39 | def fields(): |
---|
40 | return [field.name for field in _table().type.fields()] |
---|
41 | |
---|
42 | def mp(): |
---|
43 | return '_Configuration_MP_table' in fields() |
---|
44 | |
---|
45 | def smp(): |
---|
46 | if 'smp_enabled' in fields(): |
---|
47 | return int(_table()['smp_enabled']) != 0 |
---|
48 | return False |
---|
49 | |
---|
50 | def maximum_processors(): |
---|
51 | if smp(): |
---|
52 | return int(_table()['maximum_processors']) |
---|
53 | return 1 |
---|
54 | |
---|
55 | def work_space_size(): |
---|
56 | return long(_table()['work_space_size']) |
---|
57 | |
---|
58 | def stack_space_size(): |
---|
59 | return long(_table()['stack_space_size']) |
---|
60 | |
---|
61 | def maximum_extensions(): |
---|
62 | return long(_table()['maximum_extensions']) |
---|
63 | |
---|
64 | def maximum_keys(): |
---|
65 | return long(_table()['maximum_keys']) |
---|
66 | |
---|
67 | def maximum_key_value_pairs(): |
---|
68 | return long(_table()['maximum_key_value_pairs']) |
---|
69 | |
---|
70 | def microseconds_per_tick(): |
---|
71 | return long(_table()['microseconds_per_tick']) |
---|
72 | |
---|
73 | def nanoseconds_per_tick(): |
---|
74 | return long(_table()['nanoseconds_per_tick']) |
---|
75 | |
---|
76 | def ticks_per_timeslice(): |
---|
77 | return long(_table()['ticks_per_timeslice']) |
---|
78 | |
---|
79 | def idle_task(): |
---|
80 | return long(_table()['idle_task']) |
---|
81 | |
---|
82 | def idle_task_stack_size(): |
---|
83 | return long(_table()['idle_task_stack_size']) |
---|
84 | |
---|
85 | def interrupt_stack_size(): |
---|
86 | return long(_table()['interrupt_stack_size']) |
---|
87 | |
---|
88 | def stack_allocate_init_hook(): |
---|
89 | return long(_table()['stack_allocate_init_hook']) |
---|
90 | |
---|
91 | def stack_allocate_hook(): |
---|
92 | return long(_table()['stack_allocate_hook']) |
---|
93 | |
---|
94 | def stack_free_hook(): |
---|
95 | return long(_table()['stack_free_hook']) |
---|
96 | |
---|
97 | def do_zero_of_workspace(): |
---|
98 | return int(_table()['do_zero_of_workspace']) != 0 |
---|
99 | |
---|
100 | def unified_work_area(): |
---|
101 | return int(_table()['unified_work_area']) != 0 |
---|
102 | |
---|
103 | def stack_allocator_avoids_work_space(): |
---|
104 | return long(_table()['stack_allocator_avoids_work_space']) |
---|
105 | |
---|
106 | def number_of_initial_extensions(): |
---|
107 | return int(_table()['number_of_initial_extensions']) |
---|
108 | |
---|
109 | def user_extension_table(): |
---|
110 | return _table()['User_extension_table'] |
---|