Delphi-PRAXiS
Seite 1 von 9  1 23     Letzte »    

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Win32/Win64 API (native code) (https://www.delphipraxis.net/17-win32-win64-api-native-code/)
-   -   Delphi Comparing functions (https://www.delphipraxis.net/98537-comparing-functions.html)

Razor 28. Aug 2007 20:06


Comparing functions
 
From IO driver #1

Delphi-Quellcode:
 procedure GetPCIRDWord(dwBus, dwDev, dwFunc, offs: byte; var pdata: DWord);
 procedure SetPCIRDWord(dwBus, dwDev, dwFunc, offs: byte; pdata: DWord);


From IO driver #2

Delphi-Quellcode:
function GetPCRD(Bus, Dev, Func, Reg : byte): dword;
procedure SetPCRD(Bus, Dev, Func, Reg : byte; value : dword);

Can driver 2 functions be used same as driver 1 in this way

Delphi-Quellcode:
var
  dwResult : DWORD;
begin
  //-------Reading a temperature of the Core0----------
  dwResult:=GetPCRD(0,24,$03,$E4);
  SetPCRD(0,24,$03,$E4, dwResult and not (1 shl 2)); //Core0 select
  dwResult:=GetPCRD(0,24,$03,$E4);
  C0:= Format('%d °C',[(dwResult shr 16 and $FF)-49]);
  Label0.Caption := C0;
  Form1.Caption:= C0;
  Application.Title:= C0;
  if not Core2Present then Exit;

  //-------Reading a temperature of the Core1----------
  dwResult:=GetPCRD(0,24,$03,$E4);
  SetPCRD(0,24,$03,$E4, dwResult or (1 shl 2)); //Core1 select
  dwResult:=GetPCRD(0,24,$03,$E4);
  Label1.Caption := Format('%d °C',[(dwResult shr 16 and $FF)-49]);


I have tried it this way but i can't even compile this becouse IDE gives an error Internal L1333 error.:(

Delphi-Quellcode:
var
  pdata : DWORD;
begin
  //-------Reading a temperature of the Core0----------
  GetPCIRDWord(0,24,$03,$E4,pdata);
  SetPCIRDWord(0,24,$03,$E4, pdata and not (1 shl 2)); //Core0 select
  GetPCIRDWord(0,24,$03,$E4,pdata);
  C0:= Format('%d °C',[(pdata shr 16 and $FF)-49]);
  Label0.Caption := C0;
  Form1.Caption:= C0;
  Application.Title:= C0;
  if not Core2Present then Exit;

  //-------Reading a temperature of the Core1----------
  GetPCIRDWord(0,24,$03,$E4,pdata);
  SetPCIRDWord(0,24,$03,$E4, pdata or (1 shl 2)); //Core1 select
  GetPCIRDWord(0,24,$03,$E4,pdata);
  Label1.Caption := Format('%d °C',[(pdata shr 16 and $FF)-49]);





Thanks!

Mackhack 28. Aug 2007 21:06

Re: Comparing functions
 
Did you write this code or did you copy and paste it again like all the other code fragments you've showed us so far?

Der_Unwissende 29. Aug 2007 09:38

Re: Comparing functions
 
Zitat:

Zitat von Razor
Can driver 2 functions be used same as driver 1 in this way

Well, take a minute (just one minute, ok!) to think about it! How could you expect two different functions to work the same way? They don't even have the same signature.

I don't know how you could expect meeting your deadline without having any knowledge about the pure Delphi-basics at all. Sorry man, but if you don't even get the meaning of these lines you've posted...

Razor 29. Aug 2007 10:20

Re: Comparing functions
 
Yes i do understand them,they both read dword from pci bus,but maybe is it better to join the 2 driver to 1 single driver?What you think about that?

Muetze1 29. Aug 2007 10:35

Re: Comparing functions
 
Both driver offer the same functionality so device which one to use and then change your code to use the selected one...

Razor 29. Aug 2007 10:37

Re: Comparing functions
 
So basicly here goes for an old version of a driver and a new version of a driver wich has also x64,x86.But why does it delphi give out L1333 internal error I dont understand this... :oops:


The second driver also provides msr read functions basicly both do.... :!:

OlafSt 29. Aug 2007 11:36

Re: Comparing functions
 
Where does this highly interesting code comes from ?

Razor 29. Aug 2007 11:40

Re: Comparing functions
 
Basicly this can't compile...:x

Delphi-Quellcode:
var
pdata:Cardinal;
begin

omcdrv.GetPCIRDWord(0,24,$03,$E4,pdata); // Here i get Internal error L1333
omcdrv.SetPCIRDWord(0,24,$03,$E4, pdata and not (1 shl 2));

C0:= Format('%d °C',[(pdata shr 16 and $FF)-49]);
Label0.Caption := C0;



//procedure GetPCIRDWord(dwBus, dwDev, dwFunc, offs: byte; var pdata: Cardinal);

Torpedo 29. Aug 2007 12:10

Re: Comparing functions
 
Zitat:

Zitat von OlafSt
Where does this highly interesting code comes from ?

Found some parts with Google Code
URL

Razor 29. Aug 2007 12:12

Re: Comparing functions
 
Yes that is AMD64 Core Temperature!Posted by hathor made by deamonES...Do i need to say more?


Alle Zeitangaben in WEZ +1. Es ist jetzt 00:27 Uhr.
Seite 1 von 9  1 23     Letzte »    

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz