/**************************************************************************
* FreeDOS32 Floppy Driver *
* by Salvo Isaja *
* *
* Copyright (C) 2003-2005, Salvatore Isaja *
* *
* This is "fdc.c" - Portable code for Floppy Disk Controller support *
* *
* *
* This file is part of the FreeDOS32 Floppy Driver. *
* *
* The FreeDOS32 Floppy Driver is free software; you can redistribute *
* it and/or modify it under the terms of the GNU General Public License *
* as published by the Free Software Foundation; either version 2 of the *
* License, or (at your option) any later version. *
* *
* The FreeDOS32 Floppy Driver is distributed in the hope that it will *
* be useful, but WITHOUT ANY WARRANTY; without even the implied warranty *
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with the FreeDOS32 Floppy Driver; see the file COPYING.txt; *
* if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
* *
* ACKNLOWLEDGEMENT *
* This file is derived from fdc.c, floppy controller handler functions *
* Copyright (C) 1998 Fabian Nunez *
* You can download the original library from Cottontail OS Development *
* Library <http://www.0xfi.com/oslib/topx.html>, the file is FDC.ZIP *
* The author can be reached by email at: [email protected] *
* or by airmail at: Fabian Nunez *
* 10 Eastbrooke *
* Highstead Road *
* Rondebosch 7700 *
* South Africa *
* Floppy formats and drive parameters table are from the Linux driver *
* linux/kernel/floppy.c *
* Copyright (C) 1991, 1992 Linus Torvalds *
* Copyright (C) 1993, 1994 Alain Knaff *
**************************************************************************/
#include "hos.h"
#define MAXDRIVES 2 /* Newer controllers don't support 4 drives, just 2 */
#define SAFESEEK 5 /* Track to seek before issuing a recalibrate */
//#define HAS2FDCS
//#define __DEBUG__
#define LOG_PRINTF(x) printk(x)
#define fd32_message printk
/* This is called when fdc_logdisk is able to read sectors from the new disk. */
/* It fine-tunes format probing by reading informations in the boot sector. */
extern int floppy_bootsector(Fdd *fdd, const FloppyFormat *formats, unsigned num_formats);
/* Floppy Drive Controller IO ports */
enum
{
FDC_BPRI = 0x3F0, /* Base port of the primary controller */
FDC_BSEC = 0x370, /* Base port of the secondary controller */
FDC_DOR = 0x002, /* RW: Digital Output Register */
FDC_MSR = 0x004, /* R : Main Status Register */
FDC_DRS = 0x004, /* W : Data Rate Select Register */
FDC_DATA = 0x005, /* RW: Data Register */
FDC_DIR = 0x007, /* R : Digital Input Register */
FDC_CCR = 0x007 /* W : Configuration Control Register */
};
/* Command bytes (these are NEC765 commands + options such as MFM, etc) */
enum
{
CMD_SPECIFY = 0x03, /* Specify drive timings */
CMD_WRITE = 0xC5, /* Write data (+ MT,MFM) */
CMD_READ = 0xE6, /* Read data (+ MT,MFM,SK) */
CMD_SENSEI = 0x08, /* Sense interrupt status */
//CMD_FORMAT = 0x4D, /* Format track (+ MFM) */
CMD_READID = 0x4A, /* Read sector Id (+ MFM) */
CMD_RECAL = 0x07, /* Recalibrate */
CMD_SEEK = 0x0F, /* Seek track */
CMD_VERSION = 0x10 /* Get FDC version */
};
/* Bits for Fdd.flags */
enum
{
DF_CHANGED = 1 << 0, /* Disk has been changed during the last command */
DF_SPINUP = 1 << 1, /* Motor spinup time elapsed, ready to transfer */
DF_SPINDN = 1 << 2 /* Motor spindown time started */
};
/* Status structure for a Floppy Disk Controller */
// moved to fdc.h
#ifdef MYFDC
typedef struct Fdc
{
unsigned base_port; /* Base port for this controller: XXX0h */
BYTE result[7]; /* Stores the result bytes returned */
BYTE result_size; /* Number of result bytes returned */
BYTE sr0; /* Status Register 0 after a sense interrupt */
BYTE dor; /* Reflects the Digital Output Register */
Fdd drive[4]; /* Drives connected to this controller */
}
Fdc;
#endif
/* All Floppy Drive Controllers issue an IRQ6 to report command completion. */
/* The irq_signaled variable let us know when IRQ6 happened. */
/* Since it is a global variable, this makes the driver not reentrant, thus */
/* we use a simple busy flag to protect the critical sections (all... :-) */
/* For the same reason, we can use just a single, shared, DMA buffer. */
//static IrqSave old_irq6; /* Saves the old IRQ6 handler */
/* TODO: At present we have no means to save the old IRQ6 handler */
static volatile int busy = 0; /* Set if the driver is busy */
//static volatile int irq_signaled = 0; /* Set if IRQ has been signaled */
int irq_signaled = 0; /* Set if IRQ has been signaled */
//static LOWMEM_ADDR dma_sel; /* Selector/address of DMA buf */
//static DWORD dma_addr; /* Physical address of DMA buf */
static Fdc pri_fdc; /* Status of the primary FDC */
#ifdef HAS2FDCS
static Fdc sec_fdc; /* Status of the secondary FDC */
#endif
/* Geometry and other format specifications for floppy disks */
static const FloppyFormat floppy_formats[32] =
{
/* SIZE SPT HD TRK STR GAP3 RATE SRHUT GAP3F NAME NR DESCRIPTION */
{ 0, 0, 0, 0, 0, 0x00, 0x00, 0x00, 0x00, NULL }, /* 0 no testing */
{ 720, 9, 2, 40, 0, 0x2A, 0x02, 0xDF, 0x50, "d360" }, /* 1 360KB PC */
{ 2400, 15, 2, 80, 0, 0x1B, 0x00, 0xDF, 0x54, "h1200" }, /* 2 1.2MB AT */
{ 720, 9, 1, 80, 0, 0x2A, 0x02, 0xDF, 0x50, "D360" }, /* 3 360KB SS 3.5" */
{ 1440, 9, 2, 80, 0, 0x2A, 0x02, 0xDF, 0x50, "D720" }, /* 4 720KB 3.5" */
{ 720, 9, 2, 40, 1, 0x23, 0x01, 0xDF, 0x50, "h360" }, /* 5 360KB AT */
{ 1440, 9, 2, 80, 0, 0x23, 0x01, 0xDF, 0x50, "h720" }, /* 6 720KB AT */
// { 2880, 18, 2, 80, 0, 0x1B, 0x00, 0xDF, 0x6C, "H1440" }, /* 7 1.44MB 3.5" */
{ 2880, 18, 2, 80, 0, 0x1B, 0x00, 0xCF, 0x6C, "H1440" }, /* 7 1.44MB 3.5" */
{ 5760, 36, 2, 80, 0, 0x1B, 0x43, 0xAF, 0x54, "E2880" }, /* 8 2.88MB 3.5" */
{ 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" */
没有合适的资源?快使用搜索试试~ 我知道了~
hos.zip_hos.zip
共636个文件
c:188个
o:180个
h:146个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 46 浏览量
2022-09-21
03:58:01
上传
评论
收藏 689KB ZIP 举报
温馨提示
用于汇编领域的,运用于OS的MAIN函数.基于硬件基础的源代码
资源推荐
资源详情
资源评论
收起资源包目录
hos.zip_hos.zip (636个子文件)
2 2KB
bootwr.asm 1KB
boot 512B
boot 512B
boot 512B
boot 512B
boot 512B
boot 512B
boot 512B
boot 512B
boot 512B
boot1 8B
fdc.c 35KB
old-fdc.c 35KB
old-fdc.c 35KB
old-fdc.c 35KB
old-fdc.c 35KB
process.c 9KB
process.c 6KB
process.c 6KB
process.c 6KB
process.c 6KB
process.c 6KB
new-process.c 6KB
floppy.c 6KB
floppy.c 6KB
floppy.c 6KB
floppy.c 6KB
floppy.c 6KB
old-process.c 5KB
old-process.c 5KB
old-process.c 5KB
old-process.c 5KB
p.c 5KB
p.c 5KB
p.c 5KB
p.c 5KB
old-process.c 5KB
old-process.c 5KB
buggy-process.c 5KB
buggy-process.c 5KB
buggy-process.c 5KB
buggy-process.c 5KB
buggy-process.c 5KB
buggy-process.c 5KB
interrupt.c 5KB
printk.c 4KB
printk.c 4KB
printk.c 4KB
printk.c 4KB
printk.c 4KB
printk.c 4KB
printk.c 4KB
printk.c 4KB
printk.c 4KB
inode.c 4KB
inode.c 4KB
file-syscall.c 4KB
inode.c 4KB
inode.c 4KB
fs.c 4KB
dir.c 4KB
dir.c 4KB
fs.c 4KB
fs.c 4KB
fs.c 3KB
main.c 3KB
mm.c 3KB
kbd.c 3KB
d-super-block.c 3KB
d-super-block.c 3KB
d-super-block.c 3KB
d-super-block.c 3KB
file-block.c 2KB
file-block.c 2KB
kbd.c 2KB
kbd.c 2KB
kbd.c 2KB
file-block.c 2KB
file-block.c 2KB
main.c 2KB
main.c 2KB
main.c 2KB
file-syscall.c 2KB
file-syscall.c 2KB
file-syscall.c 2KB
main.c 2KB
kbd.c 2KB
string.c 2KB
string.c 2KB
kbd.c 2KB
kbd.c 2KB
sched.c 2KB
ext2-inode.c 2KB
ext2-inode.c 2KB
string.c 2KB
string.c 2KB
interrupt.c 2KB
interrupt.c 2KB
interrupt.c 2KB
共 636 条
- 1
- 2
- 3
- 4
- 5
- 6
- 7
资源评论
周楷雯
- 粉丝: 80
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功