special usb hub handling, IDE disks, and retries all over the place
[linux-2.4.git] / drivers / cdrom / cm206.h
1 /* cm206.h Header file for cm206.c.
2    Copyright (c) 1995 David van Leeuwen 
3 */
4
5 #ifndef LINUX_CM206_H
6 #define LINUX_CM206_H
7
8 #include <linux/ioctl.h>
9
10 /* First, the cm260 stuff */
11 /* The ports and irq used. Although CM206_BASE and CM206_IRQ are defined
12    below, the values are not used unless autoprobing is turned off and 
13    no LILO boot options or module command line options are given. Change
14    these values to your own as last resort if autoprobing and options
15    don't work. */
16
17 #define CM206_BASE 0x340
18 #define CM206_IRQ 11
19
20 #define r_data_status (cm206_base)
21 #define r_uart_receive (cm206_base+0x2)
22 #define r_fifo_output_buffer (cm206_base+0x4)
23 #define r_line_status (cm206_base+0x6)
24 #define r_data_control (cm206_base+0x8)
25 #define r_uart_transmit (cm206_base+0xa)
26 #define r_test_clock (cm206_base+0xc)
27 #define r_test_control (cm206_base+0xe)
28
29 /* the data_status flags */
30 #define ds_ram_size 0x4000
31 #define ds_toc_ready 0x2000
32 #define ds_fifo_empty 0x1000
33 #define ds_sync_error 0x800
34 #define ds_crc_error 0x400
35 #define ds_data_error 0x200
36 #define ds_fifo_overflow 0x100
37 #define ds_data_ready 0x80
38
39 /* the line_status flags */
40 #define ls_attention 0x10
41 #define ls_parity_error 0x8
42 #define ls_overrun 0x4
43 #define ls_receive_buffer_full 0x2
44 #define ls_transmitter_buffer_empty 0x1
45
46 /* the data control register flags */
47 #define dc_read_q_channel 0x4000
48 #define dc_mask_sync_error 0x2000
49 #define dc_toc_enable 0x1000
50 #define dc_no_stop_on_error 0x800
51 #define dc_break 0x400
52 #define dc_initialize 0x200
53 #define dc_mask_transmit_ready 0x100
54 #define dc_flag_enable 0x80
55
56 /* Define the default data control register flags here */
57 #define dc_normal (dc_mask_sync_error | dc_no_stop_on_error | \
58                    dc_mask_transmit_ready)
59
60 /* now some constants related to the cm206 */
61 /* another drive status byte, echoed by the cm206 on most commands */
62
63 #define dsb_error_condition 0x1
64 #define dsb_play_in_progress 0x4
65 #define dsb_possible_media_change 0x8
66 #define dsb_disc_present 0x10
67 #define dsb_drive_not_ready 0x20
68 #define dsb_tray_locked 0x40
69 #define dsb_tray_not_closed 0x80
70
71 #define dsb_not_useful (dsb_drive_not_ready | dsb_tray_not_closed)
72
73 /* the cm206 command set */
74
75 #define c_close_tray 0
76 #define c_lock_tray 0x01
77 #define c_unlock_tray 0x04
78 #define c_open_tray 0x05
79 #define c_seek 0x10
80 #define c_read_data 0x20
81 #define c_force_1x 0x21
82 #define c_force_2x 0x22
83 #define c_auto_mode 0x23
84 #define c_play 0x30
85 #define c_set_audio_mode 0x31
86 #define c_read_current_q 0x41
87 #define c_stream_q 0x42
88 #define c_drive_status 0x50
89 #define c_disc_status 0x51
90 #define c_audio_status 0x52
91 #define c_drive_configuration 0x53
92 #define c_read_upc 0x60
93 #define c_stop 0x70
94 #define c_calc_checksum 0xe5
95
96 #define c_gimme 0xf8
97
98 /* finally, the (error) condition that the drive can be in      *
99  * OK, this is not always an error, but let's prefix it with e_ */
100
101 #define e_none 0
102 #define e_illegal_command 0x01
103 #define e_sync 0x02
104 #define e_seek 0x03
105 #define e_parity 0x04
106 #define e_focus 0x05
107 #define e_header_sync 0x06
108 #define e_code_incompatibility 0x07
109 #define e_reset_done 0x08
110 #define e_bad_parameter 0x09
111 #define e_radial 0x0a
112 #define e_sub_code 0x0b
113 #define e_no_data_track 0x0c
114 #define e_scan 0x0d
115 #define e_tray_open 0x0f
116 #define e_no_disc 0x10
117 #define e_tray stalled 0x11
118
119 /* drive configuration masks */
120
121 #define dcf_revision_code 0x7
122 #define dcf_transfer_rate 0x60
123 #define dcf_motorized_tray 0x80
124
125 /* disc status byte */
126
127 #define cds_multi_session 0x2
128 #define cds_all_audio 0x8
129 #define cds_xa_mode 0xf0
130
131 /* finally some ioctls for the driver */
132
133 #define CM206CTL_GET_STAT _IO( 0x20, 0 )
134 #define CM206CTL_GET_LAST_STAT _IO( 0x20, 1 )
135
136 #ifdef STATISTICS
137
138 /* This is an ugly way to guarantee that the names of the statistics
139  * are the same in the code and in the diagnostics program.  */
140
141 #ifdef __KERNEL__
142 #define x(a) st_ ## a
143 #define y enum
144 #else
145 #define x(a) #a
146 #define y char * stats_name[] = 
147 #endif
148
149 y {x(interrupt), x(data_ready), x(fifo_overflow), x(data_error),
150      x(crc_error), x(sync_error), x(lost_intr), x(echo),
151      x(write_timeout), x(receive_timeout), x(read_timeout),
152      x(dsb_timeout), x(stop_0xff), x(back_read_timeout),
153      x(sector_transferred), x(read_restarted), x(read_background),
154      x(bh), x(open), x(ioctl_multisession), x(attention)
155 #ifdef __KERNEL__
156      , x(last_entry)
157 #endif
158  };
159
160 #ifdef __KERNEL__
161 #define NR_STATS st_last_entry
162 #else
163 #define NR_STATS (sizeof(stats_name)/sizeof(char*))
164 #endif
165
166 #undef y
167 #undef x
168
169 #endif /* STATISTICS */
170
171 #endif /* LINUX_CM206_H */