linux/sound/isa/sb/sb16_csp.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 *  Copyright (c) 1999 by Uros Bizjak <[email protected]>
 *                        Takashi Iwai <[email protected]>
 *
 *  SB16ASP/AWE32 CSP control
 *
 *  CSP microcode loader:
 *   alsa-tools/sb16_csp/ 
 */

#include <linux/delay.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/module.h>
#include <sound/core.h>
#include <sound/control.h>
#include <sound/info.h>
#include <sound/sb16_csp.h>
#include <sound/initval.h>

MODULE_AUTHOR();
MODULE_DESCRIPTION();
MODULE_LICENSE();
MODULE_FIRMWARE();
MODULE_FIRMWARE();
MODULE_FIRMWARE();
MODULE_FIRMWARE();
MODULE_FIRMWARE();

#ifdef SNDRV_LITTLE_ENDIAN
#define CSP_HDR_VALUE(a,b,c,d)
#else
#define CSP_HDR_VALUE
#endif

#define RIFF_HEADER
#define CSP__HEADER
#define LIST_HEADER
#define FUNC_HEADER
#define CODE_HEADER
#define INIT_HEADER
#define MAIN_HEADER

/*
 * RIFF data format
 */
struct riff_header {};

struct desc_header {};

/*
 * prototypes
 */
static void snd_sb_csp_free(struct snd_hwdep *hw);
static int snd_sb_csp_open(struct snd_hwdep * hw, struct file *file);
static int snd_sb_csp_ioctl(struct snd_hwdep * hw, struct file *file, unsigned int cmd, unsigned long arg);
static int snd_sb_csp_release(struct snd_hwdep * hw, struct file *file);

static int csp_detect(struct snd_sb *chip, int *version);
static int set_codec_parameter(struct snd_sb *chip, unsigned char par, unsigned char val);
static int set_register(struct snd_sb *chip, unsigned char reg, unsigned char val);
static int read_register(struct snd_sb *chip, unsigned char reg);
static int set_mode_register(struct snd_sb *chip, unsigned char mode);
static int get_version(struct snd_sb *chip);

static int snd_sb_csp_riff_load(struct snd_sb_csp * p,
				struct snd_sb_csp_microcode __user * code);
static int snd_sb_csp_unload(struct snd_sb_csp * p);
static int snd_sb_csp_load_user(struct snd_sb_csp * p, const unsigned char __user *buf, int size, int load_flags);
static int snd_sb_csp_autoload(struct snd_sb_csp * p, snd_pcm_format_t pcm_sfmt, int play_rec_mode);
static int snd_sb_csp_check_version(struct snd_sb_csp * p);

static int snd_sb_csp_use(struct snd_sb_csp * p);
static int snd_sb_csp_unuse(struct snd_sb_csp * p);
static int snd_sb_csp_start(struct snd_sb_csp * p, int sample_width, int channels);
static int snd_sb_csp_stop(struct snd_sb_csp * p);
static int snd_sb_csp_pause(struct snd_sb_csp * p);
static int snd_sb_csp_restart(struct snd_sb_csp * p);

static int snd_sb_qsound_build(struct snd_sb_csp * p);
static void snd_sb_qsound_destroy(struct snd_sb_csp * p);
static int snd_sb_csp_qsound_transfer(struct snd_sb_csp * p);

static int init_proc_entry(struct snd_sb_csp * p, int device);
static void info_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer);

/*
 * Detect CSP chip and create a new instance
 */
int snd_sb_csp_new(struct snd_sb *chip, int device, struct snd_hwdep ** rhwdep)
{}

/*
 * free_private for hwdep instance
 */
static void snd_sb_csp_free(struct snd_hwdep *hwdep)
{}

/* ------------------------------ */

/*
 * open the device exclusively
 */
static int snd_sb_csp_open(struct snd_hwdep * hw, struct file *file)
{}

/*
 * ioctl for hwdep device:
 */
static int snd_sb_csp_ioctl(struct snd_hwdep * hw, struct file *file, unsigned int cmd, unsigned long arg)
{}

