1 /*
2  * Definitions for a GoldStar R420 CD-ROM interface
3  *
4  *   Copyright (C) 1995  Oliver Raupach <raupach@nwfs1.rz.fh-hannover.de>
5  *                       Eberhard Moenkeberg <emoenke@gwdg.de>
6  *
7  *  Published under the GPL.
8  *
9  */
10 
11 
12 /* The Interface Card default address is 0x340. This will work for most
13    applications. Address selection is accomplished by jumpers PN801-1 to
14    PN801-4 on the GoldStar Interface Card.
15    Appropriate settings are: 0x300, 0x310, 0x320, 0x330, 0x340, 0x350, 0x360
16    0x370, 0x380, 0x390, 0x3A0, 0x3B0, 0x3C0, 0x3D0, 0x3E0, 0x3F0             */
17 
18 /* insert here the I/O port address */
19 #define GSCD_BASE_ADDR	        0x340
20 
21 /* change this to set the dma-channel */
22 #define GSCD_DMA_CHANNEL        3                  /* not used */
23 
24 /************** nothing to set up below here *********************/
25 
26 /* port access macro */
27 #define GSCDPORT(x)		(gscd_port + (x))
28 
29 /*
30  * commands
31  * the lower nibble holds the command length
32  */
33 #define CMD_STATUS     0x01
34 #define CMD_READSUBQ   0x02 /* 1: ?, 2: UPC, 5: ? */
35 #define CMD_SEEK       0x05 /* read_mode M-S-F */
36 #define CMD_READ       0x07 /* read_mode M-S-F nsec_h nsec_l */
37 #define CMD_RESET      0x11
38 #define CMD_SETMODE    0x15
39 #define CMD_PLAY       0x17 /* M-S-F M-S-F */
40 #define CMD_LOCK_CTL   0x22 /* 0: unlock, 1: lock */
41 #define CMD_IDENT      0x31
42 #define CMD_SETSPEED   0x32 /* 0: auto */ /* ??? */
43 #define CMD_GETMODE    0x41
44 #define CMD_PAUSE      0x51
45 #define CMD_READTOC    0x61
46 #define CMD_DISKINFO   0x71
47 #define CMD_TRAY_CTL   0x81
48 
49 /*
50  * disk_state:
51  */
52 #define ST_PLAYING	0x80
53 #define ST_UNLOCKED	0x40
54 #define ST_NO_DISK	0x20
55 #define ST_DOOR_OPEN	0x10
56 #define ST_x08  0x08
57 #define ST_x04	0x04
58 #define ST_INVALID	0x02
59 #define ST_x01	0x01
60 
61 /*
62  * cmd_type:
63  */
64 #define TYPE_INFO	0x01
65 #define TYPE_DATA	0x02
66 
67 /*
68  * read_mode:
69  */
70 #define MOD_POLLED	0x80
71 #define MOD_x08	0x08
72 #define MOD_RAW	0x04
73 
74 #define READ_DATA(port, buf, nr) insb(port, buf, nr)
75 
76 #define SET_TIMER(func, jifs) \
77 	((mod_timer(&gscd_timer, jiffies + jifs)), \
78 	(gscd_timer.function = func))
79 
80 #define CLEAR_TIMER		del_timer_sync(&gscd_timer)
81 
82 #define MAX_TRACKS		104
83 
84 struct msf {
85 	unsigned char	min;
86 	unsigned char	sec;
87 	unsigned char	frame;
88 };
89 
90 struct gscd_Play_msf {
91 	struct msf	start;
92 	struct msf	end;
93 };
94 
95 struct gscd_DiskInfo {
96 	unsigned char	first;
97 	unsigned char	last;
98 	struct msf	diskLength;
99 	struct msf	firstTrack;
100 };
101 
102 struct gscd_Toc {
103 	unsigned char	ctrl_addr;
104 	unsigned char	track;
105 	unsigned char	pointIndex;
106 	struct msf	trackTime;
107 	struct msf	diskTime;
108 };
109 
110