1*e2be04c7SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ 2674e95caSDavid Howells #ifndef __SOUND_ASOUND_FM_H 3674e95caSDavid Howells #define __SOUND_ASOUND_FM_H 4674e95caSDavid Howells 5674e95caSDavid Howells /* 6674e95caSDavid Howells * Advanced Linux Sound Architecture - ALSA 7674e95caSDavid Howells * 8674e95caSDavid Howells * Interface file between ALSA driver & user space 9674e95caSDavid Howells * Copyright (c) 1994-98 by Jaroslav Kysela <perex@perex.cz>, 10674e95caSDavid Howells * 4Front Technologies 11674e95caSDavid Howells * 12674e95caSDavid Howells * Direct FM control 13674e95caSDavid Howells * 14674e95caSDavid Howells * This program is free software; you can redistribute it and/or modify 15674e95caSDavid Howells * it under the terms of the GNU General Public License as published by 16674e95caSDavid Howells * the Free Software Foundation; either version 2 of the License, or 17674e95caSDavid Howells * (at your option) any later version. 18674e95caSDavid Howells * 19674e95caSDavid Howells * This program is distributed in the hope that it will be useful, 20674e95caSDavid Howells * but WITHOUT ANY WARRANTY; without even the implied warranty of 21674e95caSDavid Howells * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22674e95caSDavid Howells * GNU General Public License for more details. 23674e95caSDavid Howells * 24674e95caSDavid Howells * You should have received a copy of the GNU General Public License 25674e95caSDavid Howells * along with this program; if not, write to the Free Software 26674e95caSDavid Howells * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 27674e95caSDavid Howells * 28674e95caSDavid Howells */ 29674e95caSDavid Howells 30674e95caSDavid Howells #define SNDRV_DM_FM_MODE_OPL2 0x00 31674e95caSDavid Howells #define SNDRV_DM_FM_MODE_OPL3 0x01 32674e95caSDavid Howells 33674e95caSDavid Howells struct snd_dm_fm_info { 34674e95caSDavid Howells unsigned char fm_mode; /* OPL mode, see SNDRV_DM_FM_MODE_XXX */ 35674e95caSDavid Howells unsigned char rhythm; /* percussion mode flag */ 36674e95caSDavid Howells }; 37674e95caSDavid Howells 38674e95caSDavid Howells /* 39674e95caSDavid Howells * Data structure composing an FM "note" or sound event. 40674e95caSDavid Howells */ 41674e95caSDavid Howells 42674e95caSDavid Howells struct snd_dm_fm_voice { 43674e95caSDavid Howells unsigned char op; /* operator cell (0 or 1) */ 44674e95caSDavid Howells unsigned char voice; /* FM voice (0 to 17) */ 45674e95caSDavid Howells 46674e95caSDavid Howells unsigned char am; /* amplitude modulation */ 47674e95caSDavid Howells unsigned char vibrato; /* vibrato effect */ 48674e95caSDavid Howells unsigned char do_sustain; /* sustain phase */ 49674e95caSDavid Howells unsigned char kbd_scale; /* keyboard scaling */ 50674e95caSDavid Howells unsigned char harmonic; /* 4 bits: harmonic and multiplier */ 51674e95caSDavid Howells unsigned char scale_level; /* 2 bits: decrease output freq rises */ 52674e95caSDavid Howells unsigned char volume; /* 6 bits: volume */ 53674e95caSDavid Howells 54674e95caSDavid Howells unsigned char attack; /* 4 bits: attack rate */ 55674e95caSDavid Howells unsigned char decay; /* 4 bits: decay rate */ 56674e95caSDavid Howells unsigned char sustain; /* 4 bits: sustain level */ 57674e95caSDavid Howells unsigned char release; /* 4 bits: release rate */ 58674e95caSDavid Howells 59674e95caSDavid Howells unsigned char feedback; /* 3 bits: feedback for op0 */ 60674e95caSDavid Howells unsigned char connection; /* 0 for serial, 1 for parallel */ 61674e95caSDavid Howells unsigned char left; /* stereo left */ 62674e95caSDavid Howells unsigned char right; /* stereo right */ 63674e95caSDavid Howells unsigned char waveform; /* 3 bits: waveform shape */ 64674e95caSDavid Howells }; 65674e95caSDavid Howells 66674e95caSDavid Howells /* 67674e95caSDavid Howells * This describes an FM note by its voice, octave, frequency number (10bit) 68674e95caSDavid Howells * and key on/off. 69674e95caSDavid Howells */ 70674e95caSDavid Howells 71674e95caSDavid Howells struct snd_dm_fm_note { 72674e95caSDavid Howells unsigned char voice; /* 0-17 voice channel */ 73674e95caSDavid Howells unsigned char octave; /* 3 bits: what octave to play */ 74674e95caSDavid Howells unsigned int fnum; /* 10 bits: frequency number */ 75674e95caSDavid Howells unsigned char key_on; /* set for active, clear for silent */ 76674e95caSDavid Howells }; 77674e95caSDavid Howells 78674e95caSDavid Howells /* 79674e95caSDavid Howells * FM parameters that apply globally to all voices, and thus are not "notes" 80674e95caSDavid Howells */ 81674e95caSDavid Howells 82674e95caSDavid Howells struct snd_dm_fm_params { 83674e95caSDavid Howells unsigned char am_depth; /* amplitude modulation depth (1=hi) */ 84674e95caSDavid Howells unsigned char vib_depth; /* vibrato depth (1=hi) */ 85674e95caSDavid Howells unsigned char kbd_split; /* keyboard split */ 86674e95caSDavid Howells unsigned char rhythm; /* percussion mode select */ 87674e95caSDavid Howells 88674e95caSDavid Howells /* This block is the percussion instrument data */ 89674e95caSDavid Howells unsigned char bass; 90674e95caSDavid Howells unsigned char snare; 91674e95caSDavid Howells unsigned char tomtom; 92674e95caSDavid Howells unsigned char cymbal; 93674e95caSDavid Howells unsigned char hihat; 94674e95caSDavid Howells }; 95674e95caSDavid Howells 96674e95caSDavid Howells /* 97674e95caSDavid Howells * FM mode ioctl settings 98674e95caSDavid Howells */ 99674e95caSDavid Howells 100674e95caSDavid Howells #define SNDRV_DM_FM_IOCTL_INFO _IOR('H', 0x20, struct snd_dm_fm_info) 101674e95caSDavid Howells #define SNDRV_DM_FM_IOCTL_RESET _IO ('H', 0x21) 102674e95caSDavid Howells #define SNDRV_DM_FM_IOCTL_PLAY_NOTE _IOW('H', 0x22, struct snd_dm_fm_note) 103674e95caSDavid Howells #define SNDRV_DM_FM_IOCTL_SET_VOICE _IOW('H', 0x23, struct snd_dm_fm_voice) 104674e95caSDavid Howells #define SNDRV_DM_FM_IOCTL_SET_PARAMS _IOW('H', 0x24, struct snd_dm_fm_params) 105674e95caSDavid Howells #define SNDRV_DM_FM_IOCTL_SET_MODE _IOW('H', 0x25, int) 106674e95caSDavid Howells /* for OPL3 only */ 107674e95caSDavid Howells #define SNDRV_DM_FM_IOCTL_SET_CONNECTION _IOW('H', 0x26, int) 108674e95caSDavid Howells /* SBI patch management */ 109674e95caSDavid Howells #define SNDRV_DM_FM_IOCTL_CLEAR_PATCHES _IO ('H', 0x40) 110674e95caSDavid Howells 111674e95caSDavid Howells #define SNDRV_DM_FM_OSS_IOCTL_RESET 0x20 112674e95caSDavid Howells #define SNDRV_DM_FM_OSS_IOCTL_PLAY_NOTE 0x21 113674e95caSDavid Howells #define SNDRV_DM_FM_OSS_IOCTL_SET_VOICE 0x22 114674e95caSDavid Howells #define SNDRV_DM_FM_OSS_IOCTL_SET_PARAMS 0x23 115674e95caSDavid Howells #define SNDRV_DM_FM_OSS_IOCTL_SET_MODE 0x24 116674e95caSDavid Howells #define SNDRV_DM_FM_OSS_IOCTL_SET_OPL 0x25 117674e95caSDavid Howells 118674e95caSDavid Howells /* 119674e95caSDavid Howells * Patch Record - fixed size for write 120674e95caSDavid Howells */ 121674e95caSDavid Howells 122674e95caSDavid Howells #define FM_KEY_SBI "SBI\032" 123674e95caSDavid Howells #define FM_KEY_2OP "2OP\032" 124674e95caSDavid Howells #define FM_KEY_4OP "4OP\032" 125674e95caSDavid Howells 126674e95caSDavid Howells struct sbi_patch { 127674e95caSDavid Howells unsigned char prog; 128674e95caSDavid Howells unsigned char bank; 129674e95caSDavid Howells char key[4]; 130674e95caSDavid Howells char name[25]; 131674e95caSDavid Howells char extension[7]; 132674e95caSDavid Howells unsigned char data[32]; 133674e95caSDavid Howells }; 134674e95caSDavid Howells 135674e95caSDavid Howells #endif /* __SOUND_ASOUND_FM_H */ 136