易截截图软件、单文件、免安装、纯绿色、仅160KB

linux 0.11 内核学习 floppy.c,驱动你的软盘


/*
 *  linux/kernel/floppy.c
 *
 *  (C) 1991  Linus Torvalds
 */
/*
 * 02.12.91 - Changed to static variables to indicate need for reset
 * and recalibrate. This makes some things easier (output_byte reset
 * checking etc), and means less interrupt jumping in case of errors,
 * so the code is hopefully easier to understand.
 */
/*
 * This file is certainly a mess. I've tried my best to get it working,
 * but I don't like programming floppies, and I have only one anyway.
 * Urgel. I should check for more errors, and do more graceful error
 * recovery. Seems there are problems with several drives. I've tried to
 * correct them. No promises. 
 */
/*
 * As with hd.c, all routines within this file can (and will) be called
 * by interrupts, so extreme caution is needed. A hardware interrupt
 * handler may not sleep, or a kernel panic will happen. Thus I cannot
 * call "floppy-on" directly, but have to set a special timer interrupt
 * etc.
 *
 * Also, I'm not certain this works on more than 1 floppy. Bugs may
 * abund.
 */
#include <linux/sched.h>
#include <linux/fs.h>
#include <linux/kernel.h>
#include <linux/fdreg.h> // 软驱头文件,其中包含软驱的常用函数的定义
#include <asm/system.h>
#include <asm/io.h>
#include <asm/segment.h>
#define MAJOR_NR 2 // 软驱主设备号
#include "blk.h"
/* 全局标志变量 */
static int recalibrate = 0; // 需要重新校正
static int reset = 0; // 需要重新置位
static int seek = 0; // 寻道
extern unsigned char current_DOR; // 在文件sched.c中定义
#define immoutb_p(val,port) \ // 字节val直接输出到port
__asm__("outb %0,%1\n\tjmp 1f\n1:\tjmp 1f\n1:"::"a" ((char) (val)),"i" (port))
#define TYPE(x) ((x)>>2) // 软驱类型,2--1.2MB,7--1.44MB
#define DRIVE(x) ((x)&0x03) // 软驱序列号0-3对应A-D
/*
 * Note that MAX_ERRORS=8


相关文档:

教大家如何实现硬盘安装linux系统

作者: 羽飞 | 发布时间: 星期天, 01/24/2010 - 16:23
在网上找也好多关于这方面的资料,但都没有一个可以用的,
 
自己研究了一下,完全可以实现,只要按照以下步骤做了,包你能把CentOS请回家
平台Windows XP;     所需软件grub4dos-0.4.3.zip;  CentOS镜像文件DVD。
1.在Windows X ......

Linux下驱动硬件安装教程

对于硬件,有的新手弟兄可能还是不太明白在Linux下驱动硬件,尤其在刚接触Linux时,驱动的安装往往是最令人头痛的一件事了。
一、 对系统驱动安装的一点常识。
1. 开发工具是必须安装:
如果您是新手,我还是建议您把系统完全安装,因为在安装其它的软件会用到一些,我们不太明白的库文件以及开发工具。比如make gcc au ......

Linux 硬链接与软链接介绍

简要介绍:
链接有两种,一种被称为硬链接(Hard Link),另一种被称为符号链接(Symbolic
Link)。软链接相当于windows中的快捷方式,硬链接相当于一个数据同步备份,数据存放在两处,与复制不同的是两处之间存在同步机制,一处数据的改变会实时同步到另一处,另外,一处数据如果被删除了,不会影响到另一处的数据。
限 ......

学习linux的好书籍

http://docs.linuxtone.org/shell/
高级Bash脚本编程指南   :一本深入学习shell脚本艺术的书籍 
这本书假定你没有任何关于脚本或一般程序的编程知识, 但是如果你具备相关的知识, 那么你将很容易就能够达到中高级的水平. . . 所有这些只是UNIX®浩瀚知识的一小部分. 你可以把本书作为教材, 自学手册, ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号