floppyconstants.java

来自「纯java操作系统jnode,安装简单和操作简单的个人使用的Java操作系统」· Java 代码 · 共 196 行

JAVA
196
字号
/*
 * $Id: FloppyConstants.java,v 1.2 2003/11/29 07:45:33 epr Exp $
 */
package org.jnode.driver.floppy;

import org.jnode.fs.util.Geometry;

/**
 * @author epr
 */
public interface FloppyConstants {
	
	/** IRQ Number for floppy disk controller */
	public static final int FLOPPY_IRQ = 6;
	
	/** DMA channel for floppy disk controller */
	public static final int FLOPPY_DMA = 2;

	/** Starting I/O address of primary controller */
	public static final int PRIMARY_START_PORT = 0x3f0;
	/** Starting I/O address of secondary controller */
	public static final int SECONDARY_START_PORT = 0x370;
	/** Number of ports starting from PR/SE_START_PORT */
	public static final int NR_PORTS_RANGE1 = 6;
	public static final int OFFSET_RANGE1 = 0;
	public static final int NR_PORTS_RANGE2 = 1;
	public static final int OFFSET_RANGE2 = 7;
	
	/** Maximum number of result bytes from the FDC */
	public static final int MAX_REPLIES = 16;
	
	/** Digital Output Register offset */
	public static final int RW8_DOR_OFFSET = 2;
	
	/** Status register offset */
	public static final int R8_STATE_OFFSET = 4;
	
	/** Data register offset */
	public static final int RW8_DATA_OFFSET = 5;
	
	/** Digital Input Register offset */
	public static final int R8_DIR_OFFSET = 7;

	// Digital Output Register values	
	public static final int DOR_DRIVE0  = 0x00;
	public static final int DOR_DRIVE1  = 0x01;
	public static final int DOR_DRIVE2  = 0x02;
	public static final int DOR_DRIVE3  = 0x03;
	public static final int DOR_NRESET  = 0x04; // 1=active, 0=reset
	public static final int DOR_DMA     = 0x08; // DMA & IRQ active
	public static final int DOR_MOTOR0  = 0x10;
	public static final int DOR_MOTOR1  = 0x20;
	public static final int DOR_MOTOR2  = 0x40;
	public static final int DOR_MOTOR3  = 0x80;
	
	public static final int DOR_DRIVE_MASK = 0x03;
	
	// Stage register values
	public static final int STATE_ACTIVE0 = 0x01;
	public static final int STATE_ACTIVE1 = 0x02;
	public static final int STATE_ACTIVE2 = 0x04;
	public static final int STATE_ACTIVE3 = 0x08;
	public static final int STATE_BUSY    = 0x10;
	public static final int STATE_NDMA    = 0x20;
	public static final int STATE_DIO     = 0x40;
	public static final int STATE_READY   = 0x80;
	
	// Digital Input Register values
	public static final int DIR_DISKCHANGE = 0x80;
	
	public static final int[] SECTOR_LENGTH = {
		128, 256, 512, 1024, 2048, 4096, 8192, 16384
	};
	
	// ST0 bits
	public static final int ST0_DRIVE_MASK = 0x03;
	public static final int ST0_HEAD1      = 0x04;
	public static final int ST0_NOTREADY   = 0x08;
	public static final int ST0_EQUIPCHECK = 0x10;
	public static final int ST0_SEEKREADY  = 0x20;
	public static final int ST0_CMDST_MASK = 0xC0;	
	public static final int ST0_CMDST_NORMAL = 0x00; // Command finished normal	
	public static final int ST0_CMDST_ERROR  = 0x40; // Command finished with an error
	public static final int ST0_CMDST_INVCMD = 0x80; // Invalid command
	public static final int ST0_CMDST_POLL_ERROR = 0xC0; // Error due to change in ready signal	

	public static final int NR_DRIVES = 4;

	/*	

	{ 6240,39,2,80,0,0x1B,0x43,0xAF,0x28,"E3120" },	**  9 3.12MB 3.5"   

	{ 2880,18,2,80,0,0x25,0x00,0xDF,0x02,"h1440" }, ** 10 1.44MB 5.25"  
	{ 3360,21,2,80,0,0x1C,0x00,0xCF,0x0C,"H1680" }, ** 11 1.68MB 3.5"   
	{  820,10,2,41,1,0x25,0x01,0xDF,0x2E,"h410"  },	** 12 410KB 5.25"   
	{ 1640,10,2,82,0,0x25,0x02,0xDF,0x2E,"H820"  },	** 13 820KB 3.5"    
	{ 2952,18,2,82,0,0x25,0x00,0xDF,0x02,"h1476" },	** 14 1.48MB 5.25"  
	{ 3444,21,2,82,0,0x25,0x00,0xDF,0x0C,"H1722" },	** 15 1.72MB 3.5"   
	{  840,10,2,42,1,0x25,0x01,0xDF,0x2E,"h420"  },	** 16 420KB 5.25"   
	{ 1660,10,2,83,0,0x25,0x02,0xDF,0x2E,"H830"  },	** 17 830KB 3.5"    
	{ 2988,18,2,83,0,0x25,0x00,0xDF,0x02,"h1494" },	** 18 1.49MB 5.25"  
	{ 3486,21,2,83,0,0x25,0x00,0xDF,0x0C,"H1743" }, ** 19 1.74 MB 3.5"  

	{ 1760,11,2,80,0,0x1C,0x09,0xCF,0x00,"h880"  }, ** 20 880KB 5.25"   
	{ 2080,13,2,80,0,0x1C,0x01,0xCF,0x00,"D1040" }, ** 21 1.04MB 3.5"   
	{ 2240,14,2,80,0,0x1C,0x19,0xCF,0x00,"D1120" }, ** 22 1.12MB 3.5"   
	{ 3200,20,2,80,0,0x1C,0x20,0xCF,0x2C,"h1600" }, ** 23 1.6MB 5.25"   
	{ 3520,22,2,80,0,0x1C,0x08,0xCF,0x2e,"H1760" }, ** 24 1.76MB 3.5"   
	{ 3840,24,2,80,0,0x1C,0x20,0xCF,0x00,"H1920" }, ** 25 1.92MB 3.5"   
	{ 6400,40,2,80,0,0x25,0x5B,0xCF,0x00,"E3200" }, ** 26 3.20MB 3.5"   
	{ 7040,44,2,80,0,0x25,0x5B,0xCF,0x00,"E3520" }, ** 27 3.52MB 3.5"   
	{ 7680,48,2,80,0,0x25,0x63,0xCF,0x00,"E3840" }, ** 28 3.84MB 3.5"   

	{ 3680,23,2,80,0,0x1C,0x10,0xCF,0x00,"H1840" }, ** 29 1.84MB 3.5"   
	{ 1600,10,2,80,0,0x25,0x02,0xDF,0x2E,"D800"  },	** 30 800KB 3.5"    
	{ 3200,20,2,80,0,0x1C,0x00,0xCF,0x2C,"H1600" }, ** 31 1.6MB 3.5"
	TAKEN FROM Linux kernel    
	*/

