summaryrefslogtreecommitdiffstats
path: root/drivers/cdrom/gscd.h
blob: 9c294762bbceb7f8bcaaa8a17972859c6f20d02c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
/*
 * Definitions for a GoldStar R420 CD-ROM interface
 *
 *   Copyright (C) 1995  Oliver Raupach <raupach@nwfs1.rz.fh-hannover.de>
 *                       Eberhard Moenkeberg <emoenke@gwdg.de>
 *
 *  Published under the GPL.
 *
 */


/* The Interface Card default address is 0x340. This will work for most
   applications. Address selection is accomplished by jumpers PN801-1 to
   PN801-4 on the GoldStar Interface Card.
   Appropriate settings are: 0x300, 0x310, 0x320, 0x330, 0x340, 0x350, 0x360
   0x370, 0x380, 0x390, 0x3A0, 0x3B0, 0x3C0, 0x3D0, 0x3E0, 0x3F0             */

/* insert here the I/O port address */
#define GSCD_BASE_ADDR	        0x340

/* change this to set the dma-channel */
#define GSCD_DMA_CHANNEL        3                  /* not used */ 

/************** nothing to set up below here *********************/

/* port access macro */
#define GSCDPORT(x)		(gscd_port + (x))

/*
 * commands
 * the lower nibble holds the command length
 */
#define CMD_STATUS     0x01
#define CMD_READSUBQ   0x02 /* 1: ?, 2: UPC, 5: ? */
#define CMD_SEEK       0x05 /* read_mode M-S-F */
#define CMD_READ       0x07 /* read_mode M-S-F nsec_h nsec_l */
#define CMD_RESET      0x11
#define CMD_SETMODE    0x15
#define CMD_PLAY       0x17 /* M-S-F M-S-F */
#define CMD_LOCK_CTL   0x22 /* 0: unlock, 1: lock */
#define CMD_IDENT      0x31
#define CMD_SETSPEED   0x32 /* 0: auto */ /* ??? */
#define CMD_GETMODE    0x41
#define CMD_PAUSE      0x51
#define CMD_READTOC    0x61
#define CMD_DISKINFO   0x71
#define CMD_TRAY_CTL   0x81

/*
 * disk_state:
 */
#define ST_PLAYING	0x80
#define ST_UNLOCKED	0x40
#define ST_NO_DISK	0x20
#define ST_DOOR_OPEN	0x10
#define ST_x08  0x08
#define ST_x04	0x04
#define ST_INVALID	0x02
#define ST_x01	0x01

/*
 * cmd_type:
 */
#define TYPE_INFO	0x01
#define TYPE_DATA	0x02

/*
 * read_mode:
 */
#define MOD_POLLED	0x80
#define MOD_x08	0x08
#define MOD_RAW	0x04

#define READ_DATA(port, buf, nr) insb(port, buf, nr)

#define SET_TIMER(func, jifs) \
	((mod_timer(&gscd_timer, jiffies + jifs)), \
	(gscd_timer.function = func))

#define CLEAR_TIMER		del_timer_sync(&gscd_timer)

#define MAX_TRACKS		104

struct msf {
	unsigned char	min;
	unsigned char	sec;
	unsigned char	frame;
};

struct gscd_Play_msf {
	struct msf	start;
	struct msf	end;
};

struct gscd_DiskInfo {
	unsigned char	first;
	unsigned char	last;
	struct msf	diskLength;
	struct msf	firstTrack;
};

struct gscd_Toc {
	unsigned char	ctrl_addr;
	unsigned char	track;
	unsigned char	pointIndex;
	struct msf	trackTime;
	struct msf	diskTime;
};