Deleted Added
full compact
mcd.c (13822) mcd.c (13833)
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.63 1996/01/30 23:27:20 ache Exp $
43 * $Id: mcd.c,v 1.64 1996/02/01 16:51:53 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>

--- 146 unchanged lines hidden (view full) ---

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_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);
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>

--- 146 unchanged lines hidden (view full) ---

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_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 *);
206static int mcd_pause(int unit);
207static int mcd_resume(int unit);
208static int mcd_lock_door(int unit, int lock);
209static int mcd_close_tray(int unit);
210
211static int mcd_probe(struct isa_device *dev);
212static int mcd_attach(struct isa_device *dev);
213struct isa_driver mcddriver = { mcd_probe, mcd_attach, "mcd" };

--- 375 unchanged lines hidden (view full) ---

589 return EBADF;
590 case CDIOCPLAYTRACKS:
591 if (!(cd->flags & MCDVALID))
592 return ENXIO;
593 return mcd_playtracks(unit, (struct ioc_play_track *) addr);
594 case CDIOCPLAYBLOCKS:
595 if (!(cd->flags & MCDVALID))
596 return ENXIO;
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);
211
212static int mcd_probe(struct isa_device *dev);
213static int mcd_attach(struct isa_device *dev);
214struct isa_driver mcddriver = { mcd_probe, mcd_attach, "mcd" };

--- 375 unchanged lines hidden (view full) ---

590 return EBADF;
591 case CDIOCPLAYTRACKS:
592 if (!(cd->flags & MCDVALID))
593 return ENXIO;
594 return mcd_playtracks(unit, (struct ioc_play_track *) addr);
595 case CDIOCPLAYBLOCKS:
596 if (!(cd->flags & MCDVALID))
597 return ENXIO;
597 return EINVAL;
598 return mcd_playblocks(unit, (struct ioc_play_blocks *) addr);
598 case CDIOCPLAYMSF:
599 if (!(cd->flags & MCDVALID))
600 return ENXIO;
601 return mcd_playmsf(unit, (struct ioc_play_msf *) addr);
602 case CDIOCREADSUBCHANNEL:
603 if (!(cd->flags & MCDVALID))
604 return ENXIO;
605 return mcd_subchan(unit, (struct ioc_read_subchannel *) addr);

--- 987 unchanged lines hidden (view full) ---

1593 data.what.position.absaddr.lba = htonl(msf2hsg(q.hd_pos_msf, 0));
1594 break;
1595 }
1596
1597 return copyout(&data, sc->data, min(sizeof(struct cd_sub_channel_info), sc->data_len));
1598}
1599
1600static int
599 case CDIOCPLAYMSF:
600 if (!(cd->flags & MCDVALID))
601 return ENXIO;
602 return mcd_playmsf(unit, (struct ioc_play_msf *) addr);
603 case CDIOCREADSUBCHANNEL:
604 if (!(cd->flags & MCDVALID))
605 return ENXIO;
606 return mcd_subchan(unit, (struct ioc_read_subchannel *) addr);

--- 987 unchanged lines hidden (view full) ---

