#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/module.h>
#include <linux/err.h>
#include <linux/platform_device.h>
#include <linux/ioport.h>
#include <linux/io.h>
#include <linux/moduleparam.h>
#include <sound/core.h>
#include <sound/initval.h>
#include <sound/rawmidi.h>
#include <linux/delay.h>
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;
#define MTPAV_IOBASE …
#define MTPAV_IRQ …
#define MTPAV_MAX_PORTS …
static int index = …;
static char *id = …;
static long port = …;
static int irq = …;
static int hwports = …;
module_param(index, int, 0444);
MODULE_PARM_DESC(…) …;
module_param(id, charp, 0444);
MODULE_PARM_DESC(…) …;
module_param_hw(port, long, ioport, 0444);
MODULE_PARM_DESC(…) …;
module_param_hw(irq, int, irq, 0444);
MODULE_PARM_DESC(…) …;
module_param(hwports, int, 0444);
MODULE_PARM_DESC(…) …;
static struct platform_device *device;
#define SIGS_BYTE …
#define SIGS_RFD …
#define SIGS_IRQ …
#define SIGS_IN0 …
#define SIGS_IN1 …
#define SIGC_WRITE …
#define SIGC_READ …
#define SIGC_INTEN …
#define DREG …
#define SREG …
#define CREG …
#define MTPAV_MODE_INPUT_OPENED …
#define MTPAV_MODE_OUTPUT_OPENED …
#define MTPAV_MODE_INPUT_TRIGGERED …
#define MTPAV_MODE_OUTPUT_TRIGGERED …
#define NUMPORTS …
struct mtpav_port { … };
struct mtpav { … };
#define MTPAV_PIDX_COMPUTER …
#define MTPAV_PIDX_ADAT …
#define MTPAV_PIDX_BROADCAST …
static int translate_subdevice_to_hwport(struct mtpav *chip, int subdev)
{ … }
static int translate_hwport_to_subdevice(struct mtpav *chip, int hwport)
{ … }
static u8 snd_mtpav_getreg(struct mtpav *chip, u16 reg)
{ … }
static inline void snd_mtpav_mputreg(struct mtpav *chip, u16 reg, u8 val)
{ … }
static void snd_mtpav_wait_rfdhi(struct mtpav *chip)
{ … }
static void snd_mtpav_send_byte(struct mtpav *chip, u8 byte)
{ … }
static void snd_mtpav_output_port_write(struct mtpav *mtp_card,
struct mtpav_port *portp,
struct snd_rawmidi_substream *substream)
{ … }
static void snd_mtpav_output_write(struct snd_rawmidi_substream *substream)
{ … }
static void snd_mtpav_portscan(struct mtpav *chip)
{ … }
static int snd_mtpav_input_open(struct snd_rawmidi_substream *substream)
{ … }
static int snd_mtpav_input_close(struct snd_rawmidi_substream *substream)
{ … }
static void snd_mtpav_input_trigger(struct snd_rawmidi_substream *substream, int up)
{ … }
static void snd_mtpav_output_timer(struct timer_list *t)
{ … }
static void snd_mtpav_add_output_timer(struct mtpav *chip)
{ … }
static void snd_mtpav_remove_output_timer(struct mtpav *chip)
{ … }
static int snd_mtpav_output_open(struct snd_rawmidi_substream *substream)
{
struct mtpav *mtp_card = substream->rmidi->private_data;
struct mtpav_port *portp = &mtp_card->ports[substream->number];
unsigned long flags;
spin_lock_irqsave(&mtp_card->spinlock, flags);
portp->mode |= MTPAV_MODE_OUTPUT_OPENED;
portp->output = substream;
spin_unlock_irqrestore(&mtp_card->spinlock, flags);
return 0;
};
static int snd_mtpav_output_close(struct snd_rawmidi_substream *substream)
{
struct mtpav *mtp_card = substream->rmidi->private_data;
struct mtpav_port *portp = &mtp_card->ports[substream->number];
unsigned long flags;
spin_lock_irqsave(&mtp_card->spinlock, flags);
portp->mode &= ~MTPAV_MODE_OUTPUT_OPENED;
portp->output = NULL;
spin_unlock_irqrestore(&mtp_card->spinlock, flags);
return 0;
};
static void snd_mtpav_output_trigger(struct snd_rawmidi_substream *substream, int up)
{ … }
static void snd_mtpav_inmidi_process(struct mtpav *mcrd, u8 inbyte)
{ … }
static void snd_mtpav_inmidi_h(struct mtpav *mcrd, u8 inbyte)
{ … }
static void snd_mtpav_read_bytes(struct mtpav *mcrd)
{ … }
static irqreturn_t snd_mtpav_irqh(int irq, void *dev_id)
{ … }
static int snd_mtpav_get_ISA(struct mtpav *mcard)
{ … }
static const struct snd_rawmidi_ops snd_mtpav_output = …;
static const struct snd_rawmidi_ops snd_mtpav_input = …;
static void snd_mtpav_set_name(struct mtpav *chip,
struct snd_rawmidi_substream *substream)
{ … }
static int snd_mtpav_get_RAWMIDI(struct mtpav *mcard)
{ … }
static void snd_mtpav_free(struct snd_card *card)
{ … }
static int snd_mtpav_probe(struct platform_device *dev)
{ … }
#define SND_MTPAV_DRIVER …
static struct platform_driver snd_mtpav_driver = …;
static int __init alsa_card_mtpav_init(void)
{ … }
static void __exit alsa_card_mtpav_exit(void)
{ … }
module_init(…) …
module_exit(…)