Subversion Repositories freemyipod

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
176 farthen 1
#!/usr/bin/env python
2
#
3
#
4
#    Copyright 2010 TheSeven, benedikt93, Farthen
5
#
6
#
427 farthen 7
#    This file is part of emCORE.
176 farthen 8
#
427 farthen 9
#    emCORE is free software: you can redistribute it and/or
176 farthen 10
#    modify it under the terms of the GNU General Public License as
11
#    published by the Free Software Foundation, either version 2 of the
12
#    License, or (at your option) any later version.
13
#
427 farthen 14
#    emCORE is distributed in the hope that it will be useful,
176 farthen 15
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
16
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
17
#    See the GNU General Public License for more details.
18
#
19
#    You should have received a copy of the GNU General Public License
427 farthen 20
#    along with emCORE.  If not, see <http://www.gnu.org/licenses/>.
176 farthen 21
#
22
#
23
 
506 farthen 24
from ctypes import *
25
from misc import ExtendedCStruct, c_enum
173 farthen 26
 
27
 
506 farthen 28
class thread_type(c_enum):
29
    _fields_ = ["USER_THREAD",
30
                "OS_THREAD",
31
                "CORE_THREAD",
32
               ]
173 farthen 33
 
506 farthen 34
class thread_state(c_enum):
35
    _fields_ = ["THREAD_FREE",
36
                "THREAD_SUSPENDED",
37
                "THREAD_READY",
38
                "THREAD_RUNNING",
39
                "THREAD_BLOCKED",
40
                "THREAD_DEFUNCT",
41
                "THREAD_DEFUNCT_ACK",
42
               ]
171 farthen 43
 
506 farthen 44
class thread_block(c_enum):
45
    _fields_ = ["THREAD_NOT_BLOCKED",
46
                "THREAD_BLOCK_SLEEP",
47
                "THREAD_BLOCK_MUTEX",
48
                "THREAD_BLOCK_WAKEUP",
49
                "THREAD_DEFUNCT_STKOV",
50
                "THREAD_DEFUNCT_PANIC"
51
               ]
52
 
53
class responsecode(c_enum):
54
    _fields_ = ["INVALID",
55
                "OK",
56
                "UNSUPPORTED",
57
                "BUSY"
58
               ]
59
 
60
class scheduler_thread(ExtendedCStruct):
61
    _fields_ = [("regs", c_uint32 * 16),
62
                ("cpsr", c_uint32),
63
                ("state", c_uint32),
64
                ("name", c_uint32),
65
                ("cputime_current", c_uint32),
66
                ("cputime_total", c_uint64),
67
                ("startusec", c_uint32),
68
                ("thread_next", c_uint32),
69
                ("queue_next", c_uint32),
70
                ("timeout", c_uint32),
71
                ("blocked_since", c_uint32),
72
                ("blocked_by", c_uint32),
73
                ("stack", c_uint32),
74
                ("err_no", c_int32),
75
                ("block_type", thread_block),
76
                ("thread_type", thread_type),
77
                ("priority", c_uint8),
78
                ("cpuload", c_uint8),
79
               ]
80
 
171 farthen 81
swtypes = {
82
    0: "invalid",
434 theseven 83
    1: "emBIOS Debugger",
427 farthen 84
    2: "emCORE Debugger"
171 farthen 85
}
86
 
506 farthen 87
hwtypes = {
171 farthen 88
    0: "invalid",
506 farthen 89
    0x47324e49: "iPod nano 2g",
90
    0x47334e49: "iPod nano 3g",
91
    0x47344e49: "iPod nano 4g",
92
    0x4c435049: "iPod classic"
427 farthen 93
}