1 /*
2  *   libdi - CD Audio Device Interface Library
3  *
4  *   Copyright (C) 1993-2004  Ti Kan
5  *   E-mail: xmcd@amb.org
6  *
7  *   This program is free software; you can redistribute it and/or modify
8  *   it under the terms of the GNU General Public License as published by
9  *   the Free Software Foundation; either version 2 of the License, or
10  *   (at your option) any later version.
11  *
12  *   This program is distributed in the hope that it will be useful,
13  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
14  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  *   GNU General Public License for more details.
16  *
17  *   You should have received a copy of the GNU General Public License
18  *   along with this program; if not, write to the Free Software
19  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20  */
21 
22 /*
23  *   Pioneer vendor-unique support
24  *
25  *   The name "Pioneer" is a trademark of Pioneer Corporation, and is
26  *   used here for identification purposes only.
27  */
28 #ifndef __VU_PION_H__
29 #define __VU_PION_H__
30 
31 #ifdef VENDOR_PIONEER
32 
33 #ifndef lint
34 static char *_vu_pion_h_ident_ = "@(#)vu_pion.h	6.19 03/12/12";
35 #endif
36 
37 
38 /* Pioneer vendor-unique commands */
39 #define OP_VP_EJECT		0xc0	/* Pioneer magazine eject */
40 #define OP_VP_RDTOC		0xc1	/* Pioneer read TOC */
41 #define OP_VP_RDSUBQ		0xc2	/* Pioneer read subcode Q */
42 #define OP_VP_RDHDR		0xc3	/* Pioneer read header */
43 #define OP_VP_AUDSRCH		0xc8	/* Pioneer audio search */
44 #define OP_VP_AUDPLAY		0xc9	/* Pioneer play audio */
45 #define OP_VP_PAUSE		0xca	/* Pioneer pause */
46 #define OP_VP_AUDSTOP		0xcb	/* Pioneer audio stop */
47 #define OP_VP_AUDSTAT		0xcc	/* Pioneer audio status */
48 #define OP_VP_AUDSCAN		0xcd	/* Pioneer audio scan */
49 #define OP_VP_RDDSTAT		0xe0	/* Pioneer read drive status */
50 #define OP_VP_WRCDP		0xe3	/* Pioneer write CDP */
51 #define OP_VP_RDCDP		0xe4	/* Pioneer read CDP */
52 
53 
54 /* Pioneer audio status codes */
55 #define PAUD_PLAYING		0x00
56 #define PAUD_PAUSED		0x01
57 #define PAUD_MUTEPLAY		0x02
58 #define PAUD_COMPLETED		0x03
59 #define PAUD_ERROR		0x04
60 #define PAUD_NOSTATUS		0x05
61 
62 
63 /* Return data lengths */
64 #define SZ_VP_RDTOC		4	/* Pioneer read TOC data size */
65 #define SZ_VP_RDSUBQ		9	/* Pioneer read subcode Q data size */
66 #define SZ_VP_AUDSTAT		6	/* Pioneer audio status data size */
67 
68 
69 /* Pioneer read audio status command data */
70 typedef struct paudstat_data {
71 	unsigned int	status:8;	/* audio status */
72 #if _BYTE_ORDER_ == _L_ENDIAN_
73 	unsigned int	mode:4;		/* play mode */
74 	unsigned int	res1:4;		/* reserved */
75 	unsigned int	preemph:1;	/* preemphasis off=0 on=1 */
76 	unsigned int	copyallow:1;	/* digital copy allowed off=0 on=1 */
77 	unsigned int	trktype:1;	/* 0=audio 1=data */
78 	unsigned int	audioch:1;	/* 0=2ch 1=4ch */
79 	unsigned int	res2:4;		/* reserved */
80 #else	/* _BYTE_ORDER_ == _B_ENDIAN_ */
81 	unsigned int	res1:4;		/* reserved */
82 	unsigned int	mode:4;		/* play mode */
83 	unsigned int	res2:4;		/* reserved */
84 	unsigned int	audioch:1;	/* 0=2ch 1=4ch */
85 	unsigned int	trktype:1;	/* 0=audio 1=data */
86 	unsigned int	copyallow:1;	/* digital copy allowed off=0 on=1 */
87 	unsigned int	preemph:1;	/* preemphasis off=0 on=1 */
88 #endif	/* _BYTE_ORDER_ */
89 	unsigned int	abs_min:8;	/* absolute minutes (BCD) */
90 
91 	unsigned int	abs_sec:8;	/* absolute seconds (BCD) */
92 	unsigned int	abs_frame:8;	/* absolute frame (BCD) */
93 	unsigned int	pad1:16;	/* pad for alignment */
94 } paudstat_data_t;
95 
96 
97 
98 /* Pioneer read subcode Q command data */
99 typedef struct psubq_data {
100 #if _BYTE_ORDER_ == _L_ENDIAN_
101 	unsigned int	preemph:1;	/* preemphasis off=0 on=1 */
102 	unsigned int	copyallow:1;	/* digital copy allowed off=0 on=1 */
103 	unsigned int	trktype:1;	/* 0=audio 1=data */
104 	unsigned int	audioch:1;	/* 0=2ch 1=4ch */
105 	unsigned int	res:4;		/* reserved */
106 #else	/* _BYTE_ORDER_ == _B_ENDIAN_ */
107 	unsigned int	res:4;		/* reserved */
108 	unsigned int	audioch:1;	/* 0=2ch 1=4ch */
109 	unsigned int	trktype:1;	/* 0=audio 1=data */
110 	unsigned int	copyallow:1;	/* digital copy allowed off=0 on=1 */
111 	unsigned int	preemph:1;	/* preemphasis off=0 on=1 */
112 #endif	/* _BYTE_ORDER_ */
113 	unsigned int	trkno:8;	/* track number (BCD) */
114 	unsigned int	idxno:8;	/* index number (BCD) */
115 	unsigned int	rel_min:8;	/* trk relative minutes (BCD) */
116 
117 	unsigned int	rel_sec:8;	/* trk relative seconds (BCD) */
118 	unsigned int	rel_frame:8;	/* trk relative frame (BCD) */
119 	unsigned int	abs_min:8;	/* absolute minutes (BCD) */
120 	unsigned int	abs_sec:8;	/* absolute seconds (BCD) */
121 
122 	unsigned int	abs_frame:8;	/* absolute frame (BCD) */
123 	unsigned int	pad1:24;	/* pad for alignment */
124 } psubq_data_t;
125 
126 
127 /* Pioneer read TOC command data */
128 typedef struct pinfo_00 {		/* track information */
129 	byte_t		first_trk;	/* first track (BCD) */
130 	byte_t		last_trk;	/* last track (BCD) */
131 	byte_t		reserved[2];	/* reserved */
132 } pinfo_00_t;
133 
134 typedef struct pinfo_01 {		/* lead-out track starting time */
135 	byte_t		min;		/* minutes (BCD) */
136 	byte_t		sec;		/* seconds (BCD) */
137 	byte_t		frame;		/* frame (BCD) */
138 	byte_t		reserved;	/* reserved */
139 } pinfo_01_t;
140 
141 typedef struct pinfo_02 {		/* specified track starting time */
142 #if _BYTE_ORDER_ == _L_ENDIAN_
143 	unsigned int	preemph:1;	/* preemphasis off=0 on=1 */
144 	unsigned int	copyallow:1;	/* digital copy allowed off=0 on=1 */
145 	unsigned int	trktype:1;	/* 0=audio 1=data */
146 	unsigned int	audioch:1;	/* 0=2ch 1=4ch */
147 	unsigned int	res:4;		/* reserved */
148 #else	/* _BYTE_ORDER_ == _B_ENDIAN_ */
149 	unsigned int	res:4;		/* reserved */
150 	unsigned int	audioch:1;	/* 0=2ch 1=4ch */
151 	unsigned int	trktype:1;	/* 0=audio 1=data */
152 	unsigned int	copyallow:1;	/* digital copy allowed off=0 on=1 */
153 	unsigned int	preemph:1;	/* preemphasis off=0 on=1 */
154 #endif	/* _BYTE_ORDER_ */
155 
156 	unsigned int	min:8;		/* minutes (BCD) */
157 	unsigned int	sec:8;		/* seconds (BCD) */
158 	unsigned int	frame:8;	/* frame (BCD) */
159 } pinfo_02_t;
160 
161 
162 /* Public function prototypes */
163 extern bool_t	pion_playaudio(byte_t, sword32_t, sword32_t, msf_t *, msf_t *,
164 			byte_t, byte_t);
165 extern bool_t	pion_pause_resume(bool_t);
166 extern bool_t	pion_get_playstatus(cdstat_t *);
167 extern bool_t	pion_get_toc(curstat_t *);
168 extern bool_t	pion_eject(void);
169 extern void	pion_init(void);
170 
171 #else
172 
173 #define pion_init	NULL
174 
175 #endif	/* VENDOR_PIONEER */
176 
177 #endif	/* __VU_PION_H__ */
178 
179