1594 data.what.position.absaddr.lba = htonl(msf2hsg(q.hd_pos_msf, 0));
1595 break;
1596 }
1597
1598 return copyout(&data, sc->data, min(sizeof(struct cd_sub_channel_info), sc->data_len));
1599}
1600
1601static int
1601mcd_playmsf(int unit, struct ioc_play_msf *pt)
1602mcd_playmsf(int unit, struct ioc_play_msf *p)
1602{
1603{
1604 struct mcd_data *cd = mcd_data + unit;
1603 struct mcd_read2 pb;
1604
1605 struct mcd_read2 pb;
1606
1607 if (cd->debug)
1608 printf("mcd%d: playmsf: from %d:%d.%d to %d:%d.%d\n",
1609 unit,
1610 p->start_m, p->start_s, p->start_f,
1611 p->end_m, p->end_s, p->end_f);
1612
1613 if ((p->start_m * 60 * 75 + p->start_s * 75 + p->start_f) >=
1614 (p->end_m * 60 * 75 + p->end_s * 75 + p->end_f) ||
1615 (p->end_m * 60 * 75 + p->end_s * 75 + p->end_f) >
1616 M_msf(cd->volinfo.vol_msf) * 60 * 75 +
1617 S_msf(cd->volinfo.vol_msf) * 75 +
1618 F_msf(cd->volinfo.vol_msf))
1619 return EINVAL;
1620
1621 pb.start_msf[0] = bin2bcd(p->start_m);
1622 pb.start_msf[1] = bin2bcd(p->start_s);
1623 pb.start_msf[2] = bin2bcd(p->start_f);
1624 pb.end_msf[0] = bin2bcd(p->end_m);
1625 pb.end_msf[1] = bin2bcd(p->end_s);
1626 pb.end_msf[2] = bin2bcd(p->end_f);
1627
1605 if (mcd_setmode(unit, MCD_MD_COOKED) != 0)
1606 return EIO;
1607
1628 if (mcd_setmode(unit, MCD_MD_COOKED) != 0)
1629 return EIO;
1630
1608 pb.start_msf[0] = bin2bcd(pt->start_m);
1609 pb.start_msf[1] = bin2bcd(pt->start_s);
1610 pb.start_msf[2] = bin2bcd(pt->start_f);
1611 pb.end_msf[0] = bin2bcd(pt->end_m);
1612 pb.end_msf[1] = bin2bcd(pt->end_s);
1613 pb.end_msf[2] = bin2bcd(pt->end_f);
1614
1615 return mcd_play(unit, &pb);
1616}
1617
1618static int
1619mcd_playtracks(int unit, struct ioc_play_track *pt)
1620{
1621 struct mcd_data *cd = mcd_data + unit;
1622 struct mcd_read2 pb;

--- 15 unchanged lines hidden (view full) ---

1638 || z > bcd2bin(cd->volinfo.trk_high))
1639 return EINVAL;
1640
1641 for (i = 0; i < 3; i++) {
1642 pb.start_msf[i] = cd->toc[a].hd_pos_msf[i];
1643 pb.end_msf[i] = cd->toc[z+1].hd_pos_msf[i];
1644 }
1645
1631 return mcd_play(unit, &pb);
1632}
1633
1634static int
1635mcd_playtracks(int unit, struct ioc_play_track *pt)
1636{
1637 struct mcd_data *cd = mcd_data + unit;
1638 struct mcd_read2 pb;

--- 15 unchanged lines hidden (view full) ---

1654 || z > bcd2bin(cd->volinfo.trk_high))
1655 return EINVAL;
1656
1657 for (i = 0; i < 3; i++) {
1658 pb.start_msf[i] = cd->toc[a].hd_pos_msf[i];
1659 pb.end_msf[i] = cd->toc[z+1].hd_pos_msf[i];
1660 }
1661
1662 if (mcd_setmode(unit, MCD_MD_COOKED) != 0)
1663 return EIO;
1664
1646 return mcd_play(unit, &pb);
1647}
1648
1649static int
1665 return mcd_play(unit, &pb);
1666}
1667
1668static int
1669mcd_playblocks(int unit, struct ioc_play_blocks *p)
1670{
1671 struct mcd_data *cd = mcd_data + unit;
1672 struct mcd_read2 pb;
1673
1674 if (cd->debug)
1675 printf("mcd%d: playblocks: blkno %d length %d\n",
1676 unit, p->blk, p->len);
1677
1678 if (p->blk > cd->disksize || p->len > cd->disksize ||
1679 p->blk < 0 || p->len < 0 ||
1680 (p->blk + p->len) > cd->disksize)
1681 return EINVAL;
1682
1683 hsg2msf(p->blk, pb.start_msf);
1684 hsg2msf(p->blk + p->len, pb.end_msf);
1685
1686 if (mcd_setmode(unit, MCD_MD_COOKED) != 0)
1687 return EIO;
1688
1689 return mcd_play(unit, &pb);
1690}
1691
1692static int
1650mcd_play(int unit, struct mcd_read2 *pb)
1651{
1652 struct mcd_data *cd = mcd_data + unit;
1653 int com_port = cd->iobase + mcd_command;
1654 int retry, st = -1, status;
1655
1656 cd->lastpb = *pb;
1657 for(retry=0; retry<MCD_RETRYS; retry++) {

--- 95 unchanged lines hidden ---
1693mcd_play(int unit, struct mcd_read2 *pb)
1694{
1695 struct mcd_data *cd = mcd_data + unit;
1696 int com_port = cd->iobase + mcd_command;
1697 int retry, st = -1, status;
1698
1699 cd->lastpb = *pb;
1700 for(retry=0; retry<MCD_RETRYS; retry++) {

--- 95 unchanged lines hidden ---