#include "emu8000_local.h"
#include <linux/sched/signal.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <sound/initval.h>
#include <sound/pcm.h>
struct snd_emu8k_pcm { … };
#define LOOP_BLANK_SIZE …
static int
emu8k_open_dram_for_pcm(struct snd_emu8000 *emu, int channels)
{ … }
static void
snd_emu8000_write_wait(struct snd_emu8000 *emu, int can_schedule)
{ … }
static void
emu8k_close_dram(struct snd_emu8000 *emu)
{ … }
#define OFFSET_SAMPLERATE …
#define SAMPLERATE_RATIO …
static int calc_rate_offset(int hz)
{ … }
static const struct snd_pcm_hardware emu8k_pcm_hw = …;
static inline int emu8k_get_curpos(struct snd_emu8k_pcm *rec, int ch)
{ … }
static void emu8k_pcm_timer_func(struct timer_list *t)
{ … }
static int emu8k_pcm_open(struct snd_pcm_substream *subs)
{ … }
static int emu8k_pcm_close(struct snd_pcm_substream *subs)
{ … }
static int calc_pitch_target(int pitch)
{ … }
static void setup_voice(struct snd_emu8k_pcm *rec, int ch)
{ … }
static void start_voice(struct snd_emu8k_pcm *rec, int ch)
{ … }
static void stop_voice(struct snd_emu8k_pcm *rec, int ch)
{ … }
static int emu8k_pcm_trigger(struct snd_pcm_substream *subs, int cmd)
{ … }
#define CHECK_SCHEDULER() …
#define GET_VAL(sval, iter) …
#ifdef USE_NONINTERLEAVE
#define LOOP_WRITE …
static int emu8k_pcm_copy(struct snd_pcm_substream *subs,
int voice, unsigned long pos,
struct iov_iter *src, unsigned long count)
{
struct snd_emu8k_pcm *rec = subs->runtime->private_data;
pos = (pos << 1) + rec->loop_start[voice];
count <<= 1;
LOOP_WRITE(rec, pos, src, count);
return 0;
}
static int emu8k_pcm_silence(struct snd_pcm_substream *subs,
int voice, unsigned long pos, unsigned long count)
{
struct snd_emu8k_pcm *rec = subs->runtime->private_data;
pos = (pos << 1) + rec->loop_start[voice];
count <<= 1;
LOOP_WRITE(rec, pos, NULL, count);
return 0;
}
#else
#define LOOP_WRITE(rec, pos, iter, count) …
static int emu8k_pcm_copy(struct snd_pcm_substream *subs,
int voice, unsigned long pos,
struct iov_iter *src, unsigned long count)
{ … }
static int emu8k_pcm_silence(struct snd_pcm_substream *subs,
int voice, unsigned long pos, unsigned long count)
{ … }
#endif
static int emu8k_pcm_hw_params(struct snd_pcm_substream *subs,
struct snd_pcm_hw_params *hw_params)
{ … }
static int emu8k_pcm_hw_free(struct snd_pcm_substream *subs)
{ … }
static int emu8k_pcm_prepare(struct snd_pcm_substream *subs)
{ … }
static snd_pcm_uframes_t emu8k_pcm_pointer(struct snd_pcm_substream *subs)
{ … }
static const struct snd_pcm_ops emu8k_pcm_ops = …;
static void snd_emu8000_pcm_free(struct snd_pcm *pcm)
{ … }
int snd_emu8000_pcm_new(struct snd_card *card, struct snd_emu8000 *emu, int index)
{ … }