| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 and extent */ | 
|  | 19 | #define GSCD_BASE_ADDR	        0x340 | 
|  | 20 | #define GSCD_IO_EXTENT          4 | 
|  | 21 |  | 
|  | 22 |  | 
|  | 23 | /************** nothing to set up below here *********************/ | 
|  | 24 |  | 
|  | 25 | /* port access macro */ | 
|  | 26 | #define GSCDPORT(x)		(gscd_port + (x)) | 
|  | 27 |  | 
|  | 28 | /* | 
|  | 29 | * commands | 
|  | 30 | * the lower nibble holds the command length | 
|  | 31 | */ | 
|  | 32 | #define CMD_STATUS     0x01 | 
|  | 33 | #define CMD_READSUBQ   0x02 /* 1: ?, 2: UPC, 5: ? */ | 
|  | 34 | #define CMD_SEEK       0x05 /* read_mode M-S-F */ | 
|  | 35 | #define CMD_READ       0x07 /* read_mode M-S-F nsec_h nsec_l */ | 
|  | 36 | #define CMD_RESET      0x11 | 
|  | 37 | #define CMD_SETMODE    0x15 | 
|  | 38 | #define CMD_PLAY       0x17 /* M-S-F M-S-F */ | 
|  | 39 | #define CMD_LOCK_CTL   0x22 /* 0: unlock, 1: lock */ | 
|  | 40 | #define CMD_IDENT      0x31 | 
|  | 41 | #define CMD_SETSPEED   0x32 /* 0: auto */ /* ??? */ | 
|  | 42 | #define CMD_GETMODE    0x41 | 
|  | 43 | #define CMD_PAUSE      0x51 | 
|  | 44 | #define CMD_READTOC    0x61 | 
|  | 45 | #define CMD_DISKINFO   0x71 | 
|  | 46 | #define CMD_TRAY_CTL   0x81 | 
|  | 47 |  | 
|  | 48 | /* | 
|  | 49 | * disk_state: | 
|  | 50 | */ | 
|  | 51 | #define ST_PLAYING	0x80 | 
|  | 52 | #define ST_UNLOCKED	0x40 | 
|  | 53 | #define ST_NO_DISK	0x20 | 
|  | 54 | #define ST_DOOR_OPEN	0x10 | 
|  | 55 | #define ST_x08  0x08 | 
|  | 56 | #define ST_x04	0x04 | 
|  | 57 | #define ST_INVALID	0x02 | 
|  | 58 | #define ST_x01	0x01 | 
|  | 59 |  | 
|  | 60 | /* | 
|  | 61 | * cmd_type: | 
|  | 62 | */ | 
|  | 63 | #define TYPE_INFO	0x01 | 
|  | 64 | #define TYPE_DATA	0x02 | 
|  | 65 |  | 
|  | 66 | /* | 
|  | 67 | * read_mode: | 
|  | 68 | */ | 
|  | 69 | #define MOD_POLLED	0x80 | 
|  | 70 | #define MOD_x08	0x08 | 
|  | 71 | #define MOD_RAW	0x04 | 
|  | 72 |  | 
|  | 73 | #define READ_DATA(port, buf, nr) insb(port, buf, nr) | 
|  | 74 |  | 
|  | 75 | #define SET_TIMER(func, jifs) \ | 
|  | 76 | ((mod_timer(&gscd_timer, jiffies + jifs)), \ | 
|  | 77 | (gscd_timer.function = func)) | 
|  | 78 |  | 
|  | 79 | #define CLEAR_TIMER		del_timer_sync(&gscd_timer) | 
|  | 80 |  | 
|  | 81 | #define MAX_TRACKS		104 | 
|  | 82 |  | 
|  | 83 | struct msf { | 
|  | 84 | unsigned char	min; | 
|  | 85 | unsigned char	sec; | 
|  | 86 | unsigned char	frame; | 
|  | 87 | }; | 
|  | 88 |  | 
|  | 89 | struct gscd_Play_msf { | 
|  | 90 | struct msf	start; | 
|  | 91 | struct msf	end; | 
|  | 92 | }; | 
|  | 93 |  | 
|  | 94 | struct gscd_DiskInfo { | 
|  | 95 | unsigned char	first; | 
|  | 96 | unsigned char	last; | 
|  | 97 | struct msf	diskLength; | 
|  | 98 | struct msf	firstTrack; | 
|  | 99 | }; | 
|  | 100 |  | 
|  | 101 | struct gscd_Toc { | 
|  | 102 | unsigned char	ctrl_addr; | 
|  | 103 | unsigned char	track; | 
|  | 104 | unsigned char	pointIndex; | 
|  | 105 | struct msf	trackTime; | 
|  | 106 | struct msf	diskTime; | 
|  | 107 | }; | 
|  | 108 |  |