	/** 360K PC */
	public static final FloppyParameters FP_d360 = 
		new FloppyParameters(new Geometry(40,2,9), 0x2a, 0x02, 0xDF, "d360");
	/** 1.2M AT */ 
	public static final FloppyParameters FP_h1200 = 
		new FloppyParameters(new Geometry(80,2,15), 0x1b, 0x00, 0xDF, "h1200"); 
	/** 360K SS 3.5" */ 
	public static final FloppyParameters FP_D360 = 
		new FloppyParameters(new Geometry(80,1,9), 0x2a, 0x02, 0xDF, "D360"); 
	/** 720K 3.5" */ 
	public static final FloppyParameters FP_D720 = 
		new FloppyParameters(new Geometry(80,2,9), 0x2a, 0x02, 0xDF, "D720"); 
	/** 360K AT */ 
	public static final FloppyParameters FP_h360 = 
		new FloppyParameters(new Geometry(40,2,9), 0x23, 0x01, 0xDF, "h360"); 
	/** 720K AT */ 
	public static final FloppyParameters FP_h720 = 
		new FloppyParameters(new Geometry(80,2,9), 0x23, 0x01, 0xDF, "h720"); 
	/** 1.44M 3.5" */ 
	public static final FloppyParameters FP_H1440 = 
		new FloppyParameters(new Geometry(80,2,18), 0x1b, 0x00, 0xCF, "H1440"); 
	/** 2.88M 3.5" */ 
	public static final FloppyParameters FP_E2880 = 
		new FloppyParameters(new Geometry(80,2,36), 0x1b, 0x43, 0xAF, "E2880"); 
	
	/** All known floppy parameters */
	public static final FloppyParameters[] FLOPPY_PARAMS = 
		{ FP_d360, FP_h1200, FP_D360, FP_D720, FP_h360, FP_h720, FP_H1440, FP_E2880 };
	
	// ------------------------------------------
	// Drive parameters
	
	/** Unknown */
	public static final FloppyDriveParameters FDP_UNKNOWN = 
		new FloppyDriveParameters(0, 500, 16, 16, 8000, "unknown", 
			new FloppyParameters[] { FP_H1440, FP_D720, FP_E2880, FP_h1200, FP_d360, FP_h360, FP_D360 });

	/** 360K PC */
	public static final FloppyDriveParameters FDP_360K = 
		new FloppyDriveParameters(1, 300, 16, 16, 8000, "360K PC", 
			new FloppyParameters[] { FP_d360 });

	/** 5 1/4 HD AT */
	public static final FloppyDriveParameters FDP_1200K = 
		new FloppyDriveParameters(2, 500, 16, 16, 6000, "1.2M", 
			new FloppyParameters[] { FP_h1200, FP_h360, FP_h720 });
	
	/** 3.5" DD */
	public static final FloppyDriveParameters FDP_720K = 
		new FloppyDriveParameters(3, 250, 16, 16, 3000, "720K", 
			new FloppyParameters[] { FP_D720 });
	
	/** 3.5" HD */
	public static final FloppyDriveParameters FDP_1440K = 
		new FloppyDriveParameters(4, 500, 16, 16, 4000, "1.44M", 
			new FloppyParameters[] { FP_H1440, FP_D720 });
	
	/** 3.5" ED */
	public static final FloppyDriveParameters FDP_2880K_AMI_BIOS = 
		new FloppyDriveParameters(5, 1000, 15, 8, 3000, "2.88M AMI BIOS", 
			new FloppyParameters[] { FP_H1440, FP_E2880 });
	
	/** 3.5" ED */
	public static final FloppyDriveParameters FDP_2880K = 
		new FloppyDriveParameters(6, 1000, 15, 8, 3000, "2.88M", 
			new FloppyParameters[] { FP_H1440, FP_E2880 });
			
	/** All known floppy drive parameters */
	public static final FloppyDriveParameters[] DRIVE_PARAMS = 
		{ FDP_UNKNOWN, FDP_360K, FDP_1200K, FDP_720K, FDP_1440K, FDP_2880K_AMI_BIOS, FDP_2880K };
	
	/** Timeout for seek command */
	public static final int SEEK_TIMEOUT = 5000;
	/** Timeout for read/write commands */
	public static final int RW_TIMEOUT = 10000;
}

⌨️ 快捷键说明

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