{********************************************************************************************************}
{                                                                                                        }
{ Carbonsoft cxCpu Processor Detection Toolkit Release 4                                                 }
{                                                                                                        }
{ cxCpu2000 API Interface unit                                                                           }
{                                                                                                        }
{ Copyright © 1995-2003 Kev French, Carbonsoft. All rights reserved.                                     }
{ http://www.carbonsoft.com/cxcpu/                                                                       }
{                                                                                                        }
{ IMPORTANT INFORMATION                                                                                  }
{ You (individual or organisation) are free to use this utility and any example source code              }
{ provided by Carbonsoft for any purpose.                                                                }
{                                                                                                        }
{ Use of this utility and any example source code is entirely at your own risk.                          }
{                                                                                                        }
{ For more information please contact licensing@carbonsoft.com                                           }
{                                                                                                        }
{********************************************************************************************************}
unit cxCpu40Intf;

interface

uses cxCpu40;

type
  { Record types from cxCpu2kConst.pas }
  TProcessorInfo = packed record
    dwSize:       DWORD;
    iProcessor:   Byte;
    lpName:       String;
    lpFullName:   String;
    lpSerial:     String;
    lpVendor:     String;
  end;

  TProcessorSpeedInfo = packed record
    dwSize:       DWORD;
    iProcessor:   Byte;
    iDelay:       LongInt;
    sRaw:         Single;
    iNormalised:  LongInt;
  end;

  TCacheInfo = packed record
    dwSize:       DWORD;
    iProcessor:   Byte;
    iLevel1Code:  LongInt;
    iLevel1Data:  LongInt;
    iLevel1:      LongInt;
    iLevel2:      LongInt;
  end;

  TCPUIDInfo = packed record
    dwSize:       DWORD;
    iProcessor:   Byte;
    bAvailable:   Boolean;
    iMaxLevel:    LongInt;
    iMaxExLevel:  LongInt;
  end;

  TFeatureSetInfo = packed record
    dwSize:       DWORD;
    iProcessor:   Byte;
    bFPU:         Boolean;
    bVME:         Boolean;
    bDE:          Boolean;
    bPSE:         Boolean;
    bTSC:         Boolean;
    bMSR:         Boolean;
    bPAE:         Boolean;
    bMCE:         Boolean;
    bCX8:         Boolean;
    bAPIC:        Boolean;
    bSEP:         Boolean;
    bMTRR:        Boolean;
    bPGE:         Boolean;
    bMCA:         Boolean;
    bCMOV:        Boolean;
    bPAT:         Boolean;
    bPSE36:       Boolean;
    bSERIAL:      Boolean;
    bMMX:         Boolean;
    bXSR:         Boolean;
    bSIMD:        Boolean;
    bEXMMX:       Boolean;
    b3DNOW:       Boolean;
    bEX3DNOW:     Boolean;
    bCLFLUSH:     Boolean;
    bDTS:         Boolean;
    bACPI:        Boolean;
    bSIMD2:       Boolean;
    bSS:          Boolean;
    bTM:          Boolean;
  end;

  TSignatureInfo = packed record
    dwSize:       DWORD;
    iProcessor:   Byte;
    iSignature:   LongInt;
    iType:        LongInt;
    iFamily:      LongInt;
    iFamilyEx:    LongInt;
    iModel:       LongInt;
    iModelEx:     LongInt;
    iStepping:    LongInt;
    iBrand:       LongInt;
  end;

  TcxVersionInfo = packed record
    dwSize:       DWORD;
    APIMajor:     LongInt;
    APIMinor:     LongInt;
    IntMajor:    LongInt;
    IntMinor:    LongInt;
  end;

const
  { Internal version information }
  PRODUCT_NAME = 'CarbonSoft Processor Detection Legacy API Interface';
  PRODUCT_VERSION = 4;
  PRODUCT_BUILD = 15;
  PRODUCT_COPYRIGHT = 'Copyright © 2000-2003 CarbonSoft';
  INTF_VERSION = 2;
  INTF_BUILD = 1;

  { Error flags }
  ERR_NOERROR = 0;
  ERR_CPUIDNOTSUPPORTED = (-1);
  ERR_EXECUTIONLEVELNOTSUPPORTED = (-2);
  ERR_BADINFOSTRUCTURE = (-3);

  { Return value identifiers }
  VAL_NOVALUE = 0;

  { CPUID EFLAGS Id bit }
  CPUIDID_BIT	= cCpuid_EFlags

  { Default Benchmark delay }
  BENCHMARK_DELAY = 500;

  { Processor flags (temporary - for future SMP support) }
  USE_DEFAULT = 0;

  { CPUID execution levels }
  CPUID_MAXLEVEL        : cStd_MaximumLevel;
  CPUID_VENDORSIGNATURE : cStd_VendorSignature;
  CPUID_CPUSIGNATURE    : cStd_Signature;
  CPUID_CPUFEATURESET   : cStd_FeatureSet;
  CPUID_CACHETLB        : cStd_CacheTlb;
  CPUID_CPUSERIALNUMBER : cStd_SerialNumber;

  CPUID_MAXLEVELEX      : cExt_MaximumLevel;
  CPUID_CPUSIGNATUREEX  : cExt_Signature;
  CPUID_CPUMARKETNAME1  : cExt_MarketingName1;
  CPUID_CPUMARKETNAME2  : cExt_MarketingName2;
  CPUID_CPUMARKETNAME3  : cExt_MarketingName3;
  CPUID_LEVEL1CACHETLB  : cExt_Level1Cache;
  CPUID_LEVEL2CACHETLB  : cExt_Level2Cache;

  { CPUID result indexes }
  EAX = cReg_Eax;
  EBX = cReg_Ebc;
  ECX = cReg_Ecx;
  EDX = cReg_Edx;

  { Standard feature set flags }
  SFS_FPU     = cFeature_Fpu;
  SFS_VME     = cFeature_Vme;
  SFS_DE      = cFeature_De;
  SFS_PSE     = cFeature_Pse;
  SFS_TSC     = cFeature_Tsc;
  SFS_MSR     = cFeature_Msr;
  SFS_PAE     = cFeature_Pae;
  SFS_MCE     = cFeature_Mce;
  SFS_CX8     = cFeature_Cx8;
  SFS_APIC    = cFeature_Apic;
  SFS_SEP     = cFeature_Sep;
  SFS_MTRR    = cFeature_Mtrr;
  SFS_PGE     = cFeature_Pge;
  SFS_MCA     = cFeature_Mca;
  SFS_CMOV    = cFeature_Cmov;
  SFS_PAT     = cFeature_Pat;
  SFS_PSE36   = cFeature_Pse36;
  SFS_SERIAL  = cFeature_Psn;
  SFS_CLFLUSH = cFeature_Clfsh;
  SFS_DTS     = cFeature_Ds;
  SFS_ACPI    = cFeature_Acpi;
  SFS_MMX     = cFeature_Mmx;
  SFS_XSR     = cFeature_Fxsr;
  SFS_SIMD    = cFeature_Sse;
  SFS_SIMD2   = cFeature_Sse2;
  SFS_SS      = cFeature_Ss;
  SFS_TM      = cFeature_Tm;


  { Extended feature set flags (duplicates removed) }
  EFS_EXMMXA  = cFeature_MmxAmd; { AMD Specific }
  EFS_EXMMXC  = cFeature_MmxVia; { Cyrix Specific }
  EFS_3DNOW   = cFeature_3dNow;
  EFS_EX3DNOW = cFeature_3dNowX;

  { Processor family values }
  CPU_486CLASS        = cFamily_486;
  CPU_PENTIUMCLASS    = cFamily_P5;
  CPU_PENTIUMIICLASS  = cFamily_P6;
  CPU_PENTIUMIVCLASS  = cFamily_P7;

  { Pentium III-specific model }
  CPU_PENTIUMIIIMODEL = cModel_MinPsn;

  { Processor type values }
  CPU_OVERDRIVE       = 1;

  { Extended Cache Levels }
  CACHE_LEVEL1        = 0;
  CACHE_LEVEL2        = 1;

  { Brand ID Identifiers }
  BRAND_UNSUPPORTED    = cBrand_Unknown;
  BRAND_CELERON        = cBrand_Celeron;
  BRAND_PENTIUMIII     = cBrand_P3;
  BRAND_PENTIUMIIIXEON = cBrand_P3Xeon;
  BRAND_PENTIUMIV      = cBrand_P4;

  { Extended Model & Family Indicator }
  EXTENDED_FIELDS      = cExtend_Fields;


  { Information functions }
  function cxGetProcessorInfo(var AProcessorInfo: TProcessorInfo): LongInt;
  function cxGetSpeedInfo(var AProcessorSpeedInfo: TProcessorSpeedInfo): LongInt;
  function cxGetCacheInfo(var ACacheInfo: TCacheInfo): LongInt;
  function cxGetCPUIDInfo(var ACPUIDInfo: TCPUIDInfo): LongInt;
  function cxGetFeatureSetInfo(var AFeatureSetInfo: TFeatureSetInfo): LongInt;
  function cxGetSignatureInfo(var ASignatureInfo: TSignatureInfo): LongInt;
  function cxGetVersionInfo(var AVersionInfo: TcxVersionInfo): LongInt;

  { Exposed API function - wrapped for isolation }
  { CPUID functions }
  function cxGetCPUIDSupport(AProcessor: Byte): Boolean;
  function cxGetMaxStdCPUIDLevel(AProcessor: Byte): LongInt;
  function cxGetMaxExtCPUIDLevel(AProcessor: Byte): LongInt;
  function cxExecuteCPUID(AProcessor: Byte;
                          AExecutionLevel: Cardinal;
                          AIterations: Byte;
                          var AResult: TCPUIDResult): Boolean;

  { Signature functions }
  function cxGetProcessorSignature(AProcessor: Byte): LongInt;
  function cxGetProcessorType(AProcessor: Byte): LongInt;
  function cxGetProcessorFamily(AProcessor: Byte): LongInt;
  function cxGetProcessorExFamily(AProcessor: Byte): LongInt;
  function cxGetProcessorModel(AProcessor: Byte): LongInt;
  function cxGetProcessorExModel(AProcessor: Byte): LongInt;
  function cxGetProcessorStepping(AProcessor: Byte): LongInt;
  function cxGetProcessorBrand(AProcessor: Byte): LongInt;

  { Processor functions }
  function cxGetProcessorCount: Byte;
  function cxGetProcessorName(AProcessor: Byte): String;
  function cxGetProcessorFullName(AProcessor: Byte): String;
  function cxGetVendorName(AProcessor: Byte): String;
  function cxGetVendorIdentification(AProcessor: Byte): String;

  { Benchmark functions }
  function cxGetRawProcessorSpeed(AProcessor: Byte; ADelay: LongInt): Single;
  function cxGetNormalisedProcessorSpeed(AProcessor: Byte; ADelay: LongInt): LongInt;
  function cxGetRawProcessorSpeedEx(AProcessor: Byte): Single;
  function cxGetNormalisedProcessorSpeedEx(AProcessor: Byte): LongInt;

  { Misc functions }
  function cxGetOverdriveFlag(AProcessor: Byte): Boolean;
  function cxGetFDivBugPresent(AProcessor: Byte): Boolean;

  { Feature set functions }
  function cxGetStdFeatureSet(AProcessor: Byte): LongInt;
  function cxGetExtFeatureSet(AProcessor: Byte): LongInt;
  function cxGetStdFeatureSupport(AFeatureSet: LongInt; ABit: Byte): Boolean;
  function cxGetStdFeatureSupportEx(AProcessor: Byte; ABit: Byte): Boolean;
  function cxGetExtFeatureSupport(AFeatureSet: LongInt; ABit: Byte): Boolean;
  function cxGetExtFeatureSupportEx(AProcessor: Byte; ABit: Byte): Boolean;

  { Feature set shortcut functions }
  function cxGetMMXSupport(AProcessor: Byte): Boolean;
  function cxGetExtMMXSupport(AProcessor: Byte): Boolean;
  function cxGetSIMDSUpport(AProcessor: Byte): Boolean;
  function cxGet3DNowSupport(AProcessor: Byte): Boolean;
  function cxGetExt3DNowSupport(AProcessor: Byte): Boolean;

  { Advanced information functions }
  function cxGetSerialNumber(AProcessor: Byte): String;
  function cxGetMarketingName(AProcessor: Byte): String;

  { Cache functions }
  function cxGetLevel1DataCache(AProcessor: Byte): LongInt;
  function cxGetLevel1CodeCache(AProcessor: Byte): LongInt;
  function cxGetLevel1UnifiedCache(AProcessor: Byte): LongInt;
  function cxGetLevel2UnifiedCache(AProcessor: Byte): LongInt;

  { Version functions }
  function cxGetAPIVersionMajor: LongInt;
  function cxGetAPIVersionMinor: LongInt;
  function cxGetIntfVersionMajor: LongInt;
  function cxGetIntfVersionMinor: LongInt;

implementation

function dneGetVendor(AProcessor: Byte): LongInt;
begin
  Result := Ord(cxCpu.Processors[AProcessor].ProcessorVendor.VendorType);
end;  //------------

function cxGetProcessorInfo(var AProcessorInfo: TProcessorInfo): LongInt;
{ Fills the AProcessorInfo structure with the relevent information }
begin
  AProcessorInfo.lpName := cxCpu.Processors[AProcessorInfo.iProcessor].Name.Part;
  AprocessorInfo.lpFullName := cxCpu.Processors[AProcessorInfo.iProcessor].Name.Full;
  AProcessorInfo.lpSerial := cxCpu.Processors[AProcessorInfo.iProcessor].Serial.Formatted;
  AProcessorInfo.lpVendor := cxCpu.Processors[AProcessorInfo.iProcessor].Vendor.Name;

  Result := ERR_NOERROR;
end;  //------------

function cxGetSpeedInfo(var AProcessorSpeedInfo: TProcessorSpeedInfo): LongInt;
{ Fills the AProcessorSpeedInfo structure with the relevent information }
begin
  if (AProcessorSpeedInfo.dwSize <> SizeOf(TProcessorSpeedInfo)) then begin
    Result := ERR_BADINFOSTRUCTURE;
    Exit;
  end;

  if (AProcessorSpeedInfo.iDelay = USE_DEFAULT) then
    AProcessorSpeedInfo.sRaw := cxGetRawProcessorSpeedEx(USE_DEFAULT)
  else
    AProcessorSpeedInfo.sRaw := cxGetRawProcessorSpeed(USE_DEFAULT, AProcessorSpeedInfo.iDelay);
  AProcessorSpeedInfo.iNormalised := GetNormalisedCPUSpeed(AProcessorSpeedInfo.sRaw);

  Result := ERR_NOERROR;
end;  //------------

function cxGetCacheInfo(var ACacheInfo: TCacheInfo): LongInt;
{ Fills the ACacheInfo structure with the relevent information }
begin
  if (ACacheInfo.dwSize <> SizeOf(TCacheInfo)) then begin
    Result := ERR_BADINFOSTRUCTURE;
    Exit;
  end;

  ACacheInfo.iLevel1Code := cxCpu.Processors[ACacheInfo.iProcessor].Cache.Level1.Code.Size.AsNumber;
  ACacheInfo.iLevel1Data := cxCpu.Processors[ACacheInfo.iProcessor].Cache.Level1.Data.Size.AsNumber;
  ACacheInfo.iLevel1 := cxCpu.Processors[ACacheInfo.iProcessor].Cache.Level1.Unified.Size.AsNumber;
  ACacheInfo.iLevel2 := cxCpu.Processors[ACacheInfo.iProcessor].Cache.Level2.Code.Size.AsNumber;

  Result := ERR_NOERROR;
end;  //------------

function cxGetCPUIDInfo(var ACPUIDInfo: TCPUIDInfo): LongInt;
{ Fills the ACPUIDInfo structure with the relevent information }
begin
  if (ACPUIDInfo.dwSize <> SizeOf(TCPUIDInfo)) then begin
    Result := ERR_BADINFOSTRUCTURE;
    Exit;
  end;

  ACPUIDInfo.bAvailable := cxCpu.Processors[ACPUIDInfo.iProcessor].Cpuid.Standard.Available.AsBoolean;
  ACPUIDInfo.iMaxLevel := cxCpu.Processors[ACPUIDInfo.iProcessor].Cpuid.Standard.MaximumCommand.AsNumber;
  ACPUIDInfo.iMaxExLevel := cxCpu.Processors[ACPUIDInfo.iProcessor].Cpuid.Extended.MaximumCommand.AsNumber;

  Result := ERR_NOERROR;
end;  //------------

function cxGetFeatureSetInfo(var AFeatureSetInfo: TFeatureSetInfo): LongInt;
{ Fills the AFeatureSet structure with the relevent info }
begin
  if (AFeatureSetInfo.dwSize <> SizeOf(TFeatureSetInfo)) then begin
    Result := ERR_BADINFOSTRUCTURE;
    Exit;
  end;

  with AFeatureSetInfo do begin
    bFPU := cxCpu.Processors[AFeatureSetInfo.iProcessor].Features.Standard.ByIndex(SFS_FPU).Available.AsBoolean;
    bVME := cxCpu.Processors[AFeatureSetInfo.iProcessor].Features.Standard.ByIndex(SFS_VME).Available.AsBoolean;
    bDE := cxCpu.Processors[AFeatureSetInfo.iProcessor].Features.Standard.ByIndex(SFS_DE).Available.AsBoolean;
    bPSE := cxCpu.Processors[AFeatureSetInfo.iProcessor].Features.Standard.ByIndex(SFS_PSE).Available.AsBoolean;
    bTSC := cxCpu.Processors[AFeatureSetInfo.iProcessor].Features.Standard.ByIndex(SFS_TSC).Available.AsBoolean;
    bMSR := cxCpu.Processors[AFeatureSetInfo.iProcessor].Features.Standard.ByIndex(SFS_MSR).Available.AsBoolean;
    bPAE := cxCpu.Processors[AFeatureSetInfo.iProcessor].Features.Standard.ByIndex(SFS_PAE).Available.AsBoolean;
    bMCE := cxCpu.Processors[AFeatureSetInfo.iProcessor].Features.Standard.ByIndex(SFS_MCE).Available.AsBoolean;
    bCX8 := cxCpu.Processors[AFeatureSetInfo.iProcessor].Features.Standard.ByIndex(SFS_CX8).Available.AsBoolean;
    bAPIC := cxCpu.Processors[AFeatureSetInfo.iProcessor].Features.Standard.ByIndex(SFS_APIC).Available.AsBoolean;
    bSEP := cxCpu.Processors[AFeatureSetInfo.iProcessor].Features.Standard.ByIndex(SFS_SEP).Available.AsBoolean;
    bMTRR := cxCpu.Processors[AFeatureSetInfo.iProcessor].Features.Standard.ByIndex(SFS_MTRR).Available.AsBoolean;
    bPGE := cxCpu.Processors[AFeatureSetInfo.iProcessor].Features.Standard.ByIndex(SFS_PGE).Available.AsBoolean;
    bMCA := cxCpu.Processors[AFeatureSetInfo.iProcessor].Features.Standard.ByIndex(SFS_MCA).Available.AsBoolean;
    bCMOV := cxCpu.Processors[AFeatureSetInfo.iProcessor].Features.Standard.ByIndex(SFS_CMOV).Available.AsBoolean;
    bPAT := cxCpu.Processors[AFeatureSetInfo.iProcessor].Features.Standard.ByIndex(SFS_PAT).Available.AsBoolean;
    bPSE36 := cxCpu.Processors[AFeatureSetInfo.iProcessor].Features.Standard.ByIndex(SFS_PSE36).Available.AsBoolean;
    bSERIAL := cxCpu.Processors[AFeatureSetInfo.iProcessor].Features.Standard.ByIndex(SFS_SERIAL).Available.AsBoolean;
    bMMX := cxCpu.Processors[AFeatureSetInfo.iProcessor].Features.Standard.ByIndex(SFS_MMX).Available.AsBoolean;
    bXSR := cxCpu.Processors[AFeatureSetInfo.iProcessor].Features.Standard.ByIndex(SFS_XSR).Available.AsBoolean;
    bSIMD := cxCpu.Processors[AFeatureSetInfo.iProcessor].Features.Standard.ByIndex(SFS_SIMD).Available.AsBoolean;
    bSIMD2 := cxCpu.Processors[AFeatureSetInfo.iProcessor].Features.Standard.ByIndex(SFS_SIMD2).Available.AsBoolean;
    bDTS := cxCpu.Processors[AFeatureSetInfo.iProcessor].Features.Standard.ByIndex(SFS_DTS).Available.AsBoolean;
    bACPI := cxCpu.Processors[AFeatureSetInfo.iProcessor].Features.Standard.ByIndex(SFS_ACPI).Available.AsBoolean;
    bSS := cxCpu.Processors[AFeatureSetInfo.iProcessor].Features.Standard.ByIndex(SFS_SS).Available.AsBoolean;
    bTM := cxCpu.Processors[AFeatureSetInfo.iProcessor].Features.Standard.ByIndex(SFS_TM).Available.AsBoolean;
    bCLFLUSH := cxCpu.Processors[AFeatureSetInfo.iProcessor].Features.Standard.ByIndex(SFS_CLFLUSH).Available.AsBoolean;
    bEXMMX := cxCpu.Processors[AFeatureSetInfo.iProcessor].Features.Standard.ByName('MMX+').Available.AsBoolean;
    b3DNOW := cxCpu.Processors[AFeatureSetInfo.iProcessor].Features.Extended.ByIndex(EFS_3DNOW).Available.AsBoolean;
    bEX3DNOW := cxCpu.Processors[AFeatureSetInfo.iProcessor].Features.Extended.ByIndex(EFS_EX3DNOW).Available.AsBoolean;
  end;

  Result := ERR_NOERROR;
end;  //------------

function cxGetSignatureInfo(var ASignatureInfo: TSignatureInfo): LongInt;
{ Fills the ASignatureInfo structure with the relevent information }
begin
  if (ASignatureInfo.dwSize <> SizeOf(TSignatureInfo)) then begin
    Result := ERR_BADINFOSTRUCTURE;
    Exit;
  end;

  ASignatureInfo.iSignature := cxCpu.Processors[ASignatureInfo.iProcessor].Signature.Value.AsNumber;
  ASignatureInfo.iType := cxCpu.Processors[ASignatureInfo.iProcessor].Signature.CpuType.Value.AsNumber;
  ASignatureInfo.iFamily := cxCpu.Processors[ASignatureInfo.iProcessor].Signature.Family.Value.AsNumber;
  ASignatureInfo.iFamilyEx := cxCpu.Processors[ASignatureInfo.iProcessor].Signature.Family.Value.AsNumber;
  ASignatureInfo.iModel := cxCpu.Processors[ASignatureInfo.iProcessor].Signature.Model.Value.AsNumber;
  ASignatureInfo.iModelEx := cxCpu.Processors[ASignatureInfo.iProcessor].Signature.Model.Value.AsNumber;
  ASignatureInfo.iStepping := cxCpu.Processors[ASignatureInfo.iProcessor].Signature.Stepping.Value.AsNumber;
  ASignatureInfo.iBrand := cxCpu.Processors[ASignatureInfo.iProcessor].Signature.Brand.Value.AsNumber;

  Result := ERR_NOERROR;
end;  //------------

function cxGetVersionInfo(var AVersionInfo: TcxVersionInfo): LongInt;
{ Fills the AVersionInfo structure with the relevent details }
begin
  if (AVersionInfo.dwSize <> SizeOf(TcxVersionInfo)) then begin
    Result := ERR_BADINFOSTRUCTURE;
    Exit;
  end;

  AVersionInfo.APIMajor := cxGetAPIVersionMajor;
  AVersionInfo.APIMinor := cxGetAPIVersionMinor;
  AVersionInfo.IntMajor := cxGetIntfVersionMajor;
  AVersionInfo.IntMinor := cxGetIntfVersionMinor;

  Result := ERR_NOERROR;
end;  //------------

function cxGetCPUIDSupport(AProcessor: Byte): Boolean;
{ Returns TRUE if the CPUID instruction is supported, FALSE otherwise }
begin
  Result := cxCpu.Processors[AProcessor].Cpuid.Standard.Available.AsBoolean;
end;  //------------

function cxGetMaxStdCPUIDLevel(AProcessor: Byte): LongInt;
{ Returns the maximum supported CPUID execution level }
begin
  Result := cxCpu.Processors[AProcessor].Cpuid.Standard.MaximumCommand.AsNumber;
end;  //------------

function cxGetMaxExtCPUIDLevel(AProcessor: Byte): LongInt;
{ Returns the maximum supported extended CPUID execution level }
begin
  Result := cxCpu.Processors[AProcessor].Cpuid.Extended.MaximumCommand.AsNumber;
end;  //------------

function cxGetProcessorSignature(AProcessor: Byte): LongInt;
{ Returns the processor signature }
begin
  Result := cxCpu.Processors[AProcessor].Signature.Value.AsNumber;
end;  //------------

function cxGetProcessorType(AProcessor: Byte): LongInt;
{ Returns the processor type (0 = OEM or Retail, 1 = OverDrive) }
begin
  Result := cxCpu.Processors[AProcessor].Signature.CpuType.Value.AsNumber;
end;  //------------

function cxGetProcessorFamily(AProcessor: Byte): LongInt;
{ Returns the processor family }
begin
  Result := cxCpu.Processors[AProcessor].Signature.Family.Value.AsNumber;
end;  //------------

function cxGetProcessorExFamily(AProcessor: Byte): LongInt;
{ Returns the extended processor family }
begin
  Result := cxCpu.Processors[AProcessor].Signature.Family.Value.AsNumber;
end;  //------------

function cxGetProcessorExModel(AProcessor: Byte): LongInt;
{ Returns the extended processor family }
begin
  Result := cxCpu.Processors[AProcessor].Signature.Model.Value.AsNumber;
end;  //------------

function cxGetProcessorModel(AProcessor: Byte): LongInt;
{ Returns the processor model }
begin
  Result := cxCpu.Processors[AProcessor].Signature.Model.Value.AsNumber;
end;  //------------

function cxGetProcessorStepping(AProcessor: Byte): LongInt;
{ Returns the processor stepping }
begin
  Result := cxCpu.Processors[AProcessor].Signature.Stepping.Value.AsNumber;
end;  //------------

function cxGetProcessorBrand(AProcessor: Byte): LongInt;
{ Returns the processor brand identifier }
begin
  Result := cxCpu.Processors[AProcessor].Signature.Brand.Value.AsNumber;
end;  //------------

function cxGetProcessorCount: Byte;
{ Returns the number of processors in the system }
begin
  Result := cxCpu.ProcessorCount.Available.AsNumber;
end;  //------------


function cxGetProcessorName(AProcessor: Byte): String;
{ Returns the processor name }
begin
  Result := cxCpu.Processors[AProcessor].Name.AsString;
end;  //------------

function cxGetProcessorFullName(AProcessor: Byte): String;
{ Returns the processor name prefixed by the vendor name }
begin
  Result := cxGetProcessorName(AProcessor);
end;  //------------

function cxGetVendorName(AProcessor: Byte): String;
{ Returns the processor vendor name }
begin
  Result := cxCpu.Processors[AProcessor].Vendor.Name;
end;  //------------

function cxGetVendorIdentification(AProcessor: Byte): String;
{ Returns the processor vendor identification string }
begin
  Result := cxCpu.Processors[AProcessor].Vendor.Signature;
end;  //------------

function cxGetRawProcessorSpeed(AProcessor: Byte; ADelay: LongInt): Single;
{ Returns the raw processor speed (Pentium level processors and higher only) }
begin
  Result := cxCpu.Processors[AProcessor].Speed.RawSpeed.AsNumber;
end;  //------------

function cxGetNormalisedProcessorSpeed(AProcessor: Byte; ADelay: LongInt): LongInt;
{ Returns a normalised processor speed (Pentium level processors and higher only) }
begin
  Result := cxCpu.Processors[AProcessor].Speed.Normalised.AsNumber;
end;  //------------

function cxGetRawProcessorSpeedEx(AProcessor: Byte): Single;
{ Returns the raw processor speed using the default bewnchmark delay (500ms) }
begin
  Result := cxGetRawProcessorSpeed(USE_DEFAULT, BENCHMARK_DELAY);
end;  //------------

function cxGetNormalisedProcessorSpeedEx(AProcessor: Byte): LongInt;
{ Returns a normalised processor speed using the default benchmark delay (500ms) }
begin
  Result := cxGetNormalisedProcessorSpeed(USE_DEFAULT, BENCHMARK_DELAY);
end;  //------------


function cxGetOverdriveFlag(AProcessor: Byte): Boolean;
{ Returns TRUE if the processor is an OverDrive model, FALSE otherwise }
begin
  Result := cxCpu.Processors[AProcessor].Signature.CpuType.Value = 1;
end;  //------------

function cxGetFDivBugPresent(AProcessor: Byte): Boolean;
{ Returns TRUE if the Pentium FDIV bug is present, FALSE otherwise }
begin
  Result := cxCpu.Processors[AProcessor].Errata.FDivError.AsBoolean;
end;  //------------

function cxGetMMXSupport(AProcessor: Byte): Boolean;
{ Returns TRUE if the processor supports MMX instructions, FALSE otherwise }
begin
  Result := cxCpu.Processors[AProcessor].Features.ByName('MMX').Available.AsBoolean;
end;  //------------

function cxGetExtMMXSupport(AProcessor: Byte): Boolean;
{ Returns TRUE if the processor supported the Extended MMX instructions, FALSE otherwise }
begin
  Result := cxCpu.Processors[AProcessor].Features.ByName('MMX+').Available.AsBoolean;
end;  //------------

function cxGetSIMDSupport(AProcessor: Byte): Boolean;
{ Returns TRUE if the processor supports the SIMD instructions, FALSE otherwise }
begin
  Result := cxCpu.Processors[AProcessor].Features.ByName('SSE').Available.AsBoolean;
end;  //------------

function cxGet3DNowSupport(AProcessor: Byte): Boolean;
{ Returns TRUE if the processor supports the 3DNow! instructions, FALSE otherwise }
begin
  Result := cxCpu.Processors[AProcessor].Features.ByName('3DNOW').Available.AsBoolean;
end;  //------------

function cxGetExt3DNowSupport(AProcessor: Byte): Boolean;
{ Returns TRUE if the processor supports the extended 3DNow! instructions, FALSE otherwise }
begin
  Result := cxCpu.Processors[AProcessor].Features.ByName('3DNOW+').Available.AsBoolean;
end;  //------------

function cxGetSerialNumber(AProcessor: Byte): String;
{ Returns the processor serial number (if available and/or enabled) }
begin
  Result := cxCpu.Processors[AProcessor].Serial.Formatted;
end;  //------------

function cxGetMarketingName(AProcessor: Byte): String;
{ Returns the processor marketing name (if available) }
begin
  Result := cxCpu.Processors[AProcessor].Name.AsString;
end;  //------------

function cxGetLevel1DataCache(AProcessor: Byte): LongInt;
{ Returns the size of the level 1 data cache (in Kb) or 0 if not supported }
begin
  Result := cxCpu.Processors[AProcessor].Cache.Level1.Data.Size.AsNumber;
end;  //------------

function cxGetLevel1CodeCache(AProcessor: Byte): LongInt;
{ Returns the size of the level 1 instruction cache (in Kb) or 0 if not supported }
begin
  Result := cxCpu.Processors[AProcessor].Cache.Level1.Code.Size.AsNumber;
end;  //------------

function cxGetLevel1UnifiedCache(AProcessor: Byte): LongInt;
{ Returns the size of the level 1 unified cache (in Kb) or 0 if not supported }
begin
  Result := cxCpu.Processors[AProcessor].Cache.Level1.Unified.Size.AsNumber;
end;  //------------

function cxGetLevel2UnifiedCache(AProcessor: Byte): LongInt;
{ Returns the size of the level 2 unified cache (in Kb) or 0 if not supported }
begin
  Result := cxCpu.Processors[AProcessor].Cache.Level2.Size.AsNumber;
end;  //------------

function cxGetAPIVersionMajor: LongInt;
{ Returns the product version of the detection API }
begin
  Result := INTF_VERSION
end;  //------------

function cxGetAPIVersionMinor: LongInt;
{ Returns the minor version (build) of the detection API }
begin
  Result := INTF_BUILD;
end;  //------------

function cxGetIntfVersionMajor: LongInt;
{ Returns the product version of the Interface unit }
begin
  Result := PRODUCT_VERSION;
end;  //------------

function cxGetIntfVersionMinor: LongInt;
{ Returns the minor version (build) of the Interface unit }
begin
  Result := PRODUCT_BUILD;
end;  //------------

end.
