⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ide_disk.h

📁 硬盘测速功能。测试硬盘的速度。以及硬盘的固件
💻 H
字号:
/*-------------------------------------------------------------------------*\
|                                                                           |
|                           IDE 硬盘参数读取程序                            |
|                           ~~~~~~~~~~~~~~~~~~~~                            |
|                    Copyright (C) 1997-2003, Victor Chen                   |
|                         Email: victor@cppfans.com                         |
|                      Homepage: http://www.cppfans.com                     |
|                                                                           |
\*-------------------------------------------------------------------------*/
#ifndef _IDE_DISK_H_YBCHEN_
#define _IDE_DISK_H_YBCHEN_
//-------------------------------------------------------------------------//
#include <vcl.h>
#include "WinIo.h"
//-------------------------------------------------------------------------//
enum TIdePortAddrItem
{
  IDE1_Port = 0x1f0, //primary IDE Controller
  IDE2_Port = 0x170, //secondary IDE Controller
  IDE3_Port = 0x1e8, //Tertiary IDE Controller
  IDE4_Port = 0x168, //Quaternary IDE Controller
};
//--------------------- IDE_ID_Inf.Capabs (Offset 62H) --------------------//
enum TIdeInfCapabsItem
{
  IDE_TIM_DTA = 0x2000, //13  Standby Timer values used according to ATA standard
  IDE_IOR_Spp = 0x0800, //11  IORDY supported
  IDE_DIS_IOR = 0x0400, //10  device can disable use of IORDY
  IDE_LBA_Spp = 0x0200, // 9  LBA mode supported
  IDE_DMA_Spp = 0x0100, // 8  DMA supported
};
//-------------------------------------------------------------------------//
#pragma pack(push,1)
typedef union
{
  unsigned short w[256];
  struct
   {
     unsigned short GenCfg;     // 00h  WORD    general configuration
     unsigned short L_Cyln;     // 02h  WORD    number of logical cylinders
     unsigned short Res_00;     // 04h  WORD    reserved
     unsigned short L_Head;     // 06h  WORD    number of logical heads
     unsigned short VndSp0;     // 08h  WORD    vendor-specific
     unsigned short VndSp1;     // 0Ah  WORD    vendor-specific
     unsigned short L_Sect;     // 0Ch  WORD    number of logical sectors
     unsigned short VndSp2;     // 0Eh  WORD    vendor-specific
     unsigned short VndSp3;     // 10h  WORD    vendor-specific
     unsigned short VndSp4;     // 12h  WORD    vendor-specific
     unsigned short Serial[10]; // 14h 10 WORDs serial number
                                //              no serial number if first word is 0000h
                                //              else blank-padded ASCII serial number
     unsigned short CnType;     // 28h  WORD    vendor-specific [controller type]
     unsigned short BufNum;     // 2Ah  WORD    vendor-specific
                                //              [controller buf.size in 512-byte sectors]
     unsigned short ECCByt;     // 2Ch  WORD    number of vendor-specific(usually
                                //              ECC) bytes on Read/Write Long
     unsigned short Revisn[4];  // 2Eh 4  WORDs firmware revision
                                //              no revision number if first word is 0000h
                                //              else blank-padded ASCII revision number
     unsigned short nModel[20]; // 36h 20 WORDs model number
                                //              no model number if first word is 0000h
                                //              else blank-padded ASCII model string
     unsigned short Multip;     // 5Eh  WORD    read/write multiple support
                                //              bits 7-0: maximum number of sectors per
                                //              block supported,
                                //              00h if read/write multiple not supported
     unsigned short Res_01;     // 60h  WORD    reserved (0)
                                //              able to do doubleword transfers if
                                //              nonzero ???
     unsigned short Capabs;     // 62h  WORD    capabilities, bit 9: LBA supported
     unsigned short Securi;     // 64h  WORD    security mode
                                //              bit 15: security-mode feature set supported
                                //              bits 14-8: maximum number of passwords supported
     unsigned short PIOTim;     // 66h  WORD    PIO data transfer cycle timing
     unsigned short DMATim;     // 68h  WORD    single-word DMA data transfer cycle timing
     //========================================================================
     unsigned short FldVal;     // 6Ah  WORD    field validity
                                //              bit 0: offsets 6Ch-73h valid
                                //              bit 1: offsets 80h-8Dh valid
     //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
     unsigned short CLCyln;     // 6Ch  WORD    logical cylinders in current translation mode
     unsigned short CLHead;     // 6Eh  WORD    logical heads in current translation mode
     unsigned short CLSect;     // 70h  WORD    logical sectors per track in current translation mode
     unsigned long  CLCapa;     // 72h 2  WORDs current capacity in sectors (excluding device-specific uses)
     //------------------------------------------------------------------------
     unsigned short McSect;     // 76h  WORD    multiple-sector count for read/write multiple command
     unsigned long  LBASec;     // 78h 2 WORDs  total number of user-addressable sectors (LBA mode), 00000000h if LBA mode not supported
     unsigned short SW_DMA;     // 7Ch  WORD    single-word DMA transfer modes
                                //              low byte is bitmap of supported modes (bit 0 = mode 0, etc.)
                                //              high bytes is bitmap of active mode (bit 8 = mode 0, etc.)
     unsigned short MW_DMA;     // 7Eh  WORD    multiword DMA transfer
                                //              low byte is bitmap of supported modes (bit 0 = mode 0, etc.)
                                //              high bytes is bitmap of active mode (bit 8 = mode 0, etc.)
     //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
     unsigned short FC_PIO;     // 80h  WORD    supported flow control PIO transfer modes
     unsigned short MinDTm;     // 82h  WORD    minimum multiword DMA transfer cycle time
     unsigned short RcmDTm;     // 84h  WORD    recommended multiword DMA cycle time
     unsigned short MinNTm;     // 86h  WORD    minimum non-flow-control PIO transfer cycle time
     unsigned short MinPTm;     // 88h  WORD    minimum PIO transfer cycle time with IORDY
     unsigned short Res_02[2];  // 8Ah  2 WORDs reserved for future PIO modes (0)
     //------------------------------------------------------------------------
     unsigned short Res_03[57]; // 8Eh 57 WORDs reserved (0)
     unsigned short VndSp5[32]; //100h 32 WORDs vendor-specific
     unsigned short Res_04[95]; //140h 95 WORDs reserved (0)
     //------------------------------------------------------------------------
     unsigned short ChkSum;     //1FE  WORD     Checksum and signature(0xa5)
   };
} TIDE_ID_Inf;  //Tt: 512    = 0x140+96*2
#pragma pack(pop)
//-------------------------------------------------------------------------//
extern char DetectHDD(unsigned long BasePort); //bit 0: HDD-0, Bit 1: HDD-1
extern int  GetHDDInfo(TIDE_ID_Inf *Info, char DriveNo, unsigned int BasePort); //DriveNo ... 0:C, 1:D
extern void WordToStr(unsigned char *s, unsigned short *w, int n);
//-------------------------------------------------------------------------//
#endif
//-------------------------------------------------------------------------//

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -