4.104.115
Line | |
---|
1 | # |
---|
2 | # RTEMS Watchdog Support |
---|
3 | # Copyright 2010 Chris Johns (chrisj@rtems.org) |
---|
4 | # |
---|
5 | # $Id$ |
---|
6 | # |
---|
7 | |
---|
8 | import gdb |
---|
9 | |
---|
10 | import chains |
---|
11 | import objects |
---|
12 | |
---|
13 | class state: |
---|
14 | |
---|
15 | INACTIVE = 0 |
---|
16 | BEING_INSERTED = 1 |
---|
17 | ACTIVE = 2 |
---|
18 | REMOVE_IT = 3 |
---|
19 | |
---|
20 | states = { |
---|
21 | 0: 'inactive', |
---|
22 | 1: 'being-inserted', |
---|
23 | 2: 'active', |
---|
24 | 3: 'remove-it' |
---|
25 | } |
---|
26 | |
---|
27 | def __init__(self, s): |
---|
28 | self.s = s |
---|
29 | |
---|
30 | def to_string(self): |
---|
31 | return self.states[self.s] |
---|
32 | |
---|
33 | class control: |
---|
34 | |
---|
35 | def __init__(self, ctrl): |
---|
36 | self.ctrl = ctrl |
---|
37 | |
---|
38 | # Not sure if an extra class is needed. |
---|
39 | def state(self): |
---|
40 | return state(int(self.ctrl['state'])).to_string() |
---|
41 | |
---|
42 | def initial(self): |
---|
43 | return self.ctrl['initial'] |
---|
44 | |
---|
45 | def delta_interval(self): |
---|
46 | return self.ctrl['delta_interval'] |
---|
47 | |
---|
48 | def start_time(self): |
---|
49 | return self.ctrl['start_time'] |
---|
50 | |
---|
51 | def stop_time(self): |
---|
52 | return self.ctrl['stop_time'] |
---|
53 | |
---|
54 | # ToDo: Better printing of watchdog. |
---|
55 | def routine(self): |
---|
56 | addr = self.ctrl['routine'] |
---|
57 | return str(addr) |
---|
58 | |
---|
59 | def show(self): |
---|
60 | print " State:", self.state() |
---|
61 | print " Intial Interval:", self.initial() |
---|
62 | print " Delta Interval:", self.delta_interval() |
---|
63 | print " Start time:", self.start_time() |
---|
64 | print " Stop time:", self.stop_time() |
---|
65 | print " WD Routine:", self.routine() |
---|
Note: See
TracBrowser
for help on using the repository browser.