OpenCores
URL https://opencores.org/ocsvn/or1k_old/or1k_old/trunk

Subversion Repositories or1k_old

[/] [or1k_old/] [trunk/] [uclinux/] [uClinux-2.0.x/] [drivers/] [char/] [ftape/] [fdc-io.h] - Blame information for rev 1782

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 199 simons
#ifndef _FDC_IO_H
2
#define _FDC_IO_H
3
 
4
/*
5
 * Copyright (C) 1993-1995 Bas Laarhoven.
6
 
7
 This program is free software; you can redistribute it and/or modify
8
 it under the terms of the GNU General Public License as published by
9
 the Free Software Foundation; either version 2, or (at your option)
10
 any later version.
11
 
12
 This program is distributed in the hope that it will be useful,
13
 but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
 GNU General Public License for more details.
16
 
17
 You should have received a copy of the GNU General Public License
18
 along with this program; see the file COPYING.  If not, write to
19
 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
20
 
21
 *
22
 $Source: /home/marcus/revision_ctrl_test/oc_cvs/cvs/or1k/uclinux/uClinux-2.0.x/drivers/char/ftape/fdc-io.h,v $
23
 $Author: simons $
24
 *
25
 $Revision: 1.1.1.1 $
26
 $Date: 2001-09-10 07:44:17 $
27
 $State: Exp $
28
 *
29
 *      This file contains the low level functions
30
 *      that communicate with the floppy disk controller,
31
 *      for the QIC-40/80 floppy-tape driver for Linux.
32
 */
33
 
34
#include <linux/fdreg.h>
35
 
36
#define FDC_SK_BIT      (0x20)
37
#define FDC_MT_BIT      (0x80)
38
 
39
#define FDC_READ        (FD_READ & ~(FDC_SK_BIT | FDC_MT_BIT))
40
#define FDC_WRITE       (FD_WRITE & ~FDC_MT_BIT)
41
#define FDC_READ_DELETED (0x4c)
42
#define FDC_WRITE_DELETED (0x49)
43
#define FDC_READID      (0x4a)
44
#define FDC_SENSED      (0x04)
45
#define FDC_SENSEI      (FD_SENSEI)
46
#define FDC_RECAL       (FD_RECALIBRATE)
47
#define FDC_SEEK        (FD_SEEK)
48
#define FDC_SPECIFY     (FD_SPECIFY)
49
#define FDC_RECALIBR    (FD_RECALIBRATE)
50
#define FDC_VERSION     (FD_VERSION)
51
#define FDC_PERPEND     (FD_PERPENDICULAR)
52
#define FDC_DUMPREGS    (FD_DUMPREGS)
53
#define FDC_LOCK        (FD_LOCK)
54
#define FDC_UNLOCK      (FD_UNLOCK)
55
#define FDC_CONFIGURE   (FD_CONFIGURE)
56
#define FDC_DRIVE_SPEC  (0x8e)  /* i82078 has this (any others?) */
57
#define FDC_PARTID      (0x18)  /* i82078 has this */
58
#define FDC_SAVE        (0x2e)  /* i82078 has this (any others?) */
59
#define FDC_RESTORE     (0x4e)  /* i82078 has this (any others?) */
60
 
61
#define FDC_STATUS_MASK (STATUS_BUSY | STATUS_DMA | STATUS_DIR | STATUS_READY)
62
#define FDC_DATA_READY  (STATUS_READY)
63
#define FDC_DATA_OUTPUT (STATUS_DIR)
64
#define FDC_DATA_READY_MASK (STATUS_READY | STATUS_DIR)
65
#define FDC_DATA_OUT_READY  (STATUS_READY | STATUS_DIR)
66
#define FDC_DATA_IN_READY   (STATUS_READY)
67
#define FDC_BUSY        (STATUS_BUSY)
68
#define FDC_CLK48_BIT   (0x80)
69
#define FDC_SEL3V_BIT   (0x40)
70
 
71
#define ST0_INT_MASK    (ST0_INTR)
72
#define FDC_INT_NORMAL  (ST0_INTR & 0x00)
73
#define FDC_INT_ABNORMAL (ST0_INTR & 0x40)
74
#define FDC_INT_INVALID (ST0_INTR & 0x80)
75
#define FDC_INT_READYCH (ST0_INTR & 0xC0)
76
#define ST0_SEEK_END    (ST0_SE)
77
#define ST3_TRACK_0     (ST3_TZ)
78
 
79
#define FDC_RESET_NOT   (0x04)
80
#define FDC_DMA_MODE    (0x08)
81
#define FDC_MOTOR_0     (0x10)
82
#define FDC_MOTOR_1     (0x20)
83
 
