1993-10-12 06:08:31 +00:00
|
|
|
/*
|
|
|
|
* Copyright 1993 by Holger Veit (data part)
|
|
|
|
* Copyright 1993 by Brian Moore (audio part)
|
1994-02-22 08:44:31 +00:00
|
|
|
* Changes Copyright 1993 by Gary Clark II
|
1995-02-22 01:11:36 +00:00
|
|
|
* Changes Copyright (C) 1994-1995 by Andrey A. Chernov, Moscow, Russia
|
1994-02-22 08:44:31 +00:00
|
|
|
*
|
|
|
|
* Rewrote probe routine to work on newer Mitsumi drives.
|
|
|
|
* Additional changes (C) 1994 by Jordan K. Hubbard
|
|
|
|
*
|
1993-10-12 06:08:31 +00:00
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
* 3. All advertising materials mentioning features or use of this software
|
|
|
|
* must display the following acknowledgement:
|
|
|
|
* This software was developed by Holger Veit and Brian Moore
|
1994-02-22 08:44:31 +00:00
|
|
|
* for use with "386BSD" and similar operating systems.
|
1993-10-12 06:08:31 +00:00
|
|
|
* "Similar operating systems" includes mainly non-profit oriented
|
|
|
|
* systems for research and education, including but not restricted to
|
|
|
|
* "NetBSD", "FreeBSD", "Mach" (by CMU).
|
|
|
|
* 4. Neither the name of the developer(s) nor the name "386BSD"
|
|
|
|
* may be used to endorse or promote products derived from this
|
|
|
|
* software without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPER(S) ``AS IS'' AND ANY
|
|
|
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
|
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE DEVELOPER(S) BE
|
|
|
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
|
|
|
* OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
|
|
|
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
|
|
|
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
|
|
|
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
|
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
|
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*
|
1999-08-28 01:08:13 +00:00
|
|
|
* $FreeBSD$
|
1993-10-12 06:08:31 +00:00
|
|
|
*/
|
1996-06-12 05:11:41 +00:00
|
|
|
static const char COPYRIGHT[] = "mcd-driver (C)1993 by H.Veit & B.Moore";
|
1993-10-12 06:08:31 +00:00
|
|
|
|
|
|
|
#include "mcd.h"
|
1994-08-13 03:50:34 +00:00
|
|
|
#include <sys/param.h>
|
|
|
|
#include <sys/systm.h>
|
|
|
|
#include <sys/conf.h>
|
1997-03-23 03:37:54 +00:00
|
|
|
#include <sys/fcntl.h>
|
1994-08-13 03:50:34 +00:00
|
|
|
#include <sys/buf.h>
|
|
|
|
#include <sys/cdio.h>
|
|
|
|
#include <sys/disklabel.h>
|
1995-12-08 11:19:42 +00:00
|
|
|
#include <sys/kernel.h>
|
1994-10-23 21:28:03 +00:00
|
|
|
|
1995-03-28 07:58:53 +00:00
|
|
|
#include <machine/clock.h>
|
|
|
|
|
1994-08-13 03:50:34 +00:00
|
|
|
#include <i386/isa/isa_device.h>
|
|
|
|
#include <i386/isa/mcdreg.h>
|
1993-10-12 06:08:31 +00:00
|
|
|
|
1995-05-09 11:39:40 +00:00
|
|
|
#define MCD_TRACE(format, args...) \
|
|
|
|
{ \
|
|
|
|
if (mcd_data[unit].debug) { \
|
|
|
|
printf("mcd%d: status=0x%02x: ", \
|
|
|
|
unit, mcd_data[unit].status); \
|
|
|
|
printf(format, ## args); \
|
|
|
|
} \
|
|
|
|
}
|
1993-10-12 06:08:31 +00:00
|
|
|
|
|
|
|
#define mcd_part(dev) ((minor(dev)) & 7)
|
|
|
|
#define mcd_unit(dev) (((minor(dev)) & 0x38) >> 3)
|
|
|
|
#define mcd_phys(dev) (((minor(dev)) & 0x40) >> 6)
|
1994-08-29 21:19:27 +00:00
|
|
|
#define RAW_PART 2
|
1993-10-12 06:08:31 +00:00
|
|
|
|
|
|
|
/* flags */
|
1996-03-17 13:33:42 +00:00
|
|
|
#define MCDVALID 0x0001 /* parameters loaded */
|
|
|
|
#define MCDINIT 0x0002 /* device is init'd */
|
|
|
|
#define MCDNEWMODEL 0x0004 /* device is new model */
|
|
|
|
#define MCDLABEL 0x0008 /* label is read */
|
|
|
|
#define MCDPROBING 0x0010 /* probing */
|
|
|
|
#define MCDREADRAW 0x0020 /* read raw mode (2352 bytes) */
|
|
|
|
#define MCDVOLINFO 0x0040 /* already read volinfo */
|
|
|
|
#define MCDTOC 0x0080 /* already read toc */
|
|
|
|
#define MCDMBXBSY 0x0100 /* local mbx is busy */
|
1993-10-12 06:08:31 +00:00
|
|
|
|
|
|
|
/* status */
|
|
|
|
#define MCDAUDIOBSY MCD_ST_AUDIOBSY /* playing audio */
|
|
|
|
#define MCDDSKCHNG MCD_ST_DSKCHNG /* sensed change of disk */
|
|
|
|
#define MCDDSKIN MCD_ST_DSKIN /* sensed disk in drive */
|
|
|
|
#define MCDDOOROPEN MCD_ST_DOOROPEN /* sensed door open */
|
|
|
|
|
1994-03-06 14:14:49 +00:00
|
|
|
/* These are apparently the different states a mitsumi can get up to */
|
|
|
|
#define MCDCDABSENT 0x0030
|
|
|
|
#define MCDCDPRESENT 0x0020
|
|
|
|
#define MCDSCLOSED 0x0080
|
|
|
|
#define MCDSOPEN 0x00a0
|
1994-03-05 03:54:19 +00:00
|
|
|
|
Newly implemented ioctls list:
DIOCGDINFO, DIOCGPART, DIOCWDINFO, DIOCSDINFO, CDIOCPLAYMSF, CDIOCRESET,
CDIOCEJECT.
CDIOCPLAYBLOCKS removed (old implementation completely wrong and I don't
know how to implement it correctly).
All routines now detects media change correctly.
DELAY_GETREPLAY increased for long time access from first track
to last.
mcd_waitrdy() now use MIN_DELAY=15 as minimal delay which independs
of machine speed.
mcd_doread() now uses real status (old code uses obsoleted soft copy of it).
clear XBSY on error in mcd_doread()
mcd_statrt(): add missing splx(s), cause dead hang with unmatched slpbio()
optimize mcd_doread(), don't set CD mode each time, keep soft copy of mode.
call getdisklabel() _after_ mcdsize() for proper sizes
mcdopen(): old code forget to set MCDREADRAW in flags when open RAW
partition, doread check it for setting RAW CD mode.
Do nothing on stray interrupt (which sometimes occurse, because driver
read data block too slow, DOS driver use 'insb' here). Old stray code
cause timeouts.
Read toc entries code rewritten to return many requested entries
(as supposed) instead of one entry with incorrect structure.
CMDREAD2 requests covered with disable_intr()/enable_intr()
(from DOS driver)
Read junk code added after read block code in doread (from DOS driver)
mcd_read_toc() code fixed to read all needed entries, old code cause
some audio tracks is not played.
mcd_playtracks() code fixed to proper check valid track range.
New binary read modes implemented (from DOS driver).
1994-09-03 16:48:13 +00:00
|
|
|
#define MCD_MD_UNKNOWN (-1)
|
|
|
|
|
1993-10-12 06:08:31 +00:00
|
|
|
/* toc */
|
|
|
|
#define MCD_MAXTOCS 104 /* from the Linux driver */
|
|
|
|
#define MCD_LASTPLUS1 170 /* special toc entry */
|
|
|
|
|
1994-11-14 19:25:43 +00:00
|
|
|
#define MCD_TYPE_UNKNOWN 0
|
|
|
|
#define MCD_TYPE_LU002S 1
|
|
|
|
#define MCD_TYPE_LU005S 2
|
1996-02-03 00:06:49 +00:00
|
|
|
#define MCD_TYPE_LU006S 3
|
|
|
|
#define MCD_TYPE_FX001 4
|
|
|
|
#define MCD_TYPE_FX001D 5
|
1994-11-14 19:25:43 +00:00
|
|
|
|
1993-10-12 06:08:31 +00:00
|
|
|
struct mcd_mbx {
|
|
|
|
short unit;
|
|
|
|
short port;
|
|
|
|
short retry;
|
|
|
|
short nblk;
|
|
|
|
int sz;
|
|
|
|
u_long skip;
|
|
|
|
struct buf *bp;
|
|
|
|
int p_offset;
|
|
|
|
short count;
|
Newly implemented ioctls list:
DIOCGDINFO, DIOCGPART, DIOCWDINFO, DIOCSDINFO, CDIOCPLAYMSF, CDIOCRESET,
CDIOCEJECT.
CDIOCPLAYBLOCKS removed (old implementation completely wrong and I don't
know how to implement it correctly).
All routines now detects media change correctly.
DELAY_GETREPLAY increased for long time access from first track
to last.
mcd_waitrdy() now use MIN_DELAY=15 as minimal delay which independs
of machine speed.
mcd_doread() now uses real status (old code uses obsoleted soft copy of it).
clear XBSY on error in mcd_doread()
mcd_statrt(): add missing splx(s), cause dead hang with unmatched slpbio()
optimize mcd_doread(), don't set CD mode each time, keep soft copy of mode.
call getdisklabel() _after_ mcdsize() for proper sizes
mcdopen(): old code forget to set MCDREADRAW in flags when open RAW
partition, doread check it for setting RAW CD mode.
Do nothing on stray interrupt (which sometimes occurse, because driver
read data block too slow, DOS driver use 'insb' here). Old stray code
cause timeouts.
Read toc entries code rewritten to return many requested entries
(as supposed) instead of one entry with incorrect structure.
CMDREAD2 requests covered with disable_intr()/enable_intr()
(from DOS driver)
Read junk code added after read block code in doread (from DOS driver)
mcd_read_toc() code fixed to read all needed entries, old code cause
some audio tracks is not played.
mcd_playtracks() code fixed to proper check valid track range.
New binary read modes implemented (from DOS driver).
1994-09-03 16:48:13 +00:00
|
|
|
short mode;
|
1993-10-12 06:08:31 +00:00
|
|
|
};
|
|
|
|
|
1995-12-10 13:40:44 +00:00
|
|
|
static struct mcd_data {
|
1994-11-14 19:25:43 +00:00
|
|
|
short type;
|
|
|
|
char *name;
|
1993-10-12 06:08:31 +00:00
|
|
|
short config;
|
|
|
|
short flags;
|
1995-01-30 06:44:40 +00:00
|
|
|
u_char read_command;
|
1993-10-12 06:08:31 +00:00
|
|
|
short status;
|
|
|
|
int blksize;
|
|
|
|
u_long disksize;
|
|
|
|
int iobase;
|
|
|
|
struct disklabel dlabel;
|
|
|
|
int partflags[MAXPARTITIONS];
|
|
|
|
int openflags;
|
|
|
|
struct mcd_volinfo volinfo;
|
|
|
|
struct mcd_qchninfo toc[MCD_MAXTOCS];
|
|
|
|
short audio_status;
|
Newly implemented ioctls list:
DIOCGDINFO, DIOCGPART, DIOCWDINFO, DIOCSDINFO, CDIOCPLAYMSF, CDIOCRESET,
CDIOCEJECT.
CDIOCPLAYBLOCKS removed (old implementation completely wrong and I don't
know how to implement it correctly).
All routines now detects media change correctly.
DELAY_GETREPLAY increased for long time access from first track
to last.
mcd_waitrdy() now use MIN_DELAY=15 as minimal delay which independs
of machine speed.
mcd_doread() now uses real status (old code uses obsoleted soft copy of it).
clear XBSY on error in mcd_doread()
mcd_statrt(): add missing splx(s), cause dead hang with unmatched slpbio()
optimize mcd_doread(), don't set CD mode each time, keep soft copy of mode.
call getdisklabel() _after_ mcdsize() for proper sizes
mcdopen(): old code forget to set MCDREADRAW in flags when open RAW
partition, doread check it for setting RAW CD mode.
Do nothing on stray interrupt (which sometimes occurse, because driver
read data block too slow, DOS driver use 'insb' here). Old stray code
cause timeouts.
Read toc entries code rewritten to return many requested entries
(as supposed) instead of one entry with incorrect structure.
CMDREAD2 requests covered with disable_intr()/enable_intr()
(from DOS driver)
Read junk code added after read block code in doread (from DOS driver)
mcd_read_toc() code fixed to read all needed entries, old code cause
some audio tracks is not played.
mcd_playtracks() code fixed to proper check valid track range.
New binary read modes implemented (from DOS driver).
1994-09-03 16:48:13 +00:00
|
|
|
short curr_mode;
|
1993-10-12 06:08:31 +00:00
|
|
|
struct mcd_read2 lastpb;
|
|
|
|
short debug;
|
1996-05-03 14:57:27 +00:00
|
|
|
struct buf_queue_head head; /* head of buf queue */
|
1993-10-12 06:08:31 +00:00
|
|
|
struct mcd_mbx mbx;
|
|
|
|
} mcd_data[NMCD];
|
|
|
|
|
|
|
|
/* reader state machine */
|
|
|
|
#define MCD_S_BEGIN 0
|
|
|
|
#define MCD_S_BEGIN1 1
|
|
|
|
#define MCD_S_WAITSTAT 2
|
|
|
|
#define MCD_S_WAITMODE 3
|
|
|
|
#define MCD_S_WAITREAD 4
|
|
|
|
|
|
|
|
/* prototypes */
|
|
|
|
static void mcd_start(int unit);
|
|
|
|
static int mcd_getdisklabel(int unit);
|
1995-10-28 15:39:31 +00:00
|
|
|
#ifdef NOTYET
|
1993-10-12 06:08:31 +00:00
|
|
|
static void mcd_configure(struct mcd_data *cd);
|
1995-10-28 15:39:31 +00:00
|
|
|
#endif
|
1993-10-12 06:08:31 +00:00
|
|
|
static int mcd_get(int unit, char *buf, int nmax);
|
Newly implemented ioctls list:
DIOCGDINFO, DIOCGPART, DIOCWDINFO, DIOCSDINFO, CDIOCPLAYMSF, CDIOCRESET,
CDIOCEJECT.
CDIOCPLAYBLOCKS removed (old implementation completely wrong and I don't
know how to implement it correctly).
All routines now detects media change correctly.
DELAY_GETREPLAY increased for long time access from first track
to last.
mcd_waitrdy() now use MIN_DELAY=15 as minimal delay which independs
of machine speed.
mcd_doread() now uses real status (old code uses obsoleted soft copy of it).
clear XBSY on error in mcd_doread()
mcd_statrt(): add missing splx(s), cause dead hang with unmatched slpbio()
optimize mcd_doread(), don't set CD mode each time, keep soft copy of mode.
call getdisklabel() _after_ mcdsize() for proper sizes
mcdopen(): old code forget to set MCDREADRAW in flags when open RAW
partition, doread check it for setting RAW CD mode.
Do nothing on stray interrupt (which sometimes occurse, because driver
read data block too slow, DOS driver use 'insb' here). Old stray code
cause timeouts.
Read toc entries code rewritten to return many requested entries
(as supposed) instead of one entry with incorrect structure.
CMDREAD2 requests covered with disable_intr()/enable_intr()
(from DOS driver)
Read junk code added after read block code in doread (from DOS driver)
mcd_read_toc() code fixed to read all needed entries, old code cause
some audio tracks is not played.
mcd_playtracks() code fixed to proper check valid track range.
New binary read modes implemented (from DOS driver).
1994-09-03 16:48:13 +00:00
|
|
|
static int mcd_setflags(int unit,struct mcd_data *cd);
|
1993-10-12 06:08:31 +00:00
|
|
|
static int mcd_getstat(int unit,int sflg);
|
|
|
|
static int mcd_send(int unit, int cmd,int nretrys);
|
|
|
|
static void hsg2msf(int hsg, bcd_t *msf);
|
1996-01-30 23:27:20 +00:00
|
|
|
static int msf2hsg(bcd_t *msf, int relative);
|
1993-10-12 06:08:31 +00:00
|
|
|
static int mcd_volinfo(int unit);
|
1998-10-22 05:58:45 +00:00
|
|
|
static ointhand2_t mcdintr;
|
1993-10-12 06:08:31 +00:00
|
|
|
static int mcd_waitrdy(int port,int dly);
|
1997-04-20 17:26:55 +00:00
|
|
|
static timeout_t mcd_timeout;
|
1994-01-16 23:34:17 +00:00
|
|
|
static void mcd_doread(int state, struct mcd_mbx *mbxin);
|
Newly implemented ioctls list:
DIOCGDINFO, DIOCGPART, DIOCWDINFO, DIOCSDINFO, CDIOCPLAYMSF, CDIOCRESET,
CDIOCEJECT.
CDIOCPLAYBLOCKS removed (old implementation completely wrong and I don't
know how to implement it correctly).
All routines now detects media change correctly.
DELAY_GETREPLAY increased for long time access from first track
to last.
mcd_waitrdy() now use MIN_DELAY=15 as minimal delay which independs
of machine speed.
mcd_doread() now uses real status (old code uses obsoleted soft copy of it).
clear XBSY on error in mcd_doread()
mcd_statrt(): add missing splx(s), cause dead hang with unmatched slpbio()
optimize mcd_doread(), don't set CD mode each time, keep soft copy of mode.
call getdisklabel() _after_ mcdsize() for proper sizes
mcdopen(): old code forget to set MCDREADRAW in flags when open RAW
partition, doread check it for setting RAW CD mode.
Do nothing on stray interrupt (which sometimes occurse, because driver
read data block too slow, DOS driver use 'insb' here). Old stray code
cause timeouts.
Read toc entries code rewritten to return many requested entries
(as supposed) instead of one entry with incorrect structure.
CMDREAD2 requests covered with disable_intr()/enable_intr()
(from DOS driver)
Read junk code added after read block code in doread (from DOS driver)
mcd_read_toc() code fixed to read all needed entries, old code cause
some audio tracks is not played.
mcd_playtracks() code fixed to proper check valid track range.
New binary read modes implemented (from DOS driver).
1994-09-03 16:48:13 +00:00
|
|
|
static void mcd_soft_reset(int unit);
|
|
|
|
static int mcd_hard_reset(int unit);
|
1993-10-12 06:08:31 +00:00
|
|
|
static int mcd_setmode(int unit, int mode);
|
|
|
|
static int mcd_getqchan(int unit, struct mcd_qchninfo *q);
|
|
|
|
static int mcd_subchan(int unit, struct ioc_read_subchannel *sc);
|
|
|
|
static int mcd_toc_header(int unit, struct ioc_toc_header *th);
|
|
|
|
static int mcd_read_toc(int unit);
|
Newly implemented ioctls list:
DIOCGDINFO, DIOCGPART, DIOCWDINFO, DIOCSDINFO, CDIOCPLAYMSF, CDIOCRESET,
CDIOCEJECT.
CDIOCPLAYBLOCKS removed (old implementation completely wrong and I don't
know how to implement it correctly).
All routines now detects media change correctly.
DELAY_GETREPLAY increased for long time access from first track
to last.
mcd_waitrdy() now use MIN_DELAY=15 as minimal delay which independs
of machine speed.
mcd_doread() now uses real status (old code uses obsoleted soft copy of it).
clear XBSY on error in mcd_doread()
mcd_statrt(): add missing splx(s), cause dead hang with unmatched slpbio()
optimize mcd_doread(), don't set CD mode each time, keep soft copy of mode.
call getdisklabel() _after_ mcdsize() for proper sizes
mcdopen(): old code forget to set MCDREADRAW in flags when open RAW
partition, doread check it for setting RAW CD mode.
Do nothing on stray interrupt (which sometimes occurse, because driver
read data block too slow, DOS driver use 'insb' here). Old stray code
cause timeouts.
Read toc entries code rewritten to return many requested entries
(as supposed) instead of one entry with incorrect structure.
CMDREAD2 requests covered with disable_intr()/enable_intr()
(from DOS driver)
Read junk code added after read block code in doread (from DOS driver)
mcd_read_toc() code fixed to read all needed entries, old code cause
some audio tracks is not played.
mcd_playtracks() code fixed to proper check valid track range.
New binary read modes implemented (from DOS driver).
1994-09-03 16:48:13 +00:00
|
|
|
static int mcd_toc_entrys(int unit, struct ioc_read_toc_entry *te);
|
1997-11-07 08:53:44 +00:00
|
|
|
#if 0
|
1997-05-04 15:24:23 +00:00
|
|
|
static int mcd_toc_entry(int unit, struct ioc_read_toc_single_entry *te);
|
1997-11-07 08:53:44 +00:00
|
|
|
#endif
|
1993-10-12 06:08:31 +00:00
|
|
|
static int mcd_stop(int unit);
|
Newly implemented ioctls list:
DIOCGDINFO, DIOCGPART, DIOCWDINFO, DIOCSDINFO, CDIOCPLAYMSF, CDIOCRESET,
CDIOCEJECT.
CDIOCPLAYBLOCKS removed (old implementation completely wrong and I don't
know how to implement it correctly).
All routines now detects media change correctly.
DELAY_GETREPLAY increased for long time access from first track
to last.
mcd_waitrdy() now use MIN_DELAY=15 as minimal delay which independs
of machine speed.
mcd_doread() now uses real status (old code uses obsoleted soft copy of it).
clear XBSY on error in mcd_doread()
mcd_statrt(): add missing splx(s), cause dead hang with unmatched slpbio()
optimize mcd_doread(), don't set CD mode each time, keep soft copy of mode.
call getdisklabel() _after_ mcdsize() for proper sizes
mcdopen(): old code forget to set MCDREADRAW in flags when open RAW
partition, doread check it for setting RAW CD mode.
Do nothing on stray interrupt (which sometimes occurse, because driver
read data block too slow, DOS driver use 'insb' here). Old stray code
cause timeouts.
Read toc entries code rewritten to return many requested entries
(as supposed) instead of one entry with incorrect structure.
CMDREAD2 requests covered with disable_intr()/enable_intr()
(from DOS driver)
Read junk code added after read block code in doread (from DOS driver)
mcd_read_toc() code fixed to read all needed entries, old code cause
some audio tracks is not played.
mcd_playtracks() code fixed to proper check valid track range.
New binary read modes implemented (from DOS driver).
1994-09-03 16:48:13 +00:00
|
|
|
static int mcd_eject(int unit);
|
1996-02-02 22:08:28 +00:00
|
|
|
static int mcd_inject(int unit);
|
1993-10-12 06:08:31 +00:00
|
|
|
static int mcd_playtracks(int unit, struct ioc_play_track *pt);
|
|
|
|
static int mcd_play(int unit, struct mcd_read2 *pb);
|
Newly implemented ioctls list:
DIOCGDINFO, DIOCGPART, DIOCWDINFO, DIOCSDINFO, CDIOCPLAYMSF, CDIOCRESET,
CDIOCEJECT.
CDIOCPLAYBLOCKS removed (old implementation completely wrong and I don't
know how to implement it correctly).
All routines now detects media change correctly.
DELAY_GETREPLAY increased for long time access from first track
to last.
mcd_waitrdy() now use MIN_DELAY=15 as minimal delay which independs
of machine speed.
mcd_doread() now uses real status (old code uses obsoleted soft copy of it).
clear XBSY on error in mcd_doread()
mcd_statrt(): add missing splx(s), cause dead hang with unmatched slpbio()
optimize mcd_doread(), don't set CD mode each time, keep soft copy of mode.
call getdisklabel() _after_ mcdsize() for proper sizes
mcdopen(): old code forget to set MCDREADRAW in flags when open RAW
partition, doread check it for setting RAW CD mode.
Do nothing on stray interrupt (which sometimes occurse, because driver
read data block too slow, DOS driver use 'insb' here). Old stray code
cause timeouts.
Read toc entries code rewritten to return many requested entries
(as supposed) instead of one entry with incorrect structure.
CMDREAD2 requests covered with disable_intr()/enable_intr()
(from DOS driver)
Read junk code added after read block code in doread (from DOS driver)
mcd_read_toc() code fixed to read all needed entries, old code cause
some audio tracks is not played.
mcd_playtracks() code fixed to proper check valid track range.
New binary read modes implemented (from DOS driver).
1994-09-03 16:48:13 +00:00
|
|
|
static int mcd_playmsf(int unit, struct ioc_play_msf *pt);
|
1996-02-01 19:15:41 +00:00
|
|
|
static int mcd_playblocks(int unit, struct ioc_play_blocks *);
|
1993-10-12 06:08:31 +00:00
|
|
|
static int mcd_pause(int unit);
|
|
|
|
static int mcd_resume(int unit);
|
1995-02-22 01:11:36 +00:00
|
|
|
static int mcd_lock_door(int unit, int lock);
|
|
|
|
static int mcd_close_tray(int unit);
|
1993-10-12 06:08:31 +00:00
|
|
|
|
1995-10-28 15:39:31 +00:00
|
|
|
static int mcd_probe(struct isa_device *dev);
|
|
|
|
static int mcd_attach(struct isa_device *dev);
|
1993-10-12 06:08:31 +00:00
|
|
|
struct isa_driver mcddriver = { mcd_probe, mcd_attach, "mcd" };
|
|
|
|
|
1995-12-08 11:19:42 +00:00
|
|
|
static d_open_t mcdopen;
|
|
|
|
static d_close_t mcdclose;
|
|
|
|
static d_ioctl_t mcdioctl;
|
|
|
|
static d_psize_t mcdsize;
|
|
|
|
static d_strategy_t mcdstrategy;
|
|
|
|
|
|
|
|
#define CDEV_MAJOR 29
|
|
|
|
#define BDEV_MAJOR 7
|
1998-07-04 22:30:26 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static struct cdevsw mcd_cdevsw = {
|
1999-05-30 16:53:49 +00:00
|
|
|
/* open */ mcdopen,
|
|
|
|
/* close */ mcdclose,
|
|
|
|
/* read */ physread,
|
|
|
|
/* write */ nowrite,
|
|
|
|
/* ioctl */ mcdioctl,
|
|
|
|
/* poll */ nopoll,
|
|
|
|
/* mmap */ nommap,
|
|
|
|
/* strategy */ mcdstrategy,
|
|
|
|
/* name */ "mcd",
|
|
|
|
/* maj */ CDEV_MAJOR,
|
|
|
|
/* dump */ nodump,
|
|
|
|
/* psize */ nopsize,
|
|
|
|
/* flags */ D_DISK,
|
|
|
|
/* bmaj */ BDEV_MAJOR
|
|
|
|
};
|
1995-12-08 11:19:42 +00:00
|
|
|
|
1993-10-12 06:08:31 +00:00
|
|
|
#define mcd_put(port,byte) outb(port,byte)
|
|
|
|
|
|
|
|
#define MCD_RETRYS 5
|
|
|
|
#define MCD_RDRETRYS 8
|
|
|
|
|
1995-02-22 01:11:36 +00:00
|
|
|
#define CLOSE_TRAY_SECS 8
|
|
|
|
#define DISK_SENSE_SECS 3
|
|
|
|
#define WAIT_FRAC 4
|
|
|
|
|
1993-10-12 06:08:31 +00:00
|
|
|
/* several delays */
|
Newly implemented ioctls list:
DIOCGDINFO, DIOCGPART, DIOCWDINFO, DIOCSDINFO, CDIOCPLAYMSF, CDIOCRESET,
CDIOCEJECT.
CDIOCPLAYBLOCKS removed (old implementation completely wrong and I don't
know how to implement it correctly).
All routines now detects media change correctly.
DELAY_GETREPLAY increased for long time access from first track
to last.
mcd_waitrdy() now use MIN_DELAY=15 as minimal delay which independs
of machine speed.
mcd_doread() now uses real status (old code uses obsoleted soft copy of it).
clear XBSY on error in mcd_doread()
mcd_statrt(): add missing splx(s), cause dead hang with unmatched slpbio()
optimize mcd_doread(), don't set CD mode each time, keep soft copy of mode.
call getdisklabel() _after_ mcdsize() for proper sizes
mcdopen(): old code forget to set MCDREADRAW in flags when open RAW
partition, doread check it for setting RAW CD mode.
Do nothing on stray interrupt (which sometimes occurse, because driver
read data block too slow, DOS driver use 'insb' here). Old stray code
cause timeouts.
Read toc entries code rewritten to return many requested entries
(as supposed) instead of one entry with incorrect structure.
CMDREAD2 requests covered with disable_intr()/enable_intr()
(from DOS driver)
Read junk code added after read block code in doread (from DOS driver)
mcd_read_toc() code fixed to read all needed entries, old code cause
some audio tracks is not played.
mcd_playtracks() code fixed to proper check valid track range.
New binary read modes implemented (from DOS driver).
1994-09-03 16:48:13 +00:00
|
|
|
#define RDELAY_WAITSTAT 300
|
|
|
|
#define RDELAY_WAITMODE 300
|
1993-10-12 06:08:31 +00:00
|
|
|
#define RDELAY_WAITREAD 800
|
|
|
|
|
Newly implemented ioctls list:
DIOCGDINFO, DIOCGPART, DIOCWDINFO, DIOCSDINFO, CDIOCPLAYMSF, CDIOCRESET,
CDIOCEJECT.
CDIOCPLAYBLOCKS removed (old implementation completely wrong and I don't
know how to implement it correctly).
All routines now detects media change correctly.
DELAY_GETREPLAY increased for long time access from first track
to last.
mcd_waitrdy() now use MIN_DELAY=15 as minimal delay which independs
of machine speed.
mcd_doread() now uses real status (old code uses obsoleted soft copy of it).
clear XBSY on error in mcd_doread()
mcd_statrt(): add missing splx(s), cause dead hang with unmatched slpbio()
optimize mcd_doread(), don't set CD mode each time, keep soft copy of mode.
call getdisklabel() _after_ mcdsize() for proper sizes
mcdopen(): old code forget to set MCDREADRAW in flags when open RAW
partition, doread check it for setting RAW CD mode.
Do nothing on stray interrupt (which sometimes occurse, because driver
read data block too slow, DOS driver use 'insb' here). Old stray code
cause timeouts.
Read toc entries code rewritten to return many requested entries
(as supposed) instead of one entry with incorrect structure.
CMDREAD2 requests covered with disable_intr()/enable_intr()
(from DOS driver)
Read junk code added after read block code in doread (from DOS driver)
mcd_read_toc() code fixed to read all needed entries, old code cause
some audio tracks is not played.
mcd_playtracks() code fixed to proper check valid track range.
New binary read modes implemented (from DOS driver).
1994-09-03 16:48:13 +00:00
|
|
|
#define MIN_DELAY 15
|
1995-08-15 19:56:59 +00:00
|
|
|
#define DELAY_GETREPLY 5000000
|
1993-10-12 06:08:31 +00:00
|
|
|
|
|
|
|
int mcd_attach(struct isa_device *dev)
|
|
|
|
{
|
1995-12-08 11:19:42 +00:00
|
|
|
int unit = dev->id_unit;
|
|
|
|
struct mcd_data *cd = mcd_data + unit;
|
1995-05-30 08:16:23 +00:00
|
|
|
|
1998-10-22 05:58:45 +00:00
|
|
|
dev->id_ointr = mcdintr;
|
1993-10-12 06:08:31 +00:00
|
|
|
cd->iobase = dev->id_iobase;
|
|
|
|
cd->flags |= MCDINIT;
|
1995-12-08 11:19:42 +00:00
|
|
|
mcd_soft_reset(unit);
|
1997-09-21 21:41:49 +00:00
|
|
|
bufq_init(&cd->head);
|
1993-10-12 06:08:31 +00:00
|
|
|
|
|
|
|
#ifdef NOTYET
|
|
|
|
/* wire controller for interrupts and dma */
|
|
|
|
mcd_configure(cd);
|
|
|
|
#endif
|
1994-11-14 19:25:43 +00:00
|
|
|
/* name filled in probe */
|
1999-08-23 20:59:21 +00:00
|
|
|
make_dev(&mcd_cdevsw, dkmakeminor(unit, 0, 0),
|
|
|
|
UID_ROOT, GID_OPERATOR, 0640, "rmcd%da", unit);
|
|
|
|
make_dev(&mcd_cdevsw, dkmakeminor(unit, 0, RAW_PART),
|
|
|
|
UID_ROOT, GID_OPERATOR, 0640, "rmcd%dc", unit);
|
|
|
|
make_dev(&mcd_cdevsw, dkmakeminor(unit, 0, 0),
|
|
|
|
UID_ROOT, GID_OPERATOR, 0640, "mcd%da", unit);
|
|
|
|
make_dev(&mcd_cdevsw, dkmakeminor(unit, 0, RAW_PART),
|
|
|
|
UID_ROOT, GID_OPERATOR, 0640, "mcd%dc", unit);
|
1993-10-12 06:08:31 +00:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
1995-09-08 11:09:15 +00:00
|
|
|
int mcdopen(dev_t dev, int flags, int fmt, struct proc *p)
|
1993-10-12 06:08:31 +00:00
|
|
|
{
|
1995-02-22 01:11:36 +00:00
|
|
|
int unit,part,phys,r,retry;
|
1993-10-12 06:08:31 +00:00
|
|
|
struct mcd_data *cd;
|
1995-05-30 08:16:23 +00:00
|
|
|
|
1993-10-12 06:08:31 +00:00
|
|
|
unit = mcd_unit(dev);
|
|
|
|
if (unit >= NMCD)
|
|
|
|
return ENXIO;
|
|
|
|
|
|
|
|
cd = mcd_data + unit;
|
|
|
|
part = mcd_part(dev);
|
|
|
|
phys = mcd_phys(dev);
|
1995-05-30 08:16:23 +00:00
|
|
|
|
1993-10-12 06:08:31 +00:00
|
|
|
/* not initialized*/
|
|
|
|
if (!(cd->flags & MCDINIT))
|
|
|
|
return ENXIO;
|
|
|
|
|
|
|
|
/* invalidated in the meantime? mark all open part's invalid */
|
|
|
|
if (!(cd->flags & MCDVALID) && cd->openflags)
|
|
|
|
return ENXIO;
|
|
|
|
|
1996-02-02 21:18:02 +00:00
|
|
|
if (mcd_getstat(unit,1) == -1)
|
1995-02-22 01:11:36 +00:00
|
|
|
return EIO;
|
|
|
|
|
|
|
|
if ( (cd->status & (MCDDSKCHNG|MCDDOOROPEN))
|
|
|
|
|| !(cd->status & MCDDSKIN))
|
|
|
|
for (retry = 0; retry < DISK_SENSE_SECS * WAIT_FRAC; retry++) {
|
1996-02-27 18:53:50 +00:00
|
|
|
(void) tsleep((caddr_t)cd, PSOCK | PCATCH, "mcdsn1", hz/WAIT_FRAC);
|
1995-02-22 01:11:36 +00:00
|
|
|
if ((r = mcd_getstat(unit,1)) == -1)
|
|
|
|
return EIO;
|
|
|
|
if (r != -2)
|
|
|
|
break;
|
|
|
|
}
|
1993-10-12 06:08:31 +00:00
|
|
|
|
1996-02-27 18:53:50 +00:00
|
|
|
if (( (cd->status & (MCDDOOROPEN|MCDDSKCHNG))
|
|
|
|
|| !(cd->status & MCDDSKIN)
|
|
|
|
)
|
|
|
|
&& major(dev) == CDEV_MAJOR && part == RAW_PART
|
|
|
|
) {
|
|
|
|
cd->openflags |= (1<<part);
|
1996-03-17 13:33:42 +00:00
|
|
|
if (phys)
|
|
|
|
cd->partflags[part] |= MCDREADRAW;
|
1996-02-27 18:53:50 +00:00
|
|
|
return 0;
|
|
|
|
}
|
Newly implemented ioctls list:
DIOCGDINFO, DIOCGPART, DIOCWDINFO, DIOCSDINFO, CDIOCPLAYMSF, CDIOCRESET,
CDIOCEJECT.
CDIOCPLAYBLOCKS removed (old implementation completely wrong and I don't
know how to implement it correctly).
All routines now detects media change correctly.
DELAY_GETREPLAY increased for long time access from first track
to last.
mcd_waitrdy() now use MIN_DELAY=15 as minimal delay which independs
of machine speed.
mcd_doread() now uses real status (old code uses obsoleted soft copy of it).
clear XBSY on error in mcd_doread()
mcd_statrt(): add missing splx(s), cause dead hang with unmatched slpbio()
optimize mcd_doread(), don't set CD mode each time, keep soft copy of mode.
call getdisklabel() _after_ mcdsize() for proper sizes
mcdopen(): old code forget to set MCDREADRAW in flags when open RAW
partition, doread check it for setting RAW CD mode.
Do nothing on stray interrupt (which sometimes occurse, because driver
read data block too slow, DOS driver use 'insb' here). Old stray code
cause timeouts.
Read toc entries code rewritten to return many requested entries
(as supposed) instead of one entry with incorrect structure.
CMDREAD2 requests covered with disable_intr()/enable_intr()
(from DOS driver)
Read junk code added after read block code in doread (from DOS driver)
mcd_read_toc() code fixed to read all needed entries, old code cause
some audio tracks is not played.
mcd_playtracks() code fixed to proper check valid track range.
New binary read modes implemented (from DOS driver).
1994-09-03 16:48:13 +00:00
|
|
|
if (cd->status & MCDDOOROPEN) {
|
1995-05-09 11:39:40 +00:00
|
|
|
printf("mcd%d: door is open\n", unit);
|
Newly implemented ioctls list:
DIOCGDINFO, DIOCGPART, DIOCWDINFO, DIOCSDINFO, CDIOCPLAYMSF, CDIOCRESET,
CDIOCEJECT.
CDIOCPLAYBLOCKS removed (old implementation completely wrong and I don't
know how to implement it correctly).
All routines now detects media change correctly.
DELAY_GETREPLAY increased for long time access from first track
to last.
mcd_waitrdy() now use MIN_DELAY=15 as minimal delay which independs
of machine speed.
mcd_doread() now uses real status (old code uses obsoleted soft copy of it).
clear XBSY on error in mcd_doread()
mcd_statrt(): add missing splx(s), cause dead hang with unmatched slpbio()
optimize mcd_doread(), don't set CD mode each time, keep soft copy of mode.
call getdisklabel() _after_ mcdsize() for proper sizes
mcdopen(): old code forget to set MCDREADRAW in flags when open RAW
partition, doread check it for setting RAW CD mode.
Do nothing on stray interrupt (which sometimes occurse, because driver
read data block too slow, DOS driver use 'insb' here). Old stray code
cause timeouts.
Read toc entries code rewritten to return many requested entries
(as supposed) instead of one entry with incorrect structure.
CMDREAD2 requests covered with disable_intr()/enable_intr()
(from DOS driver)
Read junk code added after read block code in doread (from DOS driver)
mcd_read_toc() code fixed to read all needed entries, old code cause
some audio tracks is not played.
mcd_playtracks() code fixed to proper check valid track range.
New binary read modes implemented (from DOS driver).
1994-09-03 16:48:13 +00:00
|
|
|
return ENXIO;
|
|
|
|
}
|
|
|
|
if (!(cd->status & MCDDSKIN)) {
|
1995-05-09 11:39:40 +00:00
|
|
|
printf("mcd%d: no CD inside\n", unit);
|
Newly implemented ioctls list:
DIOCGDINFO, DIOCGPART, DIOCWDINFO, DIOCSDINFO, CDIOCPLAYMSF, CDIOCRESET,
CDIOCEJECT.
CDIOCPLAYBLOCKS removed (old implementation completely wrong and I don't
know how to implement it correctly).
All routines now detects media change correctly.
DELAY_GETREPLAY increased for long time access from first track
to last.
mcd_waitrdy() now use MIN_DELAY=15 as minimal delay which independs
of machine speed.
mcd_doread() now uses real status (old code uses obsoleted soft copy of it).
clear XBSY on error in mcd_doread()
mcd_statrt(): add missing splx(s), cause dead hang with unmatched slpbio()
optimize mcd_doread(), don't set CD mode each time, keep soft copy of mode.
call getdisklabel() _after_ mcdsize() for proper sizes
mcdopen(): old code forget to set MCDREADRAW in flags when open RAW
partition, doread check it for setting RAW CD mode.
Do nothing on stray interrupt (which sometimes occurse, because driver
read data block too slow, DOS driver use 'insb' here). Old stray code
cause timeouts.
Read toc entries code rewritten to return many requested entries
(as supposed) instead of one entry with incorrect structure.
CMDREAD2 requests covered with disable_intr()/enable_intr()
(from DOS driver)
Read junk code added after read block code in doread (from DOS driver)
mcd_read_toc() code fixed to read all needed entries, old code cause
some audio tracks is not played.
mcd_playtracks() code fixed to proper check valid track range.
New binary read modes implemented (from DOS driver).
1994-09-03 16:48:13 +00:00
|
|
|
return ENXIO;
|
|
|
|
}
|
1995-02-22 01:11:36 +00:00
|
|
|
if (cd->status & MCDDSKCHNG) {
|
1995-05-09 11:39:40 +00:00
|
|
|
printf("mcd%d: CD not sensed\n", unit);
|
1995-02-22 01:11:36 +00:00
|
|
|
return ENXIO;
|
|
|
|
}
|
1993-10-12 06:08:31 +00:00
|
|
|
|
|
|
|
if (mcdsize(dev) < 0) {
|
1996-02-27 18:53:50 +00:00
|
|
|
if (major(dev) == CDEV_MAJOR && part == RAW_PART) {
|
|
|
|
cd->openflags |= (1<<part);
|
1996-03-17 13:33:42 +00:00
|
|
|
if (phys)
|
|
|
|
cd->partflags[part] |= MCDREADRAW;
|
1996-02-27 18:53:50 +00:00
|
|
|
return 0;
|
|
|
|
}
|
1993-10-12 06:08:31 +00:00
|
|
|
printf("mcd%d: failed to get disk size\n",unit);
|
|
|
|
return ENXIO;
|
|
|
|
} else
|
|
|
|
cd->flags |= MCDVALID;
|
|
|
|
|
Newly implemented ioctls list:
DIOCGDINFO, DIOCGPART, DIOCWDINFO, DIOCSDINFO, CDIOCPLAYMSF, CDIOCRESET,
CDIOCEJECT.
CDIOCPLAYBLOCKS removed (old implementation completely wrong and I don't
know how to implement it correctly).
All routines now detects media change correctly.
DELAY_GETREPLAY increased for long time access from first track
to last.
mcd_waitrdy() now use MIN_DELAY=15 as minimal delay which independs
of machine speed.
mcd_doread() now uses real status (old code uses obsoleted soft copy of it).
clear XBSY on error in mcd_doread()
mcd_statrt(): add missing splx(s), cause dead hang with unmatched slpbio()
optimize mcd_doread(), don't set CD mode each time, keep soft copy of mode.
call getdisklabel() _after_ mcdsize() for proper sizes
mcdopen(): old code forget to set MCDREADRAW in flags when open RAW
partition, doread check it for setting RAW CD mode.
Do nothing on stray interrupt (which sometimes occurse, because driver
read data block too slow, DOS driver use 'insb' here). Old stray code
cause timeouts.
Read toc entries code rewritten to return many requested entries
(as supposed) instead of one entry with incorrect structure.
CMDREAD2 requests covered with disable_intr()/enable_intr()
(from DOS driver)
Read junk code added after read block code in doread (from DOS driver)
mcd_read_toc() code fixed to read all needed entries, old code cause
some audio tracks is not played.
mcd_playtracks() code fixed to proper check valid track range.
New binary read modes implemented (from DOS driver).
1994-09-03 16:48:13 +00:00
|
|
|
/* XXX get a default disklabel */
|
|
|
|
mcd_getdisklabel(unit);
|
|
|
|
|
1995-05-09 11:39:40 +00:00
|
|
|
MCD_TRACE("open: partition=%d, disksize = %ld, blksize=%d\n",
|
|
|
|
part, cd->disksize, cd->blksize);
|
1993-10-12 06:08:31 +00:00
|
|
|
|
1999-09-09 19:08:44 +00:00
|
|
|
dev->si_bsize_phys = cd->blksize;
|
|
|
|
|
1993-10-12 06:08:31 +00:00
|
|
|
if (part == RAW_PART ||
|
|
|
|
(part < cd->dlabel.d_npartitions &&
|
|
|
|
cd->dlabel.d_partitions[part].p_fstype != FS_UNUSED)) {
|
|
|
|
cd->openflags |= (1<<part);
|
1996-03-17 13:33:42 +00:00
|
|
|
if (part == RAW_PART && phys)
|
1993-10-12 06:08:31 +00:00
|
|
|
cd->partflags[part] |= MCDREADRAW;
|
1995-02-22 01:11:36 +00:00
|
|
|
(void) mcd_lock_door(unit, MCD_LK_LOCK);
|
|
|
|
if (!(cd->flags & MCDVALID))
|
|
|
|
return ENXIO;
|
1993-10-12 06:08:31 +00:00
|
|
|
return 0;
|
|
|
|
}
|
1995-05-30 08:16:23 +00:00
|
|
|
|
1993-10-12 06:08:31 +00:00
|
|
|
return ENXIO;
|
|
|
|
}
|
|
|
|
|
1995-09-08 11:09:15 +00:00
|
|
|
int mcdclose(dev_t dev, int flags, int fmt, struct proc *p)
|
1993-10-12 06:08:31 +00:00
|
|
|
{
|
1996-02-27 19:08:39 +00:00
|
|
|
int unit,part;
|
1993-10-12 06:08:31 +00:00
|
|
|
struct mcd_data *cd;
|
1995-05-30 08:16:23 +00:00
|
|
|
|
1993-10-12 06:08:31 +00:00
|
|
|
unit = mcd_unit(dev);
|
|
|
|
if (unit >= NMCD)
|
|
|
|
return ENXIO;
|
|
|
|
|
|
|
|
cd = mcd_data + unit;
|
|
|
|
part = mcd_part(dev);
|
1995-05-30 08:16:23 +00:00
|
|
|
|
1996-03-17 13:33:42 +00:00
|
|
|
if (!(cd->flags & MCDINIT) || !(cd->openflags & (1<<part)))
|
1993-10-12 06:08:31 +00:00
|
|
|
return ENXIO;
|
|
|
|
|
1996-03-17 13:33:42 +00:00
|
|
|
MCD_TRACE("close: partition=%d\n", part);
|
1993-10-12 06:08:31 +00:00
|
|
|
|
1996-03-17 13:33:42 +00:00
|
|
|
(void) mcd_lock_door(unit, MCD_LK_UNLOCK);
|
1993-10-12 06:08:31 +00:00
|
|
|
cd->openflags &= ~(1<<part);
|
1996-03-17 13:33:42 +00:00
|
|
|
cd->partflags[part] &= ~MCDREADRAW;
|
1993-10-12 06:08:31 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
1993-11-25 01:38:01 +00:00
|
|
|
void
|
|
|
|
mcdstrategy(struct buf *bp)
|
1993-10-12 06:08:31 +00:00
|
|
|
{
|
|
|
|
struct mcd_data *cd;
|
|
|
|
int s;
|
1995-05-30 08:16:23 +00:00
|
|
|
|
1993-10-12 06:08:31 +00:00
|
|
|
int unit = mcd_unit(bp->b_dev);
|
|
|
|
|
|
|
|
cd = mcd_data + unit;
|
|
|
|
|
|
|
|
/* test validity */
|
|
|
|
/*MCD_TRACE("strategy: buf=0x%lx, unit=%ld, block#=%ld bcount=%ld\n",
|
|
|
|
bp,unit,bp->b_blkno,bp->b_bcount);*/
|
|
|
|
if (unit >= NMCD || bp->b_blkno < 0) {
|
1995-05-09 11:39:40 +00:00
|
|
|
printf("mcdstrategy: unit = %d, blkno = %ld, bcount = %ld\n",
|
1998-07-13 09:53:11 +00:00
|
|
|
unit, (long)bp->b_blkno, bp->b_bcount);
|
1995-12-22 15:52:07 +00:00
|
|
|
printf("mcd: mcdstratregy failure");
|
1993-10-12 06:08:31 +00:00
|
|
|
bp->b_error = EINVAL;
|
2000-04-02 15:24:56 +00:00
|
|
|
bp->b_ioflags |= BIO_ERROR;
|
1993-10-12 06:08:31 +00:00
|
|
|
goto bad;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* if device invalidated (e.g. media change, door open), error */
|
|
|
|
if (!(cd->flags & MCDVALID)) {
|
1995-05-09 11:39:40 +00:00
|
|
|
MCD_TRACE("strategy: drive not valid\n");
|
1993-10-12 06:08:31 +00:00
|
|
|
bp->b_error = EIO;
|
|
|
|
goto bad;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* read only */
|
2000-03-20 10:44:49 +00:00
|
|
|
if (!(bp->b_iocmd == BIO_READ)) {
|
1993-10-12 06:08:31 +00:00
|
|
|
bp->b_error = EROFS;
|
|
|
|
goto bad;
|
|
|
|
}
|
1995-05-30 08:16:23 +00:00
|
|
|
|
1993-10-12 06:08:31 +00:00
|
|
|
/* no data to read */
|
|
|
|
if (bp->b_bcount == 0)
|
|
|
|
goto done;
|
1995-05-30 08:16:23 +00:00
|
|
|
|
1993-10-12 06:08:31 +00:00
|
|
|
/* for non raw access, check partition limits */
|
|
|
|
if (mcd_part(bp->b_dev) != RAW_PART) {
|
|
|
|
if (!(cd->flags & MCDLABEL)) {
|
|
|
|
bp->b_error = EIO;
|
|
|
|
goto bad;
|
|
|
|
}
|
|
|
|
/* adjust transfer if necessary */
|
|
|
|
if (bounds_check_with_label(bp,&cd->dlabel,1) <= 0) {
|
|
|
|
goto done;
|
|
|
|
}
|
1994-04-20 07:06:57 +00:00
|
|
|
} else {
|
|
|
|
bp->b_pblkno = bp->b_blkno;
|
1994-04-30 17:03:33 +00:00
|
|
|
bp->b_resid = 0;
|
1993-10-12 06:08:31 +00:00
|
|
|
}
|
1995-05-30 08:16:23 +00:00
|
|
|
|
1993-10-12 06:08:31 +00:00
|
|
|
/* queue it */
|
|
|
|
s = splbio();
|
1997-09-21 21:41:49 +00:00
|
|
|
bufqdisksort(&cd->head, bp);
|
1993-10-12 06:08:31 +00:00
|
|
|
splx(s);
|
1995-05-30 08:16:23 +00:00
|
|
|
|
1993-10-12 06:08:31 +00:00
|
|
|
/* now check whether we can perform processing */
|
|
|
|
mcd_start(unit);
|
|
|
|
return;
|
|
|
|
|
|
|
|
bad:
|
2000-04-02 15:24:56 +00:00
|
|
|
bp->b_ioflags |= BIO_ERROR;
|
1993-10-12 06:08:31 +00:00
|
|
|
done:
|
|
|
|
bp->b_resid = bp->b_bcount;
|
|
|
|
biodone(bp);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void mcd_start(int unit)
|
|
|
|
{
|
|
|
|
struct mcd_data *cd = mcd_data + unit;
|
|
|
|
struct partition *p;
|
1996-05-03 14:57:27 +00:00
|
|
|
struct buf *bp;
|
1999-05-06 18:54:19 +00:00
|
|
|
int s = splbio();
|
1995-05-30 08:16:23 +00:00
|
|
|
|
Newly implemented ioctls list:
DIOCGDINFO, DIOCGPART, DIOCWDINFO, DIOCSDINFO, CDIOCPLAYMSF, CDIOCRESET,
CDIOCEJECT.
CDIOCPLAYBLOCKS removed (old implementation completely wrong and I don't
know how to implement it correctly).
All routines now detects media change correctly.
DELAY_GETREPLAY increased for long time access from first track
to last.
mcd_waitrdy() now use MIN_DELAY=15 as minimal delay which independs
of machine speed.
mcd_doread() now uses real status (old code uses obsoleted soft copy of it).
clear XBSY on error in mcd_doread()
mcd_statrt(): add missing splx(s), cause dead hang with unmatched slpbio()
optimize mcd_doread(), don't set CD mode each time, keep soft copy of mode.
call getdisklabel() _after_ mcdsize() for proper sizes
mcdopen(): old code forget to set MCDREADRAW in flags when open RAW
partition, doread check it for setting RAW CD mode.
Do nothing on stray interrupt (which sometimes occurse, because driver
read data block too slow, DOS driver use 'insb' here). Old stray code
cause timeouts.
Read toc entries code rewritten to return many requested entries
(as supposed) instead of one entry with incorrect structure.
CMDREAD2 requests covered with disable_intr()/enable_intr()
(from DOS driver)
Read junk code added after read block code in doread (from DOS driver)
mcd_read_toc() code fixed to read all needed entries, old code cause
some audio tracks is not played.
mcd_playtracks() code fixed to proper check valid track range.
New binary read modes implemented (from DOS driver).
1994-09-03 16:48:13 +00:00
|
|
|
if (cd->flags & MCDMBXBSY) {
|
|
|
|
splx(s);
|
1993-10-12 06:08:31 +00:00
|
|
|
return;
|
Newly implemented ioctls list:
DIOCGDINFO, DIOCGPART, DIOCWDINFO, DIOCSDINFO, CDIOCPLAYMSF, CDIOCRESET,
CDIOCEJECT.
CDIOCPLAYBLOCKS removed (old implementation completely wrong and I don't
know how to implement it correctly).
All routines now detects media change correctly.
DELAY_GETREPLAY increased for long time access from first track
to last.
mcd_waitrdy() now use MIN_DELAY=15 as minimal delay which independs
of machine speed.
mcd_doread() now uses real status (old code uses obsoleted soft copy of it).
clear XBSY on error in mcd_doread()
mcd_statrt(): add missing splx(s), cause dead hang with unmatched slpbio()
optimize mcd_doread(), don't set CD mode each time, keep soft copy of mode.
call getdisklabel() _after_ mcdsize() for proper sizes
mcdopen(): old code forget to set MCDREADRAW in flags when open RAW
partition, doread check it for setting RAW CD mode.
Do nothing on stray interrupt (which sometimes occurse, because driver
read data block too slow, DOS driver use 'insb' here). Old stray code
cause timeouts.
Read toc entries code rewritten to return many requested entries
(as supposed) instead of one entry with incorrect structure.
CMDREAD2 requests covered with disable_intr()/enable_intr()
(from DOS driver)
Read junk code added after read block code in doread (from DOS driver)
mcd_read_toc() code fixed to read all needed entries, old code cause
some audio tracks is not played.
mcd_playtracks() code fixed to proper check valid track range.
New binary read modes implemented (from DOS driver).
1994-09-03 16:48:13 +00:00
|
|
|
}
|
1993-10-12 06:08:31 +00:00
|
|
|
|
1997-09-21 21:41:49 +00:00
|
|
|
bp = bufq_first(&cd->head);
|
1996-05-03 14:57:27 +00:00
|
|
|
if (bp != 0) {
|
1993-10-12 06:08:31 +00:00
|
|
|
/* block found to process, dequeue */
|
|
|
|
/*MCD_TRACE("mcd_start: found block bp=0x%x\n",bp,0,0,0);*/
|
1997-09-21 21:41:49 +00:00
|
|
|
bufq_remove(&cd->head, bp);
|
1993-10-12 06:08:31 +00:00
|
|
|
splx(s);
|
|
|
|
} else {
|
|
|
|
/* nothing to do */
|
|
|
|
splx(s);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* changed media? */
|
|
|
|
if (!(cd->flags & MCDVALID)) {
|
1995-05-09 11:39:40 +00:00
|
|
|
MCD_TRACE("mcd_start: drive not valid\n");
|
1993-10-12 06:08:31 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
p = cd->dlabel.d_partitions + mcd_part(bp->b_dev);
|
|
|
|
|
|
|
|
cd->flags |= MCDMBXBSY;
|
Newly implemented ioctls list:
DIOCGDINFO, DIOCGPART, DIOCWDINFO, DIOCSDINFO, CDIOCPLAYMSF, CDIOCRESET,
CDIOCEJECT.
CDIOCPLAYBLOCKS removed (old implementation completely wrong and I don't
know how to implement it correctly).
All routines now detects media change correctly.
DELAY_GETREPLAY increased for long time access from first track
to last.
mcd_waitrdy() now use MIN_DELAY=15 as minimal delay which independs
of machine speed.
mcd_doread() now uses real status (old code uses obsoleted soft copy of it).
clear XBSY on error in mcd_doread()
mcd_statrt(): add missing splx(s), cause dead hang with unmatched slpbio()
optimize mcd_doread(), don't set CD mode each time, keep soft copy of mode.
call getdisklabel() _after_ mcdsize() for proper sizes
mcdopen(): old code forget to set MCDREADRAW in flags when open RAW
partition, doread check it for setting RAW CD mode.
Do nothing on stray interrupt (which sometimes occurse, because driver
read data block too slow, DOS driver use 'insb' here). Old stray code
cause timeouts.
Read toc entries code rewritten to return many requested entries
(as supposed) instead of one entry with incorrect structure.
CMDREAD2 requests covered with disable_intr()/enable_intr()
(from DOS driver)
Read junk code added after read block code in doread (from DOS driver)
mcd_read_toc() code fixed to read all needed entries, old code cause
some audio tracks is not played.
mcd_playtracks() code fixed to proper check valid track range.
New binary read modes implemented (from DOS driver).
1994-09-03 16:48:13 +00:00
|
|
|
if (cd->partflags[mcd_part(bp->b_dev)] & MCDREADRAW)
|
|
|
|
cd->flags |= MCDREADRAW;
|
1993-10-12 06:08:31 +00:00
|
|
|
cd->mbx.unit = unit;
|
|
|
|
cd->mbx.port = cd->iobase;
|
|
|
|
cd->mbx.retry = MCD_RETRYS;
|
|
|
|
cd->mbx.bp = bp;
|
|
|
|
cd->mbx.p_offset = p->p_offset;
|
|
|
|
|
|
|
|
/* calling the read routine */
|
1994-01-16 23:34:17 +00:00
|
|
|
mcd_doread(MCD_S_BEGIN,&(cd->mbx));
|
1993-10-12 06:08:31 +00:00
|
|
|
/* triggers mcd_start, when successful finished */
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
1998-06-07 17:13:14 +00:00
|
|
|
int mcdioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct proc *p)
|
1993-10-12 06:08:31 +00:00
|
|
|
{
|
|
|
|
struct mcd_data *cd;
|
1996-02-27 18:53:50 +00:00
|
|
|
int unit,part,retry,r;
|
1995-05-30 08:16:23 +00:00
|
|
|
|
1993-10-12 06:08:31 +00:00
|
|
|
unit = mcd_unit(dev);
|
|
|
|
part = mcd_part(dev);
|
|
|
|
cd = mcd_data + unit;
|
|
|
|
|
1995-02-22 01:11:36 +00:00
|
|
|
if (mcd_getstat(unit, 1) == -1) /* detect disk change too */
|
1993-10-12 06:08:31 +00:00
|
|
|
return EIO;
|
1998-07-13 09:53:11 +00:00
|
|
|
MCD_TRACE("ioctl called 0x%lx\n", cmd);
|
1993-10-12 06:08:31 +00:00
|
|
|
|
|
|
|
switch (cmd) {
|
1996-02-27 18:53:50 +00:00
|
|
|
case CDIOCSETPATCH:
|
|
|
|
case CDIOCGETVOL:
|
|
|
|
case CDIOCSETVOL:
|
|
|
|
case CDIOCSETMONO:
|
|
|
|
case CDIOCSETSTERIO:
|
|
|
|
case CDIOCSETMUTE:
|
|
|
|
case CDIOCSETLEFT:
|
|
|
|
case CDIOCSETRIGHT:
|
|
|
|
return EINVAL;
|
|
|
|
case CDIOCEJECT:
|
|
|
|
return mcd_eject(unit);
|
|
|
|
case CDIOCSETDEBUG:
|
|
|
|
cd->debug = 1;
|
|
|
|
return 0;
|
|
|
|
case CDIOCCLRDEBUG:
|
|
|
|
cd->debug = 0;
|
|
|
|
return 0;
|
|
|
|
case CDIOCRESET:
|
|
|
|
return mcd_hard_reset(unit);
|
|
|
|
case CDIOCALLOW:
|
|
|
|
return mcd_lock_door(unit, MCD_LK_UNLOCK);
|
|
|
|
case CDIOCPREVENT:
|
|
|
|
return mcd_lock_door(unit, MCD_LK_LOCK);
|
|
|
|
case CDIOCCLOSE:
|
|
|
|
return mcd_inject(unit);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!(cd->flags & MCDVALID)) {
|
|
|
|
if ( major(dev) != CDEV_MAJOR
|
1996-02-27 19:08:39 +00:00
|
|
|
|| part != RAW_PART
|
1996-02-27 18:53:50 +00:00
|
|
|
|| !(cd->openflags & (1<<RAW_PART))
|
|
|
|
)
|
|
|
|
return ENXIO;
|
|
|
|
if ( (cd->status & (MCDDSKCHNG|MCDDOOROPEN))
|
|
|
|
|| !(cd->status & MCDDSKIN))
|
|
|
|
for (retry = 0; retry < DISK_SENSE_SECS * WAIT_FRAC; retry++) {
|
|
|
|
(void) tsleep((caddr_t)cd, PSOCK | PCATCH, "mcdsn2", hz/WAIT_FRAC);
|
|
|
|
if ((r = mcd_getstat(unit,1)) == -1)
|
|
|
|
return EIO;
|
|
|
|
if (r != -2)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if ( (cd->status & (MCDDOOROPEN|MCDDSKCHNG))
|
|
|
|
|| !(cd->status & MCDDSKIN)
|
|
|
|
|| mcdsize(dev) < 0
|
|
|
|
)
|
|
|
|
return ENXIO;
|
|
|
|
cd->flags |= MCDVALID;
|
|
|
|
mcd_getdisklabel(unit);
|
1996-02-27 19:08:39 +00:00
|
|
|
if (mcd_phys(dev))
|
|
|
|
cd->partflags[part] |= MCDREADRAW;
|
1996-02-27 18:53:50 +00:00
|
|
|
(void) mcd_lock_door(unit, MCD_LK_LOCK);
|
1995-02-22 01:11:36 +00:00
|
|
|
if (!(cd->flags & MCDVALID))
|
|
|
|
return ENXIO;
|
1996-02-27 18:53:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
switch (cmd) {
|
1993-10-12 06:08:31 +00:00
|
|
|
case DIOCGDINFO:
|
Newly implemented ioctls list:
DIOCGDINFO, DIOCGPART, DIOCWDINFO, DIOCSDINFO, CDIOCPLAYMSF, CDIOCRESET,
CDIOCEJECT.
CDIOCPLAYBLOCKS removed (old implementation completely wrong and I don't
know how to implement it correctly).
All routines now detects media change correctly.
DELAY_GETREPLAY increased for long time access from first track
to last.
mcd_waitrdy() now use MIN_DELAY=15 as minimal delay which independs
of machine speed.
mcd_doread() now uses real status (old code uses obsoleted soft copy of it).
clear XBSY on error in mcd_doread()
mcd_statrt(): add missing splx(s), cause dead hang with unmatched slpbio()
optimize mcd_doread(), don't set CD mode each time, keep soft copy of mode.
call getdisklabel() _after_ mcdsize() for proper sizes
mcdopen(): old code forget to set MCDREADRAW in flags when open RAW
partition, doread check it for setting RAW CD mode.
Do nothing on stray interrupt (which sometimes occurse, because driver
read data block too slow, DOS driver use 'insb' here). Old stray code
cause timeouts.
Read toc entries code rewritten to return many requested entries
(as supposed) instead of one entry with incorrect structure.
CMDREAD2 requests covered with disable_intr()/enable_intr()
(from DOS driver)
Read junk code added after read block code in doread (from DOS driver)
mcd_read_toc() code fixed to read all needed entries, old code cause
some audio tracks is not played.
mcd_playtracks() code fixed to proper check valid track range.
New binary read modes implemented (from DOS driver).
1994-09-03 16:48:13 +00:00
|
|
|
*(struct disklabel *) addr = cd->dlabel;
|
|
|
|
return 0;
|
1993-10-12 06:08:31 +00:00
|
|
|
case DIOCGPART:
|
Newly implemented ioctls list:
DIOCGDINFO, DIOCGPART, DIOCWDINFO, DIOCSDINFO, CDIOCPLAYMSF, CDIOCRESET,
CDIOCEJECT.
CDIOCPLAYBLOCKS removed (old implementation completely wrong and I don't
know how to implement it correctly).
All routines now detects media change correctly.
DELAY_GETREPLAY increased for long time access from first track
to last.
mcd_waitrdy() now use MIN_DELAY=15 as minimal delay which independs
of machine speed.
mcd_doread() now uses real status (old code uses obsoleted soft copy of it).
clear XBSY on error in mcd_doread()
mcd_statrt(): add missing splx(s), cause dead hang with unmatched slpbio()
optimize mcd_doread(), don't set CD mode each time, keep soft copy of mode.
call getdisklabel() _after_ mcdsize() for proper sizes
mcdopen(): old code forget to set MCDREADRAW in flags when open RAW
partition, doread check it for setting RAW CD mode.
Do nothing on stray interrupt (which sometimes occurse, because driver
read data block too slow, DOS driver use 'insb' here). Old stray code
cause timeouts.
Read toc entries code rewritten to return many requested entries
(as supposed) instead of one entry with incorrect structure.
CMDREAD2 requests covered with disable_intr()/enable_intr()
(from DOS driver)
Read junk code added after read block code in doread (from DOS driver)
mcd_read_toc() code fixed to read all needed entries, old code cause
some audio tracks is not played.
mcd_playtracks() code fixed to proper check valid track range.
New binary read modes implemented (from DOS driver).
1994-09-03 16:48:13 +00:00
|
|
|
((struct partinfo *) addr)->disklab = &cd->dlabel;
|
|
|
|
((struct partinfo *) addr)->part =
|
|
|
|
&cd->dlabel.d_partitions[mcd_part(dev)];
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
/*
|
1995-05-30 08:16:23 +00:00
|
|
|
* a bit silly, but someone might want to test something on a
|
Newly implemented ioctls list:
DIOCGDINFO, DIOCGPART, DIOCWDINFO, DIOCSDINFO, CDIOCPLAYMSF, CDIOCRESET,
CDIOCEJECT.
CDIOCPLAYBLOCKS removed (old implementation completely wrong and I don't
know how to implement it correctly).
All routines now detects media change correctly.
DELAY_GETREPLAY increased for long time access from first track
to last.
mcd_waitrdy() now use MIN_DELAY=15 as minimal delay which independs
of machine speed.
mcd_doread() now uses real status (old code uses obsoleted soft copy of it).
clear XBSY on error in mcd_doread()
mcd_statrt(): add missing splx(s), cause dead hang with unmatched slpbio()
optimize mcd_doread(), don't set CD mode each time, keep soft copy of mode.
call getdisklabel() _after_ mcdsize() for proper sizes
mcdopen(): old code forget to set MCDREADRAW in flags when open RAW
partition, doread check it for setting RAW CD mode.
Do nothing on stray interrupt (which sometimes occurse, because driver
read data block too slow, DOS driver use 'insb' here). Old stray code
cause timeouts.
Read toc entries code rewritten to return many requested entries
(as supposed) instead of one entry with incorrect structure.
CMDREAD2 requests covered with disable_intr()/enable_intr()
(from DOS driver)
Read junk code added after read block code in doread (from DOS driver)
mcd_read_toc() code fixed to read all needed entries, old code cause
some audio tracks is not played.
mcd_playtracks() code fixed to proper check valid track range.
New binary read modes implemented (from DOS driver).
1994-09-03 16:48:13 +00:00
|
|
|
* section of cdrom.
|
|
|
|
*/
|
1993-10-12 06:08:31 +00:00
|
|
|
case DIOCWDINFO:
|
|
|
|
case DIOCSDINFO:
|
Newly implemented ioctls list:
DIOCGDINFO, DIOCGPART, DIOCWDINFO, DIOCSDINFO, CDIOCPLAYMSF, CDIOCRESET,
CDIOCEJECT.
CDIOCPLAYBLOCKS removed (old implementation completely wrong and I don't
know how to implement it correctly).
All routines now detects media change correctly.
DELAY_GETREPLAY increased for long time access from first track
to last.
mcd_waitrdy() now use MIN_DELAY=15 as minimal delay which independs
of machine speed.
mcd_doread() now uses real status (old code uses obsoleted soft copy of it).
clear XBSY on error in mcd_doread()
mcd_statrt(): add missing splx(s), cause dead hang with unmatched slpbio()
optimize mcd_doread(), don't set CD mode each time, keep soft copy of mode.
call getdisklabel() _after_ mcdsize() for proper sizes
mcdopen(): old code forget to set MCDREADRAW in flags when open RAW
partition, doread check it for setting RAW CD mode.
Do nothing on stray interrupt (which sometimes occurse, because driver
read data block too slow, DOS driver use 'insb' here). Old stray code
cause timeouts.
Read toc entries code rewritten to return many requested entries
(as supposed) instead of one entry with incorrect structure.
CMDREAD2 requests covered with disable_intr()/enable_intr()
(from DOS driver)
Read junk code added after read block code in doread (from DOS driver)
mcd_read_toc() code fixed to read all needed entries, old code cause
some audio tracks is not played.
mcd_playtracks() code fixed to proper check valid track range.
New binary read modes implemented (from DOS driver).
1994-09-03 16:48:13 +00:00
|
|
|
if ((flags & FWRITE) == 0)
|
|
|
|
return EBADF;
|
|
|
|
else {
|
|
|
|
return setdisklabel(&cd->dlabel,
|
|
|
|
(struct disklabel *) addr,
|
|
|
|
0);
|
|
|
|
}
|
1993-10-12 06:08:31 +00:00
|
|
|
case DIOCWLABEL:
|
Newly implemented ioctls list:
DIOCGDINFO, DIOCGPART, DIOCWDINFO, DIOCSDINFO, CDIOCPLAYMSF, CDIOCRESET,
CDIOCEJECT.
CDIOCPLAYBLOCKS removed (old implementation completely wrong and I don't
know how to implement it correctly).
All routines now detects media change correctly.
DELAY_GETREPLAY increased for long time access from first track
to last.
mcd_waitrdy() now use MIN_DELAY=15 as minimal delay which independs
of machine speed.
mcd_doread() now uses real status (old code uses obsoleted soft copy of it).
clear XBSY on error in mcd_doread()
mcd_statrt(): add missing splx(s), cause dead hang with unmatched slpbio()
optimize mcd_doread(), don't set CD mode each time, keep soft copy of mode.
call getdisklabel() _after_ mcdsize() for proper sizes
mcdopen(): old code forget to set MCDREADRAW in flags when open RAW
partition, doread check it for setting RAW CD mode.
Do nothing on stray interrupt (which sometimes occurse, because driver
read data block too slow, DOS driver use 'insb' here). Old stray code
cause timeouts.
Read toc entries code rewritten to return many requested entries
(as supposed) instead of one entry with incorrect structure.
CMDREAD2 requests covered with disable_intr()/enable_intr()
(from DOS driver)
Read junk code added after read block code in doread (from DOS driver)
mcd_read_toc() code fixed to read all needed entries, old code cause
some audio tracks is not played.
mcd_playtracks() code fixed to proper check valid track range.
New binary read modes implemented (from DOS driver).
1994-09-03 16:48:13 +00:00
|
|
|
return EBADF;
|
1993-10-12 06:08:31 +00:00
|
|
|
case CDIOCPLAYTRACKS:
|
|
|
|
return mcd_playtracks(unit, (struct ioc_play_track *) addr);
|
|
|
|
case CDIOCPLAYBLOCKS:
|
1996-02-01 19:15:41 +00:00
|
|
|
return mcd_playblocks(unit, (struct ioc_play_blocks *) addr);
|
Newly implemented ioctls list:
DIOCGDINFO, DIOCGPART, DIOCWDINFO, DIOCSDINFO, CDIOCPLAYMSF, CDIOCRESET,
CDIOCEJECT.
CDIOCPLAYBLOCKS removed (old implementation completely wrong and I don't
know how to implement it correctly).
All routines now detects media change correctly.
DELAY_GETREPLAY increased for long time access from first track
to last.
mcd_waitrdy() now use MIN_DELAY=15 as minimal delay which independs
of machine speed.
mcd_doread() now uses real status (old code uses obsoleted soft copy of it).
clear XBSY on error in mcd_doread()
mcd_statrt(): add missing splx(s), cause dead hang with unmatched slpbio()
optimize mcd_doread(), don't set CD mode each time, keep soft copy of mode.
call getdisklabel() _after_ mcdsize() for proper sizes
mcdopen(): old code forget to set MCDREADRAW in flags when open RAW
partition, doread check it for setting RAW CD mode.
Do nothing on stray interrupt (which sometimes occurse, because driver
read data block too slow, DOS driver use 'insb' here). Old stray code
cause timeouts.
Read toc entries code rewritten to return many requested entries
(as supposed) instead of one entry with incorrect structure.
CMDREAD2 requests covered with disable_intr()/enable_intr()
(from DOS driver)
Read junk code added after read block code in doread (from DOS driver)
mcd_read_toc() code fixed to read all needed entries, old code cause
some audio tracks is not played.
mcd_playtracks() code fixed to proper check valid track range.
New binary read modes implemented (from DOS driver).
1994-09-03 16:48:13 +00:00
|
|
|
case CDIOCPLAYMSF:
|
|
|
|
return mcd_playmsf(unit, (struct ioc_play_msf *) addr);
|
1993-10-12 06:08:31 +00:00
|
|
|
case CDIOCREADSUBCHANNEL:
|
|
|
|
return mcd_subchan(unit, (struct ioc_read_subchannel *) addr);
|
|
|
|
case CDIOREADTOCHEADER:
|
|
|
|
return mcd_toc_header(unit, (struct ioc_toc_header *) addr);
|
|
|
|
case CDIOREADTOCENTRYS:
|
Newly implemented ioctls list:
DIOCGDINFO, DIOCGPART, DIOCWDINFO, DIOCSDINFO, CDIOCPLAYMSF, CDIOCRESET,
CDIOCEJECT.
CDIOCPLAYBLOCKS removed (old implementation completely wrong and I don't
know how to implement it correctly).
All routines now detects media change correctly.
DELAY_GETREPLAY increased for long time access from first track
to last.
mcd_waitrdy() now use MIN_DELAY=15 as minimal delay which independs
of machine speed.
mcd_doread() now uses real status (old code uses obsoleted soft copy of it).
clear XBSY on error in mcd_doread()
mcd_statrt(): add missing splx(s), cause dead hang with unmatched slpbio()
optimize mcd_doread(), don't set CD mode each time, keep soft copy of mode.
call getdisklabel() _after_ mcdsize() for proper sizes
mcdopen(): old code forget to set MCDREADRAW in flags when open RAW
partition, doread check it for setting RAW CD mode.
Do nothing on stray interrupt (which sometimes occurse, because driver
read data block too slow, DOS driver use 'insb' here). Old stray code
cause timeouts.
Read toc entries code rewritten to return many requested entries
(as supposed) instead of one entry with incorrect structure.
CMDREAD2 requests covered with disable_intr()/enable_intr()
(from DOS driver)
Read junk code added after read block code in doread (from DOS driver)
mcd_read_toc() code fixed to read all needed entries, old code cause
some audio tracks is not played.
mcd_playtracks() code fixed to proper check valid track range.
New binary read modes implemented (from DOS driver).
1994-09-03 16:48:13 +00:00
|
|
|
return mcd_toc_entrys(unit, (struct ioc_read_toc_entry *) addr);
|
1993-10-12 06:08:31 +00:00
|
|
|
case CDIOCRESUME:
|
|
|
|
return mcd_resume(unit);
|
|
|
|
case CDIOCPAUSE:
|
|
|
|
return mcd_pause(unit);
|
|
|
|
case CDIOCSTART:
|
1996-02-13 02:32:36 +00:00
|
|
|
if (mcd_setmode(unit, MCD_MD_COOKED) != 0)
|
|
|
|
return EIO;
|
|
|
|
return 0;
|
1993-10-12 06:08:31 +00:00
|
|
|
case CDIOCSTOP:
|
|
|
|
return mcd_stop(unit);
|
|
|
|
default:
|
|
|
|
return ENOTTY;
|
|
|
|
}
|
|
|
|
/*NOTREACHED*/
|
|
|
|
}
|
|
|
|
|
|
|
|
/* this could have been taken from scsi/cd.c, but it is not clear
|
|
|
|
* whether the scsi cd driver is linked in
|
|
|
|
*/
|
|
|
|
static int mcd_getdisklabel(int unit)
|
|
|
|
{
|
|
|
|
struct mcd_data *cd = mcd_data + unit;
|
1995-05-30 08:16:23 +00:00
|
|
|
|
1993-10-12 06:08:31 +00:00
|
|
|
if (cd->flags & MCDLABEL)
|
|
|
|
return -1;
|
1995-05-30 08:16:23 +00:00
|
|
|
|
1993-10-12 06:08:31 +00:00
|
|
|
bzero(&cd->dlabel,sizeof(struct disklabel));
|
1994-11-14 19:25:43 +00:00
|
|
|
/* filled with spaces first */
|
|
|
|
strncpy(cd->dlabel.d_typename," ",
|
|
|
|
sizeof(cd->dlabel.d_typename));
|
|
|
|
strncpy(cd->dlabel.d_typename, cd->name,
|
|
|
|
min(strlen(cd->name), sizeof(cd->dlabel.d_typename) - 1));
|
|
|
|
strncpy(cd->dlabel.d_packname,"unknown ",
|
|
|
|
sizeof(cd->dlabel.d_packname));
|
1993-10-12 06:08:31 +00:00
|
|
|
cd->dlabel.d_secsize = cd->blksize;
|
|
|
|
cd->dlabel.d_nsectors = 100;
|
|
|
|
cd->dlabel.d_ntracks = 1;
|
|
|
|
cd->dlabel.d_ncylinders = (cd->disksize/100)+1;
|
|
|
|
cd->dlabel.d_secpercyl = 100;
|
|
|
|
cd->dlabel.d_secperunit = cd->disksize;
|
|
|
|
cd->dlabel.d_rpm = 300;
|
|
|
|
cd->dlabel.d_interleave = 1;
|
|
|
|
cd->dlabel.d_flags = D_REMOVABLE;
|
|
|
|
cd->dlabel.d_npartitions= 1;
|
|
|
|
cd->dlabel.d_partitions[0].p_offset = 0;
|
|
|
|
cd->dlabel.d_partitions[0].p_size = cd->disksize;
|
|
|
|
cd->dlabel.d_partitions[0].p_fstype = 9;
|
|
|
|
cd->dlabel.d_magic = DISKMAGIC;
|
|
|
|
cd->dlabel.d_magic2 = DISKMAGIC;
|
|
|
|
cd->dlabel.d_checksum = dkcksum(&cd->dlabel);
|
1995-05-30 08:16:23 +00:00
|
|
|
|
1993-10-12 06:08:31 +00:00
|
|
|
cd->flags |= MCDLABEL;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int mcdsize(dev_t dev)
|
|
|
|
{
|
|
|
|
int size;
|
|
|
|
int unit = mcd_unit(dev);
|
|
|
|
struct mcd_data *cd = mcd_data + unit;
|
|
|
|
|
Newly implemented ioctls list:
DIOCGDINFO, DIOCGPART, DIOCWDINFO, DIOCSDINFO, CDIOCPLAYMSF, CDIOCRESET,
CDIOCEJECT.
CDIOCPLAYBLOCKS removed (old implementation completely wrong and I don't
know how to implement it correctly).
All routines now detects media change correctly.
DELAY_GETREPLAY increased for long time access from first track
to last.
mcd_waitrdy() now use MIN_DELAY=15 as minimal delay which independs
of machine speed.
mcd_doread() now uses real status (old code uses obsoleted soft copy of it).
clear XBSY on error in mcd_doread()
mcd_statrt(): add missing splx(s), cause dead hang with unmatched slpbio()
optimize mcd_doread(), don't set CD mode each time, keep soft copy of mode.
call getdisklabel() _after_ mcdsize() for proper sizes
mcdopen(): old code forget to set MCDREADRAW in flags when open RAW
partition, doread check it for setting RAW CD mode.
Do nothing on stray interrupt (which sometimes occurse, because driver
read data block too slow, DOS driver use 'insb' here). Old stray code
cause timeouts.
Read toc entries code rewritten to return many requested entries
(as supposed) instead of one entry with incorrect structure.
CMDREAD2 requests covered with disable_intr()/enable_intr()
(from DOS driver)
Read junk code added after read block code in doread (from DOS driver)
mcd_read_toc() code fixed to read all needed entries, old code cause
some audio tracks is not played.
mcd_playtracks() code fixed to proper check valid track range.
New binary read modes implemented (from DOS driver).
1994-09-03 16:48:13 +00:00
|
|
|
if (mcd_volinfo(unit) == 0) {
|
1993-10-12 06:08:31 +00:00
|
|
|
cd->blksize = MCDBLK;
|
1996-01-30 23:27:20 +00:00
|
|
|
size = msf2hsg(cd->volinfo.vol_msf, 0);
|
1993-10-12 06:08:31 +00:00
|
|
|
cd->disksize = size * (MCDBLK/DEV_BSIZE);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***************************************************************
|
|
|
|
* lower level of driver starts here
|
|
|
|
**************************************************************/
|
|
|
|
|
|
|
|
#ifdef NOTDEF
|
1994-02-22 08:44:31 +00:00
|
|
|
static char
|
|
|
|
irqs[] = {
|
1993-10-12 06:08:31 +00:00
|
|
|
0x00,0x00,0x10,0x20,0x00,0x30,0x00,0x00,
|
|
|
|
0x00,0x10,0x40,0x50,0x00,0x00,0x00,0x00
|
|
|
|
};
|
|
|
|
|
1994-02-22 08:44:31 +00:00
|
|
|
static char
|
|
|
|
drqs[] = {
|
1993-10-12 06:08:31 +00:00
|
|
|
0x00,0x01,0x00,0x03,0x00,0x05,0x06,0x07,
|
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
1995-10-28 15:39:31 +00:00
|
|
|
#ifdef NOT_YET
|
1994-02-22 08:44:31 +00:00
|
|
|
static void
|
|
|
|
mcd_configure(struct mcd_data *cd)
|
1993-10-12 06:08:31 +00:00
|
|
|
{
|
|
|
|
outb(cd->iobase+mcd_config,cd->config);
|
|
|
|
}
|
1995-10-28 15:39:31 +00:00
|
|
|
#endif
|
1993-10-12 06:08:31 +00:00
|
|
|
|
1994-02-22 08:44:31 +00:00
|
|
|
/* Wait for non-busy - return 0 on timeout */
|
|
|
|
static int
|
|
|
|
twiddle_thumbs(int port, int unit, int count, char *whine)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < count; i++) {
|
1994-12-24 13:24:02 +00:00
|
|
|
if (!(inb(port+MCD_FLAGS) & MFL_STATUS_NOT_AVAIL))
|
1994-02-22 08:44:31 +00:00
|
|
|
return 1;
|
|
|
|
}
|
1996-01-23 22:55:08 +00:00
|
|
|
if (bootverbose)
|
|
|
|
printf("mcd%d: timeout %s\n", unit, whine);
|
1994-02-22 08:44:31 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
1994-01-16 23:34:17 +00:00
|
|
|
/* check to see if a Mitsumi CD-ROM is attached to the ISA bus */
|
1993-10-12 06:08:31 +00:00
|
|
|
|
1994-02-22 08:44:31 +00:00
|
|
|
int
|
|
|
|
mcd_probe(struct isa_device *dev)
|
1993-10-12 06:08:31 +00:00
|
|
|
{
|
1995-05-30 08:16:23 +00:00
|
|
|
int port = dev->id_iobase;
|
1993-10-12 06:08:31 +00:00
|
|
|
int unit = dev->id_unit;
|
1994-02-22 08:44:31 +00:00
|
|
|
int i, j;
|
|
|
|
unsigned char stbytes[3];
|
1999-05-31 11:29:30 +00:00
|
|
|
static int once;
|
|
|
|
|
|
|
|
if (!once++)
|
|
|
|
cdevsw_add(&mcd_cdevsw);
|
1993-10-12 06:08:31 +00:00
|
|
|
|
|
|
|
mcd_data[unit].flags = MCDPROBING;
|
|
|
|
|
|
|
|
#ifdef NOTDEF
|
|
|
|
/* get irq/drq configuration word */
|
|
|
|
mcd_data[unit].config = irqs[dev->id_irq]; /* | drqs[dev->id_drq];*/
|
|
|
|
#else
|
|
|
|
mcd_data[unit].config = 0;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* send a reset */
|
1994-02-22 08:44:31 +00:00
|
|
|
outb(port+MCD_FLAGS, M_RESET);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* delay awhile by getting any pending garbage (old data) and
|
|
|
|
* throwing it away.
|
|
|
|
*/
|
Newly implemented ioctls list:
DIOCGDINFO, DIOCGPART, DIOCWDINFO, DIOCSDINFO, CDIOCPLAYMSF, CDIOCRESET,
CDIOCEJECT.
CDIOCPLAYBLOCKS removed (old implementation completely wrong and I don't
know how to implement it correctly).
All routines now detects media change correctly.
DELAY_GETREPLAY increased for long time access from first track
to last.
mcd_waitrdy() now use MIN_DELAY=15 as minimal delay which independs
of machine speed.
mcd_doread() now uses real status (old code uses obsoleted soft copy of it).
clear XBSY on error in mcd_doread()
mcd_statrt(): add missing splx(s), cause dead hang with unmatched slpbio()
optimize mcd_doread(), don't set CD mode each time, keep soft copy of mode.
call getdisklabel() _after_ mcdsize() for proper sizes
mcdopen(): old code forget to set MCDREADRAW in flags when open RAW
partition, doread check it for setting RAW CD mode.
Do nothing on stray interrupt (which sometimes occurse, because driver
read data block too slow, DOS driver use 'insb' here). Old stray code
cause timeouts.
Read toc entries code rewritten to return many requested entries
(as supposed) instead of one entry with incorrect structure.
CMDREAD2 requests covered with disable_intr()/enable_intr()
(from DOS driver)
Read junk code added after read block code in doread (from DOS driver)
mcd_read_toc() code fixed to read all needed entries, old code cause
some audio tracks is not played.
mcd_playtracks() code fixed to proper check valid track range.
New binary read modes implemented (from DOS driver).
1994-09-03 16:48:13 +00:00
|
|
|
for (i = 1000000; i != 0; i--)
|
1994-02-22 08:44:31 +00:00
|
|
|
inb(port+MCD_FLAGS);
|
|
|
|
|
|
|
|
/* Get status */
|
|
|
|
outb(port+MCD_DATA, MCD_CMDGETSTAT);
|
Newly implemented ioctls list:
DIOCGDINFO, DIOCGPART, DIOCWDINFO, DIOCSDINFO, CDIOCPLAYMSF, CDIOCRESET,
CDIOCEJECT.
CDIOCPLAYBLOCKS removed (old implementation completely wrong and I don't
know how to implement it correctly).
All routines now detects media change correctly.
DELAY_GETREPLAY increased for long time access from first track
to last.
mcd_waitrdy() now use MIN_DELAY=15 as minimal delay which independs
of machine speed.
mcd_doread() now uses real status (old code uses obsoleted soft copy of it).
clear XBSY on error in mcd_doread()
mcd_statrt(): add missing splx(s), cause dead hang with unmatched slpbio()
optimize mcd_doread(), don't set CD mode each time, keep soft copy of mode.
call getdisklabel() _after_ mcdsize() for proper sizes
mcdopen(): old code forget to set MCDREADRAW in flags when open RAW
partition, doread check it for setting RAW CD mode.
Do nothing on stray interrupt (which sometimes occurse, because driver
read data block too slow, DOS driver use 'insb' here). Old stray code
cause timeouts.
Read toc entries code rewritten to return many requested entries
(as supposed) instead of one entry with incorrect structure.
CMDREAD2 requests covered with disable_intr()/enable_intr()
(from DOS driver)
Read junk code added after read block code in doread (from DOS driver)
mcd_read_toc() code fixed to read all needed entries, old code cause
some audio tracks is not played.
mcd_playtracks() code fixed to proper check valid track range.
New binary read modes implemented (from DOS driver).
1994-09-03 16:48:13 +00:00
|
|
|
if (!twiddle_thumbs(port, unit, 1000000, "getting status"))
|
1994-02-22 08:44:31 +00:00
|
|
|
return 0; /* Timeout */
|
|
|
|
/* Get version information */
|
|
|
|
outb(port+MCD_DATA, MCD_CMDCONTINFO);
|
|
|
|
for (j = 0; j < 3; j++) {
|
Newly implemented ioctls list:
DIOCGDINFO, DIOCGPART, DIOCWDINFO, DIOCSDINFO, CDIOCPLAYMSF, CDIOCRESET,
CDIOCEJECT.
CDIOCPLAYBLOCKS removed (old implementation completely wrong and I don't
know how to implement it correctly).
All routines now detects media change correctly.
DELAY_GETREPLAY increased for long time access from first track
to last.
mcd_waitrdy() now use MIN_DELAY=15 as minimal delay which independs
of machine speed.
mcd_doread() now uses real status (old code uses obsoleted soft copy of it).
clear XBSY on error in mcd_doread()
mcd_statrt(): add missing splx(s), cause dead hang with unmatched slpbio()
optimize mcd_doread(), don't set CD mode each time, keep soft copy of mode.
call getdisklabel() _after_ mcdsize() for proper sizes
mcdopen(): old code forget to set MCDREADRAW in flags when open RAW
partition, doread check it for setting RAW CD mode.
Do nothing on stray interrupt (which sometimes occurse, because driver
read data block too slow, DOS driver use 'insb' here). Old stray code
cause timeouts.
Read toc entries code rewritten to return many requested entries
(as supposed) instead of one entry with incorrect structure.
CMDREAD2 requests covered with disable_intr()/enable_intr()
(from DOS driver)
Read junk code added after read block code in doread (from DOS driver)
mcd_read_toc() code fixed to read all needed entries, old code cause
some audio tracks is not played.
mcd_playtracks() code fixed to proper check valid track range.
New binary read modes implemented (from DOS driver).
1994-09-03 16:48:13 +00:00
|
|
|
if (!twiddle_thumbs(port, unit, 3000, "getting version info"))
|
1994-02-22 08:44:31 +00:00
|
|
|
return 0;
|
|
|
|
stbytes[j] = (inb(port+MCD_DATA) & 0xFF);
|
|
|
|
}
|
1994-12-21 15:17:59 +00:00
|
|
|
if (stbytes[1] == stbytes[2])
|
|
|
|
return 0;
|
1994-12-24 13:24:02 +00:00
|
|
|
if (stbytes[2] >= 4 || stbytes[1] != 'M') {
|
1994-02-22 08:44:31 +00:00
|
|
|
outb(port+MCD_CTRL, M_PICKLE);
|
Newly implemented ioctls list:
DIOCGDINFO, DIOCGPART, DIOCWDINFO, DIOCSDINFO, CDIOCPLAYMSF, CDIOCRESET,
CDIOCEJECT.
CDIOCPLAYBLOCKS removed (old implementation completely wrong and I don't
know how to implement it correctly).
All routines now detects media change correctly.
DELAY_GETREPLAY increased for long time access from first track
to last.
mcd_waitrdy() now use MIN_DELAY=15 as minimal delay which independs
of machine speed.
mcd_doread() now uses real status (old code uses obsoleted soft copy of it).
clear XBSY on error in mcd_doread()
mcd_statrt(): add missing splx(s), cause dead hang with unmatched slpbio()
optimize mcd_doread(), don't set CD mode each time, keep soft copy of mode.
call getdisklabel() _after_ mcdsize() for proper sizes
mcdopen(): old code forget to set MCDREADRAW in flags when open RAW
partition, doread check it for setting RAW CD mode.
Do nothing on stray interrupt (which sometimes occurse, because driver
read data block too slow, DOS driver use 'insb' here). Old stray code
cause timeouts.
Read toc entries code rewritten to return many requested entries
(as supposed) instead of one entry with incorrect structure.
CMDREAD2 requests covered with disable_intr()/enable_intr()
(from DOS driver)
Read junk code added after read block code in doread (from DOS driver)
mcd_read_toc() code fixed to read all needed entries, old code cause
some audio tracks is not played.
mcd_playtracks() code fixed to proper check valid track range.
New binary read modes implemented (from DOS driver).
1994-09-03 16:48:13 +00:00
|
|
|
mcd_data[unit].flags |= MCDNEWMODEL;
|
1994-02-22 08:44:31 +00:00
|
|
|
}
|
1995-01-30 06:44:40 +00:00
|
|
|
mcd_data[unit].read_command = MCD_CMDSINGLESPEEDREAD;
|
1994-11-14 19:25:43 +00:00
|
|
|
switch (stbytes[1]) {
|
|
|
|
case 'M':
|
1996-02-03 00:06:49 +00:00
|
|
|
if (stbytes[2] <= 2) {
|
|
|
|
mcd_data[unit].type = MCD_TYPE_LU002S;
|
|
|
|
mcd_data[unit].name = "Mitsumi LU002S";
|
|
|
|
} else if (stbytes[2] <= 5) {
|
1994-11-14 19:25:43 +00:00
|
|
|
mcd_data[unit].type = MCD_TYPE_LU005S;
|
|
|
|
mcd_data[unit].name = "Mitsumi LU005S";
|
|
|
|
} else {
|
1996-02-03 00:06:49 +00:00
|
|
|
mcd_data[unit].type = MCD_TYPE_LU006S;
|
|
|
|
mcd_data[unit].name = "Mitsumi LU006S";
|
1994-11-14 19:25:43 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 'F':
|
|
|
|
mcd_data[unit].type = MCD_TYPE_FX001;
|
|
|
|
mcd_data[unit].name = "Mitsumi FX001";
|
|
|
|
break;
|
|
|
|
case 'D':
|
|
|
|
mcd_data[unit].type = MCD_TYPE_FX001D;
|
|
|
|
mcd_data[unit].name = "Mitsumi FX001D";
|
1995-01-30 06:44:40 +00:00
|
|
|
mcd_data[unit].read_command = MCD_CMDDOUBLESPEEDREAD;
|
1994-11-14 19:25:43 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
mcd_data[unit].type = MCD_TYPE_UNKNOWN;
|
|
|
|
mcd_data[unit].name = "Mitsumi ???";
|
|
|
|
break;
|
|
|
|
}
|
1994-12-24 13:24:02 +00:00
|
|
|
printf("mcd%d: type %s, version info: %c %x\n", unit, mcd_data[unit].name,
|
|
|
|
stbytes[1], stbytes[2]);
|
|
|
|
|
1994-02-22 08:44:31 +00:00
|
|
|
return 4;
|
1993-10-12 06:08:31 +00:00
|
|
|
}
|
|
|
|
|
1994-01-16 23:34:17 +00:00
|
|
|
|
1994-02-22 08:44:31 +00:00
|
|
|
static int
|
|
|
|
mcd_waitrdy(int port,int dly)
|
1993-10-12 06:08:31 +00:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
1994-12-24 13:24:02 +00:00
|
|
|
/* wait until flag port senses status ready */
|
Newly implemented ioctls list:
DIOCGDINFO, DIOCGPART, DIOCWDINFO, DIOCSDINFO, CDIOCPLAYMSF, CDIOCRESET,
CDIOCEJECT.
CDIOCPLAYBLOCKS removed (old implementation completely wrong and I don't
know how to implement it correctly).
All routines now detects media change correctly.
DELAY_GETREPLAY increased for long time access from first track
to last.
mcd_waitrdy() now use MIN_DELAY=15 as minimal delay which independs
of machine speed.
mcd_doread() now uses real status (old code uses obsoleted soft copy of it).
clear XBSY on error in mcd_doread()
mcd_statrt(): add missing splx(s), cause dead hang with unmatched slpbio()
optimize mcd_doread(), don't set CD mode each time, keep soft copy of mode.
call getdisklabel() _after_ mcdsize() for proper sizes
mcdopen(): old code forget to set MCDREADRAW in flags when open RAW
partition, doread check it for setting RAW CD mode.
Do nothing on stray interrupt (which sometimes occurse, because driver
read data block too slow, DOS driver use 'insb' here). Old stray code
cause timeouts.
Read toc entries code rewritten to return many requested entries
(as supposed) instead of one entry with incorrect structure.
CMDREAD2 requests covered with disable_intr()/enable_intr()
(from DOS driver)
Read junk code added after read block code in doread (from DOS driver)
mcd_read_toc() code fixed to read all needed entries, old code cause
some audio tracks is not played.
mcd_playtracks() code fixed to proper check valid track range.
New binary read modes implemented (from DOS driver).
1994-09-03 16:48:13 +00:00
|
|
|
for (i=0; i<dly; i+=MIN_DELAY) {
|
1994-12-24 13:24:02 +00:00
|
|
|
if (!(inb(port+MCD_FLAGS) & MFL_STATUS_NOT_AVAIL))
|
1993-10-12 06:08:31 +00:00
|
|
|
return 0;
|
Newly implemented ioctls list:
DIOCGDINFO, DIOCGPART, DIOCWDINFO, DIOCSDINFO, CDIOCPLAYMSF, CDIOCRESET,
CDIOCEJECT.
CDIOCPLAYBLOCKS removed (old implementation completely wrong and I don't
know how to implement it correctly).
All routines now detects media change correctly.
DELAY_GETREPLAY increased for long time access from first track
to last.
mcd_waitrdy() now use MIN_DELAY=15 as minimal delay which independs
of machine speed.
mcd_doread() now uses real status (old code uses obsoleted soft copy of it).
clear XBSY on error in mcd_doread()
mcd_statrt(): add missing splx(s), cause dead hang with unmatched slpbio()
optimize mcd_doread(), don't set CD mode each time, keep soft copy of mode.
call getdisklabel() _after_ mcdsize() for proper sizes
mcdopen(): old code forget to set MCDREADRAW in flags when open RAW
partition, doread check it for setting RAW CD mode.
Do nothing on stray interrupt (which sometimes occurse, because driver
read data block too slow, DOS driver use 'insb' here). Old stray code
cause timeouts.
Read toc entries code rewritten to return many requested entries
(as supposed) instead of one entry with incorrect structure.
CMDREAD2 requests covered with disable_intr()/enable_intr()
(from DOS driver)
Read junk code added after read block code in doread (from DOS driver)
mcd_read_toc() code fixed to read all needed entries, old code cause
some audio tracks is not played.
mcd_playtracks() code fixed to proper check valid track range.
New binary read modes implemented (from DOS driver).
1994-09-03 16:48:13 +00:00
|
|
|
DELAY(MIN_DELAY);
|
1993-10-12 06:08:31 +00:00
|
|
|
}
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
1994-02-22 08:44:31 +00:00
|
|
|
static int
|
|
|
|
mcd_getreply(int unit,int dly)
|
1993-10-12 06:08:31 +00:00
|
|
|
{
|
|
|
|
struct mcd_data *cd = mcd_data + unit;
|
|
|
|
int port = cd->iobase;
|
|
|
|
|
|
|
|
/* wait data to become ready */
|
|
|
|
if (mcd_waitrdy(port,dly)<0) {
|
|
|
|
printf("mcd%d: timeout getreply\n",unit);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* get the data */
|
|
|
|
return inb(port+mcd_status) & 0xFF;
|
|
|
|
}
|
|
|
|
|
1994-02-22 08:44:31 +00:00
|
|
|
static int
|
|
|
|
mcd_getstat(int unit,int sflg)
|
1993-10-12 06:08:31 +00:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
struct mcd_data *cd = mcd_data + unit;
|
|
|
|
int port = cd->iobase;
|
|
|
|
|
|
|
|
/* get the status */
|
|
|
|
if (sflg)
|
|
|
|
outb(port+mcd_command, MCD_CMDGETSTAT);
|
|
|
|
i = mcd_getreply(unit,DELAY_GETREPLY);
|
1995-02-22 01:11:36 +00:00
|
|
|
if (i<0 || (i & MCD_ST_CMDCHECK)) {
|
|
|
|
cd->curr_mode = MCD_MD_UNKNOWN;
|
|
|
|
return -1;
|
|
|
|
}
|
1993-10-12 06:08:31 +00:00
|
|
|
|
|
|
|
cd->status = i;
|
|
|
|
|
Newly implemented ioctls list:
DIOCGDINFO, DIOCGPART, DIOCWDINFO, DIOCSDINFO, CDIOCPLAYMSF, CDIOCRESET,
CDIOCEJECT.
CDIOCPLAYBLOCKS removed (old implementation completely wrong and I don't
know how to implement it correctly).
All routines now detects media change correctly.
DELAY_GETREPLAY increased for long time access from first track
to last.
mcd_waitrdy() now use MIN_DELAY=15 as minimal delay which independs
of machine speed.
mcd_doread() now uses real status (old code uses obsoleted soft copy of it).
clear XBSY on error in mcd_doread()
mcd_statrt(): add missing splx(s), cause dead hang with unmatched slpbio()
optimize mcd_doread(), don't set CD mode each time, keep soft copy of mode.
call getdisklabel() _after_ mcdsize() for proper sizes
mcdopen(): old code forget to set MCDREADRAW in flags when open RAW
partition, doread check it for setting RAW CD mode.
Do nothing on stray interrupt (which sometimes occurse, because driver
read data block too slow, DOS driver use 'insb' here). Old stray code
cause timeouts.
Read toc entries code rewritten to return many requested entries
(as supposed) instead of one entry with incorrect structure.
CMDREAD2 requests covered with disable_intr()/enable_intr()
(from DOS driver)
Read junk code added after read block code in doread (from DOS driver)
mcd_read_toc() code fixed to read all needed entries, old code cause
some audio tracks is not played.
mcd_playtracks() code fixed to proper check valid track range.
New binary read modes implemented (from DOS driver).
1994-09-03 16:48:13 +00:00
|
|
|
if (mcd_setflags(unit,cd) < 0)
|
|
|
|
return -2;
|
1993-10-12 06:08:31 +00:00
|
|
|
return cd->status;
|
|
|
|
}
|
|
|
|
|
Newly implemented ioctls list:
DIOCGDINFO, DIOCGPART, DIOCWDINFO, DIOCSDINFO, CDIOCPLAYMSF, CDIOCRESET,
CDIOCEJECT.
CDIOCPLAYBLOCKS removed (old implementation completely wrong and I don't
know how to implement it correctly).
All routines now detects media change correctly.
DELAY_GETREPLAY increased for long time access from first track
to last.
mcd_waitrdy() now use MIN_DELAY=15 as minimal delay which independs
of machine speed.
mcd_doread() now uses real status (old code uses obsoleted soft copy of it).
clear XBSY on error in mcd_doread()
mcd_statrt(): add missing splx(s), cause dead hang with unmatched slpbio()
optimize mcd_doread(), don't set CD mode each time, keep soft copy of mode.
call getdisklabel() _after_ mcdsize() for proper sizes
mcdopen(): old code forget to set MCDREADRAW in flags when open RAW
partition, doread check it for setting RAW CD mode.
Do nothing on stray interrupt (which sometimes occurse, because driver
read data block too slow, DOS driver use 'insb' here). Old stray code
cause timeouts.
Read toc entries code rewritten to return many requested entries
(as supposed) instead of one entry with incorrect structure.
CMDREAD2 requests covered with disable_intr()/enable_intr()
(from DOS driver)
Read junk code added after read block code in doread (from DOS driver)
mcd_read_toc() code fixed to read all needed entries, old code cause
some audio tracks is not played.
mcd_playtracks() code fixed to proper check valid track range.
New binary read modes implemented (from DOS driver).
1994-09-03 16:48:13 +00:00
|
|
|
static int
|
1994-02-22 08:44:31 +00:00
|
|
|
mcd_setflags(int unit, struct mcd_data *cd)
|
1993-10-12 06:08:31 +00:00
|
|
|
{
|
|
|
|
/* check flags */
|
Newly implemented ioctls list:
DIOCGDINFO, DIOCGPART, DIOCWDINFO, DIOCSDINFO, CDIOCPLAYMSF, CDIOCRESET,
CDIOCEJECT.
CDIOCPLAYBLOCKS removed (old implementation completely wrong and I don't
know how to implement it correctly).
All routines now detects media change correctly.
DELAY_GETREPLAY increased for long time access from first track
to last.
mcd_waitrdy() now use MIN_DELAY=15 as minimal delay which independs
of machine speed.
mcd_doread() now uses real status (old code uses obsoleted soft copy of it).
clear XBSY on error in mcd_doread()
mcd_statrt(): add missing splx(s), cause dead hang with unmatched slpbio()
optimize mcd_doread(), don't set CD mode each time, keep soft copy of mode.
call getdisklabel() _after_ mcdsize() for proper sizes
mcdopen(): old code forget to set MCDREADRAW in flags when open RAW
partition, doread check it for setting RAW CD mode.
Do nothing on stray interrupt (which sometimes occurse, because driver
read data block too slow, DOS driver use 'insb' here). Old stray code
cause timeouts.
Read toc entries code rewritten to return many requested entries
(as supposed) instead of one entry with incorrect structure.
CMDREAD2 requests covered with disable_intr()/enable_intr()
(from DOS driver)
Read junk code added after read block code in doread (from DOS driver)
mcd_read_toc() code fixed to read all needed entries, old code cause
some audio tracks is not played.
mcd_playtracks() code fixed to proper check valid track range.
New binary read modes implemented (from DOS driver).
1994-09-03 16:48:13 +00:00
|
|
|
if ( (cd->status & (MCDDSKCHNG|MCDDOOROPEN))
|
|
|
|
|| !(cd->status & MCDDSKIN)) {
|
1995-05-09 11:39:40 +00:00
|
|
|
MCD_TRACE("setflags: sensed DSKCHNG or DOOROPEN or !DSKIN\n");
|
Newly implemented ioctls list:
DIOCGDINFO, DIOCGPART, DIOCWDINFO, DIOCSDINFO, CDIOCPLAYMSF, CDIOCRESET,
CDIOCEJECT.
CDIOCPLAYBLOCKS removed (old implementation completely wrong and I don't
know how to implement it correctly).
All routines now detects media change correctly.
DELAY_GETREPLAY increased for long time access from first track
to last.
mcd_waitrdy() now use MIN_DELAY=15 as minimal delay which independs
of machine speed.
mcd_doread() now uses real status (old code uses obsoleted soft copy of it).
clear XBSY on error in mcd_doread()
mcd_statrt(): add missing splx(s), cause dead hang with unmatched slpbio()
optimize mcd_doread(), don't set CD mode each time, keep soft copy of mode.
call getdisklabel() _after_ mcdsize() for proper sizes
mcdopen(): old code forget to set MCDREADRAW in flags when open RAW
partition, doread check it for setting RAW CD mode.
Do nothing on stray interrupt (which sometimes occurse, because driver
read data block too slow, DOS driver use 'insb' here). Old stray code
cause timeouts.
Read toc entries code rewritten to return many requested entries
(as supposed) instead of one entry with incorrect structure.
CMDREAD2 requests covered with disable_intr()/enable_intr()
(from DOS driver)
Read junk code added after read block code in doread (from DOS driver)
mcd_read_toc() code fixed to read all needed entries, old code cause
some audio tracks is not played.
mcd_playtracks() code fixed to proper check valid track range.
New binary read modes implemented (from DOS driver).
1994-09-03 16:48:13 +00:00
|
|
|
mcd_soft_reset(unit);
|
|
|
|
return -1;
|
1993-10-12 06:08:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (cd->status & MCDAUDIOBSY)
|
|
|
|
cd->audio_status = CD_AS_PLAY_IN_PROGRESS;
|
|
|
|
else if (cd->audio_status == CD_AS_PLAY_IN_PROGRESS)
|
|
|
|
cd->audio_status = CD_AS_PLAY_COMPLETED;
|
Newly implemented ioctls list:
DIOCGDINFO, DIOCGPART, DIOCWDINFO, DIOCSDINFO, CDIOCPLAYMSF, CDIOCRESET,
CDIOCEJECT.
CDIOCPLAYBLOCKS removed (old implementation completely wrong and I don't
know how to implement it correctly).
All routines now detects media change correctly.
DELAY_GETREPLAY increased for long time access from first track
to last.
mcd_waitrdy() now use MIN_DELAY=15 as minimal delay which independs
of machine speed.
mcd_doread() now uses real status (old code uses obsoleted soft copy of it).
clear XBSY on error in mcd_doread()
mcd_statrt(): add missing splx(s), cause dead hang with unmatched slpbio()
optimize mcd_doread(), don't set CD mode each time, keep soft copy of mode.
call getdisklabel() _after_ mcdsize() for proper sizes
mcdopen(): old code forget to set MCDREADRAW in flags when open RAW
partition, doread check it for setting RAW CD mode.
Do nothing on stray interrupt (which sometimes occurse, because driver
read data block too slow, DOS driver use 'insb' here). Old stray code
cause timeouts.
Read toc entries code rewritten to return many requested entries
(as supposed) instead of one entry with incorrect structure.
CMDREAD2 requests covered with disable_intr()/enable_intr()
(from DOS driver)
Read junk code added after read block code in doread (from DOS driver)
mcd_read_toc() code fixed to read all needed entries, old code cause
some audio tracks is not played.
mcd_playtracks() code fixed to proper check valid track range.
New binary read modes implemented (from DOS driver).
1994-09-03 16:48:13 +00:00
|
|
|
return 0;
|
1993-10-12 06:08:31 +00:00
|
|
|
}
|
|
|
|
|
1994-02-22 08:44:31 +00:00
|
|
|
static int
|
|
|
|
mcd_get(int unit, char *buf, int nmax)
|
1993-10-12 06:08:31 +00:00
|
|
|
{
|
|
|
|
int i,k;
|
1995-05-30 08:16:23 +00:00
|
|
|
|
1993-10-12 06:08:31 +00:00
|
|
|
for (i=0; i<nmax; i++) {
|
|
|
|
/* wait for data */
|
|
|
|
if ((k = mcd_getreply(unit,DELAY_GETREPLY)) < 0) {
|
|
|
|
printf("mcd%d: timeout mcd_get\n",unit);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
buf[i] = k;
|
|
|
|
}
|
|
|
|
return i;
|
|
|
|
}
|
|
|
|
|
1994-02-22 08:44:31 +00:00
|
|
|
static int
|
|
|
|
mcd_send(int unit, int cmd,int nretrys)
|
1993-10-12 06:08:31 +00:00
|
|
|
{
|
Newly implemented ioctls list:
DIOCGDINFO, DIOCGPART, DIOCWDINFO, DIOCSDINFO, CDIOCPLAYMSF, CDIOCRESET,
CDIOCEJECT.
CDIOCPLAYBLOCKS removed (old implementation completely wrong and I don't
know how to implement it correctly).
All routines now detects media change correctly.
DELAY_GETREPLAY increased for long time access from first track
to last.
mcd_waitrdy() now use MIN_DELAY=15 as minimal delay which independs
of machine speed.
mcd_doread() now uses real status (old code uses obsoleted soft copy of it).
clear XBSY on error in mcd_doread()
mcd_statrt(): add missing splx(s), cause dead hang with unmatched slpbio()
optimize mcd_doread(), don't set CD mode each time, keep soft copy of mode.
call getdisklabel() _after_ mcdsize() for proper sizes
mcdopen(): old code forget to set MCDREADRAW in flags when open RAW
partition, doread check it for setting RAW CD mode.
Do nothing on stray interrupt (which sometimes occurse, because driver
read data block too slow, DOS driver use 'insb' here). Old stray code
cause timeouts.
Read toc entries code rewritten to return many requested entries
(as supposed) instead of one entry with incorrect structure.
CMDREAD2 requests covered with disable_intr()/enable_intr()
(from DOS driver)
Read junk code added after read block code in doread (from DOS driver)
mcd_read_toc() code fixed to read all needed entries, old code cause
some audio tracks is not played.
mcd_playtracks() code fixed to proper check valid track range.
New binary read modes implemented (from DOS driver).
1994-09-03 16:48:13 +00:00
|
|
|
int i,k=0;
|
1993-10-12 06:08:31 +00:00
|
|
|
int port = mcd_data[unit].iobase;
|
1995-05-30 08:16:23 +00:00
|
|
|
|
Newly implemented ioctls list:
DIOCGDINFO, DIOCGPART, DIOCWDINFO, DIOCSDINFO, CDIOCPLAYMSF, CDIOCRESET,
CDIOCEJECT.
CDIOCPLAYBLOCKS removed (old implementation completely wrong and I don't
know how to implement it correctly).
All routines now detects media change correctly.
DELAY_GETREPLAY increased for long time access from first track
to last.
mcd_waitrdy() now use MIN_DELAY=15 as minimal delay which independs
of machine speed.
mcd_doread() now uses real status (old code uses obsoleted soft copy of it).
clear XBSY on error in mcd_doread()
mcd_statrt(): add missing splx(s), cause dead hang with unmatched slpbio()
optimize mcd_doread(), don't set CD mode each time, keep soft copy of mode.
call getdisklabel() _after_ mcdsize() for proper sizes
mcdopen(): old code forget to set MCDREADRAW in flags when open RAW
partition, doread check it for setting RAW CD mode.
Do nothing on stray interrupt (which sometimes occurse, because driver
read data block too slow, DOS driver use 'insb' here). Old stray code
cause timeouts.
Read toc entries code rewritten to return many requested entries
(as supposed) instead of one entry with incorrect structure.
CMDREAD2 requests covered with disable_intr()/enable_intr()
(from DOS driver)
Read junk code added after read block code in doread (from DOS driver)
mcd_read_toc() code fixed to read all needed entries, old code cause
some audio tracks is not played.
mcd_playtracks() code fixed to proper check valid track range.
New binary read modes implemented (from DOS driver).
1994-09-03 16:48:13 +00:00
|
|
|
/*MCD_TRACE("mcd_send: command = 0x%02x\n",cmd,0,0,0);*/
|
1993-10-12 06:08:31 +00:00
|
|
|
for (i=0; i<nretrys; i++) {
|
|
|
|
outb(port+mcd_command, cmd);
|
Newly implemented ioctls list:
DIOCGDINFO, DIOCGPART, DIOCWDINFO, DIOCSDINFO, CDIOCPLAYMSF, CDIOCRESET,
CDIOCEJECT.
CDIOCPLAYBLOCKS removed (old implementation completely wrong and I don't
know how to implement it correctly).
All routines now detects media change correctly.
DELAY_GETREPLAY increased for long time access from first track
to last.
mcd_waitrdy() now use MIN_DELAY=15 as minimal delay which independs
of machine speed.
mcd_doread() now uses real status (old code uses obsoleted soft copy of it).
clear XBSY on error in mcd_doread()
mcd_statrt(): add missing splx(s), cause dead hang with unmatched slpbio()
optimize mcd_doread(), don't set CD mode each time, keep soft copy of mode.
call getdisklabel() _after_ mcdsize() for proper sizes
mcdopen(): old code forget to set MCDREADRAW in flags when open RAW
partition, doread check it for setting RAW CD mode.
Do nothing on stray interrupt (which sometimes occurse, because driver
read data block too slow, DOS driver use 'insb' here). Old stray code
cause timeouts.
Read toc entries code rewritten to return many requested entries
(as supposed) instead of one entry with incorrect structure.
CMDREAD2 requests covered with disable_intr()/enable_intr()
(from DOS driver)
Read junk code added after read block code in doread (from DOS driver)
mcd_read_toc() code fixed to read all needed entries, old code cause
some audio tracks is not played.
mcd_playtracks() code fixed to proper check valid track range.
New binary read modes implemented (from DOS driver).
1994-09-03 16:48:13 +00:00
|
|
|
if ((k=mcd_getstat(unit,0)) != -1)
|
1993-10-12 06:08:31 +00:00
|
|
|
break;
|
Newly implemented ioctls list:
DIOCGDINFO, DIOCGPART, DIOCWDINFO, DIOCSDINFO, CDIOCPLAYMSF, CDIOCRESET,
CDIOCEJECT.
CDIOCPLAYBLOCKS removed (old implementation completely wrong and I don't
know how to implement it correctly).
All routines now detects media change correctly.
DELAY_GETREPLAY increased for long time access from first track
to last.
mcd_waitrdy() now use MIN_DELAY=15 as minimal delay which independs
of machine speed.
mcd_doread() now uses real status (old code uses obsoleted soft copy of it).
clear XBSY on error in mcd_doread()
mcd_statrt(): add missing splx(s), cause dead hang with unmatched slpbio()
optimize mcd_doread(), don't set CD mode each time, keep soft copy of mode.
call getdisklabel() _after_ mcdsize() for proper sizes
mcdopen(): old code forget to set MCDREADRAW in flags when open RAW
partition, doread check it for setting RAW CD mode.
Do nothing on stray interrupt (which sometimes occurse, because driver
read data block too slow, DOS driver use 'insb' here). Old stray code
cause timeouts.
Read toc entries code rewritten to return many requested entries
(as supposed) instead of one entry with incorrect structure.
CMDREAD2 requests covered with disable_intr()/enable_intr()
(from DOS driver)
Read junk code added after read block code in doread (from DOS driver)
mcd_read_toc() code fixed to read all needed entries, old code cause
some audio tracks is not played.
mcd_playtracks() code fixed to proper check valid track range.
New binary read modes implemented (from DOS driver).
1994-09-03 16:48:13 +00:00
|
|
|
}
|
|
|
|
if (k == -2) {
|
|
|
|
printf("mcd%d: media changed\n",unit);
|
|
|
|
return -1;
|
1993-10-12 06:08:31 +00:00
|
|
|
}
|
|
|
|
if (i == nretrys) {
|
|
|
|
printf("mcd%d: mcd_send retry cnt exceeded\n",unit);
|
|
|
|
return -1;
|
|
|
|
}
|
Newly implemented ioctls list:
DIOCGDINFO, DIOCGPART, DIOCWDINFO, DIOCSDINFO, CDIOCPLAYMSF, CDIOCRESET,
CDIOCEJECT.
CDIOCPLAYBLOCKS removed (old implementation completely wrong and I don't
know how to implement it correctly).
All routines now detects media change correctly.
DELAY_GETREPLAY increased for long time access from first track
to last.
mcd_waitrdy() now use MIN_DELAY=15 as minimal delay which independs
of machine speed.
mcd_doread() now uses real status (old code uses obsoleted soft copy of it).
clear XBSY on error in mcd_doread()
mcd_statrt(): add missing splx(s), cause dead hang with unmatched slpbio()
optimize mcd_doread(), don't set CD mode each time, keep soft copy of mode.
call getdisklabel() _after_ mcdsize() for proper sizes
mcdopen(): old code forget to set MCDREADRAW in flags when open RAW
partition, doread check it for setting RAW CD mode.
Do nothing on stray interrupt (which sometimes occurse, because driver
read data block too slow, DOS driver use 'insb' here). Old stray code
cause timeouts.
Read toc entries code rewritten to return many requested entries
(as supposed) instead of one entry with incorrect structure.
CMDREAD2 requests covered with disable_intr()/enable_intr()
(from DOS driver)
Read junk code added after read block code in doread (from DOS driver)
mcd_read_toc() code fixed to read all needed entries, old code cause
some audio tracks is not played.
mcd_playtracks() code fixed to proper check valid track range.
New binary read modes implemented (from DOS driver).
1994-09-03 16:48:13 +00:00
|
|
|
/*MCD_TRACE("mcd_send: done\n",0,0,0,0);*/
|
1993-10-12 06:08:31 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
1994-02-22 08:44:31 +00:00
|
|
|
static void
|
|
|
|
hsg2msf(int hsg, bcd_t *msf)
|
1993-10-12 06:08:31 +00:00
|
|
|
{
|
|
|
|
hsg += 150;
|
|
|
|
F_msf(msf) = bin2bcd(hsg % 75);
|
1996-01-30 23:27:20 +00:00
|
|
|
hsg /= 75;
|
|
|
|
S_msf(msf) = bin2bcd(hsg % 60);
|
|
|
|
hsg /= 60;
|
|
|
|
M_msf(msf) = bin2bcd(hsg);
|
1993-10-12 06:08:31 +00:00
|
|
|
}
|
|
|
|
|
1994-02-22 08:44:31 +00:00
|
|
|
static int
|
1996-01-30 23:27:20 +00:00
|
|
|
msf2hsg(bcd_t *msf, int relative)
|
1993-10-12 06:08:31 +00:00
|
|
|
{
|
1996-01-30 23:27:20 +00:00
|
|
|
return (bcd2bin(M_msf(msf)) * 60 + bcd2bin(S_msf(msf))) * 75 +
|
|
|
|
bcd2bin(F_msf(msf)) - (!relative) * 150;
|
1993-10-12 06:08:31 +00:00
|
|
|
}
|
|
|
|
|
1994-02-22 08:44:31 +00:00
|
|
|
static int
|
|
|
|
mcd_volinfo(int unit)
|
1993-10-12 06:08:31 +00:00
|
|
|
{
|
|
|
|
struct mcd_data *cd = mcd_data + unit;
|
|
|
|
|
|
|
|
/* Just return if we already have it */
|
|
|
|
if (cd->flags & MCDVOLINFO) return 0;
|
|
|
|
|
Newly implemented ioctls list:
DIOCGDINFO, DIOCGPART, DIOCWDINFO, DIOCSDINFO, CDIOCPLAYMSF, CDIOCRESET,
CDIOCEJECT.
CDIOCPLAYBLOCKS removed (old implementation completely wrong and I don't
know how to implement it correctly).
All routines now detects media change correctly.
DELAY_GETREPLAY increased for long time access from first track
to last.
mcd_waitrdy() now use MIN_DELAY=15 as minimal delay which independs
of machine speed.
mcd_doread() now uses real status (old code uses obsoleted soft copy of it).
clear XBSY on error in mcd_doread()
mcd_statrt(): add missing splx(s), cause dead hang with unmatched slpbio()
optimize mcd_doread(), don't set CD mode each time, keep soft copy of mode.
call getdisklabel() _after_ mcdsize() for proper sizes
mcdopen(): old code forget to set MCDREADRAW in flags when open RAW
partition, doread check it for setting RAW CD mode.
Do nothing on stray interrupt (which sometimes occurse, because driver
read data block too slow, DOS driver use 'insb' here). Old stray code
cause timeouts.
Read toc entries code rewritten to return many requested entries
(as supposed) instead of one entry with incorrect structure.
CMDREAD2 requests covered with disable_intr()/enable_intr()
(from DOS driver)
Read junk code added after read block code in doread (from DOS driver)
mcd_read_toc() code fixed to read all needed entries, old code cause
some audio tracks is not played.
mcd_playtracks() code fixed to proper check valid track range.
New binary read modes implemented (from DOS driver).
1994-09-03 16:48:13 +00:00
|
|
|
/*MCD_TRACE("mcd_volinfo: enter\n",0,0,0,0);*/
|
|
|
|
|
1993-10-12 06:08:31 +00:00
|
|
|
/* send volume info command */
|
|
|
|
if (mcd_send(unit,MCD_CMDGETVOLINFO,MCD_RETRYS) < 0)
|
Newly implemented ioctls list:
DIOCGDINFO, DIOCGPART, DIOCWDINFO, DIOCSDINFO, CDIOCPLAYMSF, CDIOCRESET,
CDIOCEJECT.
CDIOCPLAYBLOCKS removed (old implementation completely wrong and I don't
know how to implement it correctly).
All routines now detects media change correctly.
DELAY_GETREPLAY increased for long time access from first track
to last.
mcd_waitrdy() now use MIN_DELAY=15 as minimal delay which independs
of machine speed.
mcd_doread() now uses real status (old code uses obsoleted soft copy of it).
clear XBSY on error in mcd_doread()
mcd_statrt(): add missing splx(s), cause dead hang with unmatched slpbio()
optimize mcd_doread(), don't set CD mode each time, keep soft copy of mode.
call getdisklabel() _after_ mcdsize() for proper sizes
mcdopen(): old code forget to set MCDREADRAW in flags when open RAW
partition, doread check it for setting RAW CD mode.
Do nothing on stray interrupt (which sometimes occurse, because driver
read data block too slow, DOS driver use 'insb' here). Old stray code
cause timeouts.
Read toc entries code rewritten to return many requested entries
(as supposed) instead of one entry with incorrect structure.
CMDREAD2 requests covered with disable_intr()/enable_intr()
(from DOS driver)
Read junk code added after read block code in doread (from DOS driver)
mcd_read_toc() code fixed to read all needed entries, old code cause
some audio tracks is not played.
mcd_playtracks() code fixed to proper check valid track range.
New binary read modes implemented (from DOS driver).
1994-09-03 16:48:13 +00:00
|
|
|
return EIO;
|
1993-10-12 06:08:31 +00:00
|
|
|
|
|
|
|
/* get data */
|
|
|
|
if (mcd_get(unit,(char*) &cd->volinfo,sizeof(struct mcd_volinfo)) < 0) {
|
|
|
|
printf("mcd%d: mcd_volinfo: error read data\n",unit);
|
Newly implemented ioctls list:
DIOCGDINFO, DIOCGPART, DIOCWDINFO, DIOCSDINFO, CDIOCPLAYMSF, CDIOCRESET,
CDIOCEJECT.
CDIOCPLAYBLOCKS removed (old implementation completely wrong and I don't
know how to implement it correctly).
All routines now detects media change correctly.
DELAY_GETREPLAY increased for long time access from first track
to last.
mcd_waitrdy() now use MIN_DELAY=15 as minimal delay which independs
of machine speed.
mcd_doread() now uses real status (old code uses obsoleted soft copy of it).
clear XBSY on error in mcd_doread()
mcd_statrt(): add missing splx(s), cause dead hang with unmatched slpbio()
optimize mcd_doread(), don't set CD mode each time, keep soft copy of mode.
call getdisklabel() _after_ mcdsize() for proper sizes
mcdopen(): old code forget to set MCDREADRAW in flags when open RAW
partition, doread check it for setting RAW CD mode.
Do nothing on stray interrupt (which sometimes occurse, because driver
read data block too slow, DOS driver use 'insb' here). Old stray code
cause timeouts.
Read toc entries code rewritten to return many requested entries
(as supposed) instead of one entry with incorrect structure.
CMDREAD2 requests covered with disable_intr()/enable_intr()
(from DOS driver)
Read junk code added after read block code in doread (from DOS driver)
mcd_read_toc() code fixed to read all needed entries, old code cause
some audio tracks is not played.
mcd_playtracks() code fixed to proper check valid track range.
New binary read modes implemented (from DOS driver).
1994-09-03 16:48:13 +00:00
|
|
|
return EIO;
|
1993-10-12 06:08:31 +00:00
|
|
|
}
|
|
|
|
|
1995-02-22 01:11:36 +00:00
|
|
|
if (cd->volinfo.trk_low > 0 &&
|
|
|
|
cd->volinfo.trk_high >= cd->volinfo.trk_low
|
|
|
|
) {
|
1993-10-12 06:08:31 +00:00
|
|
|
cd->flags |= MCDVOLINFO; /* volinfo is OK */
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
Newly implemented ioctls list:
DIOCGDINFO, DIOCGPART, DIOCWDINFO, DIOCSDINFO, CDIOCPLAYMSF, CDIOCRESET,
CDIOCEJECT.
CDIOCPLAYBLOCKS removed (old implementation completely wrong and I don't
know how to implement it correctly).
All routines now detects media change correctly.
DELAY_GETREPLAY increased for long time access from first track
to last.
mcd_waitrdy() now use MIN_DELAY=15 as minimal delay which independs
of machine speed.
mcd_doread() now uses real status (old code uses obsoleted soft copy of it).
clear XBSY on error in mcd_doread()
mcd_statrt(): add missing splx(s), cause dead hang with unmatched slpbio()
optimize mcd_doread(), don't set CD mode each time, keep soft copy of mode.
call getdisklabel() _after_ mcdsize() for proper sizes
mcdopen(): old code forget to set MCDREADRAW in flags when open RAW
partition, doread check it for setting RAW CD mode.
Do nothing on stray interrupt (which sometimes occurse, because driver
read data block too slow, DOS driver use 'insb' here). Old stray code
cause timeouts.
Read toc entries code rewritten to return many requested entries
(as supposed) instead of one entry with incorrect structure.
CMDREAD2 requests covered with disable_intr()/enable_intr()
(from DOS driver)
Read junk code added after read block code in doread (from DOS driver)
mcd_read_toc() code fixed to read all needed entries, old code cause
some audio tracks is not played.
mcd_playtracks() code fixed to proper check valid track range.
New binary read modes implemented (from DOS driver).
1994-09-03 16:48:13 +00:00
|
|
|
return EINVAL;
|
1993-10-12 06:08:31 +00:00
|
|
|
}
|
|
|
|
|
1998-10-22 05:58:45 +00:00
|
|
|
static void
|
1993-11-25 01:38:01 +00:00
|
|
|
mcdintr(unit)
|
|
|
|
int unit;
|
1993-10-12 06:08:31 +00:00
|
|
|
{
|
1995-05-09 11:39:40 +00:00
|
|
|
MCD_TRACE("stray interrupt\n");
|
1993-10-12 06:08:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* state machine to process read requests
|
|
|
|
* initialize with MCD_S_BEGIN: calculate sizes, and read status
|
|
|
|
* MCD_S_WAITSTAT: wait for status reply, set mode
|
|
|
|
* MCD_S_WAITMODE: waits for status reply from set mode, set read command
|
|
|
|
* MCD_S_WAITREAD: wait for read ready, read data
|
|
|
|
*/
|
|
|
|
static struct mcd_mbx *mbxsave;
|
1997-09-21 21:41:49 +00:00
|
|
|
static struct callout_handle tohandle = CALLOUT_HANDLE_INITIALIZER(&tohandle);
|
1993-10-12 06:08:31 +00:00
|
|
|
|
1997-04-20 17:26:55 +00:00
|
|
|
static void
|
|
|
|
mcd_timeout(void *arg)
|
|
|
|
{
|
|
|
|
mcd_doread((int)arg, mbxsave);
|
|
|
|
}
|
|
|
|
|
1994-02-22 08:44:31 +00:00
|
|
|
static void
|
|
|
|
mcd_doread(int state, struct mcd_mbx *mbxin)
|
1993-10-12 06:08:31 +00:00
|
|
|
{
|
|
|
|
struct mcd_mbx *mbx = (state!=MCD_S_BEGIN) ? mbxsave : mbxin;
|
|
|
|
int unit = mbx->unit;
|
|
|
|
int port = mbx->port;
|
Newly implemented ioctls list:
DIOCGDINFO, DIOCGPART, DIOCWDINFO, DIOCSDINFO, CDIOCPLAYMSF, CDIOCRESET,
CDIOCEJECT.
CDIOCPLAYBLOCKS removed (old implementation completely wrong and I don't
know how to implement it correctly).
All routines now detects media change correctly.
DELAY_GETREPLAY increased for long time access from first track
to last.
mcd_waitrdy() now use MIN_DELAY=15 as minimal delay which independs
of machine speed.
mcd_doread() now uses real status (old code uses obsoleted soft copy of it).
clear XBSY on error in mcd_doread()
mcd_statrt(): add missing splx(s), cause dead hang with unmatched slpbio()
optimize mcd_doread(), don't set CD mode each time, keep soft copy of mode.
call getdisklabel() _after_ mcdsize() for proper sizes
mcdopen(): old code forget to set MCDREADRAW in flags when open RAW
partition, doread check it for setting RAW CD mode.
Do nothing on stray interrupt (which sometimes occurse, because driver
read data block too slow, DOS driver use 'insb' here). Old stray code
cause timeouts.
Read toc entries code rewritten to return many requested entries
(as supposed) instead of one entry with incorrect structure.
CMDREAD2 requests covered with disable_intr()/enable_intr()
(from DOS driver)
Read junk code added after read block code in doread (from DOS driver)
mcd_read_toc() code fixed to read all needed entries, old code cause
some audio tracks is not played.
mcd_playtracks() code fixed to proper check valid track range.
New binary read modes implemented (from DOS driver).
1994-09-03 16:48:13 +00:00
|
|
|
int com_port = mbx->port + mcd_command;
|
|
|
|
int data_port = mbx->port + mcd_rdata;
|
1993-10-12 06:08:31 +00:00
|
|
|
struct buf *bp = mbx->bp;
|
|
|
|
struct mcd_data *cd = mcd_data + unit;
|
|
|
|
|
|
|
|
int rm,i,k;
|
|
|
|
struct mcd_read2 rbuf;
|
|
|
|
int blknum;
|
|
|
|
caddr_t addr;
|
|
|
|
|
|
|
|
loop:
|
|
|
|
switch (state) {
|
|
|
|
case MCD_S_BEGIN:
|
|
|
|
mbx = mbxsave = mbxin;
|
|
|
|
|
|
|
|
case MCD_S_BEGIN1:
|
1995-01-30 06:44:40 +00:00
|
|
|
retry_status:
|
1995-02-22 01:11:36 +00:00
|
|
|
/* get status */
|
Newly implemented ioctls list:
DIOCGDINFO, DIOCGPART, DIOCWDINFO, DIOCSDINFO, CDIOCPLAYMSF, CDIOCRESET,
CDIOCEJECT.
CDIOCPLAYBLOCKS removed (old implementation completely wrong and I don't
know how to implement it correctly).
All routines now detects media change correctly.
DELAY_GETREPLAY increased for long time access from first track
to last.
mcd_waitrdy() now use MIN_DELAY=15 as minimal delay which independs
of machine speed.
mcd_doread() now uses real status (old code uses obsoleted soft copy of it).
clear XBSY on error in mcd_doread()
mcd_statrt(): add missing splx(s), cause dead hang with unmatched slpbio()
optimize mcd_doread(), don't set CD mode each time, keep soft copy of mode.
call getdisklabel() _after_ mcdsize() for proper sizes
mcdopen(): old code forget to set MCDREADRAW in flags when open RAW
partition, doread check it for setting RAW CD mode.
Do nothing on stray interrupt (which sometimes occurse, because driver
read data block too slow, DOS driver use 'insb' here). Old stray code
cause timeouts.
Read toc entries code rewritten to return many requested entries
(as supposed) instead of one entry with incorrect structure.
CMDREAD2 requests covered with disable_intr()/enable_intr()
(from DOS driver)
Read junk code added after read block code in doread (from DOS driver)
mcd_read_toc() code fixed to read all needed entries, old code cause
some audio tracks is not played.
mcd_playtracks() code fixed to proper check valid track range.
New binary read modes implemented (from DOS driver).
1994-09-03 16:48:13 +00:00
|
|
|
outb(com_port, MCD_CMDGETSTAT);
|
1993-10-12 06:08:31 +00:00
|
|
|
mbx->count = RDELAY_WAITSTAT;
|
1997-09-21 21:41:49 +00:00
|
|
|
tohandle = timeout(mcd_timeout,
|
|
|
|
(caddr_t)MCD_S_WAITSTAT,hz/100); /* XXX */
|
1993-10-12 06:08:31 +00:00
|
|
|
return;
|
|
|
|
case MCD_S_WAITSTAT:
|
1997-09-21 21:41:49 +00:00
|
|
|
untimeout(mcd_timeout,(caddr_t)MCD_S_WAITSTAT, tohandle);
|
1993-10-12 06:08:31 +00:00
|
|
|
if (mbx->count-- >= 0) {
|
1994-12-24 13:24:02 +00:00
|
|
|
if (inb(port+MCD_FLAGS) & MFL_STATUS_NOT_AVAIL) {
|
1997-04-20 17:26:55 +00:00
|
|
|
timeout(mcd_timeout,
|
1994-02-22 08:44:31 +00:00
|
|
|
(caddr_t)MCD_S_WAITSTAT,hz/100); /* XXX */
|
1993-10-12 06:08:31 +00:00
|
|
|
return;
|
|
|
|
}
|
Newly implemented ioctls list:
DIOCGDINFO, DIOCGPART, DIOCWDINFO, DIOCSDINFO, CDIOCPLAYMSF, CDIOCRESET,
CDIOCEJECT.
CDIOCPLAYBLOCKS removed (old implementation completely wrong and I don't
know how to implement it correctly).
All routines now detects media change correctly.
DELAY_GETREPLAY increased for long time access from first track
to last.
mcd_waitrdy() now use MIN_DELAY=15 as minimal delay which independs
of machine speed.
mcd_doread() now uses real status (old code uses obsoleted soft copy of it).
clear XBSY on error in mcd_doread()
mcd_statrt(): add missing splx(s), cause dead hang with unmatched slpbio()
optimize mcd_doread(), don't set CD mode each time, keep soft copy of mode.
call getdisklabel() _after_ mcdsize() for proper sizes
mcdopen(): old code forget to set MCDREADRAW in flags when open RAW
partition, doread check it for setting RAW CD mode.
Do nothing on stray interrupt (which sometimes occurse, because driver
read data block too slow, DOS driver use 'insb' here). Old stray code
cause timeouts.
Read toc entries code rewritten to return many requested entries
(as supposed) instead of one entry with incorrect structure.
CMDREAD2 requests covered with disable_intr()/enable_intr()
(from DOS driver)
Read junk code added after read block code in doread (from DOS driver)
mcd_read_toc() code fixed to read all needed entries, old code cause
some audio tracks is not played.
mcd_playtracks() code fixed to proper check valid track range.
New binary read modes implemented (from DOS driver).
1994-09-03 16:48:13 +00:00
|
|
|
cd->status = inb(port+mcd_status) & 0xFF;
|
1995-01-30 06:44:40 +00:00
|
|
|
if (cd->status & MCD_ST_CMDCHECK)
|
|
|
|
goto retry_status;
|
Newly implemented ioctls list:
DIOCGDINFO, DIOCGPART, DIOCWDINFO, DIOCSDINFO, CDIOCPLAYMSF, CDIOCRESET,
CDIOCEJECT.
CDIOCPLAYBLOCKS removed (old implementation completely wrong and I don't
know how to implement it correctly).
All routines now detects media change correctly.
DELAY_GETREPLAY increased for long time access from first track
to last.
mcd_waitrdy() now use MIN_DELAY=15 as minimal delay which independs
of machine speed.
mcd_doread() now uses real status (old code uses obsoleted soft copy of it).
clear XBSY on error in mcd_doread()
mcd_statrt(): add missing splx(s), cause dead hang with unmatched slpbio()
optimize mcd_doread(), don't set CD mode each time, keep soft copy of mode.
call getdisklabel() _after_ mcdsize() for proper sizes
mcdopen(): old code forget to set MCDREADRAW in flags when open RAW
partition, doread check it for setting RAW CD mode.
Do nothing on stray interrupt (which sometimes occurse, because driver
read data block too slow, DOS driver use 'insb' here). Old stray code
cause timeouts.
Read toc entries code rewritten to return many requested entries
(as supposed) instead of one entry with incorrect structure.
CMDREAD2 requests covered with disable_intr()/enable_intr()
(from DOS driver)
Read junk code added after read block code in doread (from DOS driver)
mcd_read_toc() code fixed to read all needed entries, old code cause
some audio tracks is not played.
mcd_playtracks() code fixed to proper check valid track range.
New binary read modes implemented (from DOS driver).
1994-09-03 16:48:13 +00:00
|
|
|
if (mcd_setflags(unit,cd) < 0)
|
|
|
|
goto changed;
|
1994-02-22 08:44:31 +00:00
|
|
|
MCD_TRACE("got WAITSTAT delay=%d\n",
|
1995-05-09 11:39:40 +00:00
|
|
|
RDELAY_WAITSTAT-mbx->count);
|
1993-10-12 06:08:31 +00:00
|
|
|
/* reject, if audio active */
|
|
|
|
if (cd->status & MCDAUDIOBSY) {
|
|
|
|
printf("mcd%d: audio is active\n",unit);
|
|
|
|
goto readerr;
|
|
|
|
}
|
1995-02-22 01:11:36 +00:00
|
|
|
|
1995-01-30 06:44:40 +00:00
|
|
|
retry_mode:
|
1993-10-12 06:08:31 +00:00
|
|
|
/* to check for raw/cooked mode */
|
|
|
|
if (cd->flags & MCDREADRAW) {
|
1994-11-12 13:26:13 +00:00
|
|
|
rm = MCD_MD_RAW;
|
1993-10-12 06:08:31 +00:00
|
|
|
mbx->sz = MCDRBLK;
|
|
|
|
} else {
|
1994-11-12 13:26:13 +00:00
|
|
|
rm = MCD_MD_COOKED;
|
1993-10-12 06:08:31 +00:00
|
|
|
mbx->sz = cd->blksize;
|
|
|
|
}
|
|
|
|
|
Newly implemented ioctls list:
DIOCGDINFO, DIOCGPART, DIOCWDINFO, DIOCSDINFO, CDIOCPLAYMSF, CDIOCRESET,
CDIOCEJECT.
CDIOCPLAYBLOCKS removed (old implementation completely wrong and I don't
know how to implement it correctly).
All routines now detects media change correctly.
DELAY_GETREPLAY increased for long time access from first track
to last.
mcd_waitrdy() now use MIN_DELAY=15 as minimal delay which independs
of machine speed.
mcd_doread() now uses real status (old code uses obsoleted soft copy of it).
clear XBSY on error in mcd_doread()
mcd_statrt(): add missing splx(s), cause dead hang with unmatched slpbio()
optimize mcd_doread(), don't set CD mode each time, keep soft copy of mode.
call getdisklabel() _after_ mcdsize() for proper sizes
mcdopen(): old code forget to set MCDREADRAW in flags when open RAW
partition, doread check it for setting RAW CD mode.
Do nothing on stray interrupt (which sometimes occurse, because driver
read data block too slow, DOS driver use 'insb' here). Old stray code
cause timeouts.
Read toc entries code rewritten to return many requested entries
(as supposed) instead of one entry with incorrect structure.
CMDREAD2 requests covered with disable_intr()/enable_intr()
(from DOS driver)
Read junk code added after read block code in doread (from DOS driver)
mcd_read_toc() code fixed to read all needed entries, old code cause
some audio tracks is not played.
mcd_playtracks() code fixed to proper check valid track range.
New binary read modes implemented (from DOS driver).
1994-09-03 16:48:13 +00:00
|
|
|
if (rm == cd->curr_mode)
|
|
|
|
goto modedone;
|
|
|
|
|
1993-10-12 06:08:31 +00:00
|
|
|
mbx->count = RDELAY_WAITMODE;
|
Newly implemented ioctls list:
DIOCGDINFO, DIOCGPART, DIOCWDINFO, DIOCSDINFO, CDIOCPLAYMSF, CDIOCRESET,
CDIOCEJECT.
CDIOCPLAYBLOCKS removed (old implementation completely wrong and I don't
know how to implement it correctly).
All routines now detects media change correctly.
DELAY_GETREPLAY increased for long time access from first track
to last.
mcd_waitrdy() now use MIN_DELAY=15 as minimal delay which independs
of machine speed.
mcd_doread() now uses real status (old code uses obsoleted soft copy of it).
clear XBSY on error in mcd_doread()
mcd_statrt(): add missing splx(s), cause dead hang with unmatched slpbio()
optimize mcd_doread(), don't set CD mode each time, keep soft copy of mode.
call getdisklabel() _after_ mcdsize() for proper sizes
mcdopen(): old code forget to set MCDREADRAW in flags when open RAW
partition, doread check it for setting RAW CD mode.
Do nothing on stray interrupt (which sometimes occurse, because driver
read data block too slow, DOS driver use 'insb' here). Old stray code
cause timeouts.
Read toc entries code rewritten to return many requested entries
(as supposed) instead of one entry with incorrect structure.
CMDREAD2 requests covered with disable_intr()/enable_intr()
(from DOS driver)
Read junk code added after read block code in doread (from DOS driver)
mcd_read_toc() code fixed to read all needed entries, old code cause
some audio tracks is not played.
mcd_playtracks() code fixed to proper check valid track range.
New binary read modes implemented (from DOS driver).
1994-09-03 16:48:13 +00:00
|
|
|
|
|
|
|
cd->curr_mode = MCD_MD_UNKNOWN;
|
|
|
|
mbx->mode = rm;
|
|
|
|
mcd_put(com_port, MCD_CMDSETMODE);
|
|
|
|
mcd_put(com_port, rm);
|
|
|
|
|
1997-09-21 21:41:49 +00:00
|
|
|
tohandle = timeout(mcd_timeout,
|
|
|
|
(caddr_t)MCD_S_WAITMODE,hz/100); /* XXX */
|
1993-10-12 06:08:31 +00:00
|
|
|
return;
|
|
|
|
} else {
|
|
|
|
printf("mcd%d: timeout getstatus\n",unit);
|
|
|
|
goto readerr;
|
|
|
|
}
|
|
|
|
|
|
|
|
case MCD_S_WAITMODE:
|
1997-09-21 21:41:49 +00:00
|
|
|
untimeout(mcd_timeout,(caddr_t)MCD_S_WAITMODE, tohandle);
|
1993-10-12 06:08:31 +00:00
|
|
|
if (mbx->count-- < 0) {
|
|
|
|
printf("mcd%d: timeout set mode\n",unit);
|
|
|
|
goto readerr;
|
|
|
|
}
|
1994-12-24 13:24:02 +00:00
|
|
|
if (inb(port+MCD_FLAGS) & MFL_STATUS_NOT_AVAIL) {
|
1997-09-21 21:41:49 +00:00
|
|
|
tohandle = timeout(mcd_timeout,
|
|
|
|
(caddr_t)MCD_S_WAITMODE,hz/100);
|
1993-10-12 06:08:31 +00:00
|
|
|
return;
|
|
|
|
}
|
Newly implemented ioctls list:
DIOCGDINFO, DIOCGPART, DIOCWDINFO, DIOCSDINFO, CDIOCPLAYMSF, CDIOCRESET,
CDIOCEJECT.
CDIOCPLAYBLOCKS removed (old implementation completely wrong and I don't
know how to implement it correctly).
All routines now detects media change correctly.
DELAY_GETREPLAY increased for long time access from first track
to last.
mcd_waitrdy() now use MIN_DELAY=15 as minimal delay which independs
of machine speed.
mcd_doread() now uses real status (old code uses obsoleted soft copy of it).
clear XBSY on error in mcd_doread()
mcd_statrt(): add missing splx(s), cause dead hang with unmatched slpbio()
optimize mcd_doread(), don't set CD mode each time, keep soft copy of mode.
call getdisklabel() _after_ mcdsize() for proper sizes
mcdopen(): old code forget to set MCDREADRAW in flags when open RAW
partition, doread check it for setting RAW CD mode.
Do nothing on stray interrupt (which sometimes occurse, because driver
read data block too slow, DOS driver use 'insb' here). Old stray code
cause timeouts.
Read toc entries code rewritten to return many requested entries
(as supposed) instead of one entry with incorrect structure.
CMDREAD2 requests covered with disable_intr()/enable_intr()
(from DOS driver)
Read junk code added after read block code in doread (from DOS driver)
mcd_read_toc() code fixed to read all needed entries, old code cause
some audio tracks is not played.
mcd_playtracks() code fixed to proper check valid track range.
New binary read modes implemented (from DOS driver).
1994-09-03 16:48:13 +00:00
|
|
|
cd->status = inb(port+mcd_status) & 0xFF;
|
1995-01-30 06:44:40 +00:00
|
|
|
if (cd->status & MCD_ST_CMDCHECK) {
|
1995-02-22 01:11:36 +00:00
|
|
|
cd->curr_mode = MCD_MD_UNKNOWN;
|
1995-01-30 06:44:40 +00:00
|
|
|
goto retry_mode;
|
|
|
|
}
|
Newly implemented ioctls list:
DIOCGDINFO, DIOCGPART, DIOCWDINFO, DIOCSDINFO, CDIOCPLAYMSF, CDIOCRESET,
CDIOCEJECT.
CDIOCPLAYBLOCKS removed (old implementation completely wrong and I don't
know how to implement it correctly).
All routines now detects media change correctly.
DELAY_GETREPLAY increased for long time access from first track
to last.
mcd_waitrdy() now use MIN_DELAY=15 as minimal delay which independs
of machine speed.
mcd_doread() now uses real status (old code uses obsoleted soft copy of it).
clear XBSY on error in mcd_doread()
mcd_statrt(): add missing splx(s), cause dead hang with unmatched slpbio()
optimize mcd_doread(), don't set CD mode each time, keep soft copy of mode.
call getdisklabel() _after_ mcdsize() for proper sizes
mcdopen(): old code forget to set MCDREADRAW in flags when open RAW
partition, doread check it for setting RAW CD mode.
Do nothing on stray interrupt (which sometimes occurse, because driver
read data block too slow, DOS driver use 'insb' here). Old stray code
cause timeouts.
Read toc entries code rewritten to return many requested entries
(as supposed) instead of one entry with incorrect structure.
CMDREAD2 requests covered with disable_intr()/enable_intr()
(from DOS driver)
Read junk code added after read block code in doread (from DOS driver)
mcd_read_toc() code fixed to read all needed entries, old code cause
some audio tracks is not played.
mcd_playtracks() code fixed to proper check valid track range.
New binary read modes implemented (from DOS driver).
1994-09-03 16:48:13 +00:00
|
|
|
if (mcd_setflags(unit,cd) < 0)
|
|
|
|
goto changed;
|
|
|
|
cd->curr_mode = mbx->mode;
|
1994-02-22 08:44:31 +00:00
|
|
|
MCD_TRACE("got WAITMODE delay=%d\n",
|
1995-05-09 11:39:40 +00:00
|
|
|
RDELAY_WAITMODE-mbx->count);
|
Newly implemented ioctls list:
DIOCGDINFO, DIOCGPART, DIOCWDINFO, DIOCSDINFO, CDIOCPLAYMSF, CDIOCRESET,
CDIOCEJECT.
CDIOCPLAYBLOCKS removed (old implementation completely wrong and I don't
know how to implement it correctly).
All routines now detects media change correctly.
DELAY_GETREPLAY increased for long time access from first track
to last.
mcd_waitrdy() now use MIN_DELAY=15 as minimal delay which independs
of machine speed.
mcd_doread() now uses real status (old code uses obsoleted soft copy of it).
clear XBSY on error in mcd_doread()
mcd_statrt(): add missing splx(s), cause dead hang with unmatched slpbio()
optimize mcd_doread(), don't set CD mode each time, keep soft copy of mode.
call getdisklabel() _after_ mcdsize() for proper sizes
mcdopen(): old code forget to set MCDREADRAW in flags when open RAW
partition, doread check it for setting RAW CD mode.
Do nothing on stray interrupt (which sometimes occurse, because driver
read data block too slow, DOS driver use 'insb' here). Old stray code
cause timeouts.
Read toc entries code rewritten to return many requested entries
(as supposed) instead of one entry with incorrect structure.
CMDREAD2 requests covered with disable_intr()/enable_intr()
(from DOS driver)
Read junk code added after read block code in doread (from DOS driver)
mcd_read_toc() code fixed to read all needed entries, old code cause
some audio tracks is not played.
mcd_playtracks() code fixed to proper check valid track range.
New binary read modes implemented (from DOS driver).
1994-09-03 16:48:13 +00:00
|
|
|
modedone:
|
1993-10-12 06:08:31 +00:00
|
|
|
/* for first block */
|
|
|
|
mbx->nblk = (bp->b_bcount + (mbx->sz-1)) / mbx->sz;
|
|
|
|
mbx->skip = 0;
|
|
|
|
|
|
|
|
nextblock:
|
|
|
|
blknum = (bp->b_blkno / (mbx->sz/DEV_BSIZE))
|
|
|
|
+ mbx->p_offset + mbx->skip/mbx->sz;
|
|
|
|
|
1995-05-11 19:26:53 +00:00
|
|
|
MCD_TRACE("mcd_doread: read blknum=%d for bp=%p\n",
|
1995-05-09 11:39:40 +00:00
|
|
|
blknum, bp);
|
1993-10-12 06:08:31 +00:00
|
|
|
|
|
|
|
/* build parameter block */
|
|
|
|
hsg2msf(blknum,rbuf.start_msf);
|
1995-01-30 06:44:40 +00:00
|
|
|
retry_read:
|
1993-10-12 06:08:31 +00:00
|
|
|
/* send the read command */
|
Newly implemented ioctls list:
DIOCGDINFO, DIOCGPART, DIOCWDINFO, DIOCSDINFO, CDIOCPLAYMSF, CDIOCRESET,
CDIOCEJECT.
CDIOCPLAYBLOCKS removed (old implementation completely wrong and I don't
know how to implement it correctly).
All routines now detects media change correctly.
DELAY_GETREPLAY increased for long time access from first track
to last.
mcd_waitrdy() now use MIN_DELAY=15 as minimal delay which independs
of machine speed.
mcd_doread() now uses real status (old code uses obsoleted soft copy of it).
clear XBSY on error in mcd_doread()
mcd_statrt(): add missing splx(s), cause dead hang with unmatched slpbio()
optimize mcd_doread(), don't set CD mode each time, keep soft copy of mode.
call getdisklabel() _after_ mcdsize() for proper sizes
mcdopen(): old code forget to set MCDREADRAW in flags when open RAW
partition, doread check it for setting RAW CD mode.
Do nothing on stray interrupt (which sometimes occurse, because driver
read data block too slow, DOS driver use 'insb' here). Old stray code
cause timeouts.
Read toc entries code rewritten to return many requested entries
(as supposed) instead of one entry with incorrect structure.
CMDREAD2 requests covered with disable_intr()/enable_intr()
(from DOS driver)
Read junk code added after read block code in doread (from DOS driver)
mcd_read_toc() code fixed to read all needed entries, old code cause
some audio tracks is not played.
mcd_playtracks() code fixed to proper check valid track range.
New binary read modes implemented (from DOS driver).
1994-09-03 16:48:13 +00:00
|
|
|
disable_intr();
|
1995-01-30 06:44:40 +00:00
|
|
|
mcd_put(com_port,cd->read_command);
|
Newly implemented ioctls list:
DIOCGDINFO, DIOCGPART, DIOCWDINFO, DIOCSDINFO, CDIOCPLAYMSF, CDIOCRESET,
CDIOCEJECT.
CDIOCPLAYBLOCKS removed (old implementation completely wrong and I don't
know how to implement it correctly).
All routines now detects media change correctly.
DELAY_GETREPLAY increased for long time access from first track
to last.
mcd_waitrdy() now use MIN_DELAY=15 as minimal delay which independs
of machine speed.
mcd_doread() now uses real status (old code uses obsoleted soft copy of it).
clear XBSY on error in mcd_doread()
mcd_statrt(): add missing splx(s), cause dead hang with unmatched slpbio()
optimize mcd_doread(), don't set CD mode each time, keep soft copy of mode.
call getdisklabel() _after_ mcdsize() for proper sizes
mcdopen(): old code forget to set MCDREADRAW in flags when open RAW
partition, doread check it for setting RAW CD mode.
Do nothing on stray interrupt (which sometimes occurse, because driver
read data block too slow, DOS driver use 'insb' here). Old stray code
cause timeouts.
Read toc entries code rewritten to return many requested entries
(as supposed) instead of one entry with incorrect structure.
CMDREAD2 requests covered with disable_intr()/enable_intr()
(from DOS driver)
Read junk code added after read block code in doread (from DOS driver)
mcd_read_toc() code fixed to read all needed entries, old code cause
some audio tracks is not played.
mcd_playtracks() code fixed to proper check valid track range.
New binary read modes implemented (from DOS driver).
1994-09-03 16:48:13 +00:00
|
|
|
mcd_put(com_port,rbuf.start_msf[0]);
|
|
|
|
mcd_put(com_port,rbuf.start_msf[1]);
|
|
|
|
mcd_put(com_port,rbuf.start_msf[2]);
|
|
|
|
mcd_put(com_port,0);
|
|
|
|
mcd_put(com_port,0);
|
|
|
|
mcd_put(com_port,1);
|
|
|
|
enable_intr();
|
|
|
|
|
1994-09-14 20:28:25 +00:00
|
|
|
/* Spin briefly (<= 2ms) to avoid missing next block */
|
|
|
|
for (i = 0; i < 20; i++) {
|
1994-12-24 13:24:02 +00:00
|
|
|
k = inb(port+MCD_FLAGS);
|
|
|
|
if (!(k & MFL_DATA_NOT_AVAIL))
|
1994-09-14 20:28:25 +00:00
|
|
|
goto got_it;
|
|
|
|
DELAY(100);
|
|
|
|
}
|
|
|
|
|
1993-10-12 06:08:31 +00:00
|
|
|
mbx->count = RDELAY_WAITREAD;
|
1997-09-21 21:41:49 +00:00
|
|
|
tohandle = timeout(mcd_timeout,
|
|
|
|
(caddr_t)MCD_S_WAITREAD,hz/100); /* XXX */
|
1993-10-12 06:08:31 +00:00
|
|
|
return;
|
|
|
|
case MCD_S_WAITREAD:
|
1997-09-21 21:41:49 +00:00
|
|
|
untimeout(mcd_timeout,(caddr_t)MCD_S_WAITREAD, tohandle);
|
1993-10-12 06:08:31 +00:00
|
|
|
if (mbx->count-- > 0) {
|
1994-12-24 13:24:02 +00:00
|
|
|
k = inb(port+MCD_FLAGS);
|
|
|
|
if (!(k & MFL_DATA_NOT_AVAIL)) { /* XXX */
|
1994-02-22 08:44:31 +00:00
|
|
|
MCD_TRACE("got data delay=%d\n",
|
1995-05-09 11:39:40 +00:00
|
|
|
RDELAY_WAITREAD-mbx->count);
|
1994-09-14 20:28:25 +00:00
|
|
|
got_it:
|
1993-10-12 06:08:31 +00:00
|
|
|
/* data is ready */
|
1997-12-02 21:07:20 +00:00
|
|
|
addr = bp->b_data + mbx->skip;
|
Newly implemented ioctls list:
DIOCGDINFO, DIOCGPART, DIOCWDINFO, DIOCSDINFO, CDIOCPLAYMSF, CDIOCRESET,
CDIOCEJECT.
CDIOCPLAYBLOCKS removed (old implementation completely wrong and I don't
know how to implement it correctly).
All routines now detects media change correctly.
DELAY_GETREPLAY increased for long time access from first track
to last.
mcd_waitrdy() now use MIN_DELAY=15 as minimal delay which independs
of machine speed.
mcd_doread() now uses real status (old code uses obsoleted soft copy of it).
clear XBSY on error in mcd_doread()
mcd_statrt(): add missing splx(s), cause dead hang with unmatched slpbio()
optimize mcd_doread(), don't set CD mode each time, keep soft copy of mode.
call getdisklabel() _after_ mcdsize() for proper sizes
mcdopen(): old code forget to set MCDREADRAW in flags when open RAW
partition, doread check it for setting RAW CD mode.
Do nothing on stray interrupt (which sometimes occurse, because driver
read data block too slow, DOS driver use 'insb' here). Old stray code
cause timeouts.
Read toc entries code rewritten to return many requested entries
(as supposed) instead of one entry with incorrect structure.
CMDREAD2 requests covered with disable_intr()/enable_intr()
(from DOS driver)
Read junk code added after read block code in doread (from DOS driver)
mcd_read_toc() code fixed to read all needed entries, old code cause
some audio tracks is not played.
mcd_playtracks() code fixed to proper check valid track range.
New binary read modes implemented (from DOS driver).
1994-09-03 16:48:13 +00:00
|
|
|
|
1993-10-12 06:08:31 +00:00
|
|
|
outb(port+mcd_ctl2,0x04); /* XXX */
|
|
|
|
for (i=0; i<mbx->sz; i++)
|
Newly implemented ioctls list:
DIOCGDINFO, DIOCGPART, DIOCWDINFO, DIOCSDINFO, CDIOCPLAYMSF, CDIOCRESET,
CDIOCEJECT.
CDIOCPLAYBLOCKS removed (old implementation completely wrong and I don't
know how to implement it correctly).
All routines now detects media change correctly.
DELAY_GETREPLAY increased for long time access from first track
to last.
mcd_waitrdy() now use MIN_DELAY=15 as minimal delay which independs
of machine speed.
mcd_doread() now uses real status (old code uses obsoleted soft copy of it).
clear XBSY on error in mcd_doread()
mcd_statrt(): add missing splx(s), cause dead hang with unmatched slpbio()
optimize mcd_doread(), don't set CD mode each time, keep soft copy of mode.
call getdisklabel() _after_ mcdsize() for proper sizes
mcdopen(): old code forget to set MCDREADRAW in flags when open RAW
partition, doread check it for setting RAW CD mode.
Do nothing on stray interrupt (which sometimes occurse, because driver
read data block too slow, DOS driver use 'insb' here). Old stray code
cause timeouts.
Read toc entries code rewritten to return many requested entries
(as supposed) instead of one entry with incorrect structure.
CMDREAD2 requests covered with disable_intr()/enable_intr()
(from DOS driver)
Read junk code added after read block code in doread (from DOS driver)
mcd_read_toc() code fixed to read all needed entries, old code cause
some audio tracks is not played.
mcd_playtracks() code fixed to proper check valid track range.
New binary read modes implemented (from DOS driver).
1994-09-03 16:48:13 +00:00
|
|
|
*addr++ = inb(data_port);
|
1993-10-12 06:08:31 +00:00
|
|
|
outb(port+mcd_ctl2,0x0c); /* XXX */
|
|
|
|
|
1994-12-24 13:24:02 +00:00
|
|
|
k = inb(port+MCD_FLAGS);
|
Newly implemented ioctls list:
DIOCGDINFO, DIOCGPART, DIOCWDINFO, DIOCSDINFO, CDIOCPLAYMSF, CDIOCRESET,
CDIOCEJECT.
CDIOCPLAYBLOCKS removed (old implementation completely wrong and I don't
know how to implement it correctly).
All routines now detects media change correctly.
DELAY_GETREPLAY increased for long time access from first track
to last.
mcd_waitrdy() now use MIN_DELAY=15 as minimal delay which independs
of machine speed.
mcd_doread() now uses real status (old code uses obsoleted soft copy of it).
clear XBSY on error in mcd_doread()
mcd_statrt(): add missing splx(s), cause dead hang with unmatched slpbio()
optimize mcd_doread(), don't set CD mode each time, keep soft copy of mode.
call getdisklabel() _after_ mcdsize() for proper sizes
mcdopen(): old code forget to set MCDREADRAW in flags when open RAW
partition, doread check it for setting RAW CD mode.
Do nothing on stray interrupt (which sometimes occurse, because driver
read data block too slow, DOS driver use 'insb' here). Old stray code
cause timeouts.
Read toc entries code rewritten to return many requested entries
(as supposed) instead of one entry with incorrect structure.
CMDREAD2 requests covered with disable_intr()/enable_intr()
(from DOS driver)
Read junk code added after read block code in doread (from DOS driver)
mcd_read_toc() code fixed to read all needed entries, old code cause
some audio tracks is not played.
mcd_playtracks() code fixed to proper check valid track range.
New binary read modes implemented (from DOS driver).
1994-09-03 16:48:13 +00:00
|
|
|
/* If we still have some junk, read it too */
|
1994-12-24 13:24:02 +00:00
|
|
|
if (!(k & MFL_DATA_NOT_AVAIL)) {
|
Newly implemented ioctls list:
DIOCGDINFO, DIOCGPART, DIOCWDINFO, DIOCSDINFO, CDIOCPLAYMSF, CDIOCRESET,
CDIOCEJECT.
CDIOCPLAYBLOCKS removed (old implementation completely wrong and I don't
know how to implement it correctly).
All routines now detects media change correctly.
DELAY_GETREPLAY increased for long time access from first track
to last.
mcd_waitrdy() now use MIN_DELAY=15 as minimal delay which independs
of machine speed.
mcd_doread() now uses real status (old code uses obsoleted soft copy of it).
clear XBSY on error in mcd_doread()
mcd_statrt(): add missing splx(s), cause dead hang with unmatched slpbio()
optimize mcd_doread(), don't set CD mode each time, keep soft copy of mode.
call getdisklabel() _after_ mcdsize() for proper sizes
mcdopen(): old code forget to set MCDREADRAW in flags when open RAW
partition, doread check it for setting RAW CD mode.
Do nothing on stray interrupt (which sometimes occurse, because driver
read data block too slow, DOS driver use 'insb' here). Old stray code
cause timeouts.
Read toc entries code rewritten to return many requested entries
(as supposed) instead of one entry with incorrect structure.
CMDREAD2 requests covered with disable_intr()/enable_intr()
(from DOS driver)
Read junk code added after read block code in doread (from DOS driver)
mcd_read_toc() code fixed to read all needed entries, old code cause
some audio tracks is not played.
mcd_playtracks() code fixed to proper check valid track range.
New binary read modes implemented (from DOS driver).
1994-09-03 16:48:13 +00:00
|
|
|
outb(port+mcd_ctl2,0x04); /* XXX */
|
|
|
|
(void)inb(data_port);
|
|
|
|
(void)inb(data_port);
|
|
|
|
outb(port+mcd_ctl2,0x0c); /* XXX */
|
|
|
|
}
|
|
|
|
|
1993-10-12 06:08:31 +00:00
|
|
|
if (--mbx->nblk > 0) {
|
|
|
|
mbx->skip += mbx->sz;
|
|
|
|
goto nextblock;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* return buffer */
|
|
|
|
bp->b_resid = 0;
|
|
|
|
biodone(bp);
|
|
|
|
|
Newly implemented ioctls list:
DIOCGDINFO, DIOCGPART, DIOCWDINFO, DIOCSDINFO, CDIOCPLAYMSF, CDIOCRESET,
CDIOCEJECT.
CDIOCPLAYBLOCKS removed (old implementation completely wrong and I don't
know how to implement it correctly).
All routines now detects media change correctly.
DELAY_GETREPLAY increased for long time access from first track
to last.
mcd_waitrdy() now use MIN_DELAY=15 as minimal delay which independs
of machine speed.
mcd_doread() now uses real status (old code uses obsoleted soft copy of it).
clear XBSY on error in mcd_doread()
mcd_statrt(): add missing splx(s), cause dead hang with unmatched slpbio()
optimize mcd_doread(), don't set CD mode each time, keep soft copy of mode.
call getdisklabel() _after_ mcdsize() for proper sizes
mcdopen(): old code forget to set MCDREADRAW in flags when open RAW
partition, doread check it for setting RAW CD mode.
Do nothing on stray interrupt (which sometimes occurse, because driver
read data block too slow, DOS driver use 'insb' here). Old stray code
cause timeouts.
Read toc entries code rewritten to return many requested entries
(as supposed) instead of one entry with incorrect structure.
CMDREAD2 requests covered with disable_intr()/enable_intr()
(from DOS driver)
Read junk code added after read block code in doread (from DOS driver)
mcd_read_toc() code fixed to read all needed entries, old code cause
some audio tracks is not played.
mcd_playtracks() code fixed to proper check valid track range.
New binary read modes implemented (from DOS driver).
1994-09-03 16:48:13 +00:00
|
|
|
cd->flags &= ~(MCDMBXBSY|MCDREADRAW);
|
1993-10-12 06:08:31 +00:00
|
|
|
mcd_start(mbx->unit);
|
|
|
|
return;
|
|
|
|
}
|
1994-12-24 13:24:02 +00:00
|
|
|
if (!(k & MFL_STATUS_NOT_AVAIL)) {
|
Newly implemented ioctls list:
DIOCGDINFO, DIOCGPART, DIOCWDINFO, DIOCSDINFO, CDIOCPLAYMSF, CDIOCRESET,
CDIOCEJECT.
CDIOCPLAYBLOCKS removed (old implementation completely wrong and I don't
know how to implement it correctly).
All routines now detects media change correctly.
DELAY_GETREPLAY increased for long time access from first track
to last.
mcd_waitrdy() now use MIN_DELAY=15 as minimal delay which independs
of machine speed.
mcd_doread() now uses real status (old code uses obsoleted soft copy of it).
clear XBSY on error in mcd_doread()
mcd_statrt(): add missing splx(s), cause dead hang with unmatched slpbio()
optimize mcd_doread(), don't set CD mode each time, keep soft copy of mode.
call getdisklabel() _after_ mcdsize() for proper sizes
mcdopen(): old code forget to set MCDREADRAW in flags when open RAW
partition, doread check it for setting RAW CD mode.
Do nothing on stray interrupt (which sometimes occurse, because driver
read data block too slow, DOS driver use 'insb' here). Old stray code
cause timeouts.
Read toc entries code rewritten to return many requested entries
(as supposed) instead of one entry with incorrect structure.
CMDREAD2 requests covered with disable_intr()/enable_intr()
(from DOS driver)
Read junk code added after read block code in doread (from DOS driver)
mcd_read_toc() code fixed to read all needed entries, old code cause
some audio tracks is not played.
mcd_playtracks() code fixed to proper check valid track range.
New binary read modes implemented (from DOS driver).
1994-09-03 16:48:13 +00:00
|
|
|
cd->status = inb(port+mcd_status) & 0xFF;
|
1995-01-30 06:44:40 +00:00
|
|
|
if (cd->status & MCD_ST_CMDCHECK)
|
|
|
|
goto retry_read;
|
Newly implemented ioctls list:
DIOCGDINFO, DIOCGPART, DIOCWDINFO, DIOCSDINFO, CDIOCPLAYMSF, CDIOCRESET,
CDIOCEJECT.
CDIOCPLAYBLOCKS removed (old implementation completely wrong and I don't
know how to implement it correctly).
All routines now detects media change correctly.
DELAY_GETREPLAY increased for long time access from first track
to last.
mcd_waitrdy() now use MIN_DELAY=15 as minimal delay which independs
of machine speed.
mcd_doread() now uses real status (old code uses obsoleted soft copy of it).
clear XBSY on error in mcd_doread()
mcd_statrt(): add missing splx(s), cause dead hang with unmatched slpbio()
optimize mcd_doread(), don't set CD mode each time, keep soft copy of mode.
call getdisklabel() _after_ mcdsize() for proper sizes
mcdopen(): old code forget to set MCDREADRAW in flags when open RAW
partition, doread check it for setting RAW CD mode.
Do nothing on stray interrupt (which sometimes occurse, because driver
read data block too slow, DOS driver use 'insb' here). Old stray code
cause timeouts.
Read toc entries code rewritten to return many requested entries
(as supposed) instead of one entry with incorrect structure.
CMDREAD2 requests covered with disable_intr()/enable_intr()
(from DOS driver)
Read junk code added after read block code in doread (from DOS driver)
mcd_read_toc() code fixed to read all needed entries, old code cause
some audio tracks is not played.
mcd_playtracks() code fixed to proper check valid track range.
New binary read modes implemented (from DOS driver).
1994-09-03 16:48:13 +00:00
|
|
|
if (mcd_setflags(unit,cd) < 0)
|
|
|
|
goto changed;
|
|
|
|
}
|
1997-09-21 21:41:49 +00:00
|
|
|
tohandle = timeout(mcd_timeout,
|
|
|
|
(caddr_t)MCD_S_WAITREAD,hz/100); /* XXX */
|
1993-10-12 06:08:31 +00:00
|
|
|
return;
|
|
|
|
} else {
|
|
|
|
printf("mcd%d: timeout read data\n",unit);
|
|
|
|
goto readerr;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
readerr:
|
|
|
|
if (mbx->retry-- > 0) {
|
|
|
|
printf("mcd%d: retrying\n",unit);
|
|
|
|
state = MCD_S_BEGIN1;
|
|
|
|
goto loop;
|
|
|
|
}
|
Newly implemented ioctls list:
DIOCGDINFO, DIOCGPART, DIOCWDINFO, DIOCSDINFO, CDIOCPLAYMSF, CDIOCRESET,
CDIOCEJECT.
CDIOCPLAYBLOCKS removed (old implementation completely wrong and I don't
know how to implement it correctly).
All routines now detects media change correctly.
DELAY_GETREPLAY increased for long time access from first track
to last.
mcd_waitrdy() now use MIN_DELAY=15 as minimal delay which independs
of machine speed.
mcd_doread() now uses real status (old code uses obsoleted soft copy of it).
clear XBSY on error in mcd_doread()
mcd_statrt(): add missing splx(s), cause dead hang with unmatched slpbio()
optimize mcd_doread(), don't set CD mode each time, keep soft copy of mode.
call getdisklabel() _after_ mcdsize() for proper sizes
mcdopen(): old code forget to set MCDREADRAW in flags when open RAW
partition, doread check it for setting RAW CD mode.
Do nothing on stray interrupt (which sometimes occurse, because driver
read data block too slow, DOS driver use 'insb' here). Old stray code
cause timeouts.
Read toc entries code rewritten to return many requested entries
(as supposed) instead of one entry with incorrect structure.
CMDREAD2 requests covered with disable_intr()/enable_intr()
(from DOS driver)
Read junk code added after read block code in doread (from DOS driver)
mcd_read_toc() code fixed to read all needed entries, old code cause
some audio tracks is not played.
mcd_playtracks() code fixed to proper check valid track range.
New binary read modes implemented (from DOS driver).
1994-09-03 16:48:13 +00:00
|
|
|
harderr:
|
1993-10-12 06:08:31 +00:00
|
|
|
/* invalidate the buffer */
|
2000-04-02 15:24:56 +00:00
|
|
|
bp->b_ioflags |= BIO_ERROR;
|
1993-10-12 06:08:31 +00:00
|
|
|
bp->b_resid = bp->b_bcount;
|
|
|
|
biodone(bp);
|
Newly implemented ioctls list:
DIOCGDINFO, DIOCGPART, DIOCWDINFO, DIOCSDINFO, CDIOCPLAYMSF, CDIOCRESET,
CDIOCEJECT.
CDIOCPLAYBLOCKS removed (old implementation completely wrong and I don't
know how to implement it correctly).
All routines now detects media change correctly.
DELAY_GETREPLAY increased for long time access from first track
to last.
mcd_waitrdy() now use MIN_DELAY=15 as minimal delay which independs
of machine speed.
mcd_doread() now uses real status (old code uses obsoleted soft copy of it).
clear XBSY on error in mcd_doread()
mcd_statrt(): add missing splx(s), cause dead hang with unmatched slpbio()
optimize mcd_doread(), don't set CD mode each time, keep soft copy of mode.
call getdisklabel() _after_ mcdsize() for proper sizes
mcdopen(): old code forget to set MCDREADRAW in flags when open RAW
partition, doread check it for setting RAW CD mode.
Do nothing on stray interrupt (which sometimes occurse, because driver
read data block too slow, DOS driver use 'insb' here). Old stray code
cause timeouts.
Read toc entries code rewritten to return many requested entries
(as supposed) instead of one entry with incorrect structure.
CMDREAD2 requests covered with disable_intr()/enable_intr()
(from DOS driver)
Read junk code added after read block code in doread (from DOS driver)
mcd_read_toc() code fixed to read all needed entries, old code cause
some audio tracks is not played.
mcd_playtracks() code fixed to proper check valid track range.
New binary read modes implemented (from DOS driver).
1994-09-03 16:48:13 +00:00
|
|
|
|
|
|
|
cd->flags &= ~(MCDMBXBSY|MCDREADRAW);
|
1993-10-12 06:08:31 +00:00
|
|
|
mcd_start(mbx->unit);
|
|
|
|
return;
|
|
|
|
|
Newly implemented ioctls list:
DIOCGDINFO, DIOCGPART, DIOCWDINFO, DIOCSDINFO, CDIOCPLAYMSF, CDIOCRESET,
CDIOCEJECT.
CDIOCPLAYBLOCKS removed (old implementation completely wrong and I don't
know how to implement it correctly).
All routines now detects media change correctly.
DELAY_GETREPLAY increased for long time access from first track
to last.
mcd_waitrdy() now use MIN_DELAY=15 as minimal delay which independs
of machine speed.
mcd_doread() now uses real status (old code uses obsoleted soft copy of it).
clear XBSY on error in mcd_doread()
mcd_statrt(): add missing splx(s), cause dead hang with unmatched slpbio()
optimize mcd_doread(), don't set CD mode each time, keep soft copy of mode.
call getdisklabel() _after_ mcdsize() for proper sizes
mcdopen(): old code forget to set MCDREADRAW in flags when open RAW
partition, doread check it for setting RAW CD mode.
Do nothing on stray interrupt (which sometimes occurse, because driver
read data block too slow, DOS driver use 'insb' here). Old stray code
cause timeouts.
Read toc entries code rewritten to return many requested entries
(as supposed) instead of one entry with incorrect structure.
CMDREAD2 requests covered with disable_intr()/enable_intr()
(from DOS driver)
Read junk code added after read block code in doread (from DOS driver)
mcd_read_toc() code fixed to read all needed entries, old code cause
some audio tracks is not played.
mcd_playtracks() code fixed to proper check valid track range.
New binary read modes implemented (from DOS driver).
1994-09-03 16:48:13 +00:00
|
|
|
changed:
|
|
|
|
printf("mcd%d: media changed\n", unit);
|
|
|
|
goto harderr;
|
|
|
|
|
1993-10-12 06:08:31 +00:00
|
|
|
#ifdef NOTDEF
|
|
|
|
printf("mcd%d: unit timeout, resetting\n",mbx->unit);
|
|
|
|
outb(mbx->port+mcd_reset,MCD_CMDRESET);
|
|
|
|
DELAY(300000);
|
|
|
|
(void)mcd_getstat(mbx->unit,1);
|
|
|
|
(void)mcd_getstat(mbx->unit,1);
|
|
|
|
/*cd->status &= ~MCDDSKCHNG; */
|
|
|
|
cd->debug = 1; /* preventive set debug mode */
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
}
|
|
|
|
|
Newly implemented ioctls list:
DIOCGDINFO, DIOCGPART, DIOCWDINFO, DIOCSDINFO, CDIOCPLAYMSF, CDIOCRESET,
CDIOCEJECT.
CDIOCPLAYBLOCKS removed (old implementation completely wrong and I don't
know how to implement it correctly).
All routines now detects media change correctly.
DELAY_GETREPLAY increased for long time access from first track
to last.
mcd_waitrdy() now use MIN_DELAY=15 as minimal delay which independs
of machine speed.
mcd_doread() now uses real status (old code uses obsoleted soft copy of it).
clear XBSY on error in mcd_doread()
mcd_statrt(): add missing splx(s), cause dead hang with unmatched slpbio()
optimize mcd_doread(), don't set CD mode each time, keep soft copy of mode.
call getdisklabel() _after_ mcdsize() for proper sizes
mcdopen(): old code forget to set MCDREADRAW in flags when open RAW
partition, doread check it for setting RAW CD mode.
Do nothing on stray interrupt (which sometimes occurse, because driver
read data block too slow, DOS driver use 'insb' here). Old stray code
cause timeouts.
Read toc entries code rewritten to return many requested entries
(as supposed) instead of one entry with incorrect structure.
CMDREAD2 requests covered with disable_intr()/enable_intr()
(from DOS driver)
Read junk code added after read block code in doread (from DOS driver)
mcd_read_toc() code fixed to read all needed entries, old code cause
some audio tracks is not played.
mcd_playtracks() code fixed to proper check valid track range.
New binary read modes implemented (from DOS driver).
1994-09-03 16:48:13 +00:00
|
|
|
static int
|
1995-02-22 01:11:36 +00:00
|
|
|
mcd_lock_door(int unit, int lock)
|
|
|
|
{
|
|
|
|
struct mcd_data *cd = mcd_data + unit;
|
|
|
|
int port = cd->iobase;
|
|
|
|
|
|
|
|
outb(port+mcd_command, MCD_CMDLOCKDRV);
|
|
|
|
outb(port+mcd_command, lock);
|
|
|
|
if (mcd_getstat(unit,0) == -1)
|
|
|
|
return EIO;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
mcd_close_tray(int unit)
|
Newly implemented ioctls list:
DIOCGDINFO, DIOCGPART, DIOCWDINFO, DIOCSDINFO, CDIOCPLAYMSF, CDIOCRESET,
CDIOCEJECT.
CDIOCPLAYBLOCKS removed (old implementation completely wrong and I don't
know how to implement it correctly).
All routines now detects media change correctly.
DELAY_GETREPLAY increased for long time access from first track
to last.
mcd_waitrdy() now use MIN_DELAY=15 as minimal delay which independs
of machine speed.
mcd_doread() now uses real status (old code uses obsoleted soft copy of it).
clear XBSY on error in mcd_doread()
mcd_statrt(): add missing splx(s), cause dead hang with unmatched slpbio()
optimize mcd_doread(), don't set CD mode each time, keep soft copy of mode.
call getdisklabel() _after_ mcdsize() for proper sizes
mcdopen(): old code forget to set MCDREADRAW in flags when open RAW
partition, doread check it for setting RAW CD mode.
Do nothing on stray interrupt (which sometimes occurse, because driver
read data block too slow, DOS driver use 'insb' here). Old stray code
cause timeouts.
Read toc entries code rewritten to return many requested entries
(as supposed) instead of one entry with incorrect structure.
CMDREAD2 requests covered with disable_intr()/enable_intr()
(from DOS driver)
Read junk code added after read block code in doread (from DOS driver)
mcd_read_toc() code fixed to read all needed entries, old code cause
some audio tracks is not played.
mcd_playtracks() code fixed to proper check valid track range.
New binary read modes implemented (from DOS driver).
1994-09-03 16:48:13 +00:00
|
|
|
{
|
|
|
|
struct mcd_data *cd = mcd_data + unit;
|
|
|
|
int port = cd->iobase;
|
1995-02-22 01:11:36 +00:00
|
|
|
int retry, r;
|
Newly implemented ioctls list:
DIOCGDINFO, DIOCGPART, DIOCWDINFO, DIOCSDINFO, CDIOCPLAYMSF, CDIOCRESET,
CDIOCEJECT.
CDIOCPLAYBLOCKS removed (old implementation completely wrong and I don't
know how to implement it correctly).
All routines now detects media change correctly.
DELAY_GETREPLAY increased for long time access from first track
to last.
mcd_waitrdy() now use MIN_DELAY=15 as minimal delay which independs
of machine speed.
mcd_doread() now uses real status (old code uses obsoleted soft copy of it).
clear XBSY on error in mcd_doread()
mcd_statrt(): add missing splx(s), cause dead hang with unmatched slpbio()
optimize mcd_doread(), don't set CD mode each time, keep soft copy of mode.
call getdisklabel() _after_ mcdsize() for proper sizes
mcdopen(): old code forget to set MCDREADRAW in flags when open RAW
partition, doread check it for setting RAW CD mode.
Do nothing on stray interrupt (which sometimes occurse, because driver
read data block too slow, DOS driver use 'insb' here). Old stray code
cause timeouts.
Read toc entries code rewritten to return many requested entries
(as supposed) instead of one entry with incorrect structure.
CMDREAD2 requests covered with disable_intr()/enable_intr()
(from DOS driver)
Read junk code added after read block code in doread (from DOS driver)
mcd_read_toc() code fixed to read all needed entries, old code cause
some audio tracks is not played.
mcd_playtracks() code fixed to proper check valid track range.
New binary read modes implemented (from DOS driver).
1994-09-03 16:48:13 +00:00
|
|
|
|
1995-02-22 01:11:36 +00:00
|
|
|
if (mcd_getstat(unit,1) == -1)
|
|
|
|
return EIO;
|
|
|
|
if (cd->status & MCDDOOROPEN) {
|
|
|
|
outb(port+mcd_command, MCD_CMDCLOSETRAY);
|
|
|
|
for (retry = 0; retry < CLOSE_TRAY_SECS * WAIT_FRAC; retry++) {
|
|
|
|
if (inb(port+MCD_FLAGS) & MFL_STATUS_NOT_AVAIL)
|
|
|
|
(void) tsleep((caddr_t)cd, PSOCK | PCATCH, "mcdcls", hz/WAIT_FRAC);
|
|
|
|
else {
|
|
|
|
if ((r = mcd_getstat(unit,0)) == -1)
|
|
|
|
return EIO;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return ENXIO;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
mcd_eject(int unit)
|
|
|
|
{
|
|
|
|
struct mcd_data *cd = mcd_data + unit;
|
|
|
|
int port = cd->iobase, r;
|
|
|
|
|
|
|
|
if (mcd_getstat(unit,1) == -1) /* detect disk change too */
|
|
|
|
return EIO;
|
|
|
|
if (cd->status & MCDDOOROPEN)
|
1996-02-02 22:08:28 +00:00
|
|
|
return 0;
|
1995-02-22 01:11:36 +00:00
|
|
|
if ((r = mcd_stop(unit)) == EIO)
|
|
|
|
return r;
|
Newly implemented ioctls list:
DIOCGDINFO, DIOCGPART, DIOCWDINFO, DIOCSDINFO, CDIOCPLAYMSF, CDIOCRESET,
CDIOCEJECT.
CDIOCPLAYBLOCKS removed (old implementation completely wrong and I don't
know how to implement it correctly).
All routines now detects media change correctly.
DELAY_GETREPLAY increased for long time access from first track
to last.
mcd_waitrdy() now use MIN_DELAY=15 as minimal delay which independs
of machine speed.
mcd_doread() now uses real status (old code uses obsoleted soft copy of it).
clear XBSY on error in mcd_doread()
mcd_statrt(): add missing splx(s), cause dead hang with unmatched slpbio()
optimize mcd_doread(), don't set CD mode each time, keep soft copy of mode.
call getdisklabel() _after_ mcdsize() for proper sizes
mcdopen(): old code forget to set MCDREADRAW in flags when open RAW
partition, doread check it for setting RAW CD mode.
Do nothing on stray interrupt (which sometimes occurse, because driver
read data block too slow, DOS driver use 'insb' here). Old stray code
cause timeouts.
Read toc entries code rewritten to return many requested entries
(as supposed) instead of one entry with incorrect structure.
CMDREAD2 requests covered with disable_intr()/enable_intr()
(from DOS driver)
Read junk code added after read block code in doread (from DOS driver)
mcd_read_toc() code fixed to read all needed entries, old code cause
some audio tracks is not played.
mcd_playtracks() code fixed to proper check valid track range.
New binary read modes implemented (from DOS driver).
1994-09-03 16:48:13 +00:00
|
|
|
outb(port+mcd_command, MCD_CMDEJECTDISK);
|
1995-02-22 01:11:36 +00:00
|
|
|
if (mcd_getstat(unit,0) == -1)
|
|
|
|
return EIO;
|
Newly implemented ioctls list:
DIOCGDINFO, DIOCGPART, DIOCWDINFO, DIOCSDINFO, CDIOCPLAYMSF, CDIOCRESET,
CDIOCEJECT.
CDIOCPLAYBLOCKS removed (old implementation completely wrong and I don't
know how to implement it correctly).
All routines now detects media change correctly.
DELAY_GETREPLAY increased for long time access from first track
to last.
mcd_waitrdy() now use MIN_DELAY=15 as minimal delay which independs
of machine speed.
mcd_doread() now uses real status (old code uses obsoleted soft copy of it).
clear XBSY on error in mcd_doread()
mcd_statrt(): add missing splx(s), cause dead hang with unmatched slpbio()
optimize mcd_doread(), don't set CD mode each time, keep soft copy of mode.
call getdisklabel() _after_ mcdsize() for proper sizes
mcdopen(): old code forget to set MCDREADRAW in flags when open RAW
partition, doread check it for setting RAW CD mode.
Do nothing on stray interrupt (which sometimes occurse, because driver
read data block too slow, DOS driver use 'insb' here). Old stray code
cause timeouts.
Read toc entries code rewritten to return many requested entries
(as supposed) instead of one entry with incorrect structure.
CMDREAD2 requests covered with disable_intr()/enable_intr()
(from DOS driver)
Read junk code added after read block code in doread (from DOS driver)
mcd_read_toc() code fixed to read all needed entries, old code cause
some audio tracks is not played.
mcd_playtracks() code fixed to proper check valid track range.
New binary read modes implemented (from DOS driver).
1994-09-03 16:48:13 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
1996-02-02 22:08:28 +00:00
|
|
|
static int
|
|
|
|
mcd_inject(int unit)
|
|
|
|
{
|
|
|
|
struct mcd_data *cd = mcd_data + unit;
|
|
|
|
|
|
|
|
if (mcd_getstat(unit,1) == -1) /* detect disk change too */
|
|
|
|
return EIO;
|
|
|
|
if (cd->status & MCDDOOROPEN)
|
|
|
|
return mcd_close_tray(unit);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
Newly implemented ioctls list:
DIOCGDINFO, DIOCGPART, DIOCWDINFO, DIOCSDINFO, CDIOCPLAYMSF, CDIOCRESET,
CDIOCEJECT.
CDIOCPLAYBLOCKS removed (old implementation completely wrong and I don't
know how to implement it correctly).
All routines now detects media change correctly.
DELAY_GETREPLAY increased for long time access from first track
to last.
mcd_waitrdy() now use MIN_DELAY=15 as minimal delay which independs
of machine speed.
mcd_doread() now uses real status (old code uses obsoleted soft copy of it).
clear XBSY on error in mcd_doread()
mcd_statrt(): add missing splx(s), cause dead hang with unmatched slpbio()
optimize mcd_doread(), don't set CD mode each time, keep soft copy of mode.
call getdisklabel() _after_ mcdsize() for proper sizes
mcdopen(): old code forget to set MCDREADRAW in flags when open RAW
partition, doread check it for setting RAW CD mode.
Do nothing on stray interrupt (which sometimes occurse, because driver
read data block too slow, DOS driver use 'insb' here). Old stray code
cause timeouts.
Read toc entries code rewritten to return many requested entries
(as supposed) instead of one entry with incorrect structure.
CMDREAD2 requests covered with disable_intr()/enable_intr()
(from DOS driver)
Read junk code added after read block code in doread (from DOS driver)
mcd_read_toc() code fixed to read all needed entries, old code cause
some audio tracks is not played.
mcd_playtracks() code fixed to proper check valid track range.
New binary read modes implemented (from DOS driver).
1994-09-03 16:48:13 +00:00
|
|
|
static int
|
|
|
|
mcd_hard_reset(int unit)
|
|
|
|
{
|
|
|
|
struct mcd_data *cd = mcd_data + unit;
|
|
|
|
int port = cd->iobase;
|
|
|
|
|
|
|
|
outb(port+mcd_reset,MCD_CMDRESET);
|
|
|
|
cd->curr_mode = MCD_MD_UNKNOWN;
|
|
|
|
cd->audio_status = CD_AS_AUDIO_INVALID;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
mcd_soft_reset(int unit)
|
|
|
|
{
|
|
|
|
struct mcd_data *cd = mcd_data + unit;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
cd->flags &= (MCDINIT|MCDPROBING|MCDNEWMODEL);
|
|
|
|
cd->curr_mode = MCD_MD_UNKNOWN;
|
|
|
|
for (i=0; i<MAXPARTITIONS; i++) cd->partflags[i] = 0;
|
|
|
|
cd->audio_status = CD_AS_AUDIO_INVALID;
|
|
|
|
}
|
|
|
|
|
1994-02-22 08:44:31 +00:00
|
|
|
static int
|
|
|
|
mcd_setmode(int unit, int mode)
|
1993-10-12 06:08:31 +00:00
|
|
|
{
|
|
|
|
struct mcd_data *cd = mcd_data + unit;
|
|
|
|
int port = cd->iobase;
|
Newly implemented ioctls list:
DIOCGDINFO, DIOCGPART, DIOCWDINFO, DIOCSDINFO, CDIOCPLAYMSF, CDIOCRESET,
CDIOCEJECT.
CDIOCPLAYBLOCKS removed (old implementation completely wrong and I don't
know how to implement it correctly).
All routines now detects media change correctly.
DELAY_GETREPLAY increased for long time access from first track
to last.
mcd_waitrdy() now use MIN_DELAY=15 as minimal delay which independs
of machine speed.
mcd_doread() now uses real status (old code uses obsoleted soft copy of it).
clear XBSY on error in mcd_doread()
mcd_statrt(): add missing splx(s), cause dead hang with unmatched slpbio()
optimize mcd_doread(), don't set CD mode each time, keep soft copy of mode.
call getdisklabel() _after_ mcdsize() for proper sizes
mcdopen(): old code forget to set MCDREADRAW in flags when open RAW
partition, doread check it for setting RAW CD mode.
Do nothing on stray interrupt (which sometimes occurse, because driver
read data block too slow, DOS driver use 'insb' here). Old stray code
cause timeouts.
Read toc entries code rewritten to return many requested entries
(as supposed) instead of one entry with incorrect structure.
CMDREAD2 requests covered with disable_intr()/enable_intr()
(from DOS driver)
Read junk code added after read block code in doread (from DOS driver)
mcd_read_toc() code fixed to read all needed entries, old code cause
some audio tracks is not played.
mcd_playtracks() code fixed to proper check valid track range.
New binary read modes implemented (from DOS driver).
1994-09-03 16:48:13 +00:00
|
|
|
int retry, st;
|
1993-10-12 06:08:31 +00:00
|
|
|
|
Newly implemented ioctls list:
DIOCGDINFO, DIOCGPART, DIOCWDINFO, DIOCSDINFO, CDIOCPLAYMSF, CDIOCRESET,
CDIOCEJECT.
CDIOCPLAYBLOCKS removed (old implementation completely wrong and I don't
know how to implement it correctly).
All routines now detects media change correctly.
DELAY_GETREPLAY increased for long time access from first track
to last.
mcd_waitrdy() now use MIN_DELAY=15 as minimal delay which independs
of machine speed.
mcd_doread() now uses real status (old code uses obsoleted soft copy of it).
clear XBSY on error in mcd_doread()
mcd_statrt(): add missing splx(s), cause dead hang with unmatched slpbio()
optimize mcd_doread(), don't set CD mode each time, keep soft copy of mode.
call getdisklabel() _after_ mcdsize() for proper sizes
mcdopen(): old code forget to set MCDREADRAW in flags when open RAW
partition, doread check it for setting RAW CD mode.
Do nothing on stray interrupt (which sometimes occurse, because driver
read data block too slow, DOS driver use 'insb' here). Old stray code
cause timeouts.
Read toc entries code rewritten to return many requested entries
(as supposed) instead of one entry with incorrect structure.
CMDREAD2 requests covered with disable_intr()/enable_intr()
(from DOS driver)
Read junk code added after read block code in doread (from DOS driver)
mcd_read_toc() code fixed to read all needed entries, old code cause
some audio tracks is not played.
mcd_playtracks() code fixed to proper check valid track range.
New binary read modes implemented (from DOS driver).
1994-09-03 16:48:13 +00:00
|
|
|
if (cd->curr_mode == mode)
|
|
|
|
return 0;
|
|
|
|
if (cd->debug)
|
|
|
|
printf("mcd%d: setting mode to %d\n", unit, mode);
|
1993-10-12 06:08:31 +00:00
|
|
|
for(retry=0; retry<MCD_RETRYS; retry++)
|
|
|
|
{
|
Newly implemented ioctls list:
DIOCGDINFO, DIOCGPART, DIOCWDINFO, DIOCSDINFO, CDIOCPLAYMSF, CDIOCRESET,
CDIOCEJECT.
CDIOCPLAYBLOCKS removed (old implementation completely wrong and I don't
know how to implement it correctly).
All routines now detects media change correctly.
DELAY_GETREPLAY increased for long time access from first track
to last.
mcd_waitrdy() now use MIN_DELAY=15 as minimal delay which independs
of machine speed.
mcd_doread() now uses real status (old code uses obsoleted soft copy of it).
clear XBSY on error in mcd_doread()
mcd_statrt(): add missing splx(s), cause dead hang with unmatched slpbio()
optimize mcd_doread(), don't set CD mode each time, keep soft copy of mode.
call getdisklabel() _after_ mcdsize() for proper sizes
mcdopen(): old code forget to set MCDREADRAW in flags when open RAW
partition, doread check it for setting RAW CD mode.
Do nothing on stray interrupt (which sometimes occurse, because driver
read data block too slow, DOS driver use 'insb' here). Old stray code
cause timeouts.
Read toc entries code rewritten to return many requested entries
(as supposed) instead of one entry with incorrect structure.
CMDREAD2 requests covered with disable_intr()/enable_intr()
(from DOS driver)
Read junk code added after read block code in doread (from DOS driver)
mcd_read_toc() code fixed to read all needed entries, old code cause
some audio tracks is not played.
mcd_playtracks() code fixed to proper check valid track range.
New binary read modes implemented (from DOS driver).
1994-09-03 16:48:13 +00:00
|
|
|
cd->curr_mode = MCD_MD_UNKNOWN;
|
1993-10-12 06:08:31 +00:00
|
|
|
outb(port+mcd_command, MCD_CMDSETMODE);
|
|
|
|
outb(port+mcd_command, mode);
|
Newly implemented ioctls list:
DIOCGDINFO, DIOCGPART, DIOCWDINFO, DIOCSDINFO, CDIOCPLAYMSF, CDIOCRESET,
CDIOCEJECT.
CDIOCPLAYBLOCKS removed (old implementation completely wrong and I don't
know how to implement it correctly).
All routines now detects media change correctly.
DELAY_GETREPLAY increased for long time access from first track
to last.
mcd_waitrdy() now use MIN_DELAY=15 as minimal delay which independs
of machine speed.
mcd_doread() now uses real status (old code uses obsoleted soft copy of it).
clear XBSY on error in mcd_doread()
mcd_statrt(): add missing splx(s), cause dead hang with unmatched slpbio()
optimize mcd_doread(), don't set CD mode each time, keep soft copy of mode.
call getdisklabel() _after_ mcdsize() for proper sizes
mcdopen(): old code forget to set MCDREADRAW in flags when open RAW
partition, doread check it for setting RAW CD mode.
Do nothing on stray interrupt (which sometimes occurse, because driver
read data block too slow, DOS driver use 'insb' here). Old stray code
cause timeouts.
Read toc entries code rewritten to return many requested entries
(as supposed) instead of one entry with incorrect structure.
CMDREAD2 requests covered with disable_intr()/enable_intr()
(from DOS driver)
Read junk code added after read block code in doread (from DOS driver)
mcd_read_toc() code fixed to read all needed entries, old code cause
some audio tracks is not played.
mcd_playtracks() code fixed to proper check valid track range.
New binary read modes implemented (from DOS driver).
1994-09-03 16:48:13 +00:00
|
|
|
if ((st = mcd_getstat(unit, 0)) >= 0) {
|
|
|
|
cd->curr_mode = mode;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
if (st == -2) {
|
|
|
|
printf("mcd%d: media changed\n", unit);
|
|
|
|
break;
|
|
|
|
}
|
1993-10-12 06:08:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
1994-02-22 08:44:31 +00:00
|
|
|
static int
|
|
|
|
mcd_toc_header(int unit, struct ioc_toc_header *th)
|
1993-10-12 06:08:31 +00:00
|
|
|
{
|
|
|
|
struct mcd_data *cd = mcd_data + unit;
|
Newly implemented ioctls list:
DIOCGDINFO, DIOCGPART, DIOCWDINFO, DIOCSDINFO, CDIOCPLAYMSF, CDIOCRESET,
CDIOCEJECT.
CDIOCPLAYBLOCKS removed (old implementation completely wrong and I don't
know how to implement it correctly).
All routines now detects media change correctly.
DELAY_GETREPLAY increased for long time access from first track
to last.
mcd_waitrdy() now use MIN_DELAY=15 as minimal delay which independs
of machine speed.
mcd_doread() now uses real status (old code uses obsoleted soft copy of it).
clear XBSY on error in mcd_doread()
mcd_statrt(): add missing splx(s), cause dead hang with unmatched slpbio()
optimize mcd_doread(), don't set CD mode each time, keep soft copy of mode.
call getdisklabel() _after_ mcdsize() for proper sizes
mcdopen(): old code forget to set MCDREADRAW in flags when open RAW
partition, doread check it for setting RAW CD mode.
Do nothing on stray interrupt (which sometimes occurse, because driver
read data block too slow, DOS driver use 'insb' here). Old stray code
cause timeouts.
Read toc entries code rewritten to return many requested entries
(as supposed) instead of one entry with incorrect structure.
CMDREAD2 requests covered with disable_intr()/enable_intr()
(from DOS driver)
Read junk code added after read block code in doread (from DOS driver)
mcd_read_toc() code fixed to read all needed entries, old code cause
some audio tracks is not played.
mcd_playtracks() code fixed to proper check valid track range.
New binary read modes implemented (from DOS driver).
1994-09-03 16:48:13 +00:00
|
|
|
int r;
|
1993-10-12 06:08:31 +00:00
|
|
|
|
Newly implemented ioctls list:
DIOCGDINFO, DIOCGPART, DIOCWDINFO, DIOCSDINFO, CDIOCPLAYMSF, CDIOCRESET,
CDIOCEJECT.
CDIOCPLAYBLOCKS removed (old implementation completely wrong and I don't
know how to implement it correctly).
All routines now detects media change correctly.
DELAY_GETREPLAY increased for long time access from first track
to last.
mcd_waitrdy() now use MIN_DELAY=15 as minimal delay which independs
of machine speed.
mcd_doread() now uses real status (old code uses obsoleted soft copy of it).
clear XBSY on error in mcd_doread()
mcd_statrt(): add missing splx(s), cause dead hang with unmatched slpbio()
optimize mcd_doread(), don't set CD mode each time, keep soft copy of mode.
call getdisklabel() _after_ mcdsize() for proper sizes
mcdopen(): old code forget to set MCDREADRAW in flags when open RAW
partition, doread check it for setting RAW CD mode.
Do nothing on stray interrupt (which sometimes occurse, because driver
read data block too slow, DOS driver use 'insb' here). Old stray code
cause timeouts.
Read toc entries code rewritten to return many requested entries
(as supposed) instead of one entry with incorrect structure.
CMDREAD2 requests covered with disable_intr()/enable_intr()
(from DOS driver)
Read junk code added after read block code in doread (from DOS driver)
mcd_read_toc() code fixed to read all needed entries, old code cause
some audio tracks is not played.
mcd_playtracks() code fixed to proper check valid track range.
New binary read modes implemented (from DOS driver).
1994-09-03 16:48:13 +00:00
|
|
|
if ((r = mcd_volinfo(unit)) != 0)
|
|
|
|
return r;
|
1993-10-12 06:08:31 +00:00
|
|
|
|
|
|
|
th->starting_track = bcd2bin(cd->volinfo.trk_low);
|
|
|
|
th->ending_track = bcd2bin(cd->volinfo.trk_high);
|
1996-02-03 00:06:49 +00:00
|
|
|
th->len = 2 * sizeof(u_char) /* start & end tracks */ +
|
|
|
|
(th->ending_track + 1 - th->starting_track + 1) *
|
|
|
|
sizeof(struct cd_toc_entry);
|
1993-10-12 06:08:31 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
1994-02-22 08:44:31 +00:00
|
|
|
static int
|
|
|
|
mcd_read_toc(int unit)
|
1993-10-12 06:08:31 +00:00
|
|
|
{
|
|
|
|
struct mcd_data *cd = mcd_data + unit;
|
|
|
|
struct ioc_toc_header th;
|
|
|
|
struct mcd_qchninfo q;
|
|
|
|
int rc, trk, idx, retry;
|
|
|
|
|
|
|
|
/* Only read TOC if needed */
|
Newly implemented ioctls list:
DIOCGDINFO, DIOCGPART, DIOCWDINFO, DIOCSDINFO, CDIOCPLAYMSF, CDIOCRESET,
CDIOCEJECT.
CDIOCPLAYBLOCKS removed (old implementation completely wrong and I don't
know how to implement it correctly).
All routines now detects media change correctly.
DELAY_GETREPLAY increased for long time access from first track
to last.
mcd_waitrdy() now use MIN_DELAY=15 as minimal delay which independs
of machine speed.
mcd_doread() now uses real status (old code uses obsoleted soft copy of it).
clear XBSY on error in mcd_doread()
mcd_statrt(): add missing splx(s), cause dead hang with unmatched slpbio()
optimize mcd_doread(), don't set CD mode each time, keep soft copy of mode.
call getdisklabel() _after_ mcdsize() for proper sizes
mcdopen(): old code forget to set MCDREADRAW in flags when open RAW
partition, doread check it for setting RAW CD mode.
Do nothing on stray interrupt (which sometimes occurse, because driver
read data block too slow, DOS driver use 'insb' here). Old stray code
cause timeouts.
Read toc entries code rewritten to return many requested entries
(as supposed) instead of one entry with incorrect structure.
CMDREAD2 requests covered with disable_intr()/enable_intr()
(from DOS driver)
Read junk code added after read block code in doread (from DOS driver)
mcd_read_toc() code fixed to read all needed entries, old code cause
some audio tracks is not played.
mcd_playtracks() code fixed to proper check valid track range.
New binary read modes implemented (from DOS driver).
1994-09-03 16:48:13 +00:00
|
|
|
if (cd->flags & MCDTOC)
|
1994-02-22 08:44:31 +00:00
|
|
|
return 0;
|
1993-10-12 06:08:31 +00:00
|
|
|
|
Newly implemented ioctls list:
DIOCGDINFO, DIOCGPART, DIOCWDINFO, DIOCSDINFO, CDIOCPLAYMSF, CDIOCRESET,
CDIOCEJECT.
CDIOCPLAYBLOCKS removed (old implementation completely wrong and I don't
know how to implement it correctly).
All routines now detects media change correctly.
DELAY_GETREPLAY increased for long time access from first track
to last.
mcd_waitrdy() now use MIN_DELAY=15 as minimal delay which independs
of machine speed.
mcd_doread() now uses real status (old code uses obsoleted soft copy of it).
clear XBSY on error in mcd_doread()
mcd_statrt(): add missing splx(s), cause dead hang with unmatched slpbio()
optimize mcd_doread(), don't set CD mode each time, keep soft copy of mode.
call getdisklabel() _after_ mcdsize() for proper sizes
mcdopen(): old code forget to set MCDREADRAW in flags when open RAW
partition, doread check it for setting RAW CD mode.
Do nothing on stray interrupt (which sometimes occurse, because driver
read data block too slow, DOS driver use 'insb' here). Old stray code
cause timeouts.
Read toc entries code rewritten to return many requested entries
(as supposed) instead of one entry with incorrect structure.
CMDREAD2 requests covered with disable_intr()/enable_intr()
(from DOS driver)
Read junk code added after read block code in doread (from DOS driver)
mcd_read_toc() code fixed to read all needed entries, old code cause
some audio tracks is not played.
mcd_playtracks() code fixed to proper check valid track range.
New binary read modes implemented (from DOS driver).
1994-09-03 16:48:13 +00:00
|
|
|
if (cd->debug)
|
|
|
|
printf("mcd%d: reading toc header\n", unit);
|
1993-10-12 06:08:31 +00:00
|
|
|
|
Newly implemented ioctls list:
DIOCGDINFO, DIOCGPART, DIOCWDINFO, DIOCSDINFO, CDIOCPLAYMSF, CDIOCRESET,
CDIOCEJECT.
CDIOCPLAYBLOCKS removed (old implementation completely wrong and I don't
know how to implement it correctly).
All routines now detects media change correctly.
DELAY_GETREPLAY increased for long time access from first track
to last.
mcd_waitrdy() now use MIN_DELAY=15 as minimal delay which independs
of machine speed.
mcd_doread() now uses real status (old code uses obsoleted soft copy of it).
clear XBSY on error in mcd_doread()
mcd_statrt(): add missing splx(s), cause dead hang with unmatched slpbio()
optimize mcd_doread(), don't set CD mode each time, keep soft copy of mode.
call getdisklabel() _after_ mcdsize() for proper sizes
mcdopen(): old code forget to set MCDREADRAW in flags when open RAW
partition, doread check it for setting RAW CD mode.
Do nothing on stray interrupt (which sometimes occurse, because driver
read data block too slow, DOS driver use 'insb' here). Old stray code
cause timeouts.
Read toc entries code rewritten to return many requested entries
(as supposed) instead of one entry with incorrect structure.
CMDREAD2 requests covered with disable_intr()/enable_intr()
(from DOS driver)
Read junk code added after read block code in doread (from DOS driver)
mcd_read_toc() code fixed to read all needed entries, old code cause
some audio tracks is not played.
mcd_playtracks() code fixed to proper check valid track range.
New binary read modes implemented (from DOS driver).
1994-09-03 16:48:13 +00:00
|
|
|
if ((rc = mcd_toc_header(unit, &th)) != 0)
|
1993-10-12 06:08:31 +00:00
|
|
|
return rc;
|
|
|
|
|
1995-02-23 17:40:16 +00:00
|
|
|
if (mcd_send(unit, MCD_CMDSTOPAUDIO, MCD_RETRYS) < 0)
|
|
|
|
return EIO;
|
|
|
|
|
Newly implemented ioctls list:
DIOCGDINFO, DIOCGPART, DIOCWDINFO, DIOCSDINFO, CDIOCPLAYMSF, CDIOCRESET,
CDIOCEJECT.
CDIOCPLAYBLOCKS removed (old implementation completely wrong and I don't
know how to implement it correctly).
All routines now detects media change correctly.
DELAY_GETREPLAY increased for long time access from first track
to last.
mcd_waitrdy() now use MIN_DELAY=15 as minimal delay which independs
of machine speed.
mcd_doread() now uses real status (old code uses obsoleted soft copy of it).
clear XBSY on error in mcd_doread()
mcd_statrt(): add missing splx(s), cause dead hang with unmatched slpbio()
optimize mcd_doread(), don't set CD mode each time, keep soft copy of mode.
call getdisklabel() _after_ mcdsize() for proper sizes
mcdopen(): old code forget to set MCDREADRAW in flags when open RAW
partition, doread check it for setting RAW CD mode.
Do nothing on stray interrupt (which sometimes occurse, because driver
read data block too slow, DOS driver use 'insb' here). Old stray code
cause timeouts.
Read toc entries code rewritten to return many requested entries
(as supposed) instead of one entry with incorrect structure.
CMDREAD2 requests covered with disable_intr()/enable_intr()
(from DOS driver)
Read junk code added after read block code in doread (from DOS driver)
mcd_read_toc() code fixed to read all needed entries, old code cause
some audio tracks is not played.
mcd_playtracks() code fixed to proper check valid track range.
New binary read modes implemented (from DOS driver).
1994-09-03 16:48:13 +00:00
|
|
|
if (mcd_setmode(unit, MCD_MD_TOC) != 0)
|
1993-10-12 06:08:31 +00:00
|
|
|
return EIO;
|
|
|
|
|
Newly implemented ioctls list:
DIOCGDINFO, DIOCGPART, DIOCWDINFO, DIOCSDINFO, CDIOCPLAYMSF, CDIOCRESET,
CDIOCEJECT.
CDIOCPLAYBLOCKS removed (old implementation completely wrong and I don't
know how to implement it correctly).
All routines now detects media change correctly.
DELAY_GETREPLAY increased for long time access from first track
to last.
mcd_waitrdy() now use MIN_DELAY=15 as minimal delay which independs
of machine speed.
mcd_doread() now uses real status (old code uses obsoleted soft copy of it).
clear XBSY on error in mcd_doread()
mcd_statrt(): add missing splx(s), cause dead hang with unmatched slpbio()
optimize mcd_doread(), don't set CD mode each time, keep soft copy of mode.
call getdisklabel() _after_ mcdsize() for proper sizes
mcdopen(): old code forget to set MCDREADRAW in flags when open RAW
partition, doread check it for setting RAW CD mode.
Do nothing on stray interrupt (which sometimes occurse, because driver
read data block too slow, DOS driver use 'insb' here). Old stray code
cause timeouts.
Read toc entries code rewritten to return many requested entries
(as supposed) instead of one entry with incorrect structure.
CMDREAD2 requests covered with disable_intr()/enable_intr()
(from DOS driver)
Read junk code added after read block code in doread (from DOS driver)
mcd_read_toc() code fixed to read all needed entries, old code cause
some audio tracks is not played.
mcd_playtracks() code fixed to proper check valid track range.
New binary read modes implemented (from DOS driver).
1994-09-03 16:48:13 +00:00
|
|
|
if (cd->debug)
|
|
|
|
printf("mcd%d: get_toc reading qchannel info\n",unit);
|
|
|
|
|
1993-10-12 06:08:31 +00:00
|
|
|
for(trk=th.starting_track; trk<=th.ending_track; trk++)
|
|
|
|
cd->toc[trk].idx_no = 0;
|
|
|
|
trk = th.ending_track - th.starting_track + 1;
|
1995-02-22 02:12:10 +00:00
|
|
|
for(retry=0; retry<600 && trk>0; retry++)
|
1993-10-12 06:08:31 +00:00
|
|
|
{
|
|
|
|
if (mcd_getqchan(unit, &q) < 0) break;
|
|
|
|
idx = bcd2bin(q.idx_no);
|
Newly implemented ioctls list:
DIOCGDINFO, DIOCGPART, DIOCWDINFO, DIOCSDINFO, CDIOCPLAYMSF, CDIOCRESET,
CDIOCEJECT.
CDIOCPLAYBLOCKS removed (old implementation completely wrong and I don't
know how to implement it correctly).
All routines now detects media change correctly.
DELAY_GETREPLAY increased for long time access from first track
to last.
mcd_waitrdy() now use MIN_DELAY=15 as minimal delay which independs
of machine speed.
mcd_doread() now uses real status (old code uses obsoleted soft copy of it).
clear XBSY on error in mcd_doread()
mcd_statrt(): add missing splx(s), cause dead hang with unmatched slpbio()
optimize mcd_doread(), don't set CD mode each time, keep soft copy of mode.
call getdisklabel() _after_ mcdsize() for proper sizes
mcdopen(): old code forget to set MCDREADRAW in flags when open RAW
partition, doread check it for setting RAW CD mode.
Do nothing on stray interrupt (which sometimes occurse, because driver
read data block too slow, DOS driver use 'insb' here). Old stray code
cause timeouts.
Read toc entries code rewritten to return many requested entries
(as supposed) instead of one entry with incorrect structure.
CMDREAD2 requests covered with disable_intr()/enable_intr()
(from DOS driver)
Read junk code added after read block code in doread (from DOS driver)
mcd_read_toc() code fixed to read all needed entries, old code cause
some audio tracks is not played.
mcd_playtracks() code fixed to proper check valid track range.
New binary read modes implemented (from DOS driver).
1994-09-03 16:48:13 +00:00
|
|
|
if (idx>=th.starting_track && idx<=th.ending_track && q.trk_no==0) {
|
1994-02-22 08:44:31 +00:00
|
|
|
if (cd->toc[idx].idx_no == 0) {
|
1993-10-12 06:08:31 +00:00
|
|
|
cd->toc[idx] = q;
|
|
|
|
trk--;
|
|
|
|
}
|
1994-02-22 08:44:31 +00:00
|
|
|
}
|
1993-10-12 06:08:31 +00:00
|
|
|
}
|
|
|
|
|
Newly implemented ioctls list:
DIOCGDINFO, DIOCGPART, DIOCWDINFO, DIOCSDINFO, CDIOCPLAYMSF, CDIOCRESET,
CDIOCEJECT.
CDIOCPLAYBLOCKS removed (old implementation completely wrong and I don't
know how to implement it correctly).
All routines now detects media change correctly.
DELAY_GETREPLAY increased for long time access from first track
to last.
mcd_waitrdy() now use MIN_DELAY=15 as minimal delay which independs
of machine speed.
mcd_doread() now uses real status (old code uses obsoleted soft copy of it).
clear XBSY on error in mcd_doread()
mcd_statrt(): add missing splx(s), cause dead hang with unmatched slpbio()
optimize mcd_doread(), don't set CD mode each time, keep soft copy of mode.
call getdisklabel() _after_ mcdsize() for proper sizes
mcdopen(): old code forget to set MCDREADRAW in flags when open RAW
partition, doread check it for setting RAW CD mode.
Do nothing on stray interrupt (which sometimes occurse, because driver
read data block too slow, DOS driver use 'insb' here). Old stray code
cause timeouts.
Read toc entries code rewritten to return many requested entries
(as supposed) instead of one entry with incorrect structure.
CMDREAD2 requests covered with disable_intr()/enable_intr()
(from DOS driver)
Read junk code added after read block code in doread (from DOS driver)
mcd_read_toc() code fixed to read all needed entries, old code cause
some audio tracks is not played.
mcd_playtracks() code fixed to proper check valid track range.
New binary read modes implemented (from DOS driver).
1994-09-03 16:48:13 +00:00
|
|
|
if (mcd_setmode(unit, MCD_MD_COOKED) != 0)
|
1993-10-12 06:08:31 +00:00
|
|
|
return EIO;
|
|
|
|
|
Newly implemented ioctls list:
DIOCGDINFO, DIOCGPART, DIOCWDINFO, DIOCSDINFO, CDIOCPLAYMSF, CDIOCRESET,
CDIOCEJECT.
CDIOCPLAYBLOCKS removed (old implementation completely wrong and I don't
know how to implement it correctly).
All routines now detects media change correctly.
DELAY_GETREPLAY increased for long time access from first track
to last.
mcd_waitrdy() now use MIN_DELAY=15 as minimal delay which independs
of machine speed.
mcd_doread() now uses real status (old code uses obsoleted soft copy of it).
clear XBSY on error in mcd_doread()
mcd_statrt(): add missing splx(s), cause dead hang with unmatched slpbio()
optimize mcd_doread(), don't set CD mode each time, keep soft copy of mode.
call getdisklabel() _after_ mcdsize() for proper sizes
mcdopen(): old code forget to set MCDREADRAW in flags when open RAW
partition, doread check it for setting RAW CD mode.
Do nothing on stray interrupt (which sometimes occurse, because driver
read data block too slow, DOS driver use 'insb' here). Old stray code
cause timeouts.
Read toc entries code rewritten to return many requested entries
(as supposed) instead of one entry with incorrect structure.
CMDREAD2 requests covered with disable_intr()/enable_intr()
(from DOS driver)
Read junk code added after read block code in doread (from DOS driver)
mcd_read_toc() code fixed to read all needed entries, old code cause
some audio tracks is not played.
mcd_playtracks() code fixed to proper check valid track range.
New binary read modes implemented (from DOS driver).
1994-09-03 16:48:13 +00:00
|
|
|
if (trk != 0)
|
1994-02-22 08:44:31 +00:00
|
|
|
return ENXIO;
|
1993-10-12 06:08:31 +00:00
|
|
|
|
|
|
|
/* add a fake last+1 */
|
|
|
|
idx = th.ending_track + 1;
|
1996-01-30 10:31:12 +00:00
|
|
|
cd->toc[idx].control = cd->toc[idx-1].control;
|
|
|
|
cd->toc[idx].addr_type = cd->toc[idx-1].addr_type;
|
1993-10-12 06:08:31 +00:00
|
|
|
cd->toc[idx].trk_no = 0;
|
1996-01-30 10:31:12 +00:00
|
|
|
cd->toc[idx].idx_no = MCD_LASTPLUS1;
|
1993-10-12 06:08:31 +00:00
|
|
|
cd->toc[idx].hd_pos_msf[0] = cd->volinfo.vol_msf[0];
|
|
|
|
cd->toc[idx].hd_pos_msf[1] = cd->volinfo.vol_msf[1];
|
|
|
|
cd->toc[idx].hd_pos_msf[2] = cd->volinfo.vol_msf[2];
|
|
|
|
|
Newly implemented ioctls list:
DIOCGDINFO, DIOCGPART, DIOCWDINFO, DIOCSDINFO, CDIOCPLAYMSF, CDIOCRESET,
CDIOCEJECT.
CDIOCPLAYBLOCKS removed (old implementation completely wrong and I don't
know how to implement it correctly).
All routines now detects media change correctly.
DELAY_GETREPLAY increased for long time access from first track
to last.
mcd_waitrdy() now use MIN_DELAY=15 as minimal delay which independs
of machine speed.
mcd_doread() now uses real status (old code uses obsoleted soft copy of it).
clear XBSY on error in mcd_doread()
mcd_statrt(): add missing splx(s), cause dead hang with unmatched slpbio()
optimize mcd_doread(), don't set CD mode each time, keep soft copy of mode.
call getdisklabel() _after_ mcdsize() for proper sizes
mcdopen(): old code forget to set MCDREADRAW in flags when open RAW
partition, doread check it for setting RAW CD mode.
Do nothing on stray interrupt (which sometimes occurse, because driver
read data block too slow, DOS driver use 'insb' here). Old stray code
cause timeouts.
Read toc entries code rewritten to return many requested entries
(as supposed) instead of one entry with incorrect structure.
CMDREAD2 requests covered with disable_intr()/enable_intr()
(from DOS driver)
Read junk code added after read block code in doread (from DOS driver)
mcd_read_toc() code fixed to read all needed entries, old code cause
some audio tracks is not played.
mcd_playtracks() code fixed to proper check valid track range.
New binary read modes implemented (from DOS driver).
1994-09-03 16:48:13 +00:00
|
|
|
if (cd->debug)
|
|
|
|
{ int i;
|
|
|
|
for (i = th.starting_track; i <= idx; i++)
|
|
|
|
printf("mcd%d: trk %d idx %d pos %d %d %d\n",
|
|
|
|
unit, i,
|
1996-01-30 10:31:12 +00:00
|
|
|
cd->toc[i].idx_no > 0x99 ? cd->toc[i].idx_no :
|
|
|
|
bcd2bin(cd->toc[i].idx_no),
|
Newly implemented ioctls list:
DIOCGDINFO, DIOCGPART, DIOCWDINFO, DIOCSDINFO, CDIOCPLAYMSF, CDIOCRESET,
CDIOCEJECT.
CDIOCPLAYBLOCKS removed (old implementation completely wrong and I don't
know how to implement it correctly).
All routines now detects media change correctly.
DELAY_GETREPLAY increased for long time access from first track
to last.
mcd_waitrdy() now use MIN_DELAY=15 as minimal delay which independs
of machine speed.
mcd_doread() now uses real status (old code uses obsoleted soft copy of it).
clear XBSY on error in mcd_doread()
mcd_statrt(): add missing splx(s), cause dead hang with unmatched slpbio()
optimize mcd_doread(), don't set CD mode each time, keep soft copy of mode.
call getdisklabel() _after_ mcdsize() for proper sizes
mcdopen(): old code forget to set MCDREADRAW in flags when open RAW
partition, doread check it for setting RAW CD mode.
Do nothing on stray interrupt (which sometimes occurse, because driver
read data block too slow, DOS driver use 'insb' here). Old stray code
cause timeouts.
Read toc entries code rewritten to return many requested entries
(as supposed) instead of one entry with incorrect structure.
CMDREAD2 requests covered with disable_intr()/enable_intr()
(from DOS driver)
Read junk code added after read block code in doread (from DOS driver)
mcd_read_toc() code fixed to read all needed entries, old code cause
some audio tracks is not played.
mcd_playtracks() code fixed to proper check valid track range.
New binary read modes implemented (from DOS driver).
1994-09-03 16:48:13 +00:00
|
|
|
bcd2bin(cd->toc[i].hd_pos_msf[0]),
|
|
|
|
bcd2bin(cd->toc[i].hd_pos_msf[1]),
|
|
|
|
bcd2bin(cd->toc[i].hd_pos_msf[2]));
|
|
|
|
}
|
|
|
|
|
1993-10-12 06:08:31 +00:00
|
|
|
cd->flags |= MCDTOC;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
1997-11-07 08:53:44 +00:00
|
|
|
#if 0
|
1997-05-04 15:24:23 +00:00
|
|
|
static int
|
|
|
|
mcd_toc_entry(int unit, struct ioc_read_toc_single_entry *te)
|
|
|
|
{
|
|
|
|
struct mcd_data *cd = mcd_data + unit;
|
|
|
|
struct ioc_toc_header th;
|
|
|
|
int rc, trk;
|
|
|
|
|
|
|
|
if (te->address_format != CD_MSF_FORMAT
|
|
|
|
&& te->address_format != CD_LBA_FORMAT)
|
|
|
|
return EINVAL;
|
|
|
|
|
|
|
|
/* Copy the toc header */
|
|
|
|
if ((rc = mcd_toc_header(unit, &th)) != 0)
|
|
|
|
return rc;
|
|
|
|
|
|
|
|
/* verify starting track */
|
|
|
|
trk = te->track;
|
|
|
|
if (trk == 0)
|
|
|
|
trk = th.starting_track;
|
|
|
|
else if (trk == MCD_LASTPLUS1)
|
|
|
|
trk = th.ending_track + 1;
|
|
|
|
else if (trk < th.starting_track || trk > th.ending_track + 1)
|
|
|
|
return EINVAL;
|
|
|
|
|
|
|
|
/* Make sure we have a valid toc */
|
|
|
|
if ((rc=mcd_read_toc(unit)) != 0)
|
|
|
|
return rc;
|
|
|
|
|
|
|
|
/* Copy the TOC data. */
|
|
|
|
if (cd->toc[trk].idx_no == 0)
|
|
|
|
return EIO;
|
|
|
|
|
|
|
|
te->entry.control = cd->toc[trk].control;
|
|
|
|
te->entry.addr_type = cd->toc[trk].addr_type;
|
|
|
|
te->entry.track =
|
|
|
|
cd->toc[trk].idx_no > 0x99 ? cd->toc[trk].idx_no :
|
|
|
|
bcd2bin(cd->toc[trk].idx_no);
|
|
|
|
switch (te->address_format) {
|
|
|
|
case CD_MSF_FORMAT:
|
|
|
|
te->entry.addr.msf.unused = 0;
|
|
|
|
te->entry.addr.msf.minute = bcd2bin(cd->toc[trk].hd_pos_msf[0]);
|
|
|
|
te->entry.addr.msf.second = bcd2bin(cd->toc[trk].hd_pos_msf[1]);
|
|
|
|
te->entry.addr.msf.frame = bcd2bin(cd->toc[trk].hd_pos_msf[2]);
|
|
|
|
break;
|
|
|
|
case CD_LBA_FORMAT:
|
|
|
|
te->entry.addr.lba = htonl(msf2hsg(cd->toc[trk].hd_pos_msf, 0));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
1997-11-07 08:53:44 +00:00
|
|
|
#endif
|
1997-05-04 15:24:23 +00:00
|
|
|
|
1994-02-22 08:44:31 +00:00
|
|
|
static int
|
Newly implemented ioctls list:
DIOCGDINFO, DIOCGPART, DIOCWDINFO, DIOCSDINFO, CDIOCPLAYMSF, CDIOCRESET,
CDIOCEJECT.
CDIOCPLAYBLOCKS removed (old implementation completely wrong and I don't
know how to implement it correctly).
All routines now detects media change correctly.
DELAY_GETREPLAY increased for long time access from first track
to last.
mcd_waitrdy() now use MIN_DELAY=15 as minimal delay which independs
of machine speed.
mcd_doread() now uses real status (old code uses obsoleted soft copy of it).
clear XBSY on error in mcd_doread()
mcd_statrt(): add missing splx(s), cause dead hang with unmatched slpbio()
optimize mcd_doread(), don't set CD mode each time, keep soft copy of mode.
call getdisklabel() _after_ mcdsize() for proper sizes
mcdopen(): old code forget to set MCDREADRAW in flags when open RAW
partition, doread check it for setting RAW CD mode.
Do nothing on stray interrupt (which sometimes occurse, because driver
read data block too slow, DOS driver use 'insb' here). Old stray code
cause timeouts.
Read toc entries code rewritten to return many requested entries
(as supposed) instead of one entry with incorrect structure.
CMDREAD2 requests covered with disable_intr()/enable_intr()
(from DOS driver)
Read junk code added after read block code in doread (from DOS driver)
mcd_read_toc() code fixed to read all needed entries, old code cause
some audio tracks is not played.
mcd_playtracks() code fixed to proper check valid track range.
New binary read modes implemented (from DOS driver).
1994-09-03 16:48:13 +00:00
|
|
|
mcd_toc_entrys(int unit, struct ioc_read_toc_entry *te)
|
1993-10-12 06:08:31 +00:00
|
|
|
{
|
|
|
|
struct mcd_data *cd = mcd_data + unit;
|
Newly implemented ioctls list:
DIOCGDINFO, DIOCGPART, DIOCWDINFO, DIOCSDINFO, CDIOCPLAYMSF, CDIOCRESET,
CDIOCEJECT.
CDIOCPLAYBLOCKS removed (old implementation completely wrong and I don't
know how to implement it correctly).
All routines now detects media change correctly.
DELAY_GETREPLAY increased for long time access from first track
to last.
mcd_waitrdy() now use MIN_DELAY=15 as minimal delay which independs
of machine speed.
mcd_doread() now uses real status (old code uses obsoleted soft copy of it).
clear XBSY on error in mcd_doread()
mcd_statrt(): add missing splx(s), cause dead hang with unmatched slpbio()
optimize mcd_doread(), don't set CD mode each time, keep soft copy of mode.
call getdisklabel() _after_ mcdsize() for proper sizes
mcdopen(): old code forget to set MCDREADRAW in flags when open RAW
partition, doread check it for setting RAW CD mode.
Do nothing on stray interrupt (which sometimes occurse, because driver
read data block too slow, DOS driver use 'insb' here). Old stray code
cause timeouts.
Read toc entries code rewritten to return many requested entries
(as supposed) instead of one entry with incorrect structure.
CMDREAD2 requests covered with disable_intr()/enable_intr()
(from DOS driver)
Read junk code added after read block code in doread (from DOS driver)
mcd_read_toc() code fixed to read all needed entries, old code cause
some audio tracks is not played.
mcd_playtracks() code fixed to proper check valid track range.
New binary read modes implemented (from DOS driver).
1994-09-03 16:48:13 +00:00
|
|
|
struct cd_toc_entry entries[MCD_MAXTOCS];
|
1993-10-12 06:08:31 +00:00
|
|
|
struct ioc_toc_header th;
|
1996-01-30 13:15:28 +00:00
|
|
|
int rc, n, trk, len;
|
1993-10-12 06:08:31 +00:00
|
|
|
|
1996-01-30 13:15:28 +00:00
|
|
|
if ( te->data_len < sizeof(entries[0])
|
|
|
|
|| (te->data_len % sizeof(entries[0])) != 0
|
1999-05-06 18:44:42 +00:00
|
|
|
|| (te->address_format != CD_MSF_FORMAT
|
|
|
|
&& te->address_format != CD_LBA_FORMAT)
|
Newly implemented ioctls list:
DIOCGDINFO, DIOCGPART, DIOCWDINFO, DIOCSDINFO, CDIOCPLAYMSF, CDIOCRESET,
CDIOCEJECT.
CDIOCPLAYBLOCKS removed (old implementation completely wrong and I don't
know how to implement it correctly).
All routines now detects media change correctly.
DELAY_GETREPLAY increased for long time access from first track
to last.
mcd_waitrdy() now use MIN_DELAY=15 as minimal delay which independs
of machine speed.
mcd_doread() now uses real status (old code uses obsoleted soft copy of it).
clear XBSY on error in mcd_doread()
mcd_statrt(): add missing splx(s), cause dead hang with unmatched slpbio()
optimize mcd_doread(), don't set CD mode each time, keep soft copy of mode.
call getdisklabel() _after_ mcdsize() for proper sizes
mcdopen(): old code forget to set MCDREADRAW in flags when open RAW
partition, doread check it for setting RAW CD mode.
Do nothing on stray interrupt (which sometimes occurse, because driver
read data block too slow, DOS driver use 'insb' here). Old stray code
cause timeouts.
Read toc entries code rewritten to return many requested entries
(as supposed) instead of one entry with incorrect structure.
CMDREAD2 requests covered with disable_intr()/enable_intr()
(from DOS driver)
Read junk code added after read block code in doread (from DOS driver)
mcd_read_toc() code fixed to read all needed entries, old code cause
some audio tracks is not played.
mcd_playtracks() code fixed to proper check valid track range.
New binary read modes implemented (from DOS driver).
1994-09-03 16:48:13 +00:00
|
|
|
)
|
1994-02-22 08:44:31 +00:00
|
|
|
return EINVAL;
|
1993-10-12 06:08:31 +00:00
|
|
|
|
|
|
|
/* Copy the toc header */
|
Newly implemented ioctls list:
DIOCGDINFO, DIOCGPART, DIOCWDINFO, DIOCSDINFO, CDIOCPLAYMSF, CDIOCRESET,
CDIOCEJECT.
CDIOCPLAYBLOCKS removed (old implementation completely wrong and I don't
know how to implement it correctly).
All routines now detects media change correctly.
DELAY_GETREPLAY increased for long time access from first track
to last.
mcd_waitrdy() now use MIN_DELAY=15 as minimal delay which independs
of machine speed.
mcd_doread() now uses real status (old code uses obsoleted soft copy of it).
clear XBSY on error in mcd_doread()
mcd_statrt(): add missing splx(s), cause dead hang with unmatched slpbio()
optimize mcd_doread(), don't set CD mode each time, keep soft copy of mode.
call getdisklabel() _after_ mcdsize() for proper sizes
mcdopen(): old code forget to set MCDREADRAW in flags when open RAW
partition, doread check it for setting RAW CD mode.
Do nothing on stray interrupt (which sometimes occurse, because driver
read data block too slow, DOS driver use 'insb' here). Old stray code
cause timeouts.
Read toc entries code rewritten to return many requested entries
(as supposed) instead of one entry with incorrect structure.
CMDREAD2 requests covered with disable_intr()/enable_intr()
(from DOS driver)
Read junk code added after read block code in doread (from DOS driver)
mcd_read_toc() code fixed to read all needed entries, old code cause
some audio tracks is not played.
mcd_playtracks() code fixed to proper check valid track range.
New binary read modes implemented (from DOS driver).
1994-09-03 16:48:13 +00:00
|
|
|
if ((rc = mcd_toc_header(unit, &th)) != 0)
|
|
|
|
return rc;
|
|
|
|
|
1996-01-30 10:31:12 +00:00
|
|
|
/* verify starting track */
|
|
|
|
trk = te->starting_track;
|
|
|
|
if (trk == 0)
|
|
|
|
trk = th.starting_track;
|
|
|
|
else if (trk == MCD_LASTPLUS1)
|
|
|
|
trk = th.ending_track + 1;
|
|
|
|
else if (trk < th.starting_track || trk > th.ending_track + 1)
|
|
|
|
return EINVAL;
|
|
|
|
|
1996-01-30 13:15:28 +00:00
|
|
|
len = ((th.ending_track + 1 - trk) + 1) *
|
|
|
|
sizeof(entries[0]);
|
|
|
|
if (te->data_len < len)
|
|
|
|
len = te->data_len;
|
|
|
|
if (len > sizeof(entries))
|
|
|
|
return EINVAL;
|
|
|
|
|
1996-01-30 10:31:12 +00:00
|
|
|
/* Make sure we have a valid toc */
|
|
|
|
if ((rc=mcd_read_toc(unit)) != 0)
|
|
|
|
return rc;
|
|
|
|
|
|
|
|
/* Copy the TOC data. */
|
|
|
|
for (n = 0; len > 0 && trk <= th.ending_track + 1; trk++) {
|
|
|
|
if (cd->toc[trk].idx_no == 0)
|
|
|
|
continue;
|
|
|
|
entries[n].control = cd->toc[trk].control;
|
|
|
|
entries[n].addr_type = cd->toc[trk].addr_type;
|
|
|
|
entries[n].track =
|
|
|
|
cd->toc[trk].idx_no > 0x99 ? cd->toc[trk].idx_no :
|
|
|
|
bcd2bin(cd->toc[trk].idx_no);
|
|
|
|
switch (te->address_format) {
|
|
|
|
case CD_MSF_FORMAT:
|
|
|
|
entries[n].addr.msf.unused = 0;
|
|
|
|
entries[n].addr.msf.minute = bcd2bin(cd->toc[trk].hd_pos_msf[0]);
|
|
|
|
entries[n].addr.msf.second = bcd2bin(cd->toc[trk].hd_pos_msf[1]);
|
|
|
|
entries[n].addr.msf.frame = bcd2bin(cd->toc[trk].hd_pos_msf[2]);
|
|
|
|
break;
|
|
|
|
case CD_LBA_FORMAT:
|
1996-01-30 23:27:20 +00:00
|
|
|
entries[n].addr.lba = htonl(msf2hsg(cd->toc[trk].hd_pos_msf, 0));
|
1996-01-30 10:31:12 +00:00
|
|
|
break;
|
Newly implemented ioctls list:
DIOCGDINFO, DIOCGPART, DIOCWDINFO, DIOCSDINFO, CDIOCPLAYMSF, CDIOCRESET,
CDIOCEJECT.
CDIOCPLAYBLOCKS removed (old implementation completely wrong and I don't
know how to implement it correctly).
All routines now detects media change correctly.
DELAY_GETREPLAY increased for long time access from first track
to last.
mcd_waitrdy() now use MIN_DELAY=15 as minimal delay which independs
of machine speed.
mcd_doread() now uses real status (old code uses obsoleted soft copy of it).
clear XBSY on error in mcd_doread()
mcd_statrt(): add missing splx(s), cause dead hang with unmatched slpbio()
optimize mcd_doread(), don't set CD mode each time, keep soft copy of mode.
call getdisklabel() _after_ mcdsize() for proper sizes
mcdopen(): old code forget to set MCDREADRAW in flags when open RAW
partition, doread check it for setting RAW CD mode.
Do nothing on stray interrupt (which sometimes occurse, because driver
read data block too slow, DOS driver use 'insb' here). Old stray code
cause timeouts.
Read toc entries code rewritten to return many requested entries
(as supposed) instead of one entry with incorrect structure.
CMDREAD2 requests covered with disable_intr()/enable_intr()
(from DOS driver)
Read junk code added after read block code in doread (from DOS driver)
mcd_read_toc() code fixed to read all needed entries, old code cause
some audio tracks is not played.
mcd_playtracks() code fixed to proper check valid track range.
New binary read modes implemented (from DOS driver).
1994-09-03 16:48:13 +00:00
|
|
|
}
|
|
|
|
len -= sizeof(struct cd_toc_entry);
|
1996-01-30 10:31:12 +00:00
|
|
|
n++;
|
1993-10-12 06:08:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* copy the data back */
|
1996-01-30 10:31:12 +00:00
|
|
|
return copyout(entries, te->data, n * sizeof(struct cd_toc_entry));
|
1993-10-12 06:08:31 +00:00
|
|
|
}
|
|
|
|
|
1994-02-22 08:44:31 +00:00
|
|
|
static int
|
|
|
|
mcd_stop(int unit)
|
1993-10-12 06:08:31 +00:00
|
|
|
{
|
|
|
|
struct mcd_data *cd = mcd_data + unit;
|
|
|
|
|
1995-02-22 01:11:36 +00:00
|
|
|
/* Verify current status */
|
|
|
|
if (cd->audio_status != CD_AS_PLAY_IN_PROGRESS &&
|
1996-01-30 23:27:20 +00:00
|
|
|
cd->audio_status != CD_AS_PLAY_PAUSED &&
|
|
|
|
cd->audio_status != CD_AS_PLAY_COMPLETED) {
|
1995-02-22 01:11:36 +00:00
|
|
|
if (cd->debug)
|
1996-01-30 23:27:20 +00:00
|
|
|
printf("mcd%d: stop attempted when not playing, audio status %d\n",
|
|
|
|
unit, cd->audio_status);
|
1995-02-22 01:11:36 +00:00
|
|
|
return EINVAL;
|
|
|
|
}
|
|
|
|
if (cd->audio_status == CD_AS_PLAY_IN_PROGRESS)
|
|
|
|
if (mcd_send(unit, MCD_CMDSTOPAUDIO, MCD_RETRYS) < 0)
|
|
|
|
return EIO;
|
1993-10-12 06:08:31 +00:00
|
|
|
cd->audio_status = CD_AS_PLAY_COMPLETED;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
1994-02-22 08:44:31 +00:00
|
|
|
static int
|
|
|
|
mcd_getqchan(int unit, struct mcd_qchninfo *q)
|
1993-10-12 06:08:31 +00:00
|
|
|
{
|
|
|
|
struct mcd_data *cd = mcd_data + unit;
|
|
|
|
|
Newly implemented ioctls list:
DIOCGDINFO, DIOCGPART, DIOCWDINFO, DIOCSDINFO, CDIOCPLAYMSF, CDIOCRESET,
CDIOCEJECT.
CDIOCPLAYBLOCKS removed (old implementation completely wrong and I don't
know how to implement it correctly).
All routines now detects media change correctly.
DELAY_GETREPLAY increased for long time access from first track
to last.
mcd_waitrdy() now use MIN_DELAY=15 as minimal delay which independs
of machine speed.
mcd_doread() now uses real status (old code uses obsoleted soft copy of it).
clear XBSY on error in mcd_doread()
mcd_statrt(): add missing splx(s), cause dead hang with unmatched slpbio()
optimize mcd_doread(), don't set CD mode each time, keep soft copy of mode.
call getdisklabel() _after_ mcdsize() for proper sizes
mcdopen(): old code forget to set MCDREADRAW in flags when open RAW
partition, doread check it for setting RAW CD mode.
Do nothing on stray interrupt (which sometimes occurse, because driver
read data block too slow, DOS driver use 'insb' here). Old stray code
cause timeouts.
Read toc entries code rewritten to return many requested entries
(as supposed) instead of one entry with incorrect structure.
CMDREAD2 requests covered with disable_intr()/enable_intr()
(from DOS driver)
Read junk code added after read block code in doread (from DOS driver)
mcd_read_toc() code fixed to read all needed entries, old code cause
some audio tracks is not played.
mcd_playtracks() code fixed to proper check valid track range.
New binary read modes implemented (from DOS driver).
1994-09-03 16:48:13 +00:00
|
|
|
if (mcd_send(unit, MCD_CMDGETQCHN, MCD_RETRYS) < 0)
|
1993-10-12 06:08:31 +00:00
|
|
|
return -1;
|
Newly implemented ioctls list:
DIOCGDINFO, DIOCGPART, DIOCWDINFO, DIOCSDINFO, CDIOCPLAYMSF, CDIOCRESET,
CDIOCEJECT.
CDIOCPLAYBLOCKS removed (old implementation completely wrong and I don't
know how to implement it correctly).
All routines now detects media change correctly.
DELAY_GETREPLAY increased for long time access from first track
to last.
mcd_waitrdy() now use MIN_DELAY=15 as minimal delay which independs
of machine speed.
mcd_doread() now uses real status (old code uses obsoleted soft copy of it).
clear XBSY on error in mcd_doread()
mcd_statrt(): add missing splx(s), cause dead hang with unmatched slpbio()
optimize mcd_doread(), don't set CD mode each time, keep soft copy of mode.
call getdisklabel() _after_ mcdsize() for proper sizes
mcdopen(): old code forget to set MCDREADRAW in flags when open RAW
partition, doread check it for setting RAW CD mode.
Do nothing on stray interrupt (which sometimes occurse, because driver
read data block too slow, DOS driver use 'insb' here). Old stray code
cause timeouts.
Read toc entries code rewritten to return many requested entries
(as supposed) instead of one entry with incorrect structure.
CMDREAD2 requests covered with disable_intr()/enable_intr()
(from DOS driver)
Read junk code added after read block code in doread (from DOS driver)
mcd_read_toc() code fixed to read all needed entries, old code cause
some audio tracks is not played.
mcd_playtracks() code fixed to proper check valid track range.
New binary read modes implemented (from DOS driver).
1994-09-03 16:48:13 +00:00
|
|
|
if (mcd_get(unit, (char *) q, sizeof(struct mcd_qchninfo)) < 0)
|
1993-10-12 06:08:31 +00:00
|
|
|
return -1;
|
1994-02-22 08:44:31 +00:00
|
|
|
if (cd->debug) {
|
1996-01-30 10:31:12 +00:00
|
|
|
printf("mcd%d: getqchan control=0x%x addr_type=0x%x trk=%d ind=%d ttm=%d:%d.%d dtm=%d:%d.%d\n",
|
1993-10-12 06:08:31 +00:00
|
|
|
unit,
|
1996-01-30 10:31:12 +00:00
|
|
|
q->control, q->addr_type, bcd2bin(q->trk_no),
|
|
|
|
bcd2bin(q->idx_no),
|
1994-11-12 14:19:11 +00:00
|
|
|
bcd2bin(q->trk_size_msf[0]), bcd2bin(q->trk_size_msf[1]),
|
|
|
|
bcd2bin(q->trk_size_msf[2]),
|
Newly implemented ioctls list:
DIOCGDINFO, DIOCGPART, DIOCWDINFO, DIOCSDINFO, CDIOCPLAYMSF, CDIOCRESET,
CDIOCEJECT.
CDIOCPLAYBLOCKS removed (old implementation completely wrong and I don't
know how to implement it correctly).
All routines now detects media change correctly.
DELAY_GETREPLAY increased for long time access from first track
to last.
mcd_waitrdy() now use MIN_DELAY=15 as minimal delay which independs
of machine speed.
mcd_doread() now uses real status (old code uses obsoleted soft copy of it).
clear XBSY on error in mcd_doread()
mcd_statrt(): add missing splx(s), cause dead hang with unmatched slpbio()
optimize mcd_doread(), don't set CD mode each time, keep soft copy of mode.
call getdisklabel() _after_ mcdsize() for proper sizes
mcdopen(): old code forget to set MCDREADRAW in flags when open RAW
partition, doread check it for setting RAW CD mode.
Do nothing on stray interrupt (which sometimes occurse, because driver
read data block too slow, DOS driver use 'insb' here). Old stray code
cause timeouts.
Read toc entries code rewritten to return many requested entries
(as supposed) instead of one entry with incorrect structure.
CMDREAD2 requests covered with disable_intr()/enable_intr()
(from DOS driver)
Read junk code added after read block code in doread (from DOS driver)
mcd_read_toc() code fixed to read all needed entries, old code cause
some audio tracks is not played.
mcd_playtracks() code fixed to proper check valid track range.
New binary read modes implemented (from DOS driver).
1994-09-03 16:48:13 +00:00
|
|
|
bcd2bin(q->hd_pos_msf[0]), bcd2bin(q->hd_pos_msf[1]),
|
|
|
|
bcd2bin(q->hd_pos_msf[2]));
|
1994-02-22 08:44:31 +00:00
|
|
|
}
|
1993-10-12 06:08:31 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
1994-02-22 08:44:31 +00:00
|
|
|
static int
|
|
|
|
mcd_subchan(int unit, struct ioc_read_subchannel *sc)
|
1993-10-12 06:08:31 +00:00
|
|
|
{
|
|
|
|
struct mcd_data *cd = mcd_data + unit;
|
|
|
|
struct mcd_qchninfo q;
|
|
|
|
struct cd_sub_channel_info data;
|
1996-01-30 23:27:20 +00:00
|
|
|
int lba;
|
1993-10-12 06:08:31 +00:00
|
|
|
|
Newly implemented ioctls list:
DIOCGDINFO, DIOCGPART, DIOCWDINFO, DIOCSDINFO, CDIOCPLAYMSF, CDIOCRESET,
CDIOCEJECT.
CDIOCPLAYBLOCKS removed (old implementation completely wrong and I don't
know how to implement it correctly).
All routines now detects media change correctly.
DELAY_GETREPLAY increased for long time access from first track
to last.
mcd_waitrdy() now use MIN_DELAY=15 as minimal delay which independs
of machine speed.
mcd_doread() now uses real status (old code uses obsoleted soft copy of it).
clear XBSY on error in mcd_doread()
mcd_statrt(): add missing splx(s), cause dead hang with unmatched slpbio()
optimize mcd_doread(), don't set CD mode each time, keep soft copy of mode.
call getdisklabel() _after_ mcdsize() for proper sizes
mcdopen(): old code forget to set MCDREADRAW in flags when open RAW
partition, doread check it for setting RAW CD mode.
Do nothing on stray interrupt (which sometimes occurse, because driver
read data block too slow, DOS driver use 'insb' here). Old stray code
cause timeouts.
Read toc entries code rewritten to return many requested entries
(as supposed) instead of one entry with incorrect structure.
CMDREAD2 requests covered with disable_intr()/enable_intr()
(from DOS driver)
Read junk code added after read block code in doread (from DOS driver)
mcd_read_toc() code fixed to read all needed entries, old code cause
some audio tracks is not played.
mcd_playtracks() code fixed to proper check valid track range.
New binary read modes implemented (from DOS driver).
1994-09-03 16:48:13 +00:00
|
|
|
if (cd->debug)
|
|
|
|
printf("mcd%d: subchan af=%d, df=%d\n", unit,
|
|
|
|
sc->address_format,
|
|
|
|
sc->data_format);
|
|
|
|
|
1995-02-23 17:40:16 +00:00
|
|
|
if (sc->address_format != CD_MSF_FORMAT &&
|
|
|
|
sc->address_format != CD_LBA_FORMAT)
|
Newly implemented ioctls list:
DIOCGDINFO, DIOCGPART, DIOCWDINFO, DIOCSDINFO, CDIOCPLAYMSF, CDIOCRESET,
CDIOCEJECT.
CDIOCPLAYBLOCKS removed (old implementation completely wrong and I don't
know how to implement it correctly).
All routines now detects media change correctly.
DELAY_GETREPLAY increased for long time access from first track
to last.
mcd_waitrdy() now use MIN_DELAY=15 as minimal delay which independs
of machine speed.
mcd_doread() now uses real status (old code uses obsoleted soft copy of it).
clear XBSY on error in mcd_doread()
mcd_statrt(): add missing splx(s), cause dead hang with unmatched slpbio()
optimize mcd_doread(), don't set CD mode each time, keep soft copy of mode.
call getdisklabel() _after_ mcdsize() for proper sizes
mcdopen(): old code forget to set MCDREADRAW in flags when open RAW
partition, doread check it for setting RAW CD mode.
Do nothing on stray interrupt (which sometimes occurse, because driver
read data block too slow, DOS driver use 'insb' here). Old stray code
cause timeouts.
Read toc entries code rewritten to return many requested entries
(as supposed) instead of one entry with incorrect structure.
CMDREAD2 requests covered with disable_intr()/enable_intr()
(from DOS driver)
Read junk code added after read block code in doread (from DOS driver)
mcd_read_toc() code fixed to read all needed entries, old code cause
some audio tracks is not played.
mcd_playtracks() code fixed to proper check valid track range.
New binary read modes implemented (from DOS driver).
1994-09-03 16:48:13 +00:00
|
|
|
return EINVAL;
|
|
|
|
|
1996-02-03 14:33:56 +00:00
|
|
|
if (sc->data_format != CD_CURRENT_POSITION &&
|
|
|
|
sc->data_format != CD_MEDIA_CATALOG)
|
Newly implemented ioctls list:
DIOCGDINFO, DIOCGPART, DIOCWDINFO, DIOCSDINFO, CDIOCPLAYMSF, CDIOCRESET,
CDIOCEJECT.
CDIOCPLAYBLOCKS removed (old implementation completely wrong and I don't
know how to implement it correctly).
All routines now detects media change correctly.
DELAY_GETREPLAY increased for long time access from first track
to last.
mcd_waitrdy() now use MIN_DELAY=15 as minimal delay which independs
of machine speed.
mcd_doread() now uses real status (old code uses obsoleted soft copy of it).
clear XBSY on error in mcd_doread()
mcd_statrt(): add missing splx(s), cause dead hang with unmatched slpbio()
optimize mcd_doread(), don't set CD mode each time, keep soft copy of mode.
call getdisklabel() _after_ mcdsize() for proper sizes
mcdopen(): old code forget to set MCDREADRAW in flags when open RAW
partition, doread check it for setting RAW CD mode.
Do nothing on stray interrupt (which sometimes occurse, because driver
read data block too slow, DOS driver use 'insb' here). Old stray code
cause timeouts.
Read toc entries code rewritten to return many requested entries
(as supposed) instead of one entry with incorrect structure.
CMDREAD2 requests covered with disable_intr()/enable_intr()
(from DOS driver)
Read junk code added after read block code in doread (from DOS driver)
mcd_read_toc() code fixed to read all needed entries, old code cause
some audio tracks is not played.
mcd_playtracks() code fixed to proper check valid track range.
New binary read modes implemented (from DOS driver).
1994-09-03 16:48:13 +00:00
|
|
|
return EINVAL;
|
|
|
|
|
|
|
|
if (mcd_setmode(unit, MCD_MD_COOKED) != 0)
|
1994-02-22 08:44:31 +00:00
|
|
|
return EIO;
|
Newly implemented ioctls list:
DIOCGDINFO, DIOCGPART, DIOCWDINFO, DIOCSDINFO, CDIOCPLAYMSF, CDIOCRESET,
CDIOCEJECT.
CDIOCPLAYBLOCKS removed (old implementation completely wrong and I don't
know how to implement it correctly).
All routines now detects media change correctly.
DELAY_GETREPLAY increased for long time access from first track
to last.
mcd_waitrdy() now use MIN_DELAY=15 as minimal delay which independs
of machine speed.
mcd_doread() now uses real status (old code uses obsoleted soft copy of it).
clear XBSY on error in mcd_doread()
mcd_statrt(): add missing splx(s), cause dead hang with unmatched slpbio()
optimize mcd_doread(), don't set CD mode each time, keep soft copy of mode.
call getdisklabel() _after_ mcdsize() for proper sizes
mcdopen(): old code forget to set MCDREADRAW in flags when open RAW
partition, doread check it for setting RAW CD mode.
Do nothing on stray interrupt (which sometimes occurse, because driver
read data block too slow, DOS driver use 'insb' here). Old stray code
cause timeouts.
Read toc entries code rewritten to return many requested entries
(as supposed) instead of one entry with incorrect structure.
CMDREAD2 requests covered with disable_intr()/enable_intr()
(from DOS driver)
Read junk code added after read block code in doread (from DOS driver)
mcd_read_toc() code fixed to read all needed entries, old code cause
some audio tracks is not played.
mcd_playtracks() code fixed to proper check valid track range.
New binary read modes implemented (from DOS driver).
1994-09-03 16:48:13 +00:00
|
|
|
|
|
|
|
if (mcd_getqchan(unit, &q) < 0)
|
1994-02-22 08:44:31 +00:00
|
|
|
return EIO;
|
1993-10-12 06:08:31 +00:00
|
|
|
|
|
|
|
data.header.audio_status = cd->audio_status;
|
1996-01-30 23:27:20 +00:00
|
|
|
data.what.position.data_format = sc->data_format;
|
1996-02-03 14:33:56 +00:00
|
|
|
|
|
|
|
switch (sc->data_format) {
|
|
|
|
case CD_MEDIA_CATALOG:
|
|
|
|
data.what.media_catalog.mc_valid = 1;
|
|
|
|
data.what.media_catalog.mc_number[0] = '\0';
|
1996-01-30 10:31:12 +00:00
|
|
|
break;
|
1996-02-03 14:33:56 +00:00
|
|
|
|
|
|
|
case CD_CURRENT_POSITION:
|
|
|
|
data.what.position.control = q.control;
|
|
|
|
data.what.position.addr_type = q.addr_type;
|
|
|
|
data.what.position.track_number = bcd2bin(q.trk_no);
|
|
|
|
data.what.position.index_number = bcd2bin(q.idx_no);
|
|
|
|
switch (sc->address_format) {
|
|
|
|
case CD_MSF_FORMAT:
|
|
|
|
data.what.position.reladdr.msf.unused = 0;
|
|
|
|
data.what.position.reladdr.msf.minute = bcd2bin(q.trk_size_msf[0]);
|
|
|
|
data.what.position.reladdr.msf.second = bcd2bin(q.trk_size_msf[1]);
|
|
|
|
data.what.position.reladdr.msf.frame = bcd2bin(q.trk_size_msf[2]);
|
|
|
|
data.what.position.absaddr.msf.unused = 0;
|
|
|
|
data.what.position.absaddr.msf.minute = bcd2bin(q.hd_pos_msf[0]);
|
|
|
|
data.what.position.absaddr.msf.second = bcd2bin(q.hd_pos_msf[1]);
|
|
|
|
data.what.position.absaddr.msf.frame = bcd2bin(q.hd_pos_msf[2]);
|
|
|
|
break;
|
|
|
|
case CD_LBA_FORMAT:
|
|
|
|
lba = msf2hsg(q.trk_size_msf, 1);
|
|
|
|
/*
|
|
|
|
* Pre-gap has index number of 0, and decreasing MSF
|
|
|
|
* address. Must be converted to negative LBA, per
|
|
|
|
* SCSI spec.
|
|
|
|
*/
|
|
|
|
if (data.what.position.index_number == 0)
|
|
|
|
lba = -lba;
|
|
|
|
data.what.position.reladdr.lba = htonl(lba);
|
|
|
|
data.what.position.absaddr.lba = htonl(msf2hsg(q.hd_pos_msf, 0));
|
|
|
|
break;
|
|
|
|
}
|
1996-01-30 10:31:12 +00:00
|
|
|
break;
|
1995-02-23 17:40:16 +00:00
|
|
|
}
|
1994-11-12 14:19:11 +00:00
|
|
|
|
1996-01-30 10:31:12 +00:00
|
|
|
return copyout(&data, sc->data, min(sizeof(struct cd_sub_channel_info), sc->data_len));
|
1993-10-12 06:08:31 +00:00
|
|
|
}
|
|
|
|
|
Newly implemented ioctls list:
DIOCGDINFO, DIOCGPART, DIOCWDINFO, DIOCSDINFO, CDIOCPLAYMSF, CDIOCRESET,
CDIOCEJECT.
CDIOCPLAYBLOCKS removed (old implementation completely wrong and I don't
know how to implement it correctly).
All routines now detects media change correctly.
DELAY_GETREPLAY increased for long time access from first track
to last.
mcd_waitrdy() now use MIN_DELAY=15 as minimal delay which independs
of machine speed.
mcd_doread() now uses real status (old code uses obsoleted soft copy of it).
clear XBSY on error in mcd_doread()
mcd_statrt(): add missing splx(s), cause dead hang with unmatched slpbio()
optimize mcd_doread(), don't set CD mode each time, keep soft copy of mode.
call getdisklabel() _after_ mcdsize() for proper sizes
mcdopen(): old code forget to set MCDREADRAW in flags when open RAW
partition, doread check it for setting RAW CD mode.
Do nothing on stray interrupt (which sometimes occurse, because driver
read data block too slow, DOS driver use 'insb' here). Old stray code
cause timeouts.
Read toc entries code rewritten to return many requested entries
(as supposed) instead of one entry with incorrect structure.
CMDREAD2 requests covered with disable_intr()/enable_intr()
(from DOS driver)
Read junk code added after read block code in doread (from DOS driver)
mcd_read_toc() code fixed to read all needed entries, old code cause
some audio tracks is not played.
mcd_playtracks() code fixed to proper check valid track range.
New binary read modes implemented (from DOS driver).
1994-09-03 16:48:13 +00:00
|
|
|
static int
|
1996-02-01 19:15:41 +00:00
|
|
|
mcd_playmsf(int unit, struct ioc_play_msf *p)
|
Newly implemented ioctls list:
DIOCGDINFO, DIOCGPART, DIOCWDINFO, DIOCSDINFO, CDIOCPLAYMSF, CDIOCRESET,
CDIOCEJECT.
CDIOCPLAYBLOCKS removed (old implementation completely wrong and I don't
know how to implement it correctly).
All routines now detects media change correctly.
DELAY_GETREPLAY increased for long time access from first track
to last.
mcd_waitrdy() now use MIN_DELAY=15 as minimal delay which independs
of machine speed.
mcd_doread() now uses real status (old code uses obsoleted soft copy of it).
clear XBSY on error in mcd_doread()
mcd_statrt(): add missing splx(s), cause dead hang with unmatched slpbio()
optimize mcd_doread(), don't set CD mode each time, keep soft copy of mode.
call getdisklabel() _after_ mcdsize() for proper sizes
mcdopen(): old code forget to set MCDREADRAW in flags when open RAW
partition, doread check it for setting RAW CD mode.
Do nothing on stray interrupt (which sometimes occurse, because driver
read data block too slow, DOS driver use 'insb' here). Old stray code
cause timeouts.
Read toc entries code rewritten to return many requested entries
(as supposed) instead of one entry with incorrect structure.
CMDREAD2 requests covered with disable_intr()/enable_intr()
(from DOS driver)
Read junk code added after read block code in doread (from DOS driver)
mcd_read_toc() code fixed to read all needed entries, old code cause
some audio tracks is not played.
mcd_playtracks() code fixed to proper check valid track range.
New binary read modes implemented (from DOS driver).
1994-09-03 16:48:13 +00:00
|
|
|
{
|
1996-02-01 19:15:41 +00:00
|
|
|
struct mcd_data *cd = mcd_data + unit;
|
Newly implemented ioctls list:
DIOCGDINFO, DIOCGPART, DIOCWDINFO, DIOCSDINFO, CDIOCPLAYMSF, CDIOCRESET,
CDIOCEJECT.
CDIOCPLAYBLOCKS removed (old implementation completely wrong and I don't
know how to implement it correctly).
All routines now detects media change correctly.
DELAY_GETREPLAY increased for long time access from first track
to last.
mcd_waitrdy() now use MIN_DELAY=15 as minimal delay which independs
of machine speed.
mcd_doread() now uses real status (old code uses obsoleted soft copy of it).
clear XBSY on error in mcd_doread()
mcd_statrt(): add missing splx(s), cause dead hang with unmatched slpbio()
optimize mcd_doread(), don't set CD mode each time, keep soft copy of mode.
call getdisklabel() _after_ mcdsize() for proper sizes
mcdopen(): old code forget to set MCDREADRAW in flags when open RAW
partition, doread check it for setting RAW CD mode.
Do nothing on stray interrupt (which sometimes occurse, because driver
read data block too slow, DOS driver use 'insb' here). Old stray code
cause timeouts.
Read toc entries code rewritten to return many requested entries
(as supposed) instead of one entry with incorrect structure.
CMDREAD2 requests covered with disable_intr()/enable_intr()
(from DOS driver)
Read junk code added after read block code in doread (from DOS driver)
mcd_read_toc() code fixed to read all needed entries, old code cause
some audio tracks is not played.
mcd_playtracks() code fixed to proper check valid track range.
New binary read modes implemented (from DOS driver).
1994-09-03 16:48:13 +00:00
|
|
|
struct mcd_read2 pb;
|
|
|
|
|
1996-02-01 19:15:41 +00:00
|
|
|
if (cd->debug)
|
|
|
|
printf("mcd%d: playmsf: from %d:%d.%d to %d:%d.%d\n",
|
|
|
|
unit,
|
|
|
|
p->start_m, p->start_s, p->start_f,
|
|
|
|
p->end_m, p->end_s, p->end_f);
|
|
|
|
|
|
|
|
if ((p->start_m * 60 * 75 + p->start_s * 75 + p->start_f) >=
|
|
|
|
(p->end_m * 60 * 75 + p->end_s * 75 + p->end_f) ||
|
|
|
|
(p->end_m * 60 * 75 + p->end_s * 75 + p->end_f) >
|
|
|
|
M_msf(cd->volinfo.vol_msf) * 60 * 75 +
|
|
|
|
S_msf(cd->volinfo.vol_msf) * 75 +
|
|
|
|
F_msf(cd->volinfo.vol_msf))
|
|
|
|
return EINVAL;
|
|
|
|
|
|
|
|
pb.start_msf[0] = bin2bcd(p->start_m);
|
|
|
|
pb.start_msf[1] = bin2bcd(p->start_s);
|
|
|
|
pb.start_msf[2] = bin2bcd(p->start_f);
|
|
|
|
pb.end_msf[0] = bin2bcd(p->end_m);
|
|
|
|
pb.end_msf[1] = bin2bcd(p->end_s);
|
|
|
|
pb.end_msf[2] = bin2bcd(p->end_f);
|
|
|
|
|
Newly implemented ioctls list:
DIOCGDINFO, DIOCGPART, DIOCWDINFO, DIOCSDINFO, CDIOCPLAYMSF, CDIOCRESET,
CDIOCEJECT.
CDIOCPLAYBLOCKS removed (old implementation completely wrong and I don't
know how to implement it correctly).
All routines now detects media change correctly.
DELAY_GETREPLAY increased for long time access from first track
to last.
mcd_waitrdy() now use MIN_DELAY=15 as minimal delay which independs
of machine speed.
mcd_doread() now uses real status (old code uses obsoleted soft copy of it).
clear XBSY on error in mcd_doread()
mcd_statrt(): add missing splx(s), cause dead hang with unmatched slpbio()
optimize mcd_doread(), don't set CD mode each time, keep soft copy of mode.
call getdisklabel() _after_ mcdsize() for proper sizes
mcdopen(): old code forget to set MCDREADRAW in flags when open RAW
partition, doread check it for setting RAW CD mode.
Do nothing on stray interrupt (which sometimes occurse, because driver
read data block too slow, DOS driver use 'insb' here). Old stray code
cause timeouts.
Read toc entries code rewritten to return many requested entries
(as supposed) instead of one entry with incorrect structure.
CMDREAD2 requests covered with disable_intr()/enable_intr()
(from DOS driver)
Read junk code added after read block code in doread (from DOS driver)
mcd_read_toc() code fixed to read all needed entries, old code cause
some audio tracks is not played.
mcd_playtracks() code fixed to proper check valid track range.
New binary read modes implemented (from DOS driver).
1994-09-03 16:48:13 +00:00
|
|
|
if (mcd_setmode(unit, MCD_MD_COOKED) != 0)
|
|
|
|
return EIO;
|
|
|
|
|
|
|
|
return mcd_play(unit, &pb);
|
|
|
|
}
|
|
|
|
|
1994-02-22 08:44:31 +00:00
|
|
|
static int
|
|
|
|
mcd_playtracks(int unit, struct ioc_play_track *pt)
|
1993-10-12 06:08:31 +00:00
|
|
|
{
|
|
|
|
struct mcd_data *cd = mcd_data + unit;
|
|
|
|
struct mcd_read2 pb;
|
|
|
|
int a = pt->start_track;
|
|
|
|
int z = pt->end_track;
|
1994-11-12 14:19:11 +00:00
|
|
|
int rc, i;
|
1993-10-12 06:08:31 +00:00
|
|
|
|
Newly implemented ioctls list:
DIOCGDINFO, DIOCGPART, DIOCWDINFO, DIOCSDINFO, CDIOCPLAYMSF, CDIOCRESET,
CDIOCEJECT.
CDIOCPLAYBLOCKS removed (old implementation completely wrong and I don't
know how to implement it correctly).
All routines now detects media change correctly.
DELAY_GETREPLAY increased for long time access from first track
to last.
mcd_waitrdy() now use MIN_DELAY=15 as minimal delay which independs
of machine speed.
mcd_doread() now uses real status (old code uses obsoleted soft copy of it).
clear XBSY on error in mcd_doread()
mcd_statrt(): add missing splx(s), cause dead hang with unmatched slpbio()
optimize mcd_doread(), don't set CD mode each time, keep soft copy of mode.
call getdisklabel() _after_ mcdsize() for proper sizes
mcdopen(): old code forget to set MCDREADRAW in flags when open RAW
partition, doread check it for setting RAW CD mode.
Do nothing on stray interrupt (which sometimes occurse, because driver
read data block too slow, DOS driver use 'insb' here). Old stray code
cause timeouts.
Read toc entries code rewritten to return many requested entries
(as supposed) instead of one entry with incorrect structure.
CMDREAD2 requests covered with disable_intr()/enable_intr()
(from DOS driver)
Read junk code added after read block code in doread (from DOS driver)
mcd_read_toc() code fixed to read all needed entries, old code cause
some audio tracks is not played.
mcd_playtracks() code fixed to proper check valid track range.
New binary read modes implemented (from DOS driver).
1994-09-03 16:48:13 +00:00
|
|
|
if ((rc = mcd_read_toc(unit)) != 0)
|
1994-02-22 08:44:31 +00:00
|
|
|
return rc;
|
1993-10-12 06:08:31 +00:00
|
|
|
|
Newly implemented ioctls list:
DIOCGDINFO, DIOCGPART, DIOCWDINFO, DIOCSDINFO, CDIOCPLAYMSF, CDIOCRESET,
CDIOCEJECT.
CDIOCPLAYBLOCKS removed (old implementation completely wrong and I don't
know how to implement it correctly).
All routines now detects media change correctly.
DELAY_GETREPLAY increased for long time access from first track
to last.
mcd_waitrdy() now use MIN_DELAY=15 as minimal delay which independs
of machine speed.
mcd_doread() now uses real status (old code uses obsoleted soft copy of it).
clear XBSY on error in mcd_doread()
mcd_statrt(): add missing splx(s), cause dead hang with unmatched slpbio()
optimize mcd_doread(), don't set CD mode each time, keep soft copy of mode.
call getdisklabel() _after_ mcdsize() for proper sizes
mcdopen(): old code forget to set MCDREADRAW in flags when open RAW
partition, doread check it for setting RAW CD mode.
Do nothing on stray interrupt (which sometimes occurse, because driver
read data block too slow, DOS driver use 'insb' here). Old stray code
cause timeouts.
Read toc entries code rewritten to return many requested entries
(as supposed) instead of one entry with incorrect structure.
CMDREAD2 requests covered with disable_intr()/enable_intr()
(from DOS driver)
Read junk code added after read block code in doread (from DOS driver)
mcd_read_toc() code fixed to read all needed entries, old code cause
some audio tracks is not played.
mcd_playtracks() code fixed to proper check valid track range.
New binary read modes implemented (from DOS driver).
1994-09-03 16:48:13 +00:00
|
|
|
if (cd->debug)
|
|
|
|
printf("mcd%d: playtracks from %d:%d to %d:%d\n", unit,
|
|
|
|
a, pt->start_index, z, pt->end_index);
|
|
|
|
|
|
|
|
if ( a < bcd2bin(cd->volinfo.trk_low)
|
|
|
|
|| a > bcd2bin(cd->volinfo.trk_high)
|
|
|
|
|| a > z
|
|
|
|
|| z < bcd2bin(cd->volinfo.trk_low)
|
|
|
|
|| z > bcd2bin(cd->volinfo.trk_high))
|
1993-10-12 06:08:31 +00:00
|
|
|
return EINVAL;
|
|
|
|
|
1994-11-12 14:19:11 +00:00
|
|
|
for (i = 0; i < 3; i++) {
|
|
|
|
pb.start_msf[i] = cd->toc[a].hd_pos_msf[i];
|
|
|
|
pb.end_msf[i] = cd->toc[z+1].hd_pos_msf[i];
|
|
|
|
}
|
1993-10-12 06:08:31 +00:00
|
|
|
|
1996-02-01 19:15:41 +00:00
|
|
|
if (mcd_setmode(unit, MCD_MD_COOKED) != 0)
|
|
|
|
return EIO;
|
|
|
|
|
|
|
|
return mcd_play(unit, &pb);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
mcd_playblocks(int unit, struct ioc_play_blocks *p)
|
|
|
|
{
|
|
|
|
struct mcd_data *cd = mcd_data + unit;
|
|
|
|
struct mcd_read2 pb;
|
|
|
|
|
|
|
|
if (cd->debug)
|
|
|
|
printf("mcd%d: playblocks: blkno %d length %d\n",
|
|
|
|
unit, p->blk, p->len);
|
|
|
|
|
|
|
|
if (p->blk > cd->disksize || p->len > cd->disksize ||
|
|
|
|
p->blk < 0 || p->len < 0 ||
|
|
|
|
(p->blk + p->len) > cd->disksize)
|
|
|
|
return EINVAL;
|
|
|
|
|
|
|
|
hsg2msf(p->blk, pb.start_msf);
|
|
|
|
hsg2msf(p->blk + p->len, pb.end_msf);
|
|
|
|
|
|
|
|
if (mcd_setmode(unit, MCD_MD_COOKED) != 0)
|
|
|
|
return EIO;
|
|
|
|
|
1993-10-12 06:08:31 +00:00
|
|
|
return mcd_play(unit, &pb);
|
|
|
|
}
|
|
|
|
|
1994-02-22 08:44:31 +00:00
|
|
|
static int
|
|
|
|
mcd_play(int unit, struct mcd_read2 *pb)
|
1993-10-12 06:08:31 +00:00
|
|
|
{
|
|
|
|
struct mcd_data *cd = mcd_data + unit;
|
Newly implemented ioctls list:
DIOCGDINFO, DIOCGPART, DIOCWDINFO, DIOCSDINFO, CDIOCPLAYMSF, CDIOCRESET,
CDIOCEJECT.
CDIOCPLAYBLOCKS removed (old implementation completely wrong and I don't
know how to implement it correctly).
All routines now detects media change correctly.
DELAY_GETREPLAY increased for long time access from first track
to last.
mcd_waitrdy() now use MIN_DELAY=15 as minimal delay which independs
of machine speed.
mcd_doread() now uses real status (old code uses obsoleted soft copy of it).
clear XBSY on error in mcd_doread()
mcd_statrt(): add missing splx(s), cause dead hang with unmatched slpbio()
optimize mcd_doread(), don't set CD mode each time, keep soft copy of mode.
call getdisklabel() _after_ mcdsize() for proper sizes
mcdopen(): old code forget to set MCDREADRAW in flags when open RAW
partition, doread check it for setting RAW CD mode.
Do nothing on stray interrupt (which sometimes occurse, because driver
read data block too slow, DOS driver use 'insb' here). Old stray code
cause timeouts.
Read toc entries code rewritten to return many requested entries
(as supposed) instead of one entry with incorrect structure.
CMDREAD2 requests covered with disable_intr()/enable_intr()
(from DOS driver)
Read junk code added after read block code in doread (from DOS driver)
mcd_read_toc() code fixed to read all needed entries, old code cause
some audio tracks is not played.
mcd_playtracks() code fixed to proper check valid track range.
New binary read modes implemented (from DOS driver).
1994-09-03 16:48:13 +00:00
|
|
|
int com_port = cd->iobase + mcd_command;
|
|
|
|
int retry, st = -1, status;
|
1993-10-12 06:08:31 +00:00
|
|
|
|
|
|
|
cd->lastpb = *pb;
|
1994-02-22 08:44:31 +00:00
|
|
|
for(retry=0; retry<MCD_RETRYS; retry++) {
|
1993-10-12 06:08:31 +00:00
|
|
|
|
Newly implemented ioctls list:
DIOCGDINFO, DIOCGPART, DIOCWDINFO, DIOCSDINFO, CDIOCPLAYMSF, CDIOCRESET,
CDIOCEJECT.
CDIOCPLAYBLOCKS removed (old implementation completely wrong and I don't
know how to implement it correctly).
All routines now detects media change correctly.
DELAY_GETREPLAY increased for long time access from first track
to last.
mcd_waitrdy() now use MIN_DELAY=15 as minimal delay which independs
of machine speed.
mcd_doread() now uses real status (old code uses obsoleted soft copy of it).
clear XBSY on error in mcd_doread()
mcd_statrt(): add missing splx(s), cause dead hang with unmatched slpbio()
optimize mcd_doread(), don't set CD mode each time, keep soft copy of mode.
call getdisklabel() _after_ mcdsize() for proper sizes
mcdopen(): old code forget to set MCDREADRAW in flags when open RAW
partition, doread check it for setting RAW CD mode.
Do nothing on stray interrupt (which sometimes occurse, because driver
read data block too slow, DOS driver use 'insb' here). Old stray code
cause timeouts.
Read toc entries code rewritten to return many requested entries
(as supposed) instead of one entry with incorrect structure.
CMDREAD2 requests covered with disable_intr()/enable_intr()
(from DOS driver)
Read junk code added after read block code in doread (from DOS driver)
mcd_read_toc() code fixed to read all needed entries, old code cause
some audio tracks is not played.
mcd_playtracks() code fixed to proper check valid track range.
New binary read modes implemented (from DOS driver).
1994-09-03 16:48:13 +00:00
|
|
|
disable_intr();
|
1995-01-30 06:44:40 +00:00
|
|
|
outb(com_port, MCD_CMDSINGLESPEEDREAD);
|
Newly implemented ioctls list:
DIOCGDINFO, DIOCGPART, DIOCWDINFO, DIOCSDINFO, CDIOCPLAYMSF, CDIOCRESET,
CDIOCEJECT.
CDIOCPLAYBLOCKS removed (old implementation completely wrong and I don't
know how to implement it correctly).
All routines now detects media change correctly.
DELAY_GETREPLAY increased for long time access from first track
to last.
mcd_waitrdy() now use MIN_DELAY=15 as minimal delay which independs
of machine speed.
mcd_doread() now uses real status (old code uses obsoleted soft copy of it).
clear XBSY on error in mcd_doread()
mcd_statrt(): add missing splx(s), cause dead hang with unmatched slpbio()
optimize mcd_doread(), don't set CD mode each time, keep soft copy of mode.
call getdisklabel() _after_ mcdsize() for proper sizes
mcdopen(): old code forget to set MCDREADRAW in flags when open RAW
partition, doread check it for setting RAW CD mode.
Do nothing on stray interrupt (which sometimes occurse, because driver
read data block too slow, DOS driver use 'insb' here). Old stray code
cause timeouts.
Read toc entries code rewritten to return many requested entries
(as supposed) instead of one entry with incorrect structure.
CMDREAD2 requests covered with disable_intr()/enable_intr()
(from DOS driver)
Read junk code added after read block code in doread (from DOS driver)
mcd_read_toc() code fixed to read all needed entries, old code cause
some audio tracks is not played.
mcd_playtracks() code fixed to proper check valid track range.
New binary read modes implemented (from DOS driver).
1994-09-03 16:48:13 +00:00
|
|
|
outb(com_port, pb->start_msf[0]);
|
|
|
|
outb(com_port, pb->start_msf[1]);
|
|
|
|
outb(com_port, pb->start_msf[2]);
|
|
|
|
outb(com_port, pb->end_msf[0]);
|
|
|
|
outb(com_port, pb->end_msf[1]);
|
|
|
|
outb(com_port, pb->end_msf[2]);
|
|
|
|
enable_intr();
|
|
|
|
|
|
|
|
status=mcd_getstat(unit, 0);
|
|
|
|
if (status == -1)
|
|
|
|
continue;
|
|
|
|
else if (status != -2)
|
|
|
|
st = 0;
|
|
|
|
break;
|
1994-02-22 08:44:31 +00:00
|
|
|
}
|
Newly implemented ioctls list:
DIOCGDINFO, DIOCGPART, DIOCWDINFO, DIOCSDINFO, CDIOCPLAYMSF, CDIOCRESET,
CDIOCEJECT.
CDIOCPLAYBLOCKS removed (old implementation completely wrong and I don't
know how to implement it correctly).
All routines now detects media change correctly.
DELAY_GETREPLAY increased for long time access from first track
to last.
mcd_waitrdy() now use MIN_DELAY=15 as minimal delay which independs
of machine speed.
mcd_doread() now uses real status (old code uses obsoleted soft copy of it).
clear XBSY on error in mcd_doread()
mcd_statrt(): add missing splx(s), cause dead hang with unmatched slpbio()
optimize mcd_doread(), don't set CD mode each time, keep soft copy of mode.
call getdisklabel() _after_ mcdsize() for proper sizes
mcdopen(): old code forget to set MCDREADRAW in flags when open RAW
partition, doread check it for setting RAW CD mode.
Do nothing on stray interrupt (which sometimes occurse, because driver
read data block too slow, DOS driver use 'insb' here). Old stray code
cause timeouts.
Read toc entries code rewritten to return many requested entries
(as supposed) instead of one entry with incorrect structure.
CMDREAD2 requests covered with disable_intr()/enable_intr()
(from DOS driver)
Read junk code added after read block code in doread (from DOS driver)
mcd_read_toc() code fixed to read all needed entries, old code cause
some audio tracks is not played.
mcd_playtracks() code fixed to proper check valid track range.
New binary read modes implemented (from DOS driver).
1994-09-03 16:48:13 +00:00
|
|
|
|
|
|
|
if (status == -2) {
|
|
|
|
printf("mcd%d: media changed\n", unit);
|
1994-02-22 08:44:31 +00:00
|
|
|
return ENXIO;
|
|
|
|
}
|
Newly implemented ioctls list:
DIOCGDINFO, DIOCGPART, DIOCWDINFO, DIOCSDINFO, CDIOCPLAYMSF, CDIOCRESET,
CDIOCEJECT.
CDIOCPLAYBLOCKS removed (old implementation completely wrong and I don't
know how to implement it correctly).
All routines now detects media change correctly.
DELAY_GETREPLAY increased for long time access from first track
to last.
mcd_waitrdy() now use MIN_DELAY=15 as minimal delay which independs
of machine speed.
mcd_doread() now uses real status (old code uses obsoleted soft copy of it).
clear XBSY on error in mcd_doread()
mcd_statrt(): add missing splx(s), cause dead hang with unmatched slpbio()
optimize mcd_doread(), don't set CD mode each time, keep soft copy of mode.
call getdisklabel() _after_ mcdsize() for proper sizes
mcdopen(): old code forget to set MCDREADRAW in flags when open RAW
partition, doread check it for setting RAW CD mode.
Do nothing on stray interrupt (which sometimes occurse, because driver
read data block too slow, DOS driver use 'insb' here). Old stray code
cause timeouts.
Read toc entries code rewritten to return many requested entries
(as supposed) instead of one entry with incorrect structure.
CMDREAD2 requests covered with disable_intr()/enable_intr()
(from DOS driver)
Read junk code added after read block code in doread (from DOS driver)
mcd_read_toc() code fixed to read all needed entries, old code cause
some audio tracks is not played.
mcd_playtracks() code fixed to proper check valid track range.
New binary read modes implemented (from DOS driver).
1994-09-03 16:48:13 +00:00
|
|
|
if (cd->debug)
|
|
|
|
printf("mcd%d: mcd_play retry=%d, status=0x%02x\n", unit, retry, status);
|
|
|
|
if (st < 0)
|
|
|
|
return ENXIO;
|
1993-10-12 06:08:31 +00:00
|
|
|
cd->audio_status = CD_AS_PLAY_IN_PROGRESS;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
1994-02-22 08:44:31 +00:00
|
|
|
static int
|
|
|
|
mcd_pause(int unit)
|
1993-10-12 06:08:31 +00:00
|
|
|
{
|
|
|
|
struct mcd_data *cd = mcd_data + unit;
|
|
|
|
struct mcd_qchninfo q;
|
|
|
|
int rc;
|
|
|
|
|
|
|
|
/* Verify current status */
|
1996-01-30 23:27:20 +00:00
|
|
|
if (cd->audio_status != CD_AS_PLAY_IN_PROGRESS &&
|
|
|
|
cd->audio_status != CD_AS_PLAY_PAUSED) {
|
Newly implemented ioctls list:
DIOCGDINFO, DIOCGPART, DIOCWDINFO, DIOCSDINFO, CDIOCPLAYMSF, CDIOCRESET,
CDIOCEJECT.
CDIOCPLAYBLOCKS removed (old implementation completely wrong and I don't
know how to implement it correctly).
All routines now detects media change correctly.
DELAY_GETREPLAY increased for long time access from first track
to last.
mcd_waitrdy() now use MIN_DELAY=15 as minimal delay which independs
of machine speed.
mcd_doread() now uses real status (old code uses obsoleted soft copy of it).
clear XBSY on error in mcd_doread()
mcd_statrt(): add missing splx(s), cause dead hang with unmatched slpbio()
optimize mcd_doread(), don't set CD mode each time, keep soft copy of mode.
call getdisklabel() _after_ mcdsize() for proper sizes
mcdopen(): old code forget to set MCDREADRAW in flags when open RAW
partition, doread check it for setting RAW CD mode.
Do nothing on stray interrupt (which sometimes occurse, because driver
read data block too slow, DOS driver use 'insb' here). Old stray code
cause timeouts.
Read toc entries code rewritten to return many requested entries
(as supposed) instead of one entry with incorrect structure.
CMDREAD2 requests covered with disable_intr()/enable_intr()
(from DOS driver)
Read junk code added after read block code in doread (from DOS driver)
mcd_read_toc() code fixed to read all needed entries, old code cause
some audio tracks is not played.
mcd_playtracks() code fixed to proper check valid track range.
New binary read modes implemented (from DOS driver).
1994-09-03 16:48:13 +00:00
|
|
|
if (cd->debug)
|
1996-01-30 23:27:20 +00:00
|
|
|
printf("mcd%d: pause attempted when not playing, audio status %d\n",
|
|
|
|
unit, cd->audio_status);
|
1993-10-12 06:08:31 +00:00
|
|
|
return EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Get the current position */
|
Newly implemented ioctls list:
DIOCGDINFO, DIOCGPART, DIOCWDINFO, DIOCSDINFO, CDIOCPLAYMSF, CDIOCRESET,
CDIOCEJECT.
CDIOCPLAYBLOCKS removed (old implementation completely wrong and I don't
know how to implement it correctly).
All routines now detects media change correctly.
DELAY_GETREPLAY increased for long time access from first track
to last.
mcd_waitrdy() now use MIN_DELAY=15 as minimal delay which independs
of machine speed.
mcd_doread() now uses real status (old code uses obsoleted soft copy of it).
clear XBSY on error in mcd_doread()
mcd_statrt(): add missing splx(s), cause dead hang with unmatched slpbio()
optimize mcd_doread(), don't set CD mode each time, keep soft copy of mode.
call getdisklabel() _after_ mcdsize() for proper sizes
mcdopen(): old code forget to set MCDREADRAW in flags when open RAW
partition, doread check it for setting RAW CD mode.
Do nothing on stray interrupt (which sometimes occurse, because driver
read data block too slow, DOS driver use 'insb' here). Old stray code
cause timeouts.
Read toc entries code rewritten to return many requested entries
(as supposed) instead of one entry with incorrect structure.
CMDREAD2 requests covered with disable_intr()/enable_intr()
(from DOS driver)
Read junk code added after read block code in doread (from DOS driver)
mcd_read_toc() code fixed to read all needed entries, old code cause
some audio tracks is not played.
mcd_playtracks() code fixed to proper check valid track range.
New binary read modes implemented (from DOS driver).
1994-09-03 16:48:13 +00:00
|
|
|
if (mcd_getqchan(unit, &q) < 0)
|
1994-02-22 08:44:31 +00:00
|
|
|
return EIO;
|
1993-10-12 06:08:31 +00:00
|
|
|
|
|
|
|
/* Copy it into lastpb */
|
|
|
|
cd->lastpb.start_msf[0] = q.hd_pos_msf[0];
|
|
|
|
cd->lastpb.start_msf[1] = q.hd_pos_msf[1];
|
|
|
|
cd->lastpb.start_msf[2] = q.hd_pos_msf[2];
|
|
|
|
|
|
|
|
/* Stop playing */
|
Newly implemented ioctls list:
DIOCGDINFO, DIOCGPART, DIOCWDINFO, DIOCSDINFO, CDIOCPLAYMSF, CDIOCRESET,
CDIOCEJECT.
CDIOCPLAYBLOCKS removed (old implementation completely wrong and I don't
know how to implement it correctly).
All routines now detects media change correctly.
DELAY_GETREPLAY increased for long time access from first track
to last.
mcd_waitrdy() now use MIN_DELAY=15 as minimal delay which independs
of machine speed.
mcd_doread() now uses real status (old code uses obsoleted soft copy of it).
clear XBSY on error in mcd_doread()
mcd_statrt(): add missing splx(s), cause dead hang with unmatched slpbio()
optimize mcd_doread(), don't set CD mode each time, keep soft copy of mode.
call getdisklabel() _after_ mcdsize() for proper sizes
mcdopen(): old code forget to set MCDREADRAW in flags when open RAW
partition, doread check it for setting RAW CD mode.
Do nothing on stray interrupt (which sometimes occurse, because driver
read data block too slow, DOS driver use 'insb' here). Old stray code
cause timeouts.
Read toc entries code rewritten to return many requested entries
(as supposed) instead of one entry with incorrect structure.
CMDREAD2 requests covered with disable_intr()/enable_intr()
(from DOS driver)
Read junk code added after read block code in doread (from DOS driver)
mcd_read_toc() code fixed to read all needed entries, old code cause
some audio tracks is not played.
mcd_playtracks() code fixed to proper check valid track range.
New binary read modes implemented (from DOS driver).
1994-09-03 16:48:13 +00:00
|
|
|
if ((rc=mcd_stop(unit)) != 0)
|
1994-02-22 08:44:31 +00:00
|
|
|
return rc;
|
1993-10-12 06:08:31 +00:00
|
|
|
|
|
|
|
/* Set the proper status and exit */
|
|
|
|
cd->audio_status = CD_AS_PLAY_PAUSED;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
1994-02-22 08:44:31 +00:00
|
|
|
static int
|
|
|
|
mcd_resume(int unit)
|
1993-10-12 06:08:31 +00:00
|
|
|
{
|
|
|
|
struct mcd_data *cd = mcd_data + unit;
|
|
|
|
|
Newly implemented ioctls list:
DIOCGDINFO, DIOCGPART, DIOCWDINFO, DIOCSDINFO, CDIOCPLAYMSF, CDIOCRESET,
CDIOCEJECT.
CDIOCPLAYBLOCKS removed (old implementation completely wrong and I don't
know how to implement it correctly).
All routines now detects media change correctly.
DELAY_GETREPLAY increased for long time access from first track
to last.
mcd_waitrdy() now use MIN_DELAY=15 as minimal delay which independs
of machine speed.
mcd_doread() now uses real status (old code uses obsoleted soft copy of it).
clear XBSY on error in mcd_doread()
mcd_statrt(): add missing splx(s), cause dead hang with unmatched slpbio()
optimize mcd_doread(), don't set CD mode each time, keep soft copy of mode.
call getdisklabel() _after_ mcdsize() for proper sizes
mcdopen(): old code forget to set MCDREADRAW in flags when open RAW
partition, doread check it for setting RAW CD mode.
Do nothing on stray interrupt (which sometimes occurse, because driver
read data block too slow, DOS driver use 'insb' here). Old stray code
cause timeouts.
Read toc entries code rewritten to return many requested entries
(as supposed) instead of one entry with incorrect structure.
CMDREAD2 requests covered with disable_intr()/enable_intr()
(from DOS driver)
Read junk code added after read block code in doread (from DOS driver)
mcd_read_toc() code fixed to read all needed entries, old code cause
some audio tracks is not played.
mcd_playtracks() code fixed to proper check valid track range.
New binary read modes implemented (from DOS driver).
1994-09-03 16:48:13 +00:00
|
|
|
if (cd->audio_status != CD_AS_PLAY_PAUSED)
|
1994-02-22 08:44:31 +00:00
|
|
|
return EINVAL;
|
1993-10-12 06:08:31 +00:00
|
|
|
return mcd_play(unit, &cd->lastpb);
|
|
|
|
}
|