/*
* Copyright (C) 1993-1996 Bas Laarhoven,
* (C) 1996-1997 Claus-Justus Heine.
This program 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, or (at your option)
any later version.
This program 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 this program; see the file COPYING. If not, write to
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Source: /homes/cvs/ftape-stacked/ftape/lowlevel/fdc-io.c,v $
* $Revision: 1.7.4.2 $
* $Date: 1997/11/16 14:48:17 $
*
* This file contains the low-level floppy disk interface code
* for the QIC-40/80/3010/3020 floppy-tape driver "ftape" for
* Linux.
*/
#include <linux/config.h> /* for CONFIG_FT_* */
#include <linux/errno.h>
#include <linux/sched.h>
#include <linux/ioport.h>
#include <linux/interrupt.h>
#include <linux/kernel.h>
#include <asm/system.h>
#include <asm/io.h>
#include <asm/dma.h>
#include <asm/irq.h>
#include <linux/ftape.h>
#include <linux/qic117.h>
#include "../lowlevel/ftape-tracing.h"
#include "../lowlevel/fdc-io.h"
#include "../lowlevel/fdc-isr.h"
#include "../lowlevel/ftape-io.h"
#include "../lowlevel/ftape-rw.h"
#include "../lowlevel/ftape-ctl.h"
#include "../lowlevel/ftape-calibr.h"
#include "../lowlevel/fc-10.h"
/* Global vars.
*/
static int ftape_motor;
volatile int ftape_current_cylinder = -1;
volatile fdc_mode_enum fdc_mode = fdc_idle;
fdc_config_info fdc;
DECLARE_WAIT_QUEUE_HEAD(ftape_wait_intr);
unsigned int ft_fdc_base = CONFIG_FT_FDC_BASE;
unsigned int ft_fdc_irq = CONFIG_FT_FDC_IRQ;
unsigned int ft_fdc_dma = CONFIG_FT_FDC_DMA;
unsigned int ft_fdc_threshold = CONFIG_FT_FDC_THR; /* bytes */
unsigned int ft_fdc_rate_limit = CONFIG_FT_FDC_MAX_RATE; /* bits/sec */
int ft_probe_fc10 = CONFIG_FT_PROBE_FC10;
int ft_mach2 = CONFIG_FT_MACH2;
/* Local vars.
*/
static spinlock_t fdc_io_lock;
static unsigned int fdc_calibr_count;
static unsigned int fdc_calibr_time;
static int fdc_status;
volatile __u8 fdc_head; /* FDC head from sector id */
volatile __u8 fdc_cyl; /* FDC track from sector id */
volatile __u8 fdc_sect; /* FDC sector from sector id */
static int fdc_data_rate = 500; /* data rate (Kbps) */
static int fdc_rate_code; /* data rate code (0 == 500 Kbps) */
static int fdc_seek_rate = 2; /* step rate (msec) */
static void (*do_ftape) (void);
static int fdc_fifo_state; /* original fifo