1 /* 2 * Copyright 1993 by Holger Veit (data part) 3 * Copyright 1993 by Brian Moore (audio part) 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: 9 * 1. Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. 11 * 2. Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in the 13 * documentation and/or other materials provided with the distribution. 14 * 3. All advertising materials mentioning features or use of this software 15 * must display the following acknowledgement: 16 * This software was developed by Holger Veit and Brian Moore 17 * for use with "386BSD" and similar operating systems. 18 * "Similar operating systems" includes mainly non-profit oriented 19 * systems for research and education, including but not restricted to 20 * "NetBSD", "FreeBSD", "Mach" (by CMU). 21 * 4. Neither the name of the developer(s) nor the name "386BSD" 22 * may be used to endorse or promote products derived from this 23 * software without specific prior written permission. 24 * 25 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPER(S) ``AS IS'' AND ANY 26 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 28 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE DEVELOPER(S) BE 29 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, 30 * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 31 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 32 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 33 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 34 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 35 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 36 * 37 38 * @(#) $RCSfile: mcdreg.h,v $ $Revision: 1.2 $ $Date: 93/07/06 12:58:55 $ 39 * 40 * This file contains definitions for some cdrom control commands 41 * and status codes. This info was "inherited" from the DOS MTMCDE.SYS 42 * driver, and is thus not complete (and may even be wrong). Some day 43 * the manufacturer or anyone else might provide better documentation, 44 * so this file (and the driver) will then have a better quality. 45 */ 46 #ifndef MCD_H 47 #define MCD_H 48 49 #ifdef __GNUC__ 50 #if __GNUC__ >= 2 51 #pragma pack(1) 52 #endif 53 #endif 54 55 typedef unsigned char bcd_t; 56 #define M_msf(msf) msf[0] 57 #define S_msf(msf) msf[1] 58 #define F_msf(msf) msf[2] 59 60 /* io lines used */ 61 #define MCD_IO_BASE 0x300 62 63 #define mcd_command 0 64 #define mcd_status 0 65 #define mcd_rdata 0 66 67 #define mcd_reset 1 68 #define MCD_CMDRESET 0x00 69 #define mcd_xfer 1 70 #define MCD_ST_BUSY 0x04 71 /* XXX Bit 3,1 used, but for what? */ 72 #define mcd_ctl2 2 /* XXX Is this right? */ 73 74 #define mcd_config 3 75 #define MCD_MASK_DMA 0x07 /* bits 2-0 = DMA channel */ 76 #define MCD_MASK_IRQ 0x70 /* bits 6-4 = INT number */ 77 /* 001 = int 2,9 */ 78 /* 010 = int 3 */ 79 /* 011 = int 5 */ 80 /* 100 = int 10 */ 81 /* 101 = int 11 */ 82 83 /* commands known by the controller */ 84 #define MCD_CMDGETVOLINFO 0x10 /* gets mcd_volinfo */ 85 /* 0x11 used, gets 4 bytes */ 86 #define MCD_CMDGETQCHN 0x20 /* gets mcd_qchninfo */ 87 #define MCD_CMDGETSTAT 0x40 /* gets a byte of status */ 88 #define MCD_ST_DOOROPEN 0x80 89 #define MCD_ST_DSKIN 0x40 90 #define MCD_ST_DSKCHNG 0x20 91 /* XXX Bits 4,3,2 used, for what? Bit 3=position reached? */ 92 #define MCD_ST_AUDIOBSY 0x02 93 #define MCD_CMDSETMODE 0x50 /* set transmission mode, needs byte */ 94 #define MCD_MD_RAW 0x60 95 #define MCD_MD_COOKED 0x01 96 #define MCD_MD_TOC 0x05 97 #define MCD_CMDSTOPAUDIO 0x70 98 /* XXX 0x90 used, 1,2,or 3 args */ 99 #define MCD_CMDGETVOLUME 0x8E /* gets mcd_volume */ 100 /* XXX 0xA0 used, 1 arg */ 101 #define MCD_CMDSETVOLUME 0xAE /* sets mcd_volume */ 102 #define MCD_CMDREAD1 0xB0 /* read n sectors */ 103 #define MCD_CMDREAD2 0xC0 /* read from-to */ 104 /* XXX 0xDC used, gets 2 bytes */ 105 #define MCD_CMDEJECTDISK 0xF6 106 #define MCD_CMDCLOSETRAY 0xF8 107 #define MCD_CMDLOCKDRV 0xFE /* needs byte */ 108 #define MCD_LK_UNLOCK 0x00 109 #define MCD_LK_LOCK 0x01 110 #define MCD_LK_TEST 0x02 111 112 struct mcd_volinfo { 113 bcd_t trk_low; 114 bcd_t trk_high; 115 bcd_t vol_msf[3]; 116 bcd_t trk1_msf[3]; 117 }; 118 119 struct mcd_qchninfo { 120 u_char ctrl_adr; 121 u_char trk_no; 122 u_char idx_no; 123 bcd_t trk_size_msf[3]; 124 u_char :8; 125 bcd_t hd_pos_msf[3]; 126 }; 127 128 struct mcd_volume { 129 u_char v0l; 130 u_char v0rs; 131 u_char v0r; 132 u_char v0ls; 133 }; 134 135 struct mcd_read1 { 136 bcd_t start_msf[3]; 137 u_char nsec[3]; 138 }; 139 140 struct mcd_read2 { 141 bcd_t start_msf[3]; 142 bcd_t end_msf[3]; 143 }; 144 145 146 #endif /* MCD_H */ 147