ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/cwcbm/catweasel.h
Revision: 1.1.1.1 (vendor branch)
Committed: 2004-01-07T15:37:45Z (20 years, 2 months ago) by cebix
Content type: text/plain
Branch: MAIN, cebix
CVS Tags: start, HEAD
Changes since 1.1: +0 -0 lines
Log Message:
imported sources

File Contents

# User Rev Content
1 cebix 1.1
2     /*
3     * Catweasel -- Advanced Floppy Controller
4     * Linux device driver
5     * Low-level routines (header)
6     *
7     * Copyright (C) 1998-2002 Michael Krause
8     *
9     * This program is free software; you can redistribute it and/or modify
10     * it under the terms of the GNU General Public License as published by
11     * the Free Software Foundation; either version 2 of the License, or
12     * (at your option) any later version.
13     *
14     * This program is distributed in the hope that it will be useful,
15     * but WITHOUT ANY WARRANTY; without even the implied warranty of
16     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17     * GNU General Public License for more details.
18     *
19     * You should have received a copy of the GNU General Public License
20     * along with this program; if not, write to the Free Software
21     * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22     */
23    
24     #ifndef _CATWEASEL_H
25     #define _CATWEASEL_H
26    
27     typedef struct catweasel_drive {
28     struct catweasel_contr *contr; /* The controller this drive belongs to */
29     int number; /* Drive number: 0 or 1 */
30     int type; /* 0 = not present, 1 = 3.5" */
31     int track; /* current r/w head position (0..79) */
32     int diskindrive; /* 0 = no disk, 1 = disk in drive */
33     int wprot; /* 0 = not, 1 = write protected */
34     } catweasel_drive;
35    
36     typedef struct catweasel_contr {
37     int type; /* see CATWEASEL_TYPE_* defines below */
38     int iobase; /* 0 = not present (factory default is 0x320) */
39     void (*msdelay)(int ms); /* microseconds delay routine, provided by host program */
40     catweasel_drive drives[2]; /* at most two drives on each controller */
41     int control_register; /* contents of control register */
42     unsigned char crm_sel0; /* bit masks for the control / status register */
43     unsigned char crm_sel1;
44     unsigned char crm_mot0;
45     unsigned char crm_mot1;
46     unsigned char crm_dir;
47     unsigned char crm_step;
48     unsigned char srm_trk0;
49     unsigned char srm_dchg;
50     unsigned char srm_writ;
51     int io_sr; /* IO port of control / status register */
52     int io_mem; /* IO port of memory register */
53     } catweasel_contr;
54    
55     #define CATWEASEL_TYPE_NONE -1
56     #define CATWEASEL_TYPE_MK1 1
57     #define CATWEASEL_TYPE_MK3 3
58    
59     /* Initialize a Catweasel controller; c->iobase and c->msdelay must have
60     been initialized -- msdelay might be used */
61     void catweasel_init_controller(catweasel_contr *c);
62    
63     /* Reset the controller */
64     void catweasel_free_controller(catweasel_contr *c);
65    
66     /* Set current drive select mask */
67     void catweasel_select(catweasel_contr *c, int dr0, int dr1);
68    
69     /* Start/stop the drive's motor */
70     void catweasel_set_motor(catweasel_drive *d, int on);
71    
72     /* Move the r/w head -- msdelay might be used */
73     int catweasel_seek(catweasel_drive *d, int track);
74    
75     /* Check for a disk change and update d->diskindrive
76     -- msdelay might be used. Returns 1 == disk has been changed */
77     int catweasel_disk_changed(catweasel_drive *d);
78    
79     /* Check if disk in selected drive is write protected. */
80     int catweasel_write_protected(catweasel_drive *d);
81    
82     /* Read data -- msdelay will be used */
83     int catweasel_read(catweasel_drive *d, int side, int clock, int time);
84    
85     /* Write data -- msdelay will be used. If time == -1, the write will
86     be started at the index pulse and stopped at the next index pulse,
87     or earlier if the Catweasel RAM contains a 128 end byte. The
88     function returns after the write has finished. */
89     int catweasel_write(catweasel_drive *d, int side, int clock, int time);
90    
91     #endif /* _CATWEASEL_H */