阅读:1331回复:3
如何向硬盘IO端口发IDENTIFY命令? ECH什么意思? 在哪里得到相应字节的信息?
如何向硬盘IO端口发IDENTIFY命令? ECH什么意思? 在哪里得到相应字节的信息?
|
|
沙发#
发布于:2002-05-30 21:59
ECH就是IDENTIFY命令。
我曾经做过一个ATA5的函数供你参考: ATAC_IDENTIFY EQU 0ECH IOBASE_IDE0 EQU 1F0H IOBASE_IDE1 EQU 170H ATAP_DATA EQU 0 ;;I/O for data IO ATAP_ERR EQU 1 ;;O for error output ATAP_FEATURES EQU 1 ;;I for features set ATAP_SECCOUNT EQU 2 ;;I/O for sector count ATAP_SECNUMBER EQU 3 ;;I/O for sector number/LBA:a7-a0 ATAP_CYLINDERLOW EQU 4 ;;I/O for cylinder:a0-a7/LBA:a15-a8 ATAP_CYLINDERHIGH EQU 5 ;;I/O for cylinder:a8-a15/LBA:a23-a16 ATAP_DEVICE EQU 6 ;;I/O D6: 0=CHS D3-D0:head number ;; 1=LBA D3-D0:LBA:a27-a24 ;; D4: device number ATAP_STATUS EQU 7 ;;O for status output ATAP_COMMAND EQU 7 ;;I for command issue ;;name: AtaIdentify ;;function: get information of disk ;;input: theDevice==device number ;; theBuffer==buffer address in segment:offset ;;output: ax==YES device exist ;; ax==NO device not exist AtaIdentify proc uses bx cx dx si di es, theDevice : BYTE, theBuffer : DWORD LOCAL the_base : WORD .if theDevice & 02h mov the_base, IOBASE_IDE1 .else mov the_base, IOBASE_IDE0 .endif INVOKE IfDrdy, the_base .if theDevice & 01h OutpB the_base, ATAP_DEVICE, ATA_DEVICE1 .else OutpB the_base, ATAP_DEVICE, ATA_DEVICE0 .endif OutpB the_base, ATAP_COMMAND, ATAC_IDENTIFY mov ax, TYPE DEV_INFO mul theDevice mov bx, ax InpB the_base, ATAP_DEVICE INVOKE WaitD, the_base .if ax == NO mov DevInfo[bx].Exist, NO ret .endif mov DevInfo[bx].Exist, YES push theBuffer pop si pop es push si mov cx, 256 @@: InpW the_base, ATAP_DATA mov es:[di], ax add di, 2 INVOKE IfBsy, the_base loop @B pop si .if WORD PTR es:[si] & 8000h mov DevInfo[bx].AtaMode, NO .else mov DevInfo[bx].AtaMode, YES mov ax, es:[si+160] mov DevInfo[bx].ModeNo, ax .endif mov ax, es:[si+2] mov DevInfo[bx].Cylinders, ax mov ax, es:[si+6] mov DevInfo[bx].Heads, ax mov ax, es:[si+12] mov DevInfo[bx].SecPerTrack, ax mov eax, es:[si+120] mov DevInfo[bx].UserMax, eax mov ax, es:[si+184] mov DevInfo[bx].PswRvsCode, ax mov ax, YES ret AtaIdentify endp |
|
|
板凳#
发布于:2002-05-30 22:30
老大,好难看懂噢!我的QQ,759537,我想和你交流.
|
|
地板#
发布于:2002-05-31 15:58
如何用IDE的命令端口和状态端口.
|
|