#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/err.h>
#include <linux/platform_device.h>
#include <linux/slab.h>
#include <linux/ioport.h>
#include <linux/module.h>
#include <linux/io.h>
#include <sound/core.h>
#include <sound/rawmidi.h>
#include <sound/initval.h>
#include <linux/serial_reg.h>
#include <linux/jiffies.h>
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;
#define SNDRV_SERIAL_SOUNDCANVAS …
#define SNDRV_SERIAL_MS124T …
#define SNDRV_SERIAL_MS124W_SA …
#define SNDRV_SERIAL_MS124W_MB …
#define SNDRV_SERIAL_GENERIC …
#define SNDRV_SERIAL_MAX_ADAPTOR …
static const char * const adaptor_names[] = …;
#define SNDRV_SERIAL_NORMALBUFF …
#define SNDRV_SERIAL_DROPBUFF …
static int index[SNDRV_CARDS] = …;
static char *id[SNDRV_CARDS] = …;
static bool enable[SNDRV_CARDS] = …;
static long port[SNDRV_CARDS] = …;
static int irq[SNDRV_CARDS] = …;
static int speed[SNDRV_CARDS] = …;
static int base[SNDRV_CARDS] = …;
static int outs[SNDRV_CARDS] = …;
static int ins[SNDRV_CARDS] = …;
static int adaptor[SNDRV_CARDS] = …;
static bool droponfull[SNDRV_CARDS] = …;
module_param_array(…);
MODULE_PARM_DESC(…) …;
module_param_array(…);
MODULE_PARM_DESC(…) …;
module_param_array(…);
MODULE_PARM_DESC(…) …;
module_param_hw_array(port, long, ioport, NULL, 0444);
MODULE_PARM_DESC(…) …;
module_param_hw_array(irq, int, irq, NULL, 0444);
MODULE_PARM_DESC(…) …;
module_param_array(…);
MODULE_PARM_DESC(…) …;
module_param_array(…);
MODULE_PARM_DESC(…) …;
module_param_array(…);
MODULE_PARM_DESC(…) …;
module_param_array(…);
MODULE_PARM_DESC(…) …;
module_param_array(…);
MODULE_PARM_DESC(…) …;
module_param_array(…);
MODULE_PARM_DESC(…) …;
#define SNDRV_SERIAL_MAX_OUTS …
#define SNDRV_SERIAL_MAX_INS …
#define TX_BUFF_SIZE …
#define TX_BUFF_MASK …
#define SERIAL_MODE_NOT_OPENED …
#define SERIAL_MODE_INPUT_OPEN …
#define SERIAL_MODE_OUTPUT_OPEN …
#define SERIAL_MODE_INPUT_TRIGGERED …
#define SERIAL_MODE_OUTPUT_TRIGGERED …
struct snd_uart16550 { … };
static struct platform_device *devices[SNDRV_CARDS];
static inline void snd_uart16550_add_timer(struct snd_uart16550 *uart)
{ … }
static inline void snd_uart16550_del_timer(struct snd_uart16550 *uart)
{ … }
static inline void snd_uart16550_buffer_output(struct snd_uart16550 *uart)
{ … }
static void snd_uart16550_io_loop(struct snd_uart16550 * uart)
{ … }
static irqreturn_t snd_uart16550_interrupt(int irq, void *dev_id)
{ … }
static void snd_uart16550_buffer_timer(struct timer_list *t)
{ … }
static int snd_uart16550_detect(struct snd_uart16550 *uart)
{ … }
static void snd_uart16550_do_open(struct snd_uart16550 * uart)
{ … }
static void snd_uart16550_do_close(struct snd_uart16550 * uart)
{ … }
static int snd_uart16550_input_open(struct snd_rawmidi_substream *substream)
{ … }
static int snd_uart16550_input_close(struct snd_rawmidi_substream *substream)
{ … }
static void snd_uart16550_input_trigger(struct snd_rawmidi_substream *substream,
int up)
{ … }
static int snd_uart16550_output_open(struct snd_rawmidi_substream *substream)
{
unsigned long flags;
struct snd_uart16550 *uart = substream->rmidi->private_data;
spin_lock_irqsave(&uart->open_lock, flags);
if (uart->filemode == SERIAL_MODE_NOT_OPENED)
snd_uart16550_do_open(uart);
uart->filemode |= SERIAL_MODE_OUTPUT_OPEN;
uart->midi_output[substream->number] = substream;
spin_unlock_irqrestore(&uart->open_lock, flags);
return 0;
};
static int snd_uart16550_output_close(struct snd_rawmidi_substream *substream)
{
unsigned long flags;
struct snd_uart16550 *uart = substream->rmidi->private_data;
spin_lock_irqsave(&uart->open_lock, flags);
uart->filemode &= ~SERIAL_MODE_OUTPUT_OPEN;
uart->midi_output[substream->number] = NULL;
if (uart->filemode == SERIAL_MODE_NOT_OPENED)
snd_uart16550_do_close(uart);
spin_unlock_irqrestore(&uart->open_lock, flags);
return 0;
};
static inline int snd_uart16550_buffer_can_write(struct snd_uart16550 *uart,
int Num)
{ … }
static inline int snd_uart16550_write_buffer(struct snd_uart16550 *uart,
unsigned char byte)
{ … }
static int snd_uart16550_output_byte(struct snd_uart16550 *uart,
struct snd_rawmidi_substream *substream,
unsigned char midi_byte)
{ … }
static void snd_uart16550_output_write(struct snd_rawmidi_substream *substream)
{ … }
static void snd_uart16550_output_trigger(struct snd_rawmidi_substream *substream,
int up)
{ … }
static const struct snd_rawmidi_ops snd_uart16550_output = …;
static const struct snd_rawmidi_ops snd_uart16550_input = …;
static int snd_uart16550_create(struct snd_card *card,
unsigned long iobase,
int irq,
unsigned int speed,
unsigned int base,
int adaptor,
int droponfull,
struct snd_uart16550 **ruart)
{ … }
static void snd_uart16550_substreams(struct snd_rawmidi_str *stream)
{ … }
static int snd_uart16550_rmidi(struct snd_uart16550 *uart, int device,
int outs, int ins,
struct snd_rawmidi **rmidi)
{ … }
static int snd_serial_probe(struct platform_device *devptr)
{ … }
#define SND_SERIAL_DRIVER …
static struct platform_driver snd_serial_driver = …;
static void snd_serial_unregister_all(void)
{ … }
static int __init alsa_card_serial_init(void)
{ … }
static void __exit alsa_card_serial_exit(void)
{ … }
module_init(…) …
module_exit(…)