2 * Definitions for a Sanyo CD-ROM interface.
4 * Copyright (C) 1995 Vadim V. Model
5 * model@cecmow.enet.dec.com
9 * H.T.M.v.d.Maarel@marin.nl
11 * This information is based on mcd.c from M. Harriss and sjcd102.lst from
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.
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.
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.
33 * Change this to set the I/O port address as default. More flexibility
34 * come with setup implementation.
36 #define SJCD_BASE_ADDR 0x340
39 * Change this to set the irq as default. Really SANYO do not use interrupts
42 #define SJCD_INTR_NR 0
45 * Change this to set the dma as default value. really SANYO does not use
46 * direct memory access at all.
51 * Macros which allow us to find out the status of the drive.
53 #define SJCD_STATUS_AVAILABLE( x ) (((x)&0x02)==0)
54 #define SJCD_DATA_AVAILABLE( x ) (((x)&0x01)==0)
57 * Port access macro. Three ports are available: S-data port (command port),
58 * status port (read only) and D-data port (read only).
60 #define SJCDPORT( 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 )
67 * Drive info bits. Drive info available as first (mandatory) byte of
68 * command completion status.
70 #define SST_NOT_READY 0x10 /* no disk in the drive (???) */
71 #define SST_MEDIA_CHANGED 0x20 /* disk is changed */
72 #define SST_DOOR_OPENED 0x40 /* door is open */
76 #define SCMD_EJECT_TRAY 0xD0 /* eject tray if not locked */
77 #define SCMD_LOCK_TRAY 0xD2 /* lock tray when in */
78 #define SCMD_UNLOCK_TRAY 0xD4 /* unlock tray when in */
79 #define SCMD_CLOSE_TRAY 0xD6 /* load tray in */
81 #define SCMD_RESET 0xFA /* soft reset */
82 #define SCMD_GET_STATUS 0x80
83 #define SCMD_GET_VERSION 0xCC
85 #define SCMD_DATA_READ 0xA0 /* are the same, depend on mode&args */
86 #define SCMD_SEEK 0xA0
87 #define SCMD_PLAY 0xA0
89 #define SCMD_GET_QINFO 0xA8
91 #define SCMD_SET_MODE 0xC4
92 #define SCMD_MODE_PLAY 0xE0
93 #define SCMD_MODE_COOKED (0xF8 & ~0x20)
94 #define SCMD_MODE_RAW 0xF9
95 #define SCMD_MODE_x20_BIT 0x20 /* What is it for ? */
97 #define SCMD_SET_VOLUME 0xAE
98 #define SCMD_PAUSE 0xE0
99 #define SCMD_STOP 0xE0
101 #define SCMD_GET_DISK_INFO 0xAA
104 * Some standard arguments for SCMD_GET_DISK_INFO.
106 #define SCMD_GET_1_TRACK 0xA0 /* get the first track information */
107 #define SCMD_GET_L_TRACK 0xA1 /* get the last track information */
108 #define SCMD_GET_D_SIZE 0xA2 /* get the whole disk information */
111 * Borrowed from hd.c. Allows to optimize multiple port read commands.
113 #define S_READ_DATA( port, buf, nr ) insb( port, buf, nr )
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).
119 #define SJCD_MAX_TRACKS 100
127 struct sjcd_hw_disk_info
{
128 unsigned char track_control
;
129 unsigned char track_no
;
130 unsigned char x
, y
, z
;
132 unsigned char track_no
;
133 struct msf track_msf
;
137 struct sjcd_hw_qinfo
{
138 unsigned char track_control
;
139 unsigned char track_no
;
145 struct sjcd_play_msf
{
150 struct sjcd_disk_info
{
153 struct msf disk_length
;
154 struct msf first_track
;
158 unsigned char ctrl_addr
;
160 unsigned char point_index
;
161 struct msf track_time
;
162 struct msf disk_time
;
165 #if defined( SJCD_GATHER_STAT )