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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [linux/] [linux-2.4/] [drivers/] [char/] [ftape/] [lowlevel/] [fdc-io.h] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1275 phoenix
#ifndef _FDC_IO_H
2
#define _FDC_IO_H
3
 
4
/*
5
 *    Copyright (C) 1993-1996 Bas Laarhoven,
6
 *              (C) 1996-1997 Claus-Justus Heine.
7
 
8
 This program is free software; you can redistribute it and/or modify
9
 it under the terms of the GNU General Public License as published by
10
 the Free Software Foundation; either version 2, or (at your option)
11
 any later version.
12
 
13
 This program is distributed in the hope that it will be useful,
14
 but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
 GNU General Public License for more details.
17
 
18
 You should have received a copy of the GNU General Public License
19
 along with this program; see the file COPYING.  If not, write to
20
 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
21
 
22
 *
23
 * $Source: /home/marcus/revision_ctrl_test/oc_cvs/cvs/or1k/linux/linux-2.4/drivers/char/ftape/lowlevel/fdc-io.h,v $
24
 * $Revision: 1.1.1.1 $
25
 * $Date: 2004-04-15 02:02:35 $
26
 *
27
 *      This file contains the declarations for the low level
28
 *      functions that communicate with the floppy disk controller,
29
 *      for the QIC-40/80/3010/3020 floppy-tape driver "ftape" for
30
 *      Linux.
31
 */
32
 
33
#include <linux/fdreg.h>
34
 
35
#include "../lowlevel/ftape-bsm.h"
36
 
37
#define FDC_SK_BIT      (0x20)
38
#define FDC_MT_BIT      (0x80)
39
 
40
#define FDC_READ        (FD_READ & ~(FDC_SK_BIT | FDC_MT_BIT))
41
#define FDC_WRITE       (FD_WRITE & ~FDC_MT_BIT)
42
#define FDC_READ_DELETED  (0x4c)
43
#define FDC_WRITE_DELETED (0x49)
44
#define FDC_VERIFY        (0x56)
45
#define FDC_READID      (0x4a)
46
#define FDC_SENSED      (0x04)
47
#define FDC_SENSEI      (FD_SENSEI)
48
#define FDC_FORMAT      (FD_FORMAT)
49
#define FDC_RECAL       (FD_RECALIBRATE)
50
#define FDC_SEEK        (FD_SEEK)
51
#define FDC_SPECIFY     (FD_SPECIFY)
52
#define FDC_RECALIBR    (FD_RECALIBRATE)
53
#define FDC_VERSION     (FD_VERSION)
54
#define FDC_PERPEND     (FD_PERPENDICULAR)
55
#define FDC_DUMPREGS    (FD_DUMPREGS)
56
#define FDC_LOCK        (FD_LOCK)
57
#define FDC_UNLOCK      (FD_UNLOCK)
58
#define FDC_CONFIGURE   (FD_CONFIGURE)
59
#define FDC_DRIVE_SPEC  (0x8e)  /* i82078 has this (any others?) */
60
#define FDC_PARTID      (0x18)  /* i82078 has this */
61
#define FDC_SAVE        (0x2e)  /* i82078 has this (any others?) */
62
#define FDC_RESTORE     (0x4e)  /* i82078 has this (any others?) */
63
 
64
#define FDC_STATUS_MASK (STATUS_BUSY | STATUS_DMA | STATUS_DIR | STATUS_READY)
65
#define FDC_DATA_READY  (STATUS_READY)
66
#define FDC_DATA_OUTPUT (STATUS_DIR)
67
#define FDC_DATA_READY_MASK (STATUS_READY | STATUS_DIR)
68
#define FDC_DATA_OUT_READY  (STATUS_READY | STATUS_DIR)
69
#define FDC_DATA_IN_READY   (STATUS_READY)
70
#define FDC_BUSY        (STATUS_BUSY)
71
#define FDC_CLK48_BIT   (0x80)
72
#define FDC_SEL3V_BIT   (0x40)
73
 
