linux/sound/drivers/opl4/opl4_local.h

/*
 * Local definitions for the OPL4 driver
 *
 * Copyright (c) 2003 by Clemens Ladisch <[email protected]>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions, and the following disclaimer,
 *    without modification.
 * 2. The name of the author may not be used to endorse or promote products
 *    derived from this software without specific prior written permission.
 *
 * Alternatively, this software may be distributed and/or modified under the
 * terms of the GNU General Public License as published by the Free Software
 * Foundation; either version 2 of the License, or (at your option) any later
 * version.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 */

#ifndef __OPL4_LOCAL_H
#define __OPL4_LOCAL_H

#include <sound/opl4.h>

/*
 * Register numbers
 */

#define OPL4_REG_TEST0
#define OPL4_REG_TEST1

#define OPL4_REG_MEMORY_CONFIGURATION
#define OPL4_MODE_BIT
#define OPL4_MTYPE_BIT
#define OPL4_TONE_HEADER_MASK
#define OPL4_DEVICE_ID_MASK

#define OPL4_REG_MEMORY_ADDRESS_HIGH
#define OPL4_REG_MEMORY_ADDRESS_MID
#define OPL4_REG_MEMORY_ADDRESS_LOW
#define OPL4_REG_MEMORY_DATA

/*
 * Offsets to the register banks for voices. To get the
 * register number just add the voice number to the bank offset.
 *
 * Wave Table Number low bits (0x08 to 0x1F)
 */
#define OPL4_REG_TONE_NUMBER

/* Wave Table Number high bit, F-Number low bits (0x20 to 0x37) */
#define OPL4_REG_F_NUMBER
#define OPL4_TONE_NUMBER_BIT8
#define OPL4_F_NUMBER_LOW_MASK

/* F-Number high bits, Octave, Pseudo-Reverb (0x38 to 0x4F) */
#define OPL4_REG_OCTAVE
#define OPL4_F_NUMBER_HIGH_MASK
#define OPL4_BLOCK_MASK
#define OPL4_PSEUDO_REVERB_BIT

/* Total Level, Level Direct (0x50 to 0x67) */
#define OPL4_REG_LEVEL
#define OPL4_TOTAL_LEVEL_MASK
#define OPL4_LEVEL_DIRECT_BIT

/* Key On, Damp, LFO RST, CH, Panpot (0x68 to 0x7F) */
#define OPL4_REG_MISC
#define OPL4_KEY_ON_BIT
#define OPL4_DAMP_BIT
#define OPL4_LFO_RESET_BIT
#define OPL4_OUTPUT_CHANNEL_BIT
#define OPL4_PAN_POT_MASK

/* LFO, VIB (0x80 to 0x97) */
#define OPL4_REG_LFO_VIBRATO
#define OPL4_LFO_FREQUENCY_MASK
#define OPL4_VIBRATO_DEPTH_MASK
#define OPL4_CHORUS_SEND_MASK

/* Attack / Decay 1 rate (0x98 to 0xAF) */
#define OPL4_REG_ATTACK_DECAY1
#define OPL4_ATTACK_RATE_MASK
#define OPL4_DECAY1_RATE_MASK

/* Decay level / 2 rate (0xB0 to 0xC7) */
#define OPL4_REG_LEVEL_DECAY2
#define OPL4_DECAY_LEVEL_MASK
#define OPL4_DECAY2_RATE_MASK

/* Release rate / Rate correction (0xC8 to 0xDF) */
#define OPL4_REG_RELEASE_CORRECTION
#define OPL4_RELEASE_RATE_MASK
#define OPL4_RATE_INTERPOLATION_MASK

/* AM (0xE0 to 0xF7) */
#define OPL4_REG_TREMOLO
#define OPL4_TREMOLO_DEPTH_MASK
#define OPL4_REVERB_SEND_MASK

/* Mixer */
#define OPL4_REG_MIX_CONTROL_FM
#define OPL4_REG_MIX_CONTROL_PCM
#define OPL4_MIX_LEFT_MASK
#define OPL4_MIX_RIGHT_MASK

#define OPL4_REG_ATC
#define OPL4_ATC_BIT

/* bits in the OPL3 Status register */
#define OPL4_STATUS_BUSY
#define OPL4_STATUS_LOAD


#define OPL4_MAX_VOICES

#define SNDRV_SEQ_DEV_ID_OPL4


struct opl4_sound {};

struct opl4_region {};

struct opl4_region_ptr {};

struct opl4_voice {};

struct snd_opl4 {};

/* opl4_lib.c */
void snd_opl4_write(struct snd_opl4 *opl4, u8 reg, u8 value);
u8 snd_opl4_read(struct snd_opl4 *opl4, u8 reg);
void snd_opl4_read_memory(struct snd_opl4 *opl4, char *buf, int offset, int size);
void snd_opl4_write_memory(struct snd_opl4 *opl4, const char *buf, int offset, int size);

/* opl4_mixer.c */
int snd_opl4_create_mixer(struct snd_opl4 *opl4);

#ifdef CONFIG_SND_PROC_FS
/* opl4_proc.c */
int snd_opl4_create_proc(struct snd_opl4 *opl4);
void snd_opl4_free_proc(struct snd_opl4 *opl4);
#else
static inline int snd_opl4_create_proc(struct snd_opl4 *opl4) { return 0; }
static inline void snd_opl4_free_proc(struct snd_opl4 *opl4) {}
#endif

/* opl4_seq.c */
extern int volume_boost;

/* opl4_synth.c */
void snd_opl4_synth_reset(struct snd_opl4 *opl4);
void snd_opl4_synth_shutdown(struct snd_opl4 *opl4);
void snd_opl4_note_on(void *p, int note, int vel, struct snd_midi_channel *chan);
void snd_opl4_note_off(void *p, int note, int vel, struct snd_midi_channel *chan);
void snd_opl4_terminate_note(void *p, int note, struct snd_midi_channel *chan);
void snd_opl4_control(void *p, int type, struct snd_midi_channel *chan);
void snd_opl4_sysex(void *p, unsigned char *buf, int len, int parsed, struct snd_midi_channel_set *chset);

/* yrw801.c */
int snd_yrw801_detect(struct snd_opl4 *opl4);
extern const struct opl4_region_ptr snd_yrw801_regions[];

#endif /* __OPL4_LOCAL_H */