18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ 28c2ecf20Sopenharmony_ci#ifndef __SOUND_ASOUND_FM_H 38c2ecf20Sopenharmony_ci#define __SOUND_ASOUND_FM_H 48c2ecf20Sopenharmony_ci 58c2ecf20Sopenharmony_ci/* 68c2ecf20Sopenharmony_ci * Advanced Linux Sound Architecture - ALSA 78c2ecf20Sopenharmony_ci * 88c2ecf20Sopenharmony_ci * Interface file between ALSA driver & user space 98c2ecf20Sopenharmony_ci * Copyright (c) 1994-98 by Jaroslav Kysela <perex@perex.cz>, 108c2ecf20Sopenharmony_ci * 4Front Technologies 118c2ecf20Sopenharmony_ci * 128c2ecf20Sopenharmony_ci * Direct FM control 138c2ecf20Sopenharmony_ci * 148c2ecf20Sopenharmony_ci * This program is free software; you can redistribute it and/or modify 158c2ecf20Sopenharmony_ci * it under the terms of the GNU General Public License as published by 168c2ecf20Sopenharmony_ci * the Free Software Foundation; either version 2 of the License, or 178c2ecf20Sopenharmony_ci * (at your option) any later version. 188c2ecf20Sopenharmony_ci * 198c2ecf20Sopenharmony_ci * This program is distributed in the hope that it will be useful, 208c2ecf20Sopenharmony_ci * but WITHOUT ANY WARRANTY; without even the implied warranty of 218c2ecf20Sopenharmony_ci * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 228c2ecf20Sopenharmony_ci * GNU General Public License for more details. 238c2ecf20Sopenharmony_ci * 248c2ecf20Sopenharmony_ci * You should have received a copy of the GNU General Public License 258c2ecf20Sopenharmony_ci * along with this program; if not, write to the Free Software 268c2ecf20Sopenharmony_ci * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 278c2ecf20Sopenharmony_ci * 288c2ecf20Sopenharmony_ci */ 298c2ecf20Sopenharmony_ci 308c2ecf20Sopenharmony_ci#define SNDRV_DM_FM_MODE_OPL2 0x00 318c2ecf20Sopenharmony_ci#define SNDRV_DM_FM_MODE_OPL3 0x01 328c2ecf20Sopenharmony_ci 338c2ecf20Sopenharmony_cistruct snd_dm_fm_info { 348c2ecf20Sopenharmony_ci unsigned char fm_mode; /* OPL mode, see SNDRV_DM_FM_MODE_XXX */ 358c2ecf20Sopenharmony_ci unsigned char rhythm; /* percussion mode flag */ 368c2ecf20Sopenharmony_ci}; 378c2ecf20Sopenharmony_ci 388c2ecf20Sopenharmony_ci/* 398c2ecf20Sopenharmony_ci * Data structure composing an FM "note" or sound event. 408c2ecf20Sopenharmony_ci */ 418c2ecf20Sopenharmony_ci 428c2ecf20Sopenharmony_cistruct snd_dm_fm_voice { 438c2ecf20Sopenharmony_ci unsigned char op; /* operator cell (0 or 1) */ 448c2ecf20Sopenharmony_ci unsigned char voice; /* FM voice (0 to 17) */ 458c2ecf20Sopenharmony_ci 468c2ecf20Sopenharmony_ci unsigned char am; /* amplitude modulation */ 478c2ecf20Sopenharmony_ci unsigned char vibrato; /* vibrato effect */ 488c2ecf20Sopenharmony_ci unsigned char do_sustain; /* sustain phase */ 498c2ecf20Sopenharmony_ci unsigned char kbd_scale; /* keyboard scaling */ 508c2ecf20Sopenharmony_ci unsigned char harmonic; /* 4 bits: harmonic and multiplier */ 518c2ecf20Sopenharmony_ci unsigned char scale_level; /* 2 bits: decrease output freq rises */ 528c2ecf20Sopenharmony_ci unsigned char volume; /* 6 bits: volume */ 538c2ecf20Sopenharmony_ci 548c2ecf20Sopenharmony_ci unsigned char attack; /* 4 bits: attack rate */ 558c2ecf20Sopenharmony_ci unsigned char decay; /* 4 bits: decay rate */ 568c2ecf20Sopenharmony_ci unsigned char sustain; /* 4 bits: sustain level */ 578c2ecf20Sopenharmony_ci unsigned char release; /* 4 bits: release rate */ 588c2ecf20Sopenharmony_ci 598c2ecf20Sopenharmony_ci unsigned char feedback; /* 3 bits: feedback for op0 */ 608c2ecf20Sopenharmony_ci unsigned char connection; /* 0 for serial, 1 for parallel */ 618c2ecf20Sopenharmony_ci unsigned char left; /* stereo left */ 628c2ecf20Sopenharmony_ci unsigned char right; /* stereo right */ 638c2ecf20Sopenharmony_ci unsigned char waveform; /* 3 bits: waveform shape */ 648c2ecf20Sopenharmony_ci}; 658c2ecf20Sopenharmony_ci 668c2ecf20Sopenharmony_ci/* 678c2ecf20Sopenharmony_ci * This describes an FM note by its voice, octave, frequency number (10bit) 688c2ecf20Sopenharmony_ci * and key on/off. 698c2ecf20Sopenharmony_ci */ 708c2ecf20Sopenharmony_ci 718c2ecf20Sopenharmony_cistruct snd_dm_fm_note { 728c2ecf20Sopenharmony_ci unsigned char voice; /* 0-17 voice channel */ 738c2ecf20Sopenharmony_ci unsigned char octave; /* 3 bits: what octave to play */ 748c2ecf20Sopenharmony_ci unsigned int fnum; /* 10 bits: frequency number */ 758c2ecf20Sopenharmony_ci unsigned char key_on; /* set for active, clear for silent */ 768c2ecf20Sopenharmony_ci}; 778c2ecf20Sopenharmony_ci 788c2ecf20Sopenharmony_ci/* 798c2ecf20Sopenharmony_ci * FM parameters that apply globally to all voices, and thus are not "notes" 808c2ecf20Sopenharmony_ci */ 818c2ecf20Sopenharmony_ci 828c2ecf20Sopenharmony_cistruct snd_dm_fm_params { 838c2ecf20Sopenharmony_ci unsigned char am_depth; /* amplitude modulation depth (1=hi) */ 848c2ecf20Sopenharmony_ci unsigned char vib_depth; /* vibrato depth (1=hi) */ 858c2ecf20Sopenharmony_ci unsigned char kbd_split; /* keyboard split */ 868c2ecf20Sopenharmony_ci unsigned char rhythm; /* percussion mode select */ 878c2ecf20Sopenharmony_ci 888c2ecf20Sopenharmony_ci /* This block is the percussion instrument data */ 898c2ecf20Sopenharmony_ci unsigned char bass; 908c2ecf20Sopenharmony_ci unsigned char snare; 918c2ecf20Sopenharmony_ci unsigned char tomtom; 928c2ecf20Sopenharmony_ci unsigned char cymbal; 938c2ecf20Sopenharmony_ci unsigned char hihat; 948c2ecf20Sopenharmony_ci}; 958c2ecf20Sopenharmony_ci 968c2ecf20Sopenharmony_ci/* 978c2ecf20Sopenharmony_ci * FM mode ioctl settings 988c2ecf20Sopenharmony_ci */ 998c2ecf20Sopenharmony_ci 1008c2ecf20Sopenharmony_ci#define SNDRV_DM_FM_IOCTL_INFO _IOR('H', 0x20, struct snd_dm_fm_info) 1018c2ecf20Sopenharmony_ci#define SNDRV_DM_FM_IOCTL_RESET _IO ('H', 0x21) 1028c2ecf20Sopenharmony_ci#define SNDRV_DM_FM_IOCTL_PLAY_NOTE _IOW('H', 0x22, struct snd_dm_fm_note) 1038c2ecf20Sopenharmony_ci#define SNDRV_DM_FM_IOCTL_SET_VOICE _IOW('H', 0x23, struct snd_dm_fm_voice) 1048c2ecf20Sopenharmony_ci#define SNDRV_DM_FM_IOCTL_SET_PARAMS _IOW('H', 0x24, struct snd_dm_fm_params) 1058c2ecf20Sopenharmony_ci#define SNDRV_DM_FM_IOCTL_SET_MODE _IOW('H', 0x25, int) 1068c2ecf20Sopenharmony_ci/* for OPL3 only */ 1078c2ecf20Sopenharmony_ci#define SNDRV_DM_FM_IOCTL_SET_CONNECTION _IOW('H', 0x26, int) 1088c2ecf20Sopenharmony_ci/* SBI patch management */ 1098c2ecf20Sopenharmony_ci#define SNDRV_DM_FM_IOCTL_CLEAR_PATCHES _IO ('H', 0x40) 1108c2ecf20Sopenharmony_ci 1118c2ecf20Sopenharmony_ci#define SNDRV_DM_FM_OSS_IOCTL_RESET 0x20 1128c2ecf20Sopenharmony_ci#define SNDRV_DM_FM_OSS_IOCTL_PLAY_NOTE 0x21 1138c2ecf20Sopenharmony_ci#define SNDRV_DM_FM_OSS_IOCTL_SET_VOICE 0x22 1148c2ecf20Sopenharmony_ci#define SNDRV_DM_FM_OSS_IOCTL_SET_PARAMS 0x23 1158c2ecf20Sopenharmony_ci#define SNDRV_DM_FM_OSS_IOCTL_SET_MODE 0x24 1168c2ecf20Sopenharmony_ci#define SNDRV_DM_FM_OSS_IOCTL_SET_OPL 0x25 1178c2ecf20Sopenharmony_ci 1188c2ecf20Sopenharmony_ci/* 1198c2ecf20Sopenharmony_ci * Patch Record - fixed size for write 1208c2ecf20Sopenharmony_ci */ 1218c2ecf20Sopenharmony_ci 1228c2ecf20Sopenharmony_ci#define FM_KEY_SBI "SBI\032" 1238c2ecf20Sopenharmony_ci#define FM_KEY_2OP "2OP\032" 1248c2ecf20Sopenharmony_ci#define FM_KEY_4OP "4OP\032" 1258c2ecf20Sopenharmony_ci 1268c2ecf20Sopenharmony_cistruct sbi_patch { 1278c2ecf20Sopenharmony_ci unsigned char prog; 1288c2ecf20Sopenharmony_ci unsigned char bank; 1298c2ecf20Sopenharmony_ci char key[4]; 1308c2ecf20Sopenharmony_ci char name[25]; 1318c2ecf20Sopenharmony_ci char extension[7]; 1328c2ecf20Sopenharmony_ci unsigned char data[32]; 1338c2ecf20Sopenharmony_ci}; 1348c2ecf20Sopenharmony_ci 1358c2ecf20Sopenharmony_ci#endif /* __SOUND_ASOUND_FM_H */ 136