/*
 * close the device
 */
static int snd_sb_csp_release(struct snd_hwdep * hw, struct file *file)
{}

/* ------------------------------ */

/*
 * acquire device
 */
static int snd_sb_csp_use(struct snd_sb_csp * p)
{}

/*
 * release device
 */
static int snd_sb_csp_unuse(struct snd_sb_csp * p)
{}

/*
 * load microcode via ioctl: 
 * code is user-space pointer
 */
static int snd_sb_csp_riff_load(struct snd_sb_csp * p,
				struct snd_sb_csp_microcode __user * mcode)
{}

/*
 * unload CSP microcode
 */
static int snd_sb_csp_unload(struct snd_sb_csp * p)
{}

/*
 * send command sequence to DSP
 */
static inline int command_seq(struct snd_sb *chip, const unsigned char *seq, int size)
{}

/*
 * set CSP codec parameter
 */
static int set_codec_parameter(struct snd_sb *chip, unsigned char par, unsigned char val)
{}

/*
 * set CSP register
 */
static int set_register(struct snd_sb *chip, unsigned char reg, unsigned char val)
{}

/*
 * read CSP register
 * return < 0 -> error
 */
static int read_register(struct snd_sb *chip, unsigned char reg)
{}

/*
 * set CSP mode register
 */
static int set_mode_register(struct snd_sb *chip, unsigned char mode)
{}

/*
 * Detect CSP
 * return 0 if CSP exists.
 */
static int csp_detect(struct snd_sb *chip, int *version)
{}

/*
 * get CSP version number
 */
static int get_version(struct snd_sb *chip)
{}

/*
 * check if the CSP version is valid
 */
static int snd_sb_csp_check_version(struct snd_sb_csp * p)
{}

/*
 * download microcode to CSP (microcode should have one "main" block).
 */
static int snd_sb_csp_load(struct snd_sb_csp * p, const unsigned char *buf, int size, int load_flags)
{}
 
static int snd_sb_csp_load_user(struct snd_sb_csp * p, const unsigned char __user *buf, int size, int load_flags)
{}

static int snd_sb_csp_firmware_load(struct snd_sb_csp *p, int index, int flags)
{}

/*
 * autoload hardware codec if necessary
 * return 0 if CSP is loaded and ready to run (p->running != 0)
 */
static int snd_sb_csp_autoload(struct snd_sb_csp * p, snd_pcm_format_t pcm_sfmt, int play_rec_mode)
{}

/*
 * start CSP
 */
static int snd_sb_csp_start(struct snd_sb_csp * p, int sample_width, int channels)
{}

/*
 * stop CSP
 */
static int snd_sb_csp_stop(struct snd_sb_csp * p)
{}

/*
 * pause CSP codec and hold DMA transfer
 */
static int snd_sb_csp_pause(struct snd_sb_csp * p)
{}

/*
 * restart CSP codec and resume DMA transfer
 */
static int snd_sb_csp_restart(struct snd_sb_csp * p)
{}

/* ------------------------------ */

/*
 * QSound mixer control for PCM
 */

#define snd_sb_qsound_switch_info

static int snd_sb_qsound_switch_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{}

static int snd_sb_qsound_switch_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{}

static int snd_sb_qsound_space_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
{}

static int snd_sb_qsound_space_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{}

static int snd_sb_qsound_space_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{}

static const struct snd_kcontrol_new snd_sb_qsound_switch =;

static const struct snd_kcontrol_new snd_sb_qsound_space =;

static int snd_sb_qsound_build(struct snd_sb_csp * p)
{}

static void snd_sb_qsound_destroy(struct snd_sb_csp * p)
{}

/*
 * Transfer qsound parameters to CSP,
 * function should be called from interrupt routine
 */
static int snd_sb_csp_qsound_transfer(struct snd_sb_csp * p)
{}

/* ------------------------------ */

/*
 * proc interface
 */
static int init_proc_entry(struct snd_sb_csp * p, int device)
{}

static void info_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer)
{}

/* */

EXPORT_SYMBOL();