mcd.c (13864) | mcd.c (13866) |
---|---|
1/* 2 * Copyright 1993 by Holger Veit (data part) 3 * Copyright 1993 by Brian Moore (audio part) 4 * Changes Copyright 1993 by Gary Clark II 5 * Changes Copyright (C) 1994-1995 by Andrey A. Chernov, Moscow, Russia 6 * 7 * Rewrote probe routine to work on newer Mitsumi drives. 8 * Additional changes (C) 1994 by Jordan K. Hubbard --- 26 unchanged lines hidden (view full) --- 35 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, 36 * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 37 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 38 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 39 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 40 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 41 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 42 * | 1/* 2 * Copyright 1993 by Holger Veit (data part) 3 * Copyright 1993 by Brian Moore (audio part) 4 * Changes Copyright 1993 by Gary Clark II 5 * Changes Copyright (C) 1994-1995 by Andrey A. Chernov, Moscow, Russia 6 * 7 * Rewrote probe routine to work on newer Mitsumi drives. 8 * Additional changes (C) 1994 by Jordan K. Hubbard --- 26 unchanged lines hidden (view full) --- 35 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, 36 * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 37 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 38 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 39 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 40 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 41 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 42 * |
43 * $Id: mcd.c,v 1.66 1996/02/02 20:50:03 ache Exp $ | 43 * $Id: mcd.c,v 1.67 1996/02/02 21:18:02 ache Exp $ |
44 */ 45static char COPYRIGHT[] = "mcd-driver (C)1993 by H.Veit & B.Moore"; 46 47#include "mcd.h" 48#if NMCD > 0 49#include <sys/types.h> 50#include <sys/param.h> 51#include <sys/systm.h> --- 143 unchanged lines hidden (view full) --- 195static int mcd_setmode(int unit, int mode); 196static int mcd_getqchan(int unit, struct mcd_qchninfo *q); 197static int mcd_subchan(int unit, struct ioc_read_subchannel *sc); 198static int mcd_toc_header(int unit, struct ioc_toc_header *th); 199static int mcd_read_toc(int unit); 200static int mcd_toc_entrys(int unit, struct ioc_read_toc_entry *te); 201static int mcd_stop(int unit); 202static int mcd_eject(int unit); | 44 */ 45static char COPYRIGHT[] = "mcd-driver (C)1993 by H.Veit & B.Moore"; 46 47#include "mcd.h" 48#if NMCD > 0 49#include <sys/types.h> 50#include <sys/param.h> 51#include <sys/systm.h> --- 143 unchanged lines hidden (view full) --- 195static int mcd_setmode(int unit, int mode); 196static int mcd_getqchan(int unit, struct mcd_qchninfo *q); 197static int mcd_subchan(int unit, struct ioc_read_subchannel *sc); 198static int mcd_toc_header(int unit, struct ioc_toc_header *th); 199static int mcd_read_toc(int unit); 200static int mcd_toc_entrys(int unit, struct ioc_read_toc_entry *te); 201static int mcd_stop(int unit); 202static int mcd_eject(int unit); |
203static int mcd_inject(int unit); |
|
203static int mcd_playtracks(int unit, struct ioc_play_track *pt); 204static int mcd_play(int unit, struct mcd_read2 *pb); 205static int mcd_playmsf(int unit, struct ioc_play_msf *pt); 206static int mcd_playblocks(int unit, struct ioc_play_blocks *); 207static int mcd_pause(int unit); 208static int mcd_resume(int unit); 209static int mcd_lock_door(int unit, int lock); 210static int mcd_close_tray(int unit); --- 433 unchanged lines hidden (view full) --- 644 return 0; 645 case CDIOCCLRDEBUG: 646 cd->debug = 0; 647 return 0; 648 case CDIOCRESET: 649 return mcd_hard_reset(unit); 650 case CDIOCALLOW: 651 return mcd_lock_door(unit, MCD_LK_UNLOCK); | 204static int mcd_playtracks(int unit, struct ioc_play_track *pt); 205static int mcd_play(int unit, struct mcd_read2 *pb); 206static int mcd_playmsf(int unit, struct ioc_play_msf *pt); 207static int mcd_playblocks(int unit, struct ioc_play_blocks *); 208static int mcd_pause(int unit); 209static int mcd_resume(int unit); 210static int mcd_lock_door(int unit, int lock); 211static int mcd_close_tray(int unit); --- 433 unchanged lines hidden (view full) --- 645 return 0; 646 case CDIOCCLRDEBUG: 647 cd->debug = 0; 648 return 0; 649 case CDIOCRESET: 650 return mcd_hard_reset(unit); 651 case CDIOCALLOW: 652 return mcd_lock_door(unit, MCD_LK_UNLOCK); |
653 case CDIOCPREVENT: 654 return mcd_lock_door(unit, MCD_LK_LOCK); 655 case CDIOCCLOSE: 656 return mcd_inject(unit); |
|
652 default: 653 return ENOTTY; 654 } 655 /*NOTREACHED*/ 656} 657 658/* this could have been taken from scsi/cd.c, but it is not clear 659 * whether the scsi cd driver is linked in --- 607 unchanged lines hidden (view full) --- 1267mcd_eject(int unit) 1268{ 1269 struct mcd_data *cd = mcd_data + unit; 1270 int port = cd->iobase, r; 1271 1272 if (mcd_getstat(unit,1) == -1) /* detect disk change too */ 1273 return EIO; 1274 if (cd->status & MCDDOOROPEN) | 657 default: 658 return ENOTTY; 659 } 660 /*NOTREACHED*/ 661} 662 663/* this could have been taken from scsi/cd.c, but it is not clear 664 * whether the scsi cd driver is linked in --- 607 unchanged lines hidden (view full) --- 1272mcd_eject(int unit) 1273{ 1274 struct mcd_data *cd = mcd_data + unit; 1275 int port = cd->iobase, r; 1276 1277 if (mcd_getstat(unit,1) == -1) /* detect disk change too */ 1278 return EIO; 1279 if (cd->status & MCDDOOROPEN) |
1275 return mcd_close_tray(unit); | 1280 return 0; |
1276 if ((r = mcd_stop(unit)) == EIO) 1277 return r; 1278 outb(port+mcd_command, MCD_CMDEJECTDISK); 1279 if (mcd_getstat(unit,0) == -1) 1280 return EIO; 1281 return 0; 1282} 1283 1284static int | 1281 if ((r = mcd_stop(unit)) == EIO) 1282 return r; 1283 outb(port+mcd_command, MCD_CMDEJECTDISK); 1284 if (mcd_getstat(unit,0) == -1) 1285 return EIO; 1286 return 0; 1287} 1288 1289static int |
1290mcd_inject(int unit) 1291{ 1292 struct mcd_data *cd = mcd_data + unit; 1293 1294 if (mcd_getstat(unit,1) == -1) /* detect disk change too */ 1295 return EIO; 1296 if (cd->status & MCDDOOROPEN) 1297 return mcd_close_tray(unit); 1298 return 0; 1299} 1300 1301static int |
|
1285mcd_hard_reset(int unit) 1286{ 1287 struct mcd_data *cd = mcd_data + unit; 1288 int port = cd->iobase; 1289 1290 outb(port+mcd_reset,MCD_CMDRESET); 1291 cd->curr_mode = MCD_MD_UNKNOWN; 1292 cd->audio_status = CD_AS_AUDIO_INVALID; --- 503 unchanged lines hidden --- | 1302mcd_hard_reset(int unit) 1303{ 1304 struct mcd_data *cd = mcd_data + unit; 1305 int port = cd->iobase; 1306 1307 outb(port+mcd_reset,MCD_CMDRESET); 1308 cd->curr_mode = MCD_MD_UNKNOWN; 1309 cd->audio_status = CD_AS_AUDIO_INVALID; --- 503 unchanged lines hidden --- |