Blame include/sound/sb16_csp.h

Packit 4a16fb
/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
Packit 4a16fb
/*
Packit 4a16fb
 *  Copyright (c) 1999 by Uros Bizjak <uros@kss-loka.si>
Packit 4a16fb
 *                        Takashi Iwai <tiwai@suse.de>
Packit 4a16fb
 *
Packit 4a16fb
 *  SB16ASP/AWE32 CSP control
Packit 4a16fb
 *
Packit 4a16fb
 *   This program is free software; you can redistribute it and/or modify 
Packit 4a16fb
 *   it under the terms of the GNU General Public License as published by
Packit 4a16fb
 *   the Free Software Foundation; either version 2 of the License, or
Packit 4a16fb
 *   (at your option) any later version.
Packit 4a16fb
 *
Packit 4a16fb
 *   This program is distributed in the hope that it will be useful,
Packit 4a16fb
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 4a16fb
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit 4a16fb
 *   GNU General Public License for more details.
Packit 4a16fb
 *
Packit 4a16fb
 *   You should have received a copy of the GNU General Public License
Packit 4a16fb
 *   along with this program; if not, write to the Free Software
Packit 4a16fb
 *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
Packit 4a16fb
 *
Packit 4a16fb
 */
Packit 4a16fb
#ifndef _UAPI__SOUND_SB16_CSP_H
Packit 4a16fb
#define _UAPI__SOUND_SB16_CSP_H
Packit 4a16fb
Packit 4a16fb
Packit 4a16fb
/* CSP modes */
Packit 4a16fb
#define SNDRV_SB_CSP_MODE_NONE		0x00
Packit 4a16fb
#define SNDRV_SB_CSP_MODE_DSP_READ	0x01	/* Record from DSP */
Packit 4a16fb
#define SNDRV_SB_CSP_MODE_DSP_WRITE	0x02	/* Play to DSP */
Packit 4a16fb
#define SNDRV_SB_CSP_MODE_QSOUND		0x04	/* QSound */
Packit 4a16fb
Packit 4a16fb
/* CSP load flags */
Packit 4a16fb
#define SNDRV_SB_CSP_LOAD_FROMUSER	0x01
Packit 4a16fb
#define SNDRV_SB_CSP_LOAD_INITBLOCK	0x02
Packit 4a16fb
Packit 4a16fb
/* CSP sample width */
Packit 4a16fb
#define SNDRV_SB_CSP_SAMPLE_8BIT		0x01
Packit 4a16fb
#define SNDRV_SB_CSP_SAMPLE_16BIT		0x02
Packit 4a16fb
Packit 4a16fb
/* CSP channels */
Packit 4a16fb
#define SNDRV_SB_CSP_MONO			0x01
Packit 4a16fb
#define SNDRV_SB_CSP_STEREO		0x02
Packit 4a16fb
Packit 4a16fb
/* CSP rates */
Packit 4a16fb
#define SNDRV_SB_CSP_RATE_8000		0x01
Packit 4a16fb
#define SNDRV_SB_CSP_RATE_11025		0x02
Packit 4a16fb
#define SNDRV_SB_CSP_RATE_22050		0x04
Packit 4a16fb
#define SNDRV_SB_CSP_RATE_44100		0x08
Packit 4a16fb
#define SNDRV_SB_CSP_RATE_ALL		0x0f
Packit 4a16fb
Packit 4a16fb
/* CSP running state */
Packit 4a16fb
#define SNDRV_SB_CSP_ST_IDLE		0x00
Packit 4a16fb
#define SNDRV_SB_CSP_ST_LOADED		0x01
Packit 4a16fb
#define SNDRV_SB_CSP_ST_RUNNING		0x02
Packit 4a16fb
#define SNDRV_SB_CSP_ST_PAUSED		0x04
Packit 4a16fb
#define SNDRV_SB_CSP_ST_AUTO		0x08
Packit 4a16fb
#define SNDRV_SB_CSP_ST_QSOUND		0x10
Packit 4a16fb
Packit 4a16fb
/* maximum QSound value (180 degrees right) */
Packit 4a16fb
#define SNDRV_SB_CSP_QSOUND_MAX_RIGHT	0x20
Packit 4a16fb
Packit 4a16fb
/* maximum microcode RIFF file size */
Packit 4a16fb
#define SNDRV_SB_CSP_MAX_MICROCODE_FILE_SIZE	0x3000
Packit 4a16fb
Packit 4a16fb
/* microcode header */
Packit 4a16fb
struct snd_sb_csp_mc_header {
Packit 4a16fb
	char codec_name[16];		/* id name of codec */
Packit 4a16fb
	unsigned short func_req;	/* requested function */
Packit 4a16fb
};
Packit 4a16fb
Packit 4a16fb
/* microcode to be loaded */
Packit 4a16fb
struct snd_sb_csp_microcode {
Packit 4a16fb
	struct snd_sb_csp_mc_header info;
Packit 4a16fb
	unsigned char data[SNDRV_SB_CSP_MAX_MICROCODE_FILE_SIZE];
Packit 4a16fb
};
Packit 4a16fb
Packit 4a16fb
/* start CSP with sample_width in mono/stereo */
Packit 4a16fb
struct snd_sb_csp_start {
Packit 4a16fb
	int sample_width;	/* sample width, look above */
Packit 4a16fb
	int channels;		/* channels, look above */
Packit 4a16fb
};
Packit 4a16fb
Packit 4a16fb
/* CSP information */
Packit 4a16fb
struct snd_sb_csp_info {
Packit 4a16fb
	char codec_name[16];		/* id name of codec */
Packit 4a16fb
	unsigned short func_nr;		/* function number */
Packit 4a16fb
	unsigned int acc_format;	/* accepted PCM formats */
Packit 4a16fb
	unsigned short acc_channels;	/* accepted channels */
Packit 4a16fb
	unsigned short acc_width;	/* accepted sample width */
Packit 4a16fb
	unsigned short acc_rates;	/* accepted sample rates */
Packit 4a16fb
	unsigned short csp_mode;	/* CSP mode, see above */
Packit 4a16fb
	unsigned short run_channels;	/* current channels  */
Packit 4a16fb
	unsigned short run_width;	/* current sample width */
Packit 4a16fb
	unsigned short version;		/* version id: 0x10 - 0x1f */
Packit 4a16fb
	unsigned short state;		/* state bits */
Packit 4a16fb
};
Packit 4a16fb
Packit 4a16fb
/* HWDEP controls */
Packit 4a16fb
/* get CSP information */
Packit 4a16fb
#define SNDRV_SB_CSP_IOCTL_INFO		_IOR('H', 0x10, struct snd_sb_csp_info)
Packit 4a16fb
/* load microcode to CSP */
Packit 4a16fb
/* NOTE: struct snd_sb_csp_microcode overflows the max size (13 bits)
Packit 4a16fb
 * defined for some architectures like MIPS, and it leads to build errors.
Packit 4a16fb
 * (x86 and co have 14-bit size, thus it's valid, though.)
Packit 4a16fb
 * As a workaround for skipping the size-limit check, here we don't use the
Packit 4a16fb
 * normal _IOW() macro but _IOC() with the manual argument.
Packit 4a16fb
 */
