亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? fl_drver.c

?? 移植Nuclues_RTC到coldfire5307在diab下編譯通過
?? C
?? 第 1 頁 / 共 5 頁
字號:
/*************************************************************************/
/*聲明: 本文件由張士玉修改,如果要修改,請先與他聯系!
/*                                                                      */
/* VERSION                               RELEASE DATE: 12-08-93          */
/*                                                                       */
/* RTX/PLUS/386 PC WITH                                                  */
/* NUCLEUS BIOS                                                          */
/* FILE SYSTEM 1.5                                                       */
/*                                                                       */
/*                                                                       */
/* HISTORY                                                               */
/*                                                                       */
/*      DATE                    REMARKS                                  */
/*                                                                       */
/*    12-08-93                  Initial version of the Nucleus Single    */
/*                              Board File System. This version was      */
/*                              originally only for the Nucleus PLUS     */
/*                              Single Board version.                    */
/*                                                                       */
/*    12-22-93                  The File System is updated to run with   */
/*                              either Nucleus RTX Single Board (ver 1.1)*/
/*                              or Nucleus Plus Single Board (ver 1.1b). */
/*                                                                       */
/*    08-20-97                  The File System is updated to run        */
/*                              without using DMA. The compile line      */
/*                              option POLLED will turn off DMA support  */
/*                              and use polled mode to talk to the       */
/*                              floppy controller (release 1.5).         */
/*                                                                       */
/*    10-06-97                  Changed FLTMO_SEEK to support low level  */
/*                              formatting of 360k floppy.               */
/*                                                                       */
/*************************************************************************/

/* Contains NUCLEUS Specific Code */
/*
* EBS - RTFS (Real Time File Manager)
*
* Copyright Peter Van Oudenaren , 1993
* All rights reserved.
* This code may not be redistributed in source or linkable object form
* without the consent of its author.
*/

/* fl_drver.c - Generic floppy disk driver routines.

    Routines in this file are generic routines to control an NEC765 class
    floppy disk controller in AT mode. The routines should be independent 
    of executive environment and of the system hosting the 765 controller.

Public routines:
  These routines are  pointed to by the RTFS bdevsw table.

    floppy_ioctl        -   IO control function. Does nothing
    floppy_raw_open     -   Raw open routine. Does nothing
    floppy_open         -   Drive open routine. Initializes the controller and
			    establishes interrupt vector if open count is zero.
			    Increments the open count.
    floppy_close        -   Decreases the open count. If the open count goes
			    to zero it releases interrupts.
    floppy_io           -   Performs reads/writes on the drives

  This routine is public but is not in the device table. You may call it 
  directly. 

    fl_format           -   
  
  The rest of the routines are internal to the driver.

    fl_claim            -   Claims the controller for a drive. Establishes 
			    the media type if need be and sets the data rate
			    so the disk may be read/written.
    fl_establish_media  -   Determines the media type of the floppy disk in
			    the drive by varying the data rate and attempting to
			    read the sector ID off of the disk. Also seeks the
			    head to clear the disk changed line.
    fl_sense_interrupt  -   Requests sense (staust registers) from the floppy 
			    after reset,recal and seek
    fl_read_id          -   Reads sector IDs from a floppy. Used by establish
			    media
    fl_seek             -   Seeks the head.
    fl_recalibrate      -   Seeks the head to track 0 and resets chips internal 
			    head position counter
    fl_specify          -   Specify head load/unload times and seek step rate
    fl_controller_init  -   Clears internal floppy tables, establishes interrupts
			    and resets the 765 chip.
    fl_reset_controller -   Called by fl_controller_init. Issues a reset to 
			    the chip.
    fl_motor_on         -   Turns the floppy motor on and starts a daemon to 
			    shut it off.
    fl_motor_off        -   The daemon calls this to shut off the floppy motor
    fl_command_phase    -   Sends command phase values to the chip. Called by
			    higher level routines like fl_read_id, fl_io etc.
    fl_results_phase    -   Reads results phase values from the chip. Called by
			    higher level routines like fl_read_id, fl_io etc.
    fl_ready            -   Determines what data transfer state the floppy 
			    controller's state machine is in. TO, FROM or 
			    none.
    fl_change_line      -   Called by floppy_io to check the drive's change
			    line to see if the floppy disk has been removed.
			    If the drive has been removed we call establish
			    media to clear it. We should probaly add a call 
			    back mechanism here to alert the user to replace the
			    disk and possibly to give the file system a
			    chance to recover.
    fl_cp_parms         -   Copy parameters from the parameter table to the
			    _floppy structure.
    fl_dma_chk          -   Takes an address and returns the number of blocks
			    that may be transferd to that address before a 
			    dma segment wrap occurs.
    fl_dma_init         -   Sets up the dma controller for a to or from memory
			    transfer from/to the floppy controller
    fl_int_enable       -   Mask floppy disk interupts oin/off
    fl_read_data        -   Reads a byte from the 765 data register
    fl_read_drr         -   Reads a byte from the 765 data rate register
    fl_read_msr         -   Reads a byte from the 765 master status register
    fl_write_data       -   Writes a byte to the 765 data register
    fl_write_dor        -   Writes a byte to the 765 digital output register
    fl_write_drr        -   Writes a byte to the 765 data rate register
    fl_report_error     -   Converts floppy errors to strings and prints them
    fl_waitdma          -   Waits for dma to complete and checks status
    fl_waitint          -   Waits for a floppy disk interrupt. Or tiomes out
    fl_isr              -   Floppy disk interrupt service routine

*/