74
#define ST0_INT_MASK    (ST0_INTR)
75
#define FDC_INT_NORMAL  (ST0_INTR & 0x00)
76
#define FDC_INT_ABNORMAL (ST0_INTR & 0x40)
77
#define FDC_INT_INVALID (ST0_INTR & 0x80)
78
#define FDC_INT_READYCH (ST0_INTR & 0xC0)
79
#define ST0_SEEK_END    (ST0_SE)
80
#define ST3_TRACK_0     (ST3_TZ)
81
 
82
#define FDC_RESET_NOT   (0x04)
83
#define FDC_DMA_MODE    (0x08)
84
#define FDC_MOTOR_0     (0x10)
85
#define FDC_MOTOR_1     (0x20)
86
 
87
typedef struct {
88
        void (**hook) (void);   /* our wedge into the isr */
89
        enum {
90
                no_fdc, i8272, i82077, i82077AA, fc10,
91
                i82078, i82078_1
92
        } type;                 /* FDC type */
93
        unsigned int irq; /* FDC irq nr */
94
        unsigned int dma; /* FDC dma channel nr */
95
        __u16 sra;        /* Status register A (PS/2 only) */
96
        __u16 srb;        /* Status register B (PS/2 only) */
97
        __u16 dor;        /* Digital output register */
98
        __u16 tdr;        /* Tape Drive Register (82077SL-1 &
99
                             82078 only) */
100
        __u16 msr;        /* Main Status Register */
101
        __u16 dsr;        /* Datarate Select Register (8207x only) */
102
        __u16 fifo;       /* Data register / Fifo on 8207x */
103
        __u16 dir;        /* Digital Input Register */
104
        __u16 ccr;        /* Configuration Control Register */
105
        __u16 dor2;       /* Alternate dor on MACH-2 controller,
106
                             also used with FC-10, meaning unknown */
107
} fdc_config_info;
108
 
109
typedef enum {
110
        fdc_data_rate_250  = 2,
111
        fdc_data_rate_300  = 1, /* any fdc in default configuration */
112
        fdc_data_rate_500  = 0,
113
        fdc_data_rate_1000 = 3,
114
        fdc_data_rate_2000 = 1, /* i82078-1: when using Data Rate Table #2 */
115
} fdc_data_rate_type;
116
 
117
typedef enum {
118
        fdc_idle          = 0,
119
        fdc_reading_data  = FDC_READ,
120
        fdc_seeking       = FDC_SEEK,
121
        fdc_writing_data  = FDC_WRITE,
122
        fdc_deleting      = FDC_WRITE_DELETED,
123
        fdc_reading_id    = FDC_READID,
124
        fdc_recalibrating = FDC_RECAL,
125
        fdc_formatting    = FDC_FORMAT,
126
        fdc_verifying     = FDC_VERIFY
127
} fdc_mode_enum;
128
 
129
typedef enum {
130
        waiting = 0,
131
        reading,
132
        writing,
133
        formatting,
134
        verifying,
135
        deleting,
136
        done,
137
        error,
138
        mmapped,
139
} buffer_state_enum;
140
 
