1106449Smdodd/*
2106449Smdodd * $FreeBSD$
3106449Smdodd */
4106449Smdodd
5106449Smdoddstruct scd_mbx {
6106449Smdodd	short		retry;
7106449Smdodd	short		nblk;
8106449Smdodd	int		sz;
9106449Smdodd	u_long		skip;
10106449Smdodd	struct bio *	bp;
11106449Smdodd	short		count;
12106449Smdodd};
13106449Smdodd
14106449Smdoddstruct scd_data {
15106449Smdodd	char			double_speed;
16106449Smdodd	char *			name;
17106449Smdodd	short			flags;
18106449Smdodd	int			blksize;
19106449Smdodd	u_long			disksize;
20106449Smdodd	int			openflag;
21106449Smdodd	struct {
22106449Smdodd		unsigned int	adr :4;
23106449Smdodd		unsigned int	ctl :4; /* xcdplayer needs this */
24106449Smdodd		unsigned char	start_msf[3];
25106449Smdodd	} toc[MAX_TRACKS];
26106449Smdodd	short			first_track;
27106449Smdodd	short			last_track;
28106449Smdodd	struct  ioc_play_msf	last_play;
29106449Smdodd
30106449Smdodd	short			audio_status;
31106449Smdodd	struct bio_queue_head	head;	     /* head of bio queue */
32106449Smdodd	struct scd_mbx		mbx;
33106449Smdodd};
34106449Smdodd
35106449Smdoddstruct scd_softc {
36106449Smdodd	device_t		dev;
37130585Sphk	struct cdev *scd_dev_t;
38106449Smdodd	int			debug;
39106449Smdodd
40106449Smdodd	struct resource *	port;
41106449Smdodd	int			port_rid;
42106449Smdodd	int			port_type;
43106449Smdodd	bus_space_tag_t		port_bst;
44106449Smdodd	bus_space_handle_t	port_bsh;
45106449Smdodd
46106449Smdodd	struct mtx		mtx;
47106449Smdodd
48106449Smdodd	struct callout_handle	ch;
49106449Smdodd	int			ch_state;
50106449Smdodd	struct scd_mbx *	ch_mbxsave;
51106449Smdodd
52106449Smdodd	struct scd_data		data;
53106449Smdodd};
54106449Smdodd
55106449Smdodd#define	SCD_LOCK(_sc)		splx(&(_sc)->mtx
56106449Smdodd#define	SCD_UNLOCK(_sc)		splx(&(_sc)->mtx
57106449Smdodd
58106449Smdodd#define	SCD_READ(_sc, _reg) \
59106449Smdodd	bus_space_read_1(_sc->port_bst, _sc->port_bsh, _reg)
60106449Smdodd#define	SCD_READ_MULTI(_sc, _reg, _addr, _count) \
61106449Smdodd	bus_space_read_multi_1(_sc->port_bst, _sc->port_bsh, _reg, _addr, _count)
62106449Smdodd#define	SCD_WRITE(_sc, _reg, _val) \
63106449Smdodd	bus_space_write_1(_sc->port_bst, _sc->port_bsh, _reg, _val)
64106449Smdodd
65106449Smdoddint	scd_probe	(struct scd_softc *);
66106449Smdoddint	scd_attach	(struct scd_softc *);
67