-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathr0_testAdapterbase.lua
More file actions
149 lines (129 loc) · 3.06 KB
/
r0_testAdapterbase.lua
File metadata and controls
149 lines (129 loc) · 3.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
-- coding:utf-8
-- File Name: r0_testAdapterbase.lua
-- Author: kht
-- Created Time: 2017/3/14 10:46:06
function show_adapter_baseinfo(out_port, in_port)
bprint = true
outb(out_port, 0x0)
g = inb(in_port)
s = string.format("Length:%d", g)
if bprint then
print(s)
end
g = inb(in_port)
Descriptor = ""
for i = 0, 1 do
g = inb(in_port)
Descriptor = Descriptor .. string.format("%c", g)
end
if bprint then
print("Descriptor:" .. Descriptor)
end
Name = ""
for i = 0, 7 do
g = inb(in_port)
Name = Name .. string.format("%c", g)
end
if bprint then
print("Name:" .. Name)
end
g = inb(in_port)
s = string.format("FirmwareMajorVersion:%d", g)
if bprint then
print(s)
end
g = inb(in_port)
s = string.format("NumberofAuxiliary:%d", g)
if bprint then
print(s)
end
g = inb(in_port)
s = string.format("FirmwareMinorVersion:%d", g)
if bprint then
print(s)
end
g = inb(in_port)
s = string.format("FirmwareBuildNo:%d", g)
if bprint then
print(s)
end
l = inb(in_port)
v = inb(in_port)
g = v * 2 ^ 8 + l
s = string.format("AdapterFifoPort:0x%04X", g)
if bprint then
print(s)
end
l = inb(in_port)
v = inb(in_port)
g = v * 2 ^ 8 + l
s = string.format("AdapterFifoLength:0x%04X", g)
if bprint then
print(s)
end
for i =0, 3 do
if bprint then
print(tostring(i))
end
l = inb(in_port)
v = inb(in_port)
g = v * 2 ^ 8 + l
s = string.format("DownFifoPort:0x%04X", g)
if bprint then
print(s)
end
l = inb(in_port)
v = inb(in_port)
g = v * 2 ^ 8 + l
s = string.format("DownFifoLength:0x%04X", g)
if bprint then
print(s)
end
l = inb(in_port)
v = inb(in_port)
g = v * 2 ^ 8 + l
s = string.format("UpFifoPort:0x%04X", g)
if bprint then
print(s)
end
l = inb(in_port)
v = inb(in_port)
g = v * 2 ^ 8 + l
s = string.format("UpFifoLength:0x%04X", g)
if bprint then
print(s)
end
end
l = inb(in_port)
v = inb(in_port)
g = v * 2 ^ 8 + l
AdapterDownFifoPort = g
s = string.format("AdapterDownFifoPort:0x%04X", g)
if bprint then
print(s)
end
l = inb(in_port)
v = inb(in_port)
g = v * 2 ^ 8 + l
s = string.format("AdapterDownFifoLength:0x%04X", g)
if bprint then
print(s)
end
l = inb(in_port)
v = inb(in_port)
g = v * 2 ^ 8 + l
AdapterUpFifoPort = g
s = string.format("AdapterUpFifoPort:0x%04X", g)
if bprint then
print(s)
end
l = inb(in_port)
v = inb(in_port)
g = v * 2 ^ 8 + l
s = string.format("AdapterUpFiroLength:0x%04X", g)
if bprint then
print(s)
end
end
port_base = adapter.get_base_port()
show_adapter_baseinfo(port_base + 0x0013, port_base + 0x0012)