//Daniel Start
#ifndef POLLED
#define POLLED	1
#endif
//Daniel End

#ifdef  PLUS
#include "nucleus.h"
#else
#include "nu_defs.h"
#include "nu_extr.h"
#include <dos.h>
#endif

#include "pcdisk.h"
#include "miniexec.h"
//add by Lxd on 02-2-8
#define Start_gTimer() asm("  nop  ")
#define Stop_gTimer()  asm("  nop  ")
//add by zlp 02-01-14, mo
#define delay_25us() asm("  nop  ")
#define delay_1us()  asm("  nop  ")
//end add by zlp

//系統自檢加入,放驅動器重校準命令執行的結果  Liao Yibai 2002-11-26
int Recalibrate_Ok;

/*
//Daniel Start, 定時器2

#define TMR2	0x10000120
#define TRR2    0x10000124
#define TCR2    0x10000128
#define TCN2    0x1000012c
#define TER2    0x10000131

//Daniel End
*/

/* Handy bit definitions */
#define BIT7 (UTINY) 0x80
#define BIT6 (UTINY) 0x40
#define BIT5 (UTINY) 0x20
#define BIT4 (UTINY) 0x10
#define BIT3 (UTINY) 0x08
#define BIT2 (UTINY) 0x04
#define BIT1 (UTINY) 0x02
#define BIT0 (UTINY) 0x01

/* Timing parameters */
#if 0
NUCLEUS - These values are expressed below in ticks.
#define FL_SPINUP       1000  /* Milliseconds to delay on spin up */
#define MOTOR_TIMEOUT   3000  /* Milliseconds until we shut the motor off */

/* Timeout values in millisecond for various operations */
/* These are in ticks under smx */
#define FLTMO_IO        6000        /* 6 sec Read or write */
#define FLTMO_FMTTRACK  6000        /* 6 sec Format a track */
#define FLTMO_READID    3000        /* 3 sec Read ID during establish media */
#define FLTMO_SEEK      1000        /* 1 sek Seek to a track */
#define FLTMO_RECAL     3000        /* 3 sec Recalibrate (seek to 0) */
#define FLTMO_RESET     6000        /* 6 sec Wait for interrupt after reset */

#else

#define FL_SPINUP       18  /* Milliseconds to delay on spin up */
//#define MOTOR_TIMEOUT   54  /* Milliseconds until we shut the motor off */
#define MOTOR_TIMEOUT   260	//需要調整,以獲得最佳效果

/* Timeout values in millisecond for various operations */
/* These are in ticks under smx */
#ifdef POLLED

