mcd.c (25056) | mcd.c (25460) |
---|---|
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.87 1997/03/24 11:23:55 bde Exp $ | 43 * $Id: mcd.c,v 1.88 1997/04/20 17:26:54 bde Exp $ |
44 */ 45static const 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> --- 138 unchanged lines hidden (view full) --- 190static void mcd_soft_reset(int unit); 191static int mcd_hard_reset(int unit); 192static int mcd_setmode(int unit, int mode); 193static int mcd_getqchan(int unit, struct mcd_qchninfo *q); 194static int mcd_subchan(int unit, struct ioc_read_subchannel *sc); 195static int mcd_toc_header(int unit, struct ioc_toc_header *th); 196static int mcd_read_toc(int unit); 197static int mcd_toc_entrys(int unit, struct ioc_read_toc_entry *te); | 44 */ 45static const 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> --- 138 unchanged lines hidden (view full) --- 190static void mcd_soft_reset(int unit); 191static int mcd_hard_reset(int unit); 192static int mcd_setmode(int unit, int mode); 193static int mcd_getqchan(int unit, struct mcd_qchninfo *q); 194static int mcd_subchan(int unit, struct ioc_read_subchannel *sc); 195static int mcd_toc_header(int unit, struct ioc_toc_header *th); 196static int mcd_read_toc(int unit); 197static int mcd_toc_entrys(int unit, struct ioc_read_toc_entry *te); |
198static int mcd_toc_entry(int unit, struct ioc_read_toc_single_entry *te); |
|
198static int mcd_stop(int unit); 199static int mcd_eject(int unit); 200static int mcd_inject(int unit); 201static int mcd_playtracks(int unit, struct ioc_play_track *pt); 202static int mcd_play(int unit, struct mcd_read2 *pb); 203static int mcd_playmsf(int unit, struct ioc_play_msf *pt); 204static int mcd_playblocks(int unit, struct ioc_play_blocks *); 205static int mcd_pause(int unit); --- 1216 unchanged lines hidden (view full) --- 1422 } 1423 1424 cd->flags |= MCDTOC; 1425 1426 return 0; 1427} 1428 1429static int | 199static int mcd_stop(int unit); 200static int mcd_eject(int unit); 201static int mcd_inject(int unit); 202static int mcd_playtracks(int unit, struct ioc_play_track *pt); 203static int mcd_play(int unit, struct mcd_read2 *pb); 204static int mcd_playmsf(int unit, struct ioc_play_msf *pt); 205static int mcd_playblocks(int unit, struct ioc_play_blocks *); 206static int mcd_pause(int unit); --- 1216 unchanged lines hidden (view full) --- 1423 } 1424 1425 cd->flags |= MCDTOC; 1426 1427 return 0; 1428} 1429 1430static int |
1431mcd_toc_entry(int unit, struct ioc_read_toc_single_entry *te) 1432{ 1433 struct mcd_data *cd = mcd_data + unit; 1434 struct ioc_toc_header th; 1435 int rc, trk; 1436 1437 if (te->address_format != CD_MSF_FORMAT 1438 && te->address_format != CD_LBA_FORMAT) 1439 return EINVAL; 1440 1441 /* Copy the toc header */ 1442 if ((rc = mcd_toc_header(unit, &th)) != 0) 1443 return rc; 1444 1445 /* verify starting track */ 1446 trk = te->track; 1447 if (trk == 0) 1448 trk = th.starting_track; 1449 else if (trk == MCD_LASTPLUS1) 1450 trk = th.ending_track + 1; 1451 else if (trk < th.starting_track || trk > th.ending_track + 1) 1452 return EINVAL; 1453 1454 /* Make sure we have a valid toc */ 1455 if ((rc=mcd_read_toc(unit)) != 0) 1456 return rc; 1457 1458 /* Copy the TOC data. */ 1459 if (cd->toc[trk].idx_no == 0) 1460 return EIO; 1461 1462 te->entry.control = cd->toc[trk].control; 1463 te->entry.addr_type = cd->toc[trk].addr_type; 1464 te->entry.track = 1465 cd->toc[trk].idx_no > 0x99 ? cd->toc[trk].idx_no : 1466 bcd2bin(cd->toc[trk].idx_no); 1467 switch (te->address_format) { 1468 case CD_MSF_FORMAT: 1469 te->entry.addr.msf.unused = 0; 1470 te->entry.addr.msf.minute = bcd2bin(cd->toc[trk].hd_pos_msf[0]); 1471 te->entry.addr.msf.second = bcd2bin(cd->toc[trk].hd_pos_msf[1]); 1472 te->entry.addr.msf.frame = bcd2bin(cd->toc[trk].hd_pos_msf[2]); 1473 break; 1474 case CD_LBA_FORMAT: 1475 te->entry.addr.lba = htonl(msf2hsg(cd->toc[trk].hd_pos_msf, 0)); 1476 break; 1477 } 1478 return 0; 1479} 1480 1481static int |
|
1430mcd_toc_entrys(int unit, struct ioc_read_toc_entry *te) 1431{ 1432 struct mcd_data *cd = mcd_data + unit; 1433 struct cd_toc_entry entries[MCD_MAXTOCS]; 1434 struct ioc_toc_header th; 1435 int rc, n, trk, len; 1436 1437 if ( te->data_len < sizeof(entries[0]) --- 363 unchanged lines hidden --- | 1482mcd_toc_entrys(int unit, struct ioc_read_toc_entry *te) 1483{ 1484 struct mcd_data *cd = mcd_data + unit; 1485 struct cd_toc_entry entries[MCD_MAXTOCS]; 1486 struct ioc_toc_header th; 1487 int rc, n, trk, len; 1488 1489 if ( te->data_len < sizeof(entries[0]) --- 363 unchanged lines hidden --- |