Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
0002 /*
0003  *  Copyright (c) 1999 by Uros Bizjak <uros@kss-loka.si>
0004  *                        Takashi Iwai <tiwai@suse.de>
0005  *
0006  *  SB16ASP/AWE32 CSP control
0007  *
0008  *   This program is free software; you can redistribute it and/or modify 
0009  *   it under the terms of the GNU General Public License as published by
0010  *   the Free Software Foundation; either version 2 of the License, or
0011  *   (at your option) any later version.
0012  *
0013  *   This program is distributed in the hope that it will be useful,
0014  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
0015  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0016  *   GNU General Public License for more details.
0017  *
0018  *   You should have received a copy of the GNU General Public License
0019  *   along with this program; if not, write to the Free Software
0020  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
0021  *
0022  */
0023 #ifndef _UAPI__SOUND_SB16_CSP_H
0024 #define _UAPI__SOUND_SB16_CSP_H
0025 
0026 
0027 /* CSP modes */
0028 #define SNDRV_SB_CSP_MODE_NONE      0x00
0029 #define SNDRV_SB_CSP_MODE_DSP_READ  0x01    /* Record from DSP */
0030 #define SNDRV_SB_CSP_MODE_DSP_WRITE 0x02    /* Play to DSP */
0031 #define SNDRV_SB_CSP_MODE_QSOUND        0x04    /* QSound */
0032 
0033 /* CSP load flags */
0034 #define SNDRV_SB_CSP_LOAD_FROMUSER  0x01
0035 #define SNDRV_SB_CSP_LOAD_INITBLOCK 0x02
0036 
0037 /* CSP sample width */
0038 #define SNDRV_SB_CSP_SAMPLE_8BIT        0x01
0039 #define SNDRV_SB_CSP_SAMPLE_16BIT       0x02
0040 
0041 /* CSP channels */
0042 #define SNDRV_SB_CSP_MONO           0x01
0043 #define SNDRV_SB_CSP_STEREO     0x02
0044 
0045 /* CSP rates */
0046 #define SNDRV_SB_CSP_RATE_8000      0x01
0047 #define SNDRV_SB_CSP_RATE_11025     0x02
0048 #define SNDRV_SB_CSP_RATE_22050     0x04
0049 #define SNDRV_SB_CSP_RATE_44100     0x08
0050 #define SNDRV_SB_CSP_RATE_ALL       0x0f
0051 
0052 /* CSP running state */
0053 #define SNDRV_SB_CSP_ST_IDLE        0x00
0054 #define SNDRV_SB_CSP_ST_LOADED      0x01
0055 #define SNDRV_SB_CSP_ST_RUNNING     0x02
0056 #define SNDRV_SB_CSP_ST_PAUSED      0x04
0057 #define SNDRV_SB_CSP_ST_AUTO        0x08
0058 #define SNDRV_SB_CSP_ST_QSOUND      0x10
0059 
0060 /* maximum QSound value (180 degrees right) */
0061 #define SNDRV_SB_CSP_QSOUND_MAX_RIGHT   0x20
0062 
0063 /* maximum microcode RIFF file size */
0064 #define SNDRV_SB_CSP_MAX_MICROCODE_FILE_SIZE    0x3000
0065 
0066 /* microcode header */
0067 struct snd_sb_csp_mc_header {
0068     char codec_name[16];        /* id name of codec */
0069     unsigned short func_req;    /* requested function */
0070 };
0071 
0072 /* microcode to be loaded */
0073 struct snd_sb_csp_microcode {
0074     struct snd_sb_csp_mc_header info;
0075     unsigned char data[SNDRV_SB_CSP_MAX_MICROCODE_FILE_SIZE];
0076 };
0077 
0078 /* start CSP with sample_width in mono/stereo */
0079 struct snd_sb_csp_start {
0080     int sample_width;   /* sample width, look above */
0081     int channels;       /* channels, look above */
0082 };
0083 
0084 /* CSP information */
0085 struct snd_sb_csp_info {
0086     char codec_name[16];        /* id name of codec */
0087     unsigned short func_nr;     /* function number */
0088     unsigned int acc_format;    /* accepted PCM formats */
0089     unsigned short acc_channels;    /* accepted channels */
0090     unsigned short acc_width;   /* accepted sample width */
0091     unsigned short acc_rates;   /* accepted sample rates */
0092     unsigned short csp_mode;    /* CSP mode, see above */
0093     unsigned short run_channels;    /* current channels  */
0094     unsigned short run_width;   /* current sample width */
0095     unsigned short version;     /* version id: 0x10 - 0x1f */
0096     unsigned short state;       /* state bits */
0097 };
0098 
0099 /* HWDEP controls */
0100 /* get CSP information */
0101 #define SNDRV_SB_CSP_IOCTL_INFO     _IOR('H', 0x10, struct snd_sb_csp_info)
0102 /* load microcode to CSP */
0103 /* NOTE: struct snd_sb_csp_microcode overflows the max size (13 bits)
0104  * defined for some architectures like MIPS, and it leads to build errors.
0105  * (x86 and co have 14-bit size, thus it's valid, though.)
0106  * As a workaround for skipping the size-limit check, here we don't use the
0107  * normal _IOW() macro but _IOC() with the manual argument.
0108  */
0109 #define SNDRV_SB_CSP_IOCTL_LOAD_CODE    \
0110     _IOC(_IOC_WRITE, 'H', 0x11, sizeof(struct snd_sb_csp_microcode))
0111 /* unload microcode from CSP */
0112 #define SNDRV_SB_CSP_IOCTL_UNLOAD_CODE  _IO('H', 0x12)
0113 /* start CSP */
0114 #define SNDRV_SB_CSP_IOCTL_START        _IOW('H', 0x13, struct snd_sb_csp_start)
0115 /* stop CSP */
0116 #define SNDRV_SB_CSP_IOCTL_STOP     _IO('H', 0x14)
0117 /* pause CSP and DMA transfer */
0118 #define SNDRV_SB_CSP_IOCTL_PAUSE        _IO('H', 0x15)
0119 /* restart CSP and DMA transfer */
0120 #define SNDRV_SB_CSP_IOCTL_RESTART  _IO('H', 0x16)
0121 
0122 
0123 #endif /* _UAPI__SOUND_SB16_CSP_H */