#define FLTMO_IO          2        /* 20 ms Read or write */
#define FLTMO_FMTTRACK    2        /* 20 ms Format a track */
#define FLTMO_READID      2        /* 20 ms Read ID during establish media */
//#define FLTMO_SEEK        2        /* 20 ms Seek to a track */
#define FLTMO_SEEK        24//36     /* 36 is used for 360k disks */
//#define FLTMO_RECAL       2        /* 20 ms Recalibrate (seek to 0) */
#define FLTMO_RECAL       24        /* 240 ms Recalibrate (seek to 0) */
#define FLTMO_RESET       2        /* 20 ms Wait for interrupt after reset */

#else /* POLLED */

#define FLTMO_IO        108        /* 6 sec Read or write */
#define FLTMO_FMTTRACK  108        /* 6 sec Format a track */
#define FLTMO_READID     54        /* 3 sec Read ID during establish media */
#define FLTMO_SEEK       36        /* was 18 for 1 sec Seek to a track */
                                   /* Changed to 36 for 360k disks */
#define FLTMO_RECAL      54        /* 3 sec Recalibrate (seek to 0) */
#define FLTMO_RESET     108        /* 6 sec Wait for interrupt after reset */

#endif /* POLLED */

#endif 

/* Digital output register bits */
#define DORB_DSEL       BIT0
#define DORB_SRSTBAR    BIT2
#define DORB_DMAEN      BIT3
#define DORB_MOEN1      BIT4
#define DORB_MOEN2      BIT5
#define DORB_MODESEL    BIT7

/* Commands to the controller */
#define FL_CONFIGURE         0x13   /* Control some operation modes */

#define FL_SPECIFY           0x3    /* Specify drive timing */
#define FL_SENSE_STATUS      0x4    /* Read status register 3 */
#define FL_WRITE             0x5    /* Write block(s)  */
#define FL_READ              0x6    /* Read block(s)  */
#define FL_RECALIBRATE       0x7    /* Recalibrate */
#define FL_SENSE_INTERRUPT   0x8    /* Sense interrupt status */
#define FL_READID            0xa    /* Read sector id under head */
#define FL_FORMAT            0xd    /* Format track */
#define FL_SEEK              0xf    /* Seek to a cylinder */

/* Qualifier bits to read/write commands */
#define MFMBIT BIT6
#define MTBIT  BIT7

/* Arguments to specify command */
//#define SP_1    (UTINY) 0xaf    /* step rate 6 milsec, head uload 240 */
#define SP_1    (UTINY) 0xDF    /*步進速率:3ms, 磁頭卸載時間:240,Daniel */
#ifdef POLLED

#define SP_2    (UTINY) 0x3     /* head load = 1ms(應該是2ms//Daniel), dma disabled */

#else /* POLLED */

#define SP_2    (UTINY) 0x2     /* head load = 1ms, dma enabled */

#endif /* POLLED */

/* Filler byte for use during format */
#define FORMAT_FILLER   0xf6

/* Error values */
#define FLERR_ABN_TERM                  1
#define FLERR_CHIP_HUNG                 2
#define FLERR_DMA                       3
#define FLERR_FORMAT                    4
#define FLERR_INVALID_INTERLEAVE        5
#define FLERR_IO_SECTOR                 6
#define FLERR_IO_TMO                    7
#define FLERR_MEDIA                     8
#define FLERR_RECAL                     9
#define FLERR_RESET                    10
#define FLERR_SEEK                     11
#define FLERR_SPECIFY                  12
#define FLERR_UNK_DRIVE                13 
#define FLERR_EXEC_EST                 14


/* Drive types as stored in the AT cmos eeprom. We use the same constants for
   established media type in the drive. */
#define DT_NONE 0
#define DT_360  1
#define DT_12   2
#define DT_720  3
#define DT_144  4
#define DT_288  5

/* Data rate register values */
#define DR_250  0x02
#define DR_300  0x01
#define DR_500  0x00
#define DR_1000 0x03

/* Values returned from fl_ready. - If it returns 0 the controller is not
   ready to accept or send data */
#define FL_FRHOST   1           /* Controller expecting data from host */
#define FL_TOHOST   2           /* Controller has data for host */

/* Gap values. nemonics make the drive description table easier to read */
/* GPF is gpl_format */
#define GPF_50 0x50
#define GPF_54 0x54
#define GPF_6C 0x6C
/* GPL is gpl_read */
#define GPL_2A 0x2A
#define GPL_1B 0x1B

