-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathvrmtool.py
87 lines (54 loc) · 1.73 KB
/
vrmtool.py
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
import ctypes
import struct
import os
import sys
import time
import tkinter as tk
from amd_tools import exeio
from amd_tools import amdadl
from amd_chips import polaris10
from vrms import ir3567b
# fix bad font rendering on screens with high dpi scaling activated
ctypes.windll.shcore.SetProcessDpiAwareness(1)
root = tk.Tk()
class App:
def __init__(self, master):
frame = tk.Frame(master)
frame.pack()
self.frame = frame
self.et = tk.StringVar()
self.entry = tk.Entry(frame, textvariable = self.et)
self.entry.pack(side=tk.LEFT)
self.button = tk.Button(frame, text="QUIT", fg="red", command=quit)
self.button.pack(side=tk.LEFT)
self.update()
def update(self):
now = time.strftime("%H:%M:%S")
self.et.set(now)
self.frame.after(1000, self.update)
# uses memory mapped I/O to get direct access to GPU registers and memory
iomap = exeio.exeio()
# assume first gpu is Polaris 10 based
# TODO: implement auto-detection
gpus = []
gpus.append(polaris10.polaris10(iomap, 0))
# add buttons/labels for direct GPU manipulation to UI
gpus[0].add_registers(root)
# initialize AMD ADL interface
adl = amdadl.amdadl()
# reference RX 480 has an IR3567B VRM controller
# with I2C at line 04 and address 08
# and PMBUS at line 04 and address 70
# TODO: auto-detection of I2C/PMBUS devices
vrms = []
vrms.append(ir3567b.ir3567b(adl, 0, 0x04, 0x08))
vrms[0].add_registers(root)
#adl.I2C_read_byte(0x04, 0x08, 0x0D, adl.active_ids[0])
# run tkinter UI
app = App(root)
root.title('VRMtool')
root.mainloop()
def print_pack(t_struct):
for field in t_struct._fields_:
print(field[0], getattr(t_struct, field[0]))
#print_pack(gpus[0].test.bits)