Packit 4a16fb
#define SNDRV_SB_CSP_IOCTL_LOAD_CODE	\
Packit 4a16fb
	_IOC(_IOC_WRITE, 'H', 0x11, sizeof(struct snd_sb_csp_microcode))
Packit 4a16fb
/* unload microcode from CSP */
Packit 4a16fb
#define SNDRV_SB_CSP_IOCTL_UNLOAD_CODE	_IO('H', 0x12)
Packit 4a16fb
/* start CSP */
Packit 4a16fb
#define SNDRV_SB_CSP_IOCTL_START		_IOW('H', 0x13, struct snd_sb_csp_start)
Packit 4a16fb
/* stop CSP */
Packit 4a16fb
#define SNDRV_SB_CSP_IOCTL_STOP		_IO('H', 0x14)
Packit 4a16fb
/* pause CSP and DMA transfer */
Packit 4a16fb
#define SNDRV_SB_CSP_IOCTL_PAUSE		_IO('H', 0x15)
Packit 4a16fb
/* restart CSP and DMA transfer */
Packit 4a16fb
#define SNDRV_SB_CSP_IOCTL_RESTART	_IO('H', 0x16)
Packit 4a16fb
Packit 4a16fb
Packit 4a16fb
#endif /* _UAPI__SOUND_SB16_CSP_H */