[PATCH] x86_64 early quirks: fix early_qrk[] section tag
[linux-2.6/openmoko-kernel/knife-kernel.git] / drivers / cdrom / sjcd.h
blob0aa5e714659d54c7e90294f2d2da878e5e703d67
1 /*
2 * Definitions for a Sanyo CD-ROM interface.
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
11 * This information is based on mcd.c from M. Harriss and sjcd102.lst from
12 * E. Moenkeberg.
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.
29 #ifndef __SJCD_H__
30 #define __SJCD_H__
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
40 * at all.
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.
48 #define SJCD_DMA_NR 0
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 */
74 /* commands */
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
121 struct msf {
122 unsigned char min;
123 unsigned char sec;
124 unsigned char frame;
127 struct sjcd_hw_disk_info {
128 unsigned char track_control;
129 unsigned char track_no;
130 unsigned char x, y, z;
131 union {
132 unsigned char track_no;
133 struct msf track_msf;
134 } un;
137 struct sjcd_hw_qinfo {
138 unsigned char track_control;
139 unsigned char track_no;
140 unsigned char x;
141 struct msf rel;
142 struct msf abs;
145 struct sjcd_play_msf {
146 struct msf start;
147 struct msf end;
150 struct sjcd_disk_info {
151 unsigned char first;
152 unsigned char last;
153 struct msf disk_length;
154 struct msf first_track;
157 struct sjcd_toc {
158 unsigned char ctrl_addr;
159 unsigned char track;
160 unsigned char point_index;
161 struct msf track_time;
162 struct msf disk_time;
165 #if defined( SJCD_GATHER_STAT )
167 struct sjcd_stat {
168 int ticks;
169 int tticks[ 8 ];
170 int idle_ticks;
171 int start_ticks;
172 int mode_ticks;
173 int read_ticks;
174 int data_ticks;
175 int stop_ticks;
176 int stopping_ticks;
179 #endif
181 #endif