typedef struct _fl_devparms {
    COUNT drive_size;           /* 360,720,1200,1440,2880 */
    UTINY drive_type;           /* DT_360 et al. Drive type from AT cmos */
    UTINY media_type;           /* DT_360 et al. Media installed in drive */
    UTINY specify_1;            /* StepRate:Head Unload */
    UTINY specify_2;            /* HeadLoad:NonDma      */
    UTINY data_rate;            /* DR_250 et al */
    UTINY sectors_per_track;    
    UTINY cylinders_per_disk;
    UTINY gpl_read;             /* Gap durong read write */
    UTINY gpl_format;           /* Gap during format     */
} _FL_DEVPARMS;

/****************************************************************
//1440,	4,		4,		0xAF, 0x03, 0,		18, 80,	  0x1B, 0x6C
specify_1 :步進速率:磁頭卸載時間
	磁頭卸載時間:0x0F 磁頭卸載時間(HUT)規定了從讀/寫命令執行階段
				  結束到磁頭處于卸載狀態的時間,該定時器是可編程的
				  編程值從16-240ms,增量是16ms(即01=16ms,02=32ms
				  …0F=240ms)
	步進速率:	0x0A 步進速率時間(SRT)規定了相鄰步進脈沖之間的時間
				間隔,該定時器可有1一16ms的編程范圍.增量是1ms(F=
				1ms,E=2ms.D=3ms等), 這里:6ms
specify_2 : 磁頭加載時間:DMA
	磁頭加載時間: 0x01 磁頭加載時間(HCT)規定了啟動磁頭加載信號和開
					始該/寫操作之間的時間間隔,該定時器可有2-254ms
					的編程范圍,增量是2ms(01=2ms,02=4ms.03=6ms,
					…FE=254ms)。步進速率應該比驅動器所需要的最短時
					間長1ms
	DMA:		0x01 非DMA方式
****************************************************************/

typedef struct command_block
{
    UTINY data_rate_reg; /* Written to data rate register each time */
    COUNT n_to_send;     /* Number of bytes to send in the command phase */
    COUNT n_to_get;      /* Number of bytes expected in the results phase */
    COUNT n_gotten;      /* Number gotten in the results phase */
	UTINY commands[10];  /* Sent during command phase */
	UTINY results[10];   /* Returned during results phase */
} COMMAND_BLOCK;

/* Each drive has one of these structures that we update one we know what the media type is */
typedef struct _floppy
{
    UTINY drive_type;           /* DT_360 et al. Drive type from AT cmos */
    UTINY media_type;           /* DT_NONE if not established */
    UTINY specify_1;            /* StepRate:Head Unload */
    UTINY specify_2;            /* HeadLoad:NonDma      */
    UTINY data_rate;            /* DR_250 et al */
    UTINY sectors_per_track;    
    UTINY sectors_per_cyl;    
    UTINY cylinders_per_disk;
    UTINY gpl_read;             /* Gap durong read write */
    BOOL  double_step;
} _FLOPPY;


/* Handle of io event channel */
/* COUNT mex_floppy_event; */

/* Shadow of the digital output register. We write to this each time we
   write to the dig. output reg. */
UTINY shadow_dig_out = 0;

#ifndef POLLED

/* We need a 512 byte buffer occasionaly */
/* UTINY dma_buffer[512]; */    /* <- Already allocated in FMT.ASM */
IMPORT UTINY dma_buffer[65535];
#define DMA_BUF_SIZE  128       /* <- Size in blocks of the dma_buffer */

#else /* NOT POLLED */

UTINY format_buffer[512];       /* Work buffer needed by the format function */

#endif /* NOT POLLED */

#ifdef POLLED

/* These are filled in by fl_dma_init and are used by fl_waitdma when in 
   polled mode so that it can transfer the data to the floppy controller. */
UTINY *polled_buffer; /* Pointer to the user supplied data buffer */
UCOUNT polled_length;      /* Number of bytes to transfer */
BOOL polled_reading;       /* Flag to determine if this is a Read or Write */

#endif /* POLLED */

