#define OSS_SUPPORT_LEVEL 0x1 /* just /dev/sequencer for now */
#if OSS_SUPPORT_LEVEL & OSS_SUPPORT_SEQ
-static int (*midi_load_patch) (int devno, int format, const char *addr,
+static int (*midi_load_patch) (int devno, int format, const char __user *addr,
int offs, int count, int pmgr_flag) = NULL;
#endif /* OSS_SUPPORT_SEQ */
board and load the firmware anyway.
*/
-int fx_raw = 1; /* if this is zero, we'll leave the FX processor in
- whatever state it is when the driver is loaded.
- The default is to download the microprogram and
- associated coefficients to set it up for "default"
- operation, whatever that means.
- */
-
-int debug_default; /* you can set this to control debugging
+static int fx_raw = 1; /* if this is zero, we'll leave the FX processor in
+ whatever state it is when the driver is loaded.
+ The default is to download the microprogram and
+ associated coefficients to set it up for "default"
+ operation, whatever that means.
+ */
+
+static int debug_default; /* you can set this to control debugging
during driver loading. it takes any combination
of the WF_DEBUG_* flags defined in
wavefront.h
/* XXX this needs to be made firmware and hardware version dependent */
-char *ospath = "/etc/sound/wavefront.os"; /* where to find a processed
- version of the WaveFront OS
- */
+static char *ospath = "/etc/sound/wavefront.os"; /* where to find a processed
+ version of the WaveFront OS
+ */
-int wait_polls = 2000; /* This is a number of tries we poll the status register
- before resorting to sleeping. WaveFront being an ISA
- card each poll takes about 1.2us. So before going to
- sleep we wait up to 2.4ms in a loop.
- */
+static int wait_polls = 2000; /* This is a number of tries we poll the
+ status register before resorting to sleeping.
+ WaveFront being an ISA card each poll takes
+ about 1.2us. So before going to
+ sleep we wait up to 2.4ms in a loop.
+ */
-int sleep_length = HZ/100; /* This says how long we're going to sleep between polls.
- 10ms sounds reasonable for fast response.
- */
+static int sleep_length = HZ/100; /* This says how long we're going to
+ sleep between polls.
+ 10ms sounds reasonable for fast response.
+ */
-int sleep_tries = 50; /* Wait for status 0.5 seconds total. */
+static int sleep_tries = 50; /* Wait for status 0.5 seconds total. */
-int reset_time = 2; /* hundreths of a second we wait after a HW reset for
+static int reset_time = 2; /* hundreths of a second we wait after a HW reset for
the expected interrupt.
*/
-int ramcheck_time = 20; /* time in seconds to wait while ROM code
- checks on-board RAM.
- */
-
-int osrun_time = 10; /* time in seconds we wait for the OS to
- start running.
- */
-
-MODULE_PARM(wf_raw,"i");
-MODULE_PARM(fx_raw,"i");
-MODULE_PARM(debug_default,"i");
-MODULE_PARM(wait_polls,"i");
-MODULE_PARM(sleep_length,"i");
-MODULE_PARM(sleep_tries,"i");
-MODULE_PARM(ospath,"s");
-MODULE_PARM(reset_time,"i");
-MODULE_PARM(ramcheck_time,"i");
-MODULE_PARM(osrun_time,"i");
+static int ramcheck_time = 20; /* time in seconds to wait while ROM code
+ checks on-board RAM.
+ */
+
+static int osrun_time = 10; /* time in seconds we wait for the OS to
+ start running.
+ */
+
+module_param(wf_raw, int, 0);
+module_param(fx_raw, int, 0);
+module_param(debug_default, int, 0);
+module_param(wait_polls, int, 0);
+module_param(sleep_length, int, 0);
+module_param(sleep_tries, int, 0);
+module_param(ospath, charp, 0);
+module_param(reset_time, int, 0);
+module_param(ramcheck_time, int, 0);
+module_param(osrun_time, int, 0);
/***************************************************************************/
wait_queue_head_t interrupt_sleeper;
} dev;
-static spinlock_t lock=SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(lock);
static int detect_wffx(void);
static int wffx_ioctl (wavefront_fx_info *);
static int wffx_init (void);
{ 0x0E, "Bad MIDI channel number" },
{ 0x10, "Download Record Error" },
{ 0x80, "Success" },
- { 0x0, 0x0 }
+ { 0 }
};
#define NEEDS_ACK 1
if (cmd == WFC_DOWNLOAD_MULTISAMPLE) {
wfcmd->write_cnt = (unsigned int) rbuf;
- rbuf = 0;
+ rbuf = NULL;
}
DPRINT (WF_DEBUG_CMD, "0x%x [%s] (%d,%d,%d)\n",
wbuf[0] = sample_num & 0x7f;
wbuf[1] = sample_num >> 7;
- if ((x = wavefront_cmd (WFC_DELETE_SAMPLE, 0, wbuf)) == 0) {
+ if ((x = wavefront_cmd (WFC_DELETE_SAMPLE, NULL, wbuf)) == 0) {
dev.sample_status[sample_num] = WF_ST_EMPTY;
}
bptr = munge_int32 (header->number, buf, 2);
munge_buf ((unsigned char *)&header->hdr.p, bptr, WF_PATCH_BYTES);
- if (wavefront_cmd (WFC_DOWNLOAD_PATCH, 0, buf)) {
+ if (wavefront_cmd (WFC_DOWNLOAD_PATCH, NULL, buf)) {
printk (KERN_ERR LOGNAME "download patch failed\n");
return -(EIO);
}
buf[0] = header->number;
munge_buf ((unsigned char *)&header->hdr.pr, &buf[1], WF_PROGRAM_BYTES);
- if (wavefront_cmd (WFC_DOWNLOAD_PROGRAM, 0, buf)) {
+ if (wavefront_cmd (WFC_DOWNLOAD_PROGRAM, NULL, buf)) {
printk (KERN_WARNING LOGNAME "download patch failed\n");
return -(EIO);
}
{
char rbuf[8];
- if (wavefront_cmd (WFC_REPORT_FREE_MEMORY, rbuf, 0)) {
+ if (wavefront_cmd (WFC_REPORT_FREE_MEMORY, rbuf, NULL)) {
printk (KERN_WARNING LOGNAME "can't get memory stats.\n");
return -1;
} else {
static int
wavefront_send_sample (wavefront_patch_info *header,
- UINT16 *dataptr,
+ UINT16 __user *dataptr,
int data_is_unsigned)
{
UINT16 sample_short;
UINT32 length;
- UINT16 *data_end = 0;
+ UINT16 __user *data_end = NULL;
unsigned int i;
const int max_blksize = 4096/2;
unsigned int written;
int initial_skip = 0;
DPRINT (WF_DEBUG_LOAD_PATCH, "sample %sdownload for slot %d, "
- "type %d, %d bytes from 0x%x\n",
+ "type %d, %d bytes from %p\n",
header->size ? "" : "header ",
header->number, header->subkey,
header->size,
- (int) header->dataptr);
+ header->dataptr);
if (header->number == WAVEFRONT_FIND_FREE_SAMPLE_SLOT) {
int x;
if (wavefront_cmd (header->size ?
WFC_DOWNLOAD_SAMPLE : WFC_DOWNLOAD_SAMPLE_HEADER,
- 0, sample_hdr)) {
+ NULL, sample_hdr)) {
printk (KERN_WARNING LOGNAME "sample %sdownload refused.\n",
header->size ? "" : "header ");
return -(EIO);
blocksize = ((length-written+7)&~0x7);
}
- if (wavefront_cmd (WFC_DOWNLOAD_BLOCK, 0, 0)) {
+ if (wavefront_cmd (WFC_DOWNLOAD_BLOCK, NULL, NULL)) {
printk (KERN_WARNING LOGNAME "download block "
"request refused.\n");
return -(EIO);
munge_int32 (header->hdr.a.FrequencyBias, &alias_hdr[20], 3);
munge_int32 (*(&header->hdr.a.FrequencyBias+1), &alias_hdr[23], 2);
- if (wavefront_cmd (WFC_DOWNLOAD_SAMPLE_ALIAS, 0, alias_hdr)) {
+ if (wavefront_cmd (WFC_DOWNLOAD_SAMPLE_ALIAS, NULL, alias_hdr)) {
printk (KERN_ERR LOGNAME "download alias failed.\n");
return -(EIO);
}
num_samples = (1 << log_ns[0]);
for (i = 0; i < num_samples; i++) {
- char d[2];
+ s8 d[2];
if ((d[0] = wavefront_read ()) == -1) {
printk (KERN_ERR LOGNAME "upload multisample failed "
munge_int32 (((unsigned char *)drum)[i], &drumbuf[1+(i*2)], 2);
}
- if (wavefront_cmd (WFC_DOWNLOAD_EDRUM_PROGRAM, 0, drumbuf)) {
+ if (wavefront_cmd (WFC_DOWNLOAD_EDRUM_PROGRAM, NULL, drumbuf)) {
printk (KERN_ERR LOGNAME "download drum failed.\n");
return -(EIO);
}
}
static int
-wavefront_load_gus_patch (int devno, int format, const char *addr,
+wavefront_load_gus_patch (int devno, int format, const char __user *addr,
int offs, int count, int pmgr_flag)
{
struct patch_info guspatch;
/* Now ship it down */
wavefront_send_sample (&samp,
- (unsigned short *) &(addr)[sizeof_patch],
+ (unsigned short __user *) &(addr)[sizeof_patch],
(guspatch.mode & WAVE_UNSIGNED) ? 1:0);
wavefront_send_patch (&pat);
wavefront_send_program (&prog);
}
static int
-wavefront_load_patch (const char *addr)
+wavefront_load_patch (const char __user *addr)
{
case WF_ST_SAMPLE: /* sample or sample_header, based on patch->size */
if (copy_from_user((unsigned char *) &header.hdr.s,
- (unsigned char *) header.hdrptr,
+ (unsigned char __user *) header.hdrptr,
sizeof (wavefront_sample)))
return -EFAULT;
case WF_ST_MULTISAMPLE:
- if (copy_from_user((unsigned char *) &header.hdr.s,
- (unsigned char *) header.hdrptr,
+ if (copy_from_user(&header.hdr.s, header.hdrptr,
sizeof(wavefront_multisample)))
return -EFAULT;
case WF_ST_ALIAS:
- if (copy_from_user((unsigned char *) &header.hdr.a,
- (unsigned char *) header.hdrptr,
+ if (copy_from_user(&header.hdr.a, header.hdrptr,
sizeof (wavefront_alias)))
return -EFAULT;
return wavefront_send_alias (&header);
case WF_ST_DRUM:
- if (copy_from_user((unsigned char *) &header.hdr.d,
- (unsigned char *) header.hdrptr,
+ if (copy_from_user(&header.hdr.d, header.hdrptr,
sizeof (wavefront_drum)))
return -EFAULT;
return wavefront_send_drum (&header);
case WF_ST_PATCH:
- if (copy_from_user((unsigned char *) &header.hdr.p,
- (unsigned char *) header.hdrptr,
+ if (copy_from_user(&header.hdr.p, header.hdrptr,
sizeof (wavefront_patch)))
return -EFAULT;
return wavefront_send_patch (&header);
case WF_ST_PROGRAM:
- if (copy_from_user((unsigned char *) &header.hdr.pr,
- (unsigned char *) header.hdrptr,
+ if (copy_from_user(&header.hdr.pr, header.hdrptr,
sizeof (wavefront_program)))
return -EFAULT;
switch (cmd) {
case WFCTL_WFCMD:
- if (copy_from_user(&wc, (void *) arg, sizeof (wc)))
+ if (copy_from_user(&wc, (void __user *) arg, sizeof (wc)))
return -EFAULT;
if ((err = wavefront_synth_control (cmd, &wc)) == 0) {
- if (copy_to_user ((void *) arg, &wc, sizeof (wc)))
+ if (copy_to_user ((void __user *) arg, &wc, sizeof (wc)))
return -EFAULT;
}
return err;
case WFCTL_LOAD_SPP:
- return wavefront_load_patch ((const char *) arg);
+ return wavefront_load_patch ((const char __user *) arg);
default:
printk (KERN_WARNING LOGNAME "invalid ioctl %#x\n", cmd);
}
static int
-wavefront_oss_ioctl (int devno, unsigned int cmd, caddr_t arg)
+wavefront_oss_ioctl (int devno, unsigned int cmd, void __user * arg)
{
wavefront_control wc;
switch (cmd) {
case SNDCTL_SYNTH_INFO:
- if(copy_to_user(&((char *) arg)[0], &wavefront_info,
- sizeof (wavefront_info)))
+ if(copy_to_user(arg, &wavefront_info, sizeof (wavefront_info)))
return -EFAULT;
return 0;
}
}
-int
-wavefront_oss_load_patch (int devno, int format, const char *addr,
+static int
+wavefront_oss_load_patch (int devno, int format, const char __user *addr,
int offs, int count, int pmgr_flag)
{
7 Unused
*/
-int
+static int
wavefront_interrupt_bits (int irq)
{
return bits;
}
-void
+static void
wavefront_should_cause_interrupt (int val, int port, int timeout)
{
voices[0] = 32;
- if (wavefront_cmd (WFC_SET_NVOICES, 0, voices)) {
+ if (wavefront_cmd (WFC_SET_NVOICES, NULL, voices)) {
printk (KERN_WARNING LOGNAME
"cannot set number of voices to 32.\n");
goto gone_bad;
return 0;
}
-int __init attach_wffx (void)
-{
- if ((dev.fx_mididev = sound_alloc_mididev ()) < 0) {
- printk (KERN_WARNING LOGNAME "cannot install FX Midi driver\n");
- return -1;
- }
-
- return 0;
-}
-
void
wffx_mute (int onoff)
if (i != cnt) {
printk (KERN_WARNING LOGNAME
"FX memset "
- "(0x%x, 0x%x, 0x%x, %d) incomplete\n",
- page, addr, (int) data, cnt);
+ "(0x%x, 0x%x, %p, %d) incomplete\n",
+ page, addr, data, cnt);
return -(EIO);
}
}
return -(EINVAL);
}
if (copy_from_user(page_data,
- (unsigned char *)r->data[3],
+ (unsigned char __user *)r->data[3],
r->data[2]))
return -EFAULT;
pd = page_data;
MODULE_AUTHOR ("Paul Barton-Davis <pbd@op.net>");
MODULE_DESCRIPTION ("Turtle Beach WaveFront Linux Driver");
MODULE_LICENSE("GPL");
-MODULE_PARM (io,"i");
-MODULE_PARM (irq,"i");
+module_param (io, int, 0);
+module_param (irq, int, 0);
static int __init init_wavfront (void)
{