Subversion Repositories freemyipod

Rev

Rev 434 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 434 Rev 506
Line 19... Line 19...
19
#    You should have received a copy of the GNU General Public License
19
#    You should have received a copy of the GNU General Public License
20
#    along with emCORE.  If not, see <http://www.gnu.org/licenses/>.
20
#    along with emCORE.  If not, see <http://www.gnu.org/licenses/>.
21
#
21
#
22
#
22
#
23
 
23
 
24
thread_state = (
24
from ctypes import *
25
    "THREAD_FREE",
-
 
26
    "THREAD_SUSPENDED",
-
 
27
    "THREAD_READY",
-
 
28
    "THREAD_RUNNING",
-
 
29
    "THREAD_BLOCKED",
-
 
30
    "THREAD_DEFUNCT",
-
 
31
    "THREAD_DEFUNCT_ACK"
-
 
32
)
-
 
33
 
-
 
34
thread_block = (
-
 
35
    "THREAD_NOT_BLOCKED",
-
 
36
    "THREAD_BLOCK_SLEEP",
-
 
37
    "THREAD_BLOCK_MUTEX",
-
 
38
    "THREAD_BLOCK_WAKEUP",
-
 
39
    "THREAD_DEFUNCT_STKOV",
25
from misc import ExtendedCStruct, c_enum
40
    "THREAD_DEFUNCT_PANIC"
-
 
41
)
-
 
42
 
-
 
43
thread_type = (
-
 
44
    "USER_THREAD",
-
 
45
    "OS_THREAD",
-
 
46
    "CORE_THREAD"
-
 
47
)
-
 
48
 
26
 
-
 
27
 
49
hwtypes = {
28
class thread_type(c_enum):
-
 
29
    _fields_ = ["USER_THREAD",
-
 
30
                "OS_THREAD",
-
 
31
                "CORE_THREAD",
50
    0: "invalid",
32
               ]
-
 
33
 
-
 
34
class thread_state(c_enum):
-
 
35
    _fields_ = ["THREAD_FREE",
-
 
36
                "THREAD_SUSPENDED",
51
    0x47324e49: "iPod nano 2g",
37
                "THREAD_READY",
-
 
38
                "THREAD_RUNNING",
52
    0x47334e49: "iPod nano 3g",
39
                "THREAD_BLOCKED",
53
    0x47344e49: "iPod nano 4g",
40
                "THREAD_DEFUNCT",
-
 
41
                "THREAD_DEFUNCT_ACK",
-
 
42
               ]
-
 
43
 
-
 
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",
54
    0x4c435049: "iPod classic"
56
                "UNSUPPORTED",
-
 
57
                "BUSY"
-
 
58
               ]
55
}
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
               ]
56
 
80
 
57
swtypes = {
81
swtypes = {
58
    0: "invalid",
82
    0: "invalid",
59
    1: "emBIOS Debugger",
83
    1: "emBIOS Debugger",
60
    2: "emCORE Debugger"
84
    2: "emCORE Debugger"
61
}
85
}
62
 
86
 
63
responsecodes = {
87
hwtypes = {
64
    0: "invalid",
88
    0: "invalid",
65
    1: "ok",
89
    0x47324e49: "iPod nano 2g",
66
    2: "unsupported",
90
    0x47334e49: "iPod nano 3g",
-
 
91
    0x47344e49: "iPod nano 4g",
67
    3: "busy"
92
    0x4c435049: "iPod classic"
68
}
93
}