1 use crate::{intel_arc
, winring0
};
3 const OLS_TYPE
: u32 = 40000;
5 const F17H_M01H_THM_TCON_CUR_TMP
: u32 = 0x00059800;
6 const F17H_TEMP_OFFSET_FLAG
: u32 = 0x80000;
7 const FAMILY_17H_PCI_CONTROL_REGISTER
: u32 = 0x60;
10 gpu_devices
: intel_arc
::Devices
,
14 pub fn new() -> Self {
17 gpu_devices
: intel_arc
::GetDevices(),
22 pub fn read_cpu_temp(&self) -> f32 {
24 winring0
::WritePciConfigDwordEx(
26 FAMILY_17H_PCI_CONTROL_REGISTER
,
27 F17H_M01H_THM_TCON_CUR_TMP
,
30 let output
: &mut u32 = &mut 0;
32 winring0
::ReadPciConfigDwordEx(0x00, FAMILY_17H_PCI_CONTROL_REGISTER
+ 4, output
);
33 let offset_flag
= *output
& F17H_TEMP_OFFSET_FLAG
!= 0;
34 let mut temperature
= ((*output
>> 21) * 125) as f32 * 0.001;
46 pub fn read_gpu_temp(&self) -> f32 {
47 unsafe { intel_arc
::GetTemperature(self.gpu_devices
, 0) as f32 }
51 impl Drop
for Sensors
{
54 intel_arc
::FreeDevices(self.gpu_devices
);