1/*-
2 * SPDX-License-Identifier: BSD-2-Clause
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
31#ifndef _SYS_SNDSTAT_H_
32#define _SYS_SNDSTAT_H_
33
34#include <sys/types.h>
35#ifndef _IOWR
36#include <sys/ioccom.h>
37#endif  /* !_IOWR */
38
39struct sndstioc_nv_arg {
40	size_t nbytes;	/* [IN/OUT] buffer size/number of bytes filled */
41	void *buf;	/* [OUT] buffer holding a packed nvlist */
42};
43
44/*
45 * Common name/value pair names
46 */
47#define SNDST_DSPS			"dsps"
48#define SNDST_DSPS_FROM_USER		"from_user"
49#define SNDST_DSPS_PCHAN		"pchan"
50#define SNDST_DSPS_RCHAN		"rchan"
51#define SNDST_DSPS_NAMEUNIT		"nameunit"
52#define SNDST_DSPS_DEVNODE		"devnode"
53#define SNDST_DSPS_DESC			"desc"
54#define SNDST_DSPS_PROVIDER		"provider"
55#define SNDST_DSPS_PROVIDER_INFO	"provider_info"
56
57/*
58 * Common name/value pair names for play/rec info
59 */
60#define SNDST_DSPS_INFO_PLAY		"info_play"
61#define SNDST_DSPS_INFO_REC		"info_rec"
62#define SNDST_DSPS_INFO_MIN_RATE	"min_rate"
63#define SNDST_DSPS_INFO_MAX_RATE	"max_rate"
64#define SNDST_DSPS_INFO_FORMATS		"formats"
65#define SNDST_DSPS_INFO_MIN_CHN		"min_chn"
66#define SNDST_DSPS_INFO_MAX_CHN		"max_chn"
67
68/*
69 * sound(4)-specific name/value pair names
70 */
71#define SNDST_DSPS_SOUND4_PROVIDER	"sound(4)"
72#define SNDST_DSPS_SOUND4_UNIT		"unit"
73#define SNDST_DSPS_SOUND4_BITPERFECT	"bitperfect"
74#define SNDST_DSPS_SOUND4_PVCHAN	"pvchan"
75#define SNDST_DSPS_SOUND4_RVCHAN	"rvchan"
76
77/*
78 * Maximum user-specified nvlist buffer size
79 */
80#define SNDST_UNVLBUF_MAX		65536
81
82#define SNDSTIOC_REFRESH_DEVS \
83	_IO('D', 100)
84#define SNDSTIOC_GET_DEVS \
85	_IOWR('D', 101, struct sndstioc_nv_arg)
86#define SNDSTIOC_ADD_USER_DEVS \
87	_IOWR('D', 102, struct sndstioc_nv_arg)
88#define SNDSTIOC_FLUSH_USER_DEVS \
89	_IO('D', 103)
90
91#ifdef _KERNEL
92#ifdef COMPAT_FREEBSD32
93
94struct sndstioc_nv_arg32 {
95	uint32_t nbytes;
96	uint32_t buf;
97};
98
99#define SNDSTIOC_GET_DEVS32 \
100	_IOC_NEWTYPE(SNDSTIOC_GET_DEVS, struct sndstioc_nv_arg32)
101#define SNDSTIOC_ADD_USER_DEVS32 \
102	_IOC_NEWTYPE(SNDSTIOC_ADD_USER_DEVS, struct sndstioc_nv_arg32)
103
104#endif
105#endif
106
107#endif /* !_SYS_SNDSTAT_H_ */
108