private void WaitForPowerTable(object sender, DoWorkEventArgs e) { if (WaitForDriverLoad()) { int minimum_retries = 2; Stopwatch timer = new Stopwatch(); timer.Start(); uint temp; // Refresh until table is transferred to DRAM or timeout do { InteropMethods.GetPhysLong((UIntPtr)dramBaseAddress, out temp); }while (temp == 0 && timer.Elapsed.TotalMilliseconds < 10000); InteropMethods.GetPhysLong((UIntPtr)dramBaseAddress, out temp); // Already in DRAM and auto-refresh disabled if (temp != 0) { Thread.Sleep(Convert.ToInt32(PowerCfgTimer.Interval.TotalMilliseconds) * minimum_retries); } timer.Stop(); } else { HandleError("InpOut driver is not responding or not loaded."); } }
private void ReadPowerConfig() { if (dramBaseAddress > 0) { try { SMU.Status status = OPS.TransferTableToDram(); if (status != SMU.Status.OK) { status = OPS.TransferTableToDram(); // retry } if (status != SMU.Status.OK) { return; } for (int i = 0; i < table.Length; ++i) { InteropMethods.GetPhysLong((UIntPtr)dramBaseAddress + (i * 0x4), out uint data); table[i] = data; } if (table.Any(v => v != 0)) { PowerTable.ConfiguredClockSpeed = MEMCFG.Frequency; PowerTable.Table = table; } } catch (EntryPointNotFoundException ex) { throw new ApplicationException(ex.Message); } catch (DllNotFoundException ex) { throw new ApplicationException(ex.Message); } } }
private void ReadPowerConfig() { #if DEBUG /*uint prev1 = 0; * uint prev2 = 0; * for (; ; ) * { * uint cmd1 = 0, cmd2 = 0; * uint arg1 = 0, arg2 = 0; * uint rsp1 = 0, rsp2 = 0; * * ops.SmuReadReg(0x03B10564, ref arg1); * ops.SmuReadReg(0x03B10528, ref cmd1); * ops.SmuReadReg(0x03B10598, ref rsp1); * if (cmd1 != prev1) * { * prev1 = cmd1; * Console.WriteLine($"1 -> 0x{cmd1:X2}: 0x{arg1:X8}: 0x{rsp1:X8}"); * } * * ops.SmuReadReg(ops.Smu.SMU_ADDR_ARG, ref arg2); * ops.SmuReadReg(ops.Smu.SMU_ADDR_MSG, ref cmd2); * ops.SmuReadReg(ops.Smu.SMU_ADDR_RSP, ref rsp2); * if (cmd2 != prev2) * { * prev2 = cmd2; * Console.WriteLine($"2 -> 0x{cmd2:X2}: 0x{arg2:X8}: 0x{rsp2:X8}"); * } * }*/ #endif if (dramBaseAddress > 0) { try { SMU.Status status = OPS.TransferTableToDram(); if (status != SMU.Status.OK) { status = OPS.TransferTableToDram(); // retry } if (status != SMU.Status.OK) { return; } for (int i = 0; i < table.Length; ++i) { InteropMethods.GetPhysLong((UIntPtr)dramBaseAddress + (i * 0x4), out uint data); table[i] = data; } if (table.Any(v => v != 0)) { PowerTable.ConfiguredClockSpeed = MEMCFG.Frequency; PowerTable.Table = table; } } catch (EntryPointNotFoundException ex) { throw new ApplicationException(ex.Message); } catch (DllNotFoundException ex) { throw new ApplicationException(ex.Message); } } }