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
Ïà¹ØÎĵµ£º
Boss˵£¬Òª¿´OpenGL£¬¿´ÁË¿ìÒ»¸öÔ£¬×ÜËã³öÁ˸öÏñÑùµÄ¶«Î÷£¬ÓÃCдÁ˸ö3DÃÔ¹¬£¬
ËäȻֻÓÐ350ÐÐ
´úÂ룬²»¹ý±ßѧ±ßд£¬×ã×ãдÁËÒ»ÖÜʱ¼ä£¬»¹ÊÇСÓгɾ͸е쬻î»î»î£¡
&n ......
´´½¨ËøÎļþ¶ÔÓÚ×ÊÔ´µÄÅÅËû·ÃÎÊ£¬ÀýÈç´®¿Ú£¬ÊÇÏ൱ºÏÊʵ쬵«ÊǶÔÓÚ·ÃÎÊ´óµÄ¹²ÏíÎļþ¾ÍÊÇÌ«ºÃÁË¡£¼ÙÈçÎÒÃÇÓµÓÐÒ»¸öÓÉÒ»¸ö³ÌÐòдÈëµÄ´óÎļþ£¬µ«ÊÇÊÇÓÉÐí¶à²»Í¬µÄ³ÌÐò½øÐгÖÐø¸üеġ£µ±Ò»¸ö³ÌÐòÕýÔڼǼһЩÔڽϳ¤µÄʱ¼äÄÚËùµÃµ½µÄÊý¾Ý£¬²¢ÇÒÕýÔÚΪÆäËûµÄһЩ³ÌÐò½øÐд¦Àíʱ¾Í»á³öÏÖÕâÑùµÄÇé¿ö¡£ÕâЩÕýÔÚ´¦ÀíµÄ³ÌÐò²¢²»»áµÈ´ý ......
¶ÔÓÚÓ²¼þ£¬ÓеÄÐÂÊÖµÜÐÖ¿ÉÄÜ»¹ÊDz»Ì«Ã÷°×ÔÚLinuxÏÂÇý¶¯Ó²¼þ£¬ÓÈÆäÔÚ¸Õ½Ó´¥Linuxʱ£¬Çý¶¯µÄ°²×°ÍùÍùÊÇ×îÁîÈËÍ·Í´µÄÒ»¼þÊÂÁË¡£
Ò»¡¢ ¶ÔϵͳÇý¶¯°²×°µÄÒ»µã³£Ê¶¡£
1£® ¿ª·¢¹¤¾ßÊDZØÐë°²×°£º
Èç¹ûÄúÊÇÐÂÊÖ£¬ÎÒ»¹Êǽ¨ÒéÄú°ÑϵͳÍêÈ«°²×°£¬ÒòΪÔÚ°²×°ÆäËüµÄÈí¼þ»áÓõ½Ò»Ð©£¬ÎÒÃDz»Ì«Ã÷°×µÄ¿âÎļþÒÔ¼°¿ª·¢¹¤¾ß¡£±ÈÈçmake gcc au ......
´ÓÓû§´ò¿ªµçÔ´µ½Óû§¿ÉÒԵǼµÄÕâ¶Ì¶ÌµÄÒ»¶Îʱ¼äÄÚ£¬Red Hat Enterprise Linuxµ½µ×¶¼×÷ÁËÄÄЩÊÂÇ飬ֻÓÐÖªµÀÁËÕâЩÊÂÇ飬Óû§ÔÚÒÔºóµÄʹÓùý³ÌÖУ¬Èç¹û³öÏÖÁËһЩÎÊÌ⣬ÎÒÃÇ¿ÉÒÔ½èÖúÕâЩ¹ý³ÌÀ´ÎªÎÒÃÇÅųýһЩ¹ÊÕÏ¡£
Red Hat Enterprise LinuxÔÚµçÄÔµÄÆô¶¯½×¶Î£¬Ò»¹²¾ÀúÒÔÏÂÁ½¸ö½×¶Î£¬Èçͼ1£º
BIOS×Ô¼ì
µ±µçÄÔ¿ª»úµÄʱº ......
4)º¯Êý
Èç¹ûÄúдÁËһЩÉÔ΢¸´ÔÓһЩµÄ³ÌÐò£¬Äú¾Í»á·¢ÏÖÔÚ³ÌÐòÖпÉÄÜÔÚ¼¸¸öµØ·½Ê¹ÓÃÁËÏàͬµÄ´úÂ룬²¢ÇÒÄúÒ²»á·¢ÏÖ£¬Èç¹ûÎÒÃÇʹÓÃÁ˺¯Êý£¬»á·½±ãºÜ¶à¡£Ò»¸öº¯ÊýÊÇÕâ¸öÑù×ӵģº
functionname()
{
# inside the body $1 is the first argument given to the function
# $2 the second ...
body
}
ÄúÐèÒªÔÚÿ¸ö³ÌÐ ......