xref: /netbsd-src/sys/dev/pad/padvar.h (revision 0646b57fa03c29fd370c9f4b4c84193674ea88e0)
1*0646b57fSmlelstv /* $NetBSD: padvar.h,v 1.17 2023/01/24 08:17:11 mlelstv Exp $ */
2b6ed7a12Sjmcneill 
3b6ed7a12Sjmcneill /*-
4b6ed7a12Sjmcneill  * Copyright (c) 2007 Jared D. McNeill <jmcneill@invisible.ca>
5b6ed7a12Sjmcneill  * All rights reserved.
6b6ed7a12Sjmcneill  *
7b6ed7a12Sjmcneill  * Redistribution and use in source and binary forms, with or without
8b6ed7a12Sjmcneill  * modification, are permitted provided that the following conditions
9b6ed7a12Sjmcneill  * are met:
10b6ed7a12Sjmcneill  * 1. Redistributions of source code must retain the above copyright
11b6ed7a12Sjmcneill  *    notice, this list of conditions and the following disclaimer.
12b6ed7a12Sjmcneill  * 2. Redistributions in binary form must reproduce the above copyright
13b6ed7a12Sjmcneill  *    notice, this list of conditions and the following disclaimer in the
14b6ed7a12Sjmcneill  *    documentation and/or other materials provided with the distribution.
15b6ed7a12Sjmcneill  *
16b6ed7a12Sjmcneill  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
17b6ed7a12Sjmcneill  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
18b6ed7a12Sjmcneill  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19b6ed7a12Sjmcneill  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
20b6ed7a12Sjmcneill  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21b6ed7a12Sjmcneill  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22b6ed7a12Sjmcneill  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23b6ed7a12Sjmcneill  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24b6ed7a12Sjmcneill  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25b6ed7a12Sjmcneill  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26b6ed7a12Sjmcneill  * POSSIBILITY OF SUCH DAMAGE.
27b6ed7a12Sjmcneill  */
28b6ed7a12Sjmcneill 
29b6ed7a12Sjmcneill #ifndef _SYS_DEV_PAD_PADVAR_H
30b6ed7a12Sjmcneill #define _SYS_DEV_PAD_PADVAR_H
31b6ed7a12Sjmcneill 
321fbfbee6Sriastradh #include <sys/types.h>
331fbfbee6Sriastradh 
341fbfbee6Sriastradh #include <sys/callout.h>
351fbfbee6Sriastradh #include <sys/condvar.h>
361fbfbee6Sriastradh #include <sys/device_if.h>
371fbfbee6Sriastradh #include <sys/mutex.h>
381fbfbee6Sriastradh 
39a5c532b1Sisaki struct pad_softc {
4051a52339Schristos 	device_t	sc_dev;
41b6ed7a12Sjmcneill 
428a962f23Sjmcneill 	u_int		sc_open;
43b6ed7a12Sjmcneill 	void		(*sc_intr)(void *);
44b6ed7a12Sjmcneill 	void		*sc_intrarg;
45b6ed7a12Sjmcneill 
46b6ed7a12Sjmcneill 	kcondvar_t	sc_condvar;
478a962f23Sjmcneill 	kmutex_t	sc_lock;
488a962f23Sjmcneill 	kmutex_t	sc_intr_lock;
49e622eac4Sisaki 	callout_t	sc_pcallout;
50b6ed7a12Sjmcneill 
518304d273Snat 	device_t	sc_audiodev;
52b6ed7a12Sjmcneill 
53b6ed7a12Sjmcneill #define PAD_BUFSIZE	65536
54b6ed7a12Sjmcneill 	uint8_t		sc_audiobuf[PAD_BUFSIZE];
55e622eac4Sisaki 	u_int		sc_buflen;
56e622eac4Sisaki 	u_int		sc_rpos;
57e622eac4Sisaki 	u_int		sc_wpos;
58b6ed7a12Sjmcneill 
59dd9a1395Sjmcneill 	uint8_t		sc_swvol;
60*0646b57fSmlelstv 
61*0646b57fSmlelstv 	u_int		sc_resid;
62a5c532b1Sisaki };
63b6ed7a12Sjmcneill 
64b6ed7a12Sjmcneill #endif /* !_SYS_DEV_PAD_PADVAR_H */
65