xref: /NextBSD/sys/dev/scd/scdvar.h (revision 4bf303e5af1834cdd3092175eeca7676420229c4)
1 /*
2  * $FreeBSD$
3  */
4 
5 struct scd_mbx {
6 	short		retry;
7 	short		nblk;
8 	int		sz;
9 	u_long		skip;
10 	struct bio *	bp;
11 	short		count;
12 };
13 
14 struct scd_data {
15 	char			double_speed;
16 	char *			name;
17 	short			flags;
18 	int			blksize;
19 	u_long			disksize;
20 	int			openflag;
21 	struct {
22 		unsigned int	adr :4;
23 		unsigned int	ctl :4; /* xcdplayer needs this */
24 		unsigned char	start_msf[3];
25 	} toc[MAX_TRACKS];
26 	short			first_track;
27 	short			last_track;
28 	struct  ioc_play_msf	last_play;
29 
30 	short			audio_status;
31 	struct bio_queue_head	head;	     /* head of bio queue */
32 	struct scd_mbx		mbx;
33 };
34 
35 struct scd_softc {
36 	device_t		dev;
37 	struct cdev *scd_dev_t;
38 	int			debug;
39 
40 	struct resource *	port;
41 	int			port_rid;
42 	int			port_type;
43 
44 	struct mtx		mtx;
45 
46 	struct callout		timer;
47 	int			ch_state;
48 	struct scd_mbx *	ch_mbxsave;
49 
50 	struct scd_data		data;
51 };
52 
53 #define	SCD_LOCK(_sc)		mtx_lock(&_sc->mtx)
54 #define	SCD_UNLOCK(_sc)		mtx_unlock(&_sc->mtx)
55 #define	SCD_ASSERT_LOCKED(_sc)	mtx_assert(&_sc->mtx, MA_OWNED)
56 
57 #define	SCD_READ(_sc, _reg) \
58 	bus_read_1(_sc->port, _reg)
59 #define	SCD_READ_MULTI(_sc, _reg, _addr, _count) \
60 	bus_read_multi_1(_sc->port, _reg, _addr, _count)
61 #define	SCD_WRITE(_sc, _reg, _val) \
62 	bus_write_1(_sc->port, _reg, _val)
63 
64 int	scd_probe	(struct scd_softc *);
65 int	scd_attach	(struct scd_softc *);
66