1 /* 2 * Definitions for a Sanyo CD-ROM interface. 3 * 4 * Copyright (C) 1995 Vadim V. Model 5 * model@cecmow.enet.dec.com 6 * vadim@rbrf.msk.su 7 * vadim@ipsun.ras.ru 8 * Eric van der Maarel 9 * H.T.M.v.d.Maarel@marin.nl 10 * 11 * This information is based on mcd.c from M. Harriss and sjcd102.lst from 12 * E. Moenkeberg. 13 * 14 * This program is free software; you can redistribute it and/or modify 15 * it under the terms of the GNU General Public License as published by 16 * the Free Software Foundation; either version 2 of the License, or 17 * (at your option) any later version. 18 * 19 * This program is distributed in the hope that it will be useful, 20 * but WITHOUT ANY WARRANTY; without even the implied warranty of 21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 * GNU General Public License for more details. 23 * 24 * You should have received a copy of the GNU General Public License 25 * along with this program; if not, write to the Free Software 26 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 27 */ 28
29 #ifndef__SJCD_H__ 30 #define__SJCD_H__ 31
32 /* 33 * Change this to set the I/O port address as default. More flexibility 34 * come with setup implementation. 35 */ 36 #defineSJCD_BASE_ADDR 0x340
37
38 /* 39 * Change this to set the irq as default. Really SANYO do not use interrupts 40 * at all. 41 */ 42 #define SJCD_INTR_NR 0
43
44 /* 45 * Change this to set the dma as default value. really SANYO does not use 46 * direct memory access at all. 47 */ 48 #define SJCD_DMA_NR 0
49
50 /* 51 * Macros which allow us to find out the status of the drive. 52 */ 53 #defineSJCD_STATUS_AVAILABLE( x ) (((x)&0x02)==0)
54 #defineSJCD_DATA_AVAILABLE( x ) (((x)&0x01)==0)
55
56 /* 57 * Port access macro. Three ports are available: S-data port (command port), 58 * status port (read only) and D-data port (read only). 59 */ 60 #defineSJCDPORT( x ) ( sjcd_base + ( x ) )
61 #define SJCD_STATUS_PORT SJCDPORT( 1 )
62 #define SJCD_S_DATA_PORT SJCDPORT( 0 )
63 #define SJCD_COMMAND_PORT SJCDPORT( 0 )
64 #define SJCD_D_DATA_PORT SJCDPORT( 2 )
65
66 /* 67 * Drive info bits. Drive info available as first (mandatory) byte of 68 * command completion status. 69 */ 70 #define SST_NOT_READY 0x10 /* no disk in the drive (???) */ 71 #defineSST_MEDIA_CHANGED 0x20 /* disk is changed */ 72 #defineSST_DOOR_OPENED 0x40 /* door is open */ 73
74 /* commands */ 75
76 #defineSCMD_EJECT_TRAY 0xD0 /* eject tray if not locked */ 77 #defineSCMD_LOCK_TRAY 0xD2 /* lock tray when in */ 78 #defineSCMD_UNLOCK_TRAY 0xD4 /* unlock tray when in */ 79 #defineSCMD_CLOSE_TRAY 0xD6 /* load tray in */ 80
81 #defineSCMD_RESET 0xFA /* soft reset */ 82 #defineSCMD_GET_STATUS 0x80
83 #defineSCMD_GET_VERSION 0xCC
84
85 #defineSCMD_DATA_READ 0xA0 /* are the same, depend on mode&args */ 86 #defineSCMD_SEEK 0xA0
87 #defineSCMD_PLAY 0xA0
88
89 #defineSCMD_GET_QINFO 0xA8
90
91 #defineSCMD_SET_MODE 0xC4
92 #defineSCMD_MODE_PLAY 0xE0
93 #defineSCMD_MODE_COOKED (0xF8 & ~0x20)
94 #define SCMD_MODE_RAW 0xF9
95 #define SCMD_MODE_x20_BIT 0x20 /* What is it for ? */ 96
97 #defineSCMD_SET_VOLUME 0xAE
98 #defineSCMD_PAUSE 0xE0
99 #defineSCMD_STOP 0xE0
100
101 #defineSCMD_GET_DISK_INFO 0xAA
102
103 /* 104 * Some standard arguments for SCMD_GET_DISK_INFO. 105 */ 106 #defineSCMD_GET_1_TRACK 0xA0 /* get the first track information */ 107 #defineSCMD_GET_L_TRACK 0xA1 /* get the last track information */ 108 #defineSCMD_GET_D_SIZE 0xA2 /* get the whole disk information */ 109
110 /* 111 * Borrowed from hd.c. Allows to optimize multiple port read commands. 112 */ 113 #define S_READ_DATA( port, buf, nr ) insb( port, buf, nr )
114
115 /* 116 * We assume that there are no audio disks with TOC length more than this 117 * number (I personally have never seen disks with more than 20 fragments). 118 */ 119 #defineSJCD_MAX_TRACKS 100
120
121 structmsf{ 122 unsignedcharmin;
123 unsignedcharsec;
124 unsignedcharframe;
125 };
126
127 structsjcd_hw_disk_info{ 128 unsignedchartrack_control;
129 unsignedchartrack_no;
130 unsignedcharx, y, z;
131 union{ 132 unsignedchartrack_no;
133 structmsftrack_msf;
134 }un;
135 };
136
137 structsjcd_hw_qinfo{ 138 unsignedchartrack_control;
139 unsignedchartrack_no;
140 unsignedcharx;
141 structmsfrel;
142 structmsfabs;
143 };
144
145 structsjcd_play_msf{ 146 structmsfstart;
147 structmsfend;
148 };
149
150 struct sjcd_disk_info { 151 unsignedcharfirst;
152 unsignedcharlast;
153 structmsfdisk_length;
154 structmsffirst_track;
155 };
156
157 struct sjcd_toc { 158 unsignedcharctrl_addr;
159 unsignedchartrack;
160 unsignedchar point_index;
161 structmsf track_time;
162 structmsf disk_time;
163 };
164
165 #ifdefined( SJCD_GATHER_STAT )
166
167 structsjcd_stat{ 168 intticks;
169 inttticks[ 8 ];
170 intidle_ticks;
171 intstart_ticks;
172 intmode_ticks;
173 intread_ticks;
174 intdata_ticks;
175 intstop_ticks;
176 intstopping_ticks;
177 };
178
179 #endif 180
181 #endif