?? hdreg.h
字號:
/** 本文件含有一些AT 硬盤控制器的定義。來自各種資料。請查證某些* 定義(帶有問號的注釋)。*/#ifndef _HDREG_H#define _HDREG_H/* Hd controller regs. Ref: IBM AT Bios-listing *//* 硬盤控制器寄存器端口。參見:IBM AT Bios 程序 */#define HD_DATA 0x1f0 /* _CTL when writing */#define HD_ERROR 0x1f1 /* see err-bits */#define HD_NSECTOR 0x1f2 /* nr of sectors to read/write */#define HD_SECTOR 0x1f3 /* starting sector */#define HD_LCYL 0x1f4 /* starting cylinder */#define HD_HCYL 0x1f5 /* high byte of starting cyl */#define HD_CURRENT 0x1f6 /* 101dhhhh , d=drive, hhhh=head */#define HD_STATUS 0x1f7 /* see status-bits */#define HD_PRECOMP HD_ERROR /* same io address, read=error, write=precomp */#define HD_COMMAND HD_STATUS /* same io address, read=status, write=cmd */#define HD_CMD 0x3f6 // 控制寄存器端口。/* Bits of HD_STATUS *//* 硬盤狀態寄存器各位的定義(HD_STATUS) */#define ERR_STAT 0x01 // 命令執行錯誤。#define INDEX_STAT 0x02 // 收到索引。#define ECC_STAT 0x04 /* Corrected error */ // ECC 校驗錯。#define DRQ_STAT 0x08 // 請求服務。#define SEEK_STAT 0x10 // 尋道結束。#define WRERR_STAT 0x20 // 驅動器故障。#define READY_STAT 0x40 // 驅動器準備好(就緒)。#define BUSY_STAT 0x80 // 控制器忙碌。/* Values for HD_COMMAND *//* 硬盤命令值(HD_CMD) */#define WIN_RESTORE 0x10 // 驅動器重新校正(驅動器復位)。#define WIN_READ 0x20 // 讀扇區。#define WIN_WRITE 0x30 // 寫扇區。#define WIN_VERIFY 0x40 // 扇區檢驗。#define WIN_FORMAT 0x50 // 格式化磁道。#define WIN_INIT 0x60 // 控制器初始化。#define WIN_SEEK 0x70 // 尋道。#define WIN_DIAGNOSE 0x90 // 控制器診斷。#define WIN_SPECIFY 0x91 // 建立驅動器參數。/* Bits for HD_ERROR *//* 錯誤寄存器各比特位的含義(HD_ERROR) */// 執行控制器診斷命令時含義與其它命令時的不同。下面分別列出:// ==================================================// 診斷命令時 其它命令時// --------------------------------------------------// 0x01 無錯誤 數據標志丟失// 0x02 控制器出錯 磁道0 錯// 0x03 扇區緩沖區錯// 0x04 ECC 部件錯 命令放棄// 0x05 控制處理器錯// 0x10 ID 未找到// 0x40 ECC 錯誤// 0x80 壞扇區//---------------------------------------------------#define MARK_ERR 0x01 /* Bad address mark ? */#define TRK0_ERR 0x02 /* couldn't find track 0 */#define ABRT_ERR 0x04 /* ? */#define ID_ERR 0x10 /* ? */#define ECC_ERR 0x40 /* ? */#define BBD_ERR 0x80 /* ? */// 硬盤分區表結構。參見下面列表后信息。struct partition{ unsigned char boot_ind; /* 0x80 - active (unused) */ unsigned char head; /* ? */ unsigned char sector; /* ? */ unsigned char cyl; /* ? */ unsigned char sys_ind; /* ? */ unsigned char end_head; /* ? */ unsigned char end_sector; /* ? */ unsigned char end_cyl; /* ? */ unsigned int start_sect; /* starting sector counting from 0 */ unsigned int nr_sects; /* nr of sectors in partition */};#endif
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -