#include <linux/io.h>
#include <linux/interrupt.h>
#include <linux/init.h>
#include <linux/delay.h>
#include <linux/time.h>
#include <linux/wait.h>
#include <linux/sched/signal.h>
#include <linux/firmware.h>
#include <linux/moduleparam.h>
#include <linux/slab.h>
#include <linux/module.h>
#include <sound/core.h>
#include <sound/snd_wavefront.h>
#include <sound/initval.h>
static int wf_raw = …;
static int fx_raw = …;
static int debug_default = …;
#define DEFAULT_OSPATH …
static char *ospath = …;
static int wait_usecs = …;
static int sleep_interval = …;
static int sleep_tries = …;
static int reset_time = …;
static int ramcheck_time = …;
static int osrun_time = …;
module_param(wf_raw, int, 0444);
MODULE_PARM_DESC(…) …;
module_param(fx_raw, int, 0444);
MODULE_PARM_DESC(…) …;
module_param(debug_default, int, 0444);
MODULE_PARM_DESC(…) …;
module_param(wait_usecs, int, 0444);
MODULE_PARM_DESC(…) …;
module_param(sleep_interval, int, 0444);
MODULE_PARM_DESC(…) …;
module_param(sleep_tries, int, 0444);
MODULE_PARM_DESC(…) …;
module_param(ospath, charp, 0444);
MODULE_PARM_DESC(…) …;
module_param(reset_time, int, 0444);
MODULE_PARM_DESC(…) …;
module_param(ramcheck_time, int, 0444);
MODULE_PARM_DESC(…) …;
module_param(osrun_time, int, 0444);
MODULE_PARM_DESC(…) …;
#define WF_DEBUG …
#ifdef WF_DEBUG
#define DPRINT(cond, ...) …
#else
#define DPRINT …
#endif
#define LOGNAME …
#define STAT_RINTR_ENABLED …
#define STAT_CAN_READ …
#define STAT_INTR_READ …
#define STAT_WINTR_ENABLED …
#define STAT_CAN_WRITE …
#define STAT_INTR_WRITE …
static int wavefront_delete_sample (snd_wavefront_t *, int sampnum);
static int wavefront_find_free_sample (snd_wavefront_t *);
struct wavefront_command { … };
static struct { … } wavefront_errors[] = …;
#define NEEDS_ACK …
static struct wavefront_command wavefront_commands[] = …;
static const char *
wavefront_errorstr (int errnum)
{ … }
static struct wavefront_command *
wavefront_get_command (int cmd)
{ … }
static inline int
wavefront_status (snd_wavefront_t *dev)
{ … }
static int
wavefront_sleep (int limit)
{ … }
static int
wavefront_wait (snd_wavefront_t *dev, int mask)
{ … }
static int
wavefront_read (snd_wavefront_t *dev)
{ … }
static int
wavefront_write (snd_wavefront_t *dev, unsigned char data)
{ … }
int
snd_wavefront_cmd (snd_wavefront_t *dev,
int cmd, unsigned char *rbuf, unsigned char *wbuf)
{ … }
static unsigned char *
munge_int32 (unsigned int src,
unsigned char *dst,
unsigned int dst_size)
{
unsigned int i;
for (i = 0; i < dst_size; i++) {
*dst = src & 0x7F;
src = src >> 7;
dst++;
}
return dst;
};
static int
demunge_int32 (unsigned char* src, int src_size)
{
int i;
int outval = 0;
for (i = src_size - 1; i >= 0; i--) {
outval=(outval<<7)+src[i];
}
return outval;
};
static
unsigned char *
munge_buf (unsigned char *src, unsigned char *dst, unsigned int dst_size)
{ … }
static
unsigned char *
demunge_buf (unsigned char *src, unsigned char *dst, unsigned int src_bytes)
{ … }
static int
wavefront_delete_sample (snd_wavefront_t *dev, int sample_num)
{ … }
static int
wavefront_get_sample_status (snd_wavefront_t *dev, int assume_rom)
{ … }
static int
wavefront_get_patch_status (snd_wavefront_t *dev)
{ … }
static int
wavefront_get_program_status (snd_wavefront_t *dev)
{ … }
static int
wavefront_send_patch (snd_wavefront_t *dev, wavefront_patch_info *header)
{ … }
static int
wavefront_send_program (snd_wavefront_t *dev, wavefront_patch_info *header)
{ … }
static int
wavefront_freemem (snd_wavefront_t *dev)
{ … }
static int
wavefront_send_sample (snd_wavefront_t *dev,
wavefront_patch_info *header,
u16 __user *dataptr,
int data_is_unsigned)
{ … }
static int
wavefront_send_alias (snd_wavefront_t *dev, wavefront_patch_info *header)
{ … }
static int
wavefront_send_multisample (snd_wavefront_t *dev, wavefront_patch_info *header)
{ … }
static int
wavefront_fetch_multisample (snd_wavefront_t *dev,
wavefront_patch_info *header)
{ … }
static int
wavefront_send_drum (snd_wavefront_t *dev, wavefront_patch_info *header)
{ … }
static int
wavefront_find_free_sample (snd_wavefront_t *dev)
{ … }
#if 0
static int
wavefront_find_free_patch (snd_wavefront_t *dev)
{
int i;
for (i = 0; i < WF_MAX_PATCH; i++) {
if (!(dev->patch_status[i] & WF_SLOT_FILLED)) {
return i;
}
}
snd_printk ("no free patch slots!\n");
return -1;
}
#endif
static int
wavefront_load_patch (snd_wavefront_t *dev, const char __user *addr)
{ … }
static void
process_sample_hdr (u8 *buf)
{ … }
static int
wavefront_synth_control (snd_wavefront_card_t *acard,
wavefront_control *wc)
{ … }
int
snd_wavefront_synth_open (struct snd_hwdep *hw, struct file *file)
{ … }
int
snd_wavefront_synth_release (struct snd_hwdep *hw, struct file *file)
{ … }
int
snd_wavefront_synth_ioctl (struct snd_hwdep *hw, struct file *file,
unsigned int cmd, unsigned long arg)
{ … }
void
snd_wavefront_internal_interrupt (snd_wavefront_card_t *card)
{ … }
static int
snd_wavefront_interrupt_bits (int irq)
{ … }
static void
wavefront_should_cause_interrupt (snd_wavefront_t *dev,
int val, int port, unsigned long timeout)
{ … }
static int
wavefront_reset_to_cleanliness (snd_wavefront_t *dev)
{ … }
static int
wavefront_download_firmware (snd_wavefront_t *dev, char *path)
{ … }
static int
wavefront_do_reset (snd_wavefront_t *dev)
{ … }
int
snd_wavefront_start (snd_wavefront_t *dev)
{ … }
int
snd_wavefront_detect (snd_wavefront_card_t *card)
{ … }
MODULE_FIRMWARE(…);