xref: /freebsd/sys/sys/sndstat.h (revision 81ad6265)
1 /*-
2  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3  *
4  * Copyright (c) 2020 The FreeBSD Foundation
5  *
6  * This software was developed by Ka Ho Ng
7  * under sponsorship from the FreeBSD Foundation.
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions
11  * are met:
12  * 1. Redistributions of source code must retain the above copyright
13  *    notice, this list of conditions and the following disclaimer.
14  * 2. Redistributions in binary form must reproduce the above copyright
15  *    notice, this list of conditions and the following disclaimer in the
16  *    documentation and/or other materials provided with the distribution.
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
19  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
22  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28  * SUCH DAMAGE.
29  *
30  * $FreeBSD$
31  */
32 
33 #ifndef _SYS_SNDSTAT_H_
34 #define _SYS_SNDSTAT_H_
35 
36 #include <sys/types.h>
37 #ifndef _IOWR
38 #include <sys/ioccom.h>
39 #endif  /* !_IOWR */
40 
41 struct sndstioc_nv_arg {
42 	size_t nbytes;	/* [IN/OUT] buffer size/number of bytes filled */
43 	void *buf;	/* [OUT] buffer holding a packed nvlist */
44 };
45 
46 /*
47  * Common name/value pair names
48  */
49 #define SNDST_DSPS			"dsps"
50 #define SNDST_DSPS_FROM_USER		"from_user"
51 #define SNDST_DSPS_PCHAN		"pchan"
52 #define SNDST_DSPS_RCHAN		"rchan"
53 #define SNDST_DSPS_NAMEUNIT		"nameunit"
54 #define SNDST_DSPS_DEVNODE		"devnode"
55 #define SNDST_DSPS_DESC			"desc"
56 #define SNDST_DSPS_PROVIDER		"provider"
57 #define SNDST_DSPS_PROVIDER_INFO	"provider_info"
58 
59 /*
60  * Common name/value pair names for play/rec info
61  */
62 #define SNDST_DSPS_INFO_PLAY		"info_play"
63 #define SNDST_DSPS_INFO_REC		"info_rec"
64 #define SNDST_DSPS_INFO_MIN_RATE	"min_rate"
65 #define SNDST_DSPS_INFO_MAX_RATE	"max_rate"
66 #define SNDST_DSPS_INFO_FORMATS		"formats"
67 #define SNDST_DSPS_INFO_MIN_CHN		"min_chn"
68 #define SNDST_DSPS_INFO_MAX_CHN		"max_chn"
69 
70 /*
71  * sound(4)-specific name/value pair names
72  */
73 #define SNDST_DSPS_SOUND4_PROVIDER	"sound(4)"
74 #define SNDST_DSPS_SOUND4_UNIT		"unit"
75 #define SNDST_DSPS_SOUND4_BITPERFECT	"bitperfect"
76 #define SNDST_DSPS_SOUND4_PVCHAN	"pvchan"
77 #define SNDST_DSPS_SOUND4_RVCHAN	"rvchan"
78 
79 #define SNDSTIOC_REFRESH_DEVS \
80 	_IO('D', 100)
81 #define SNDSTIOC_GET_DEVS \
82 	_IOWR('D', 101, struct sndstioc_nv_arg)
83 #define SNDSTIOC_ADD_USER_DEVS \
84 	_IOWR('D', 102, struct sndstioc_nv_arg)
85 #define SNDSTIOC_FLUSH_USER_DEVS \
86 	_IO('D', 103)
87 
88 #ifdef _KERNEL
89 #ifdef COMPAT_FREEBSD32
90 
91 struct sndstioc_nv_arg32 {
92 	uint32_t nbytes;
93 	uint32_t buf;
94 };
95 
96 #define SNDSTIOC_GET_DEVS32 \
97 	_IOC_NEWTYPE(SNDSTIOC_GET_DEVS, struct sndstioc_nv_arg32)
98 #define SNDSTIOC_ADD_USER_DEVS32 \
99 	_IOC_NEWTYPE(SNDSTIOC_ADD_USER_DEVS, struct sndstioc_nv_arg32)
100 
101 #endif
102 #endif
103 
104 #endif /* !_SYS_SNDSTAT_H_ */
105