141
typedef struct {
142
        __u8 *address;
143
        volatile buffer_state_enum status;
144
        volatile __u8 *ptr;
145
        volatile unsigned int bytes;
146
        volatile unsigned int segment_id;
147
 
148
        /* bitmap for remainder of segment not yet handled.
149
         * one bit set for each bad sector that must be skipped.
150
         */
151
        volatile SectorMap bad_sector_map;
152
 
153
        /* bitmap with bad data blocks in data buffer.
154
         * the errors in this map may be retried.
155
         */
156
        volatile SectorMap soft_error_map;
157
 
158
        /* bitmap with bad data blocks in data buffer
159
         * the errors in this map may not be retried.
160
         */
161
        volatile SectorMap hard_error_map;
162
 
163
        /* retry counter for soft errors.
164
         */
165
        volatile int retry;
166
 
167
        /* sectors to skip on retry ???
168
         */
169
        volatile unsigned int skip;
170
 
171
        /* nr of data blocks in data buffer
172
         */
173
        volatile unsigned int data_offset;
174
 
175
        /* offset in segment for first sector to be handled.
176
         */
177
        volatile unsigned int sector_offset;
178
 
179
        /* size of cluster of good sectors to be handled.
180
         */
181
        volatile unsigned int sector_count;
182
 
183
        /* size of remaining part of segment to be handled.
184
         */
185
        volatile unsigned int remaining;
186
 
187
        /* points to next segment (contiguous) to be handled,
188
         * or is zero if no read-ahead is allowed.
189
         */
190
        volatile unsigned int next_segment;
191
 
192
        /* flag being set if deleted data was read.
193
         */
194
        volatile int deleted;
195
 
196
        /* floppy coordinates of first sector in segment */
197
        volatile __u8 head;
198
        volatile __u8 cyl;
199
        volatile __u8 sect;
200
 
201
        /* gap to use when formatting */
202
        __u8 gap3;
203
        /* flag set when buffer is mmaped */
204
        int mmapped;
205
} buffer_struct;
206
 
207
/*
208
 *      fdc-io.c defined public variables
209
 */
210
extern volatile fdc_mode_enum fdc_mode;
211
extern int fdc_setup_error;     /* outdated ??? */
212
extern wait_queue_head_t ftape_wait_intr;
213
extern int ftape_motor;         /* fdc motor line state */
214
extern volatile int ftape_current_cylinder; /* track nr FDC thinks we're on */
215
extern volatile __u8 fdc_head;  /* FDC head */
216
extern volatile __u8 fdc_cyl;   /* FDC track */
217
extern volatile __u8 fdc_sect;  /* FDC sector */
218
extern fdc_config_info fdc;     /* FDC hardware configuration */
219
 
220
extern unsigned int ft_fdc_base;
221
extern unsigned int ft_fdc_irq;
222
extern unsigned int ft_fdc_dma;
223
extern unsigned int ft_fdc_threshold;
224
extern unsigned int ft_fdc_rate_limit;
225
extern int ft_probe_fc10;
226
extern int ft_mach2;
227
/*
228
 *      fdc-io.c defined public functions
229
 */
230
extern void fdc_catch_stray_interrupts(int count);
231
extern int fdc_ready_wait(unsigned int timeout);
232
extern int fdc_command(const __u8 * cmd_data, int cmd_len);
233
extern int fdc_result(__u8 * res_data, int res_len);
234
extern int fdc_issue_command(const __u8 * out_data, int out_count,
235
                             __u8 * in_data, int in_count);
236
extern int fdc_interrupt_wait(unsigned int time);
237
extern int fdc_set_seek_rate(int seek_rate);
238
extern int fdc_seek(int track);
239
extern int fdc_sense_drive_status(int *st3);
240
extern void fdc_motor(int motor);
241
extern void fdc_reset(void);
242
extern int fdc_recalibrate(void);
243
extern void fdc_disable(void);
244
extern int fdc_fifo_threshold(__u8 threshold,
245
                              int *fifo_state, int *lock_state, int *fifo_thr);
246
extern void fdc_wait_calibrate(void);
247
extern int fdc_sense_interrupt_status(int *st0, int *current_cylinder);
248
extern void fdc_save_drive_specs(void);
249
extern void fdc_restore_drive_specs(void);
250
extern int fdc_set_data_rate(int rate);
251
extern void fdc_set_write_precomp(int precomp);
252
extern int fdc_release_irq_and_dma(void);
253
extern void fdc_release_regions(void);
254
extern int fdc_init(void);
255
extern int fdc_setup_read_write(buffer_struct * buff, __u8 operation);
256
extern int fdc_setup_formatting(buffer_struct * buff);
257
#endif

powered by: WebSVN 2.1.0

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