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

📄 ide.h

📁 WinCE 3.0 BSP, 包含Inter SA1110, Intel_815E, Advantech_PCM9574 等
💻 H
字号:
/*++
THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
PARTICULAR PURPOSE.
Copyright (c) 1995-2000  Microsoft Corporation

Module Name: ide.h

Abstract: Boot loader IDE support code.

Functions: None.

Notes:

--*/

#ifndef _IDE_H_
#define _IDE_H_

#define DRIVE_NUM		0

//
// IDE register port addresses
//
#define IDE_DATA_REG    	0x01f0
#define IDE_ERROR_REG   	0x01f1
#define IDE_SECTCNT_REG 	0x01f2
#define IDE_SECTNUM_REG 	0x01f3
#define IDE_CYLL_REG    	0x01f4
#define IDE_CYLH_REG    	0x01f5
#define IDE_DRVHD_REG   	0x01f6
#define IDE_CMD_REG     	0x01f7  // write
#define IDE_STAT_REG    	0x01f7  // read

//
// IDE commands
//
#define IDE_DIAG_CMD    	0x90
#define IDE_RDSECTY_CMD 	0x20
#define IDE_RDSECT_CMD  	0x21
#define IDE_RDBUFF_CMD  	0xe4
#define IDE_IDDRIVE_CMD 	0xec

//
// IDE support macros
//
#define WAIT_IDE_BUSY 		while((_inp(IDE_STAT_REG) & 0x80) != 0)
#define WAIT_IDE_NOT_DRQ    	while((_inp(IDE_STAT_REG) & 0x08) == 0)
#define WAIT_IDE_NOT_DRDY       while((_inp(IDE_STAT_REG) & 0x40) == 0)
#define IS_IDE_ERROR    	(_inp(IDE_STAT_REG) & 0x1)

#define WRITE_IDE_UCHAR(a, b)	_outp(a, b)
#define WRITE_IDE_USHORT(a, b)	_outpw(a, b)
#define WRITE_IDE_ULONG(a, b)	_outpd(a, b)
#define READ_IDE_UCHAR(a)	_inp(a)
#define READ_IDE_USHORT(a)	_inpw(a)
#define READ_IDE_ULONG(a)	_inpd(a)


// Type definitions.
//
struct                  // Physical drive parameters.
{
    USHORT phy_cyls;
    USHORT phy_heads;
    USHORT phy_sectspertrk;
} g_drvparms;

typedef struct          // Drive ID header.
{
    USHORT gen;
    USHORT lcyls;       // P-CHS cyls.
    USHORT rsvd1;
    USHORT lheads;      // P-CHS heads.
    USHORT bytptrk;
    USHORT bytpsct;
    USHORT lsctptrk;    // P-CHS sect per track.
    USHORT gap;
    USHORT pll;
    USHORT venstat;
    UCHAR  sn[20];
    USHORT ctltype;
    USHORT bufsz;
    USHORT eccbyts;
    UCHAR  firmrev[8];
    UCHAR  mn[40];
    USHORT rwmults;
    USHORT dwio;
    USHORT rsvd2;
    USHORT rsvd3;
    USHORT minpio;
    USHORT mindma;
} drv_id_hdr, *pdrv_id_hdr;


#endif	// _IDE_H_.

⌨️ 快捷键说明

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