/* Current selected floppy for use by fl_claim. 
 Note: We use the following confusing convention:
    0 = None selected
    1 = Drive one selected
    2 = Drive two selected
  This is confusing because usually driveno == 0, 1 for the first two drives */

UCOUNT selected_floppy = 0;
_FLOPPY floppy[2];

/* Table of device paramters, The first field specifies the drive itself
   the second specifies the media installed, the rest are operating 
   parameters. Note: the order of the table is important. When trynig to 
   determine media type we find the drive type and then try each media
   type for that drive type in ascending order until one works. */

const _FL_DEVPARMS fl_devparms[] = {
	{360,  DT_360, DT_360, SP_1, SP_2, DR_250,  9, 40,  GPL_2A, GPF_50},
	{1200, DT_12 , DT_12 , SP_1, SP_2, DR_500, 15, 80,  GPL_1B, GPF_54},
	{360,  DT_12 , DT_360, SP_1, SP_2, DR_300,  9, 40,  GPL_2A, GPF_50},
	{720,  DT_720, DT_720, SP_1, SP_2, DR_250,  9, 80,  GPL_2A, GPF_50},
	{1440, DT_144, DT_144, SP_1, SP_2, DR_500, 18, 80,  GPL_1B, GPF_6C},
	{720,  DT_144, DT_720, SP_1, SP_2, DR_250,  9, 80,  GPL_2A, GPF_50},
	{0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
};
//1440,	4,		4,		0xAF, 0x03, 0,		18, 80,	  0x1B, 0x6C

#ifndef POLLED

#ifdef PLUS

void real_lisr_fl_isr();

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美日韩亚洲综合| 天堂在线一区二区| 成人av免费在线播放| 久久精品亚洲乱码伦伦中文 | 欧美激情一区二区在线| 国产老妇另类xxxxx| 中文字幕 久热精品 视频在线| 成人精品小蝌蚪| 亚洲天天做日日做天天谢日日欢| 91成人免费电影| 亚洲成人你懂的| 日韩欧美在线综合网| 国产丶欧美丶日本不卡视频| 亚洲男人的天堂在线aⅴ视频| 精品视频在线免费看| 男女性色大片免费观看一区二区| 久久理论电影网| 一本久道中文字幕精品亚洲嫩| 亚洲成人自拍网| 精品成人私密视频| 99久久777色| 麻豆精品精品国产自在97香蕉| 久久九九久精品国产免费直播| 色狠狠一区二区| 国产一区二区三区免费观看| 成人欧美一区二区三区黑人麻豆| 欧美主播一区二区三区美女| 精品一区二区在线视频| 亚洲日本在线天堂| 日韩一区二区三区视频在线观看 | 国产精品三级在线观看| 欧美人妇做爰xxxⅹ性高电影| 国产一区 二区 三区一级| 一区二区高清免费观看影视大全| 欧美变态tickling挠脚心| 91丨九色porny丨蝌蚪| 美女一区二区久久| 亚洲日本在线天堂| 久久精品一区二区三区不卡| 欧美日韩激情一区二区| 成人app在线| 国内一区二区视频| 亚洲第一电影网| 亚洲欧洲精品成人久久奇米网| 8v天堂国产在线一区二区| 成人avav在线| 国产精品自在欧美一区| 偷拍与自拍一区| 亚洲特黄一级片| 国产亚洲欧洲997久久综合 | 欧美成人一区二区三区片免费| 一本一道久久a久久精品| 丰满岳乱妇一区二区三区| 免费成人av在线播放| 一区二区免费视频| 国产精品传媒入口麻豆| 久久综合狠狠综合久久综合88| 欧美视频精品在线观看| 91在线国产观看| 国产一区二区精品久久99| 美国三级日本三级久久99| 午夜激情久久久| 亚洲一区二区三区视频在线播放| 国产清纯白嫩初高生在线观看91| 精品嫩草影院久久| 日韩欧美一级在线播放| 日韩欧美在线网站| 欧美美女激情18p| 99久久99久久综合| 成人综合在线观看| 高清国产一区二区三区| 国产91综合网| 粉嫩aⅴ一区二区三区四区| 蜜桃视频在线观看一区| 亚洲成人资源网| 天天色综合天天| 性做久久久久久免费观看欧美| 亚洲午夜羞羞片| 亚洲 欧美综合在线网络| 日本美女视频一区二区| 蜜臀av性久久久久蜜臀aⅴ四虎 | 欧美日韩高清一区二区三区| 欧美在线观看一二区| 欧美美女黄视频| 日韩小视频在线观看专区| 日韩欧美电影一区| 国产三级精品三级在线专区| 亚洲国产精品二十页| ...av二区三区久久精品| 亚洲美女精品一区| 亚洲成人在线免费| 精品一区二区三区在线观看 | 免费观看在线综合色| 国内精品国产成人| 成人美女在线视频| 在线观看亚洲一区| 69成人精品免费视频| 久久影院视频免费| 国产精品久久久久久久裸模| 一区二区三区不卡在线观看| 日本亚洲视频在线| 国产91精品入口| 欧美色图免费看| 日韩三级视频中文字幕| 欧美国产日韩在线观看| 一区二区在线观看av| 麻豆精品在线看| bt欧美亚洲午夜电影天堂| 欧美日韩久久一区| 国产亚洲精久久久久久| 一区二区三区四区在线播放| 美女精品自拍一二三四| 成人18视频在线播放| 91精品国产综合久久久久| 久久久久久99精品| 亚洲国产精品自拍| 国产精品自拍av| 欧美嫩在线观看| 久久久久97国产精华液好用吗| 亚洲精品视频自拍| 精品一区二区三区欧美| 色网站国产精品| 欧美精品一区二区精品网| 一区二区三区久久久| 国产v日产∨综合v精品视频| 欧美久久久久久久久中文字幕| 国产精品天干天干在观线| 麻豆国产91在线播放| 91黄色免费版| 欧美国产精品中文字幕| 日韩在线卡一卡二| 一本色道久久综合亚洲aⅴ蜜桃| 欧美r级在线观看| 亚洲制服丝袜在线| 成人黄色在线看| 337p日本欧洲亚洲大胆精品 | 精品一区二区三区免费观看| 色丁香久综合在线久综合在线观看| 亚洲精品一区二区三区福利| 亚洲成人tv网| 91视频观看免费| 久久久久久9999| 麻豆国产精品777777在线| 欧美精品少妇一区二区三区| 日韩一区欧美一区| 国产成人免费网站| 精品区一区二区| 日韩成人午夜电影| 欧美色爱综合网| 亚洲免费色视频| 成人avav在线| 亚洲欧洲日韩在线| 成人黄色777网| 国产婷婷色一区二区三区| 精品亚洲免费视频| 日韩色在线观看| 热久久免费视频| 69堂亚洲精品首页| 日韩中文字幕麻豆| 欧美夫妻性生活| 天堂在线一区二区| 在线不卡a资源高清| 亚洲曰韩产成在线| 欧美午夜电影网| 亚洲成人免费在线| 91麻豆精品国产91久久久使用方法 | 成人国产精品免费观看| 国产精品视频一二| 成人免费高清视频在线观看| 国产精品视频免费| 91猫先生在线| 亚洲国产精品久久不卡毛片| 欧美婷婷六月丁香综合色| 亚洲午夜久久久久久久久电影院| 欧美天堂一区二区三区| 亚洲第一福利一区| 欧美一区二区精品久久911| 青青青爽久久午夜综合久久午夜| 欧美一区二区三区系列电影| 久久国产精品区| 久久久国产精华| av电影一区二区| 亚洲一区二区三区中文字幕| 欧美精品第一页| 久久精品国产亚洲高清剧情介绍 | 亚洲精品乱码久久久久久| 在线观看免费视频综合| 日日摸夜夜添夜夜添精品视频 | 国产亚洲一本大道中文在线| 成人久久18免费网站麻豆| 一区二区三区91| 日韩网站在线看片你懂的| 国产精品一区二区你懂的| 亚洲欧洲av一区二区三区久久| 色婷婷精品久久二区二区蜜臀av| 五月婷婷久久综合| 日韩精品一区二区三区蜜臀| 丁香网亚洲国际| 亚洲高清一区二区三区| 欧美精品一区二区三区视频|