ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/cwcbm/common.h
Revision: 1.2
Committed: 2004-01-07T16:53:58Z (20 years, 3 months ago) by cebix
Content type: text/plain
Branch: MAIN
Changes since 1.1: +59 -55 lines
Log Message:
- better argument parsing
- drive type (40/80 tracks) selectable with command line option
- works with Catweasel PCI MK3

File Contents

# Content
1 /*
2 * common.h - Common parts of readcbm and writecbm
3 *
4 * Written in 2003-2004 by Christian Bauer <Christian.Bauer@uni-mainz.de>
5 */
6
7 #ifndef COMMON_H
8 #define COMMON_H
9
10 #include <stdio.h>
11 #include <stdlib.h>
12 #include <string.h>
13 #include <time.h>
14 #include <unistd.h>
15 #include <getopt.h>
16 #include <errno.h>
17 #include <sys/io.h>
18
19
20 /* Number of tracks (tracks are numbered 1..NUM_TRACKS) */
21 #define NUM_TRACKS 35
22
23 /* Maximum number of sectors per track */
24 #define MAX_SECTORS 21
25
26 /* Bytes per sector */
27 #define SECTOR_SIZE 256
28
29
30 /* Bit rate for each speed zone */
31 extern const int bps[4];
32
33 /* Standard speeds for tracks */
34 extern const int std_speed[NUM_TRACKS + 1];
35
36 /* Number of sectors per track, for all tracks */
37 extern const int num_sectors[NUM_TRACKS + 1];
38
39
40 /* Drive number */
41 extern int drive_num;
42
43 /* Actual RPM of the drive, and whether it's 40 or 80 tracks */
44 extern int drive_rpm;
45 extern int drive_40tracks;
46
47 /* Name of file to read from/write to */
48 extern const char *file_name;
49
50
51 /* Catweasel controller struct */
52 extern catweasel_contr c;
53
54
55 /* Clock table (nominal number of Catweasel clocks per inter-flux-change gap) */
56 extern int clock_table[4];
57
58 /* Threshold table */
59 extern int thresh_table[3];
60
61
62 /* Track buffer */
63 extern unsigned char track_buf[MAX_SECTORS * SECTOR_SIZE];
64
65
66 /* Delay specified number of milliseconds */
67 extern void msdelay(int ms);
68
69 /* Seek to given CBM track (1..35) and select correct side and speed zone */
70 extern void seek_to(int drive, int track);
71
72 /*
73 * Parse command line arguments and set
74 * c.iobase
75 * c.type
76 * drive_num
77 * drive_rpm
78 * drive_40tracks
79 * file_name
80 * Also initializes the catweasel_contr struct
81 */
82 extern void parse_args(int argc, char **argv);
83
84 /* Obtain access to I/O ports */
85 extern void ioport_access(void);
86
87 /* Start drive */
88 extern void start_drive(int drive);
89
90 /* Stop drive */
91 extern void stop_drive(int drive);
92
93 #endif