github.com/google/syzkaller@v0.0.0-20240517125934-c0f1611a36d6/sys/linux/dev_dsp.txt (about)

     1  # Copyright 2019 syzkaller project authors. All rights reserved.
     2  # Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
     3  
     4  include <uapi/asm/ioctl.h>
     5  include <uapi/linux/fcntl.h>
     6  include <uapi/linux/soundcard.h>
     7  
     8  resource fd_mixer[fd]
     9  resource fd_dsp[fd_mixer]
    10  
    11  openat$mixer(fd const[AT_FDCWD], file ptr[in, string["/dev/mixer"]], flags flags[open_flags], mode const[0]) fd_mixer
    12  openat$dsp(fd const[AT_FDCWD], file ptr[in, string["/dev/dsp"]], flags flags[open_flags], mode const[0]) fd_dsp
    13  openat$dsp1(fd const[AT_FDCWD], file ptr[in, string["/dev/dsp1"]], flags flags[open_flags], mode const[0]) fd_dsp
    14  openat$adsp1(fd const[AT_FDCWD], file ptr[in, string["/dev/adsp1"]], flags flags[open_flags], mode const[0]) fd_dsp
    15  openat$audio(fd const[AT_FDCWD], file ptr[in, string["/dev/audio"]], flags flags[open_flags], mode const[0]) fd_dsp
    16  openat$audio1(fd const[AT_FDCWD], file ptr[in, string["/dev/audio1"]], flags flags[open_flags], mode const[0]) fd_dsp
    17  
    18  write$dsp(fd fd_dsp, data ptr[in, array[int8]], len bytesize[data])
    19  read$dsp(fd fd_dsp, data ptr[out, array[int8]], len bytesize[data])
    20  mmap$dsp(addr vma, len len[addr], prot flags[mmap_prot], flags flags[mmap_flags], fd fd_dsp, offset const[0])
    21  
    22  ioctl$SNDCTL_DSP_RESET(fd fd_dsp, cmd const[SNDCTL_DSP_RESET], arg const[0])
    23  ioctl$SNDCTL_DSP_SYNC(fd fd_dsp, cmd const[SNDCTL_DSP_SYNC], arg const[0])
    24  ioctl$SNDCTL_DSP_SPEED(fd fd_dsp, cmd const[SNDCTL_DSP_SPEED], arg ptr[in, int32])
    25  ioctl$SNDCTL_DSP_STEREO(fd fd_dsp, cmd const[SNDCTL_DSP_STEREO], arg ptr[in, bool32])
    26  ioctl$SNDCTL_DSP_GETBLKSIZE(fd fd_dsp, cmd const[SNDCTL_DSP_GETBLKSIZE], arg ptr[out, int32])
    27  ioctl$SNDCTL_DSP_CHANNELS(fd fd_dsp, cmd const[SNDCTL_DSP_CHANNELS], arg ptr[in, int32])
    28  ioctl$SNDCTL_DSP_POST(fd fd_dsp, cmd const[SNDCTL_DSP_POST], arg const[0])
    29  ioctl$SNDCTL_DSP_SUBDIVIDE(fd fd_dsp, cmd const[SNDCTL_DSP_SUBDIVIDE], arg ptr[in, int32])
    30  ioctl$SNDCTL_DSP_SETFRAGMENT(fd fd_dsp, cmd const[SNDCTL_DSP_SETFRAGMENT], arg ptr[in, int32])
    31  ioctl$SNDCTL_DSP_GETFMTS(fd fd_dsp, cmd const[SNDCTL_DSP_GETFMTS], arg ptr[in, int32])
    32  ioctl$SNDCTL_DSP_SETFMT(fd fd_dsp, cmd const[SNDCTL_DSP_SETFMT], arg ptr[in, int32])
    33  ioctl$SNDCTL_DSP_GETOSPACE(fd fd_dsp, cmd const[SNDCTL_DSP_GETOSPACE], arg ptr[out, array[int8, AUFIO_BUF_INFO_SIZE]])
    34  ioctl$SNDCTL_DSP_GETISPACE(fd fd_dsp, cmd const[SNDCTL_DSP_GETISPACE], arg ptr[out, array[int8, AUFIO_BUF_INFO_SIZE]])
    35  ioctl$SNDCTL_DSP_NONBLOCK(fd fd_dsp, cmd const[SNDCTL_DSP_NONBLOCK], arg const[0])
    36  ioctl$SNDCTL_DSP_GETCAPS(fd fd_dsp, cmd const[SNDCTL_DSP_GETCAPS], arg ptr[out, int32])
    37  ioctl$SNDCTL_DSP_GETTRIGGER(fd fd_dsp, cmd const[SNDCTL_DSP_GETTRIGGER], arg ptr[out, int32])
    38  ioctl$SNDCTL_DSP_SETTRIGGER(fd fd_dsp, cmd const[SNDCTL_DSP_SETTRIGGER], arg ptr[in, int32])
    39  ioctl$SNDCTL_DSP_GETIPTR(fd fd_dsp, cmd const[SNDCTL_DSP_GETIPTR], arg ptr[out, array[int8, COUNT_INFO_SIZE]])
    40  ioctl$SNDCTL_DSP_GETOPTR(fd fd_dsp, cmd const[SNDCTL_DSP_GETOPTR], arg ptr[out, array[int8, COUNT_INFO_SIZE]])
    41  ioctl$SNDCTL_DSP_SETDUPLEX(fd fd_dsp, cmd const[SNDCTL_DSP_SETDUPLEX], arg const[0])
    42  ioctl$SNDCTL_DSP_GETODELAY(fd fd_dsp, cmd const[SNDCTL_DSP_GETODELAY], arg ptr[out, int32])
    43  ioctl$SOUND_PCM_READ_RATE(fd fd_dsp, cmd const[SOUND_PCM_READ_RATE], arg ptr[out, int32])
    44  ioctl$SOUND_PCM_READ_CHANNELS(fd fd_dsp, cmd const[SOUND_PCM_READ_CHANNELS], arg ptr[out, int32])
    45  ioctl$SOUND_PCM_READ_BITS(fd fd_dsp, cmd const[SOUND_PCM_READ_BITS], arg ptr[out, int32])
    46  
    47  # /dev/mixer
    48  ioctl$SOUND_OLD_MIXER_INFO(fd fd_mixer, cmd const[SOUND_OLD_MIXER_INFO], arg ptr[out, array[int8, OLD_MIXED_INFO_SIZE]])
    49  ioctl$SOUND_MIXER_INFO(fd fd_mixer, cmd const[SOUND_MIXER_INFO], arg ptr[out, array[int8, MIXER_INFO_SIZE]])
    50  ioctl$SOUND_MIXER_WRITE_RECSRC(fd fd_mixer, cmd const[SOUND_MIXER_WRITE_RECSRC], arg ptr[inout, int32])
    51  ioctl$mixer_OSS_GETVERSION(fd fd_mixer, cmd const[OSS_GETVERSION], arg ptr[out, int32])
    52  ioctl$mixer_OSS_ALSAEMULVER(fd fd_mixer, cmd const[OSS_ALSAEMULVER], arg ptr[out, int32])
    53  ioctl$SOUND_MIXER_READ_DEVMASK(fd fd_mixer, cmd const[SOUND_MIXER_READ_DEVMASK], arg ptr[out, int32])
    54  ioctl$SOUND_MIXER_READ_STEREODEVS(fd fd_mixer, cmd const[SOUND_MIXER_READ_STEREODEVS], arg ptr[out, int32])
    55  ioctl$SOUND_MIXER_READ_RECMASK(fd fd_mixer, cmd const[SOUND_MIXER_READ_RECMASK], arg ptr[out, int32])
    56  ioctl$SOUND_MIXER_READ_CAPS(fd fd_mixer, cmd const[SOUND_MIXER_READ_CAPS], arg ptr[out, int32])
    57  ioctl$SOUND_MIXER_READ_RECSRC(fd fd_mixer, cmd const[SOUND_MIXER_READ_RECSRC], arg ptr[out, int32])
    58  ioctl$SOUND_MIXER_WRITE_VOLUME(fd fd_mixer, cmd int32[SOUND_MIXER_WRITE_VOLUME:SOUND_MIXER_WRITE_ONOFF_MAX], arg ptr[in, int32[0:100]])
    59  ioctl$SOUND_MIXER_READ_VOLUME(fd fd_mixer, cmd int32[SOUND_MIXER_READ_VOLUME:SOUND_MIXER_READ_ONOFF_MAX], arg ptr[out, int32])
    60  
    61  # /proc/asound/card*/oss_mixer
    62  resource fd_proc_mixer[fd]
    63  oss_mixer_proc_files = "/proc/asound/card0/oss_mixer", "/proc/asound/card1/oss_mixer", "/proc/asound/card2/oss_mixer", "/proc/asound/card3/oss_mixer"
    64  
    65  openat$proc_mixer(fd const[AT_FDCWD], file ptr[in, string[oss_mixer_proc_files]], flags flags[open_flags], mode const[0]) fd_proc_mixer
    66  read$proc_mixer(fd fd_proc_mixer, data ptr[out, array[int8]], len bytesize[data])
    67  write$proc_mixer(fd fd_proc_mixer, data ptr[in, array[oss_mixer_input_line]], len bytesize[data])
    68  
    69  # The input to write$proc_mixer can consist of several lines.
    70  # The format of each line should be:
    71  # <oss_mixer_name>[ '<alsa_source_names>' <index>]\n
    72  # e.g. "VOLUME\nBASS 'Line Capture Switch' 123\n"
    73  
    74  # 10 = '\n'
    75  oss_mixer_input_line {
    76  	name	stringnoz[oss_mixer_names]
    77  	body	optional[oss_mixer_input_body]
    78  	newline	const[10, int8]
    79  } [packed]
    80  
    81  # index should be intptr[0:0x4000], but only 0 works on qemu currently.
    82  oss_mixer_input_body {
    83  	sep1		stringnoz[" '"]
    84  	alsa_source	stringnoz[alsa_source_names]
    85  	sep2		stringnoz["' "]
    86  	index		fmt[dec, intptr[0:0]]
    87  } [packed]
    88  
    89  oss_mixer_names = "VOLUME", "BASS", "TREBLE", "SYNTH", "PCM", "SPEAKER", "LINE", "MIC", "CD", "IMIX", "ALTPCM", "RECLEV", "IGAIN", "OGAIN", "LINE1", "LINE2", "LINE3", "DIGITAL1", "DIGITAL2", "DIGITAL3", "PHONEIN", "PHONEOUT", "VIDEO", "RADIO", "MONITOR"
    90  alsa_source_names = "Master", "Master Capture", "Master Capture Switch", "Master Playback", "Master Playback Volume", "Master Playback Switch", "Synth", "Synth Capture", "Synth Capture Switch", "Line", "Line Capture", "Line Capture Switch", "Mic", "Mic Capture", "Mic Capture Switch", "CD", "CD Capture", "CD Capture Switch", "Capture", "Capture Volume", "Capture Switch"
    91  
    92  # NEED: we could provide a special support for this to save typing and duplication here.
    93  # It could be eigher:
    94  #	csizeof[struct audio_buf_info]
    95  # Note: we probalby want to use sizeof as replacement for current bytesize.
    96  # Note: the argument is not necessary a struct, so we need to pronounce struct as well.
    97  # Or more generic form would be something along the following lines:
    98  #	ceval[`sizeof(struct audio_buf_info)`]
    99  # as replacement for any one-off defines.
   100  
   101  define AUFIO_BUF_INFO_SIZE	sizeof(struct audio_buf_info)
   102  define COUNT_INFO_SIZE	sizeof(struct count_info)
   103  define MIXER_INFO_SIZE	sizeof(struct mixer_info)
   104  define OLD_MIXED_INFO_SIZE	sizeof(struct _old_mixer_info)
   105  define SOUND_MIXER_WRITE_ONOFF_MAX	MIXER_WRITE(SOUND_ONOFF_MAX)
   106  define SOUND_MIXER_READ_ONOFF_MAX	MIXER_READ(SOUND_ONOFF_MAX)
   107  define OSS_ALSAEMULVER	_SIOR ('M', 249, int)
   108  _ = __NR_mmap2