84
typedef struct {
85
        void (**hook) (void);   /* our wedge into the isr */
86
        enum {
87
                no_fdc, i8272, i82077, i82077AA, fc10,
88
                i82078, i82078_1
89
        } type;                 /* FDC type */
90
        unsigned char irq;      /* FDC irq nr */
91
        unsigned char dma;      /* FDC dma channel nr */
92
        unsigned short sra;     /* Status register A (PS/2 only) */
93
        unsigned short srb;     /* Status register B (PS/2 only) */
94
        unsigned short dor;     /* Digital output register */
95
        unsigned short tdr;     /* Tape Drive Register (82077SL-1 &
96
                                   82078 only) */
97
        unsigned short msr;     /* Main Status Register */
98
        unsigned short dsr;     /* Datarate Select Register (8207x only) */
99
        unsigned short fifo;    /* Data register / Fifo on 8207x */
100
        unsigned short dir;     /* Digital Input Register */
101
        unsigned short ccr;     /* Configuration Control Register */
102
        unsigned short dor2;    /* Alternate dor on MACH-2 controller,
103
                                   also used with FC-10, meaning unknown */
104
} fdc_config_info;
105
 
106
typedef enum {
107
        fdc_data_rate_250 = 2,
108
        fdc_data_rate_500 = 0,
109
        fdc_data_rate_1000 = 3,
110
        fdc_data_rate_2000 = 1, /* i82078-1: remember to use Data Rate Table #2 */
111
} fdc_data_rate_type;
112
 
113
typedef enum {
114
        waiting = 0,
115
        reading,
116
        writing,
117
        done,
118
        error,
119
} buffer_state_enum;
120
 
121
typedef volatile enum {
122
        fdc_idle = 0,
123
        fdc_reading_data = FDC_READ,
124
        fdc_seeking = FDC_SEEK,
125
        fdc_writing_data = FDC_WRITE,
126
        fdc_reading_id = FDC_READID,
127
        fdc_recalibrating = FDC_RECAL,
128
} fdc_mode_enum;
129
 
130
/*
131
 *      fdc-io.c defined public variables
132
 */
133
extern fdc_mode_enum fdc_mode;
134
extern volatile enum runner_status_enum runner_status;
135
extern int old_vfo;
136
extern volatile int head;
137
extern volatile int tail;
138
extern int fdc_setup_error;     /* outdated ??? */
139
extern struct wait_queue *wait_intr;
140
extern volatile unsigned int next_segment;      /* next segment for read ahead */
141
extern int ftape_unit;          /* fdc unit specified at ftape_open() */
142
extern int ftape_motor;         /* fdc motor line state */
143
extern int current_cylinder;    /* track nr the FDC thinks we're on */
144
extern volatile byte fdc_head;  /* FDC head */
145
extern volatile byte fdc_cyl;   /* FDC track */
146
extern volatile byte fdc_sect;  /* FDC sector */
147
extern fdc_config_info fdc;     /* FDC hardware configuration */
148
 
149
/*
150
 *      fdc-io.c defined public functions
151
 */
152
extern void fdc_catch_stray_interrupts(unsigned count);
153
extern int fdc_ready_wait(int timeout);
154
extern int fdc_write(byte data);
155
extern int fdc_read(byte * data);
156
extern int fdc_command(byte * cmd_data, int cmd_len);
157
extern int fdc_result(byte * res_data, int res_len);
158
extern int fdc_issue_command(byte * out_data, int out_count, \
159
                             byte * in_data, int in_count);
160
extern void fdc_isr(void);
161
extern int fdc_interrupt_wait(int time);
162
extern void fdt_sleep(unsigned int time);
163
extern int fdc_specify(int head_unload_time, int seek_rate,
164
                       int head_load_time, int non_dma);
165
extern int fdc_set_seek_rate(int seek_rate);
166
extern int fdc_seek(int track);
167
extern int fdc_sense_drive_status(int *st3);
168
extern void fdc_motor(int motor);
169
extern void fdc_reset(void);
170
extern int fdc_recalibrate(void);
171
extern void fdc_disable(void);
172
extern int fdc_wait_calibrate(void);
173
extern int fdc_sense_interrupt_status(int *st0, int *current_cylinder);
174
extern void fdc_save_drive_specs(void);
175
extern void fdc_restore_drive_specs(void);
176
extern void fdc_set_data_rate(int rate);
177
extern int fdc_release_irq_and_dma(void);
178
extern int fdc_init(void);
179
extern int fdc_uninit(void);
180
extern void fdc_set_write_precomp(int precomp);
181
 
182
#endif

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.