linux/sound/drivers/mtpav.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 *      MOTU Midi Timepiece ALSA Main routines
 *      Copyright by Michael T. Mayers (c) Jan 09, 2000
 *      mail: [email protected]
 *      Thanks to John Galbraith
 *
 *      This driver is for the 'Mark Of The Unicorn' (MOTU)
 *      MidiTimePiece AV multiport MIDI interface 
 *
 *      IOPORTS
 *      -------
 *      8 MIDI Ins and 8 MIDI outs
 *      Video Sync In (BNC), Word Sync Out (BNC), 
 *      ADAT Sync Out (DB9)
 *      SMPTE in/out (1/4")
 *      2 programmable pedal/footswitch inputs and 4 programmable MIDI controller knobs.
 *      Macintosh RS422 serial port
 *      RS422 "network" port for ganging multiple MTP's
 *      PC Parallel Port ( which this driver currently uses )
 *
 *      MISC FEATURES
 *      -------------
 *      Hardware MIDI routing, merging, and filtering   
 *      MIDI Synchronization to Video, ADAT, SMPTE and other Clock sources
 *      128 'scene' memories, recallable from MIDI program change
 *
 * ChangeLog
 * Jun 11 2001	Takashi Iwai <[email protected]>
 *      - Recoded & debugged
 *      - Added timer interrupt for midi outputs
 *      - hwports is between 1 and 8, which specifies the number of hardware ports.
 *        The three global ports, computer, adat and broadcast ports, are created
 *        always after h/w and remote ports.
 */

#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>

/*
 *      globals
 */
MODULE_AUTHOR();
MODULE_DESCRIPTION();
MODULE_LICENSE();

// io resources
#define MTPAV_IOBASE
#define MTPAV_IRQ
#define MTPAV_MAX_PORTS

static int index =;
static char *id =;
static long port =;	/* 0x378, 0x278 */
static int irq =;		/* 7, 5 */
static int hwports =;	/* use hardware ports 1-8 */

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;

/*
 *      defines
 */
//#define USE_FAKE_MTP //       don't actually read/write to MTP device (for debugging without an actual unit) (does not work yet)

// parallel port usage masks
#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 {};


/*
 * possible hardware ports (selected by 0xf5 port message)
 *      0x00		all ports
 *      0x01 .. 0x08    this MTP's ports 1..8
 *      0x09 .. 0x10    networked MTP's ports (9..16)
 *      0x11            networked MTP's computer port
 *      0x63            to ADAT
 *
 * mappig:
 *  subdevice 0 - (X-1)    ports
 *            X - (2*X-1)  networked ports
 *            X            computer
 *            X+1          ADAT
 *            X+2          all ports
 *
 *  where X = chip->num_ports
 */

#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)
{}


/*
 */

/* call this with spin lock held */
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)
{}


/*
 *      mtpav control
 */

static void snd_mtpav_portscan(struct mtpav *chip)	// put mtp into smart routing mode
{}

/*
 */

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)
{}


/*
 * timer interrupt for outputs
 */

static void snd_mtpav_output_timer(struct timer_list *t)
{}

/* spinlock held! */
static void snd_mtpav_add_output_timer(struct mtpav *chip)
{}

/* spinlock held! */
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)
{}

/*
 * midi interrupt for inputs
 */

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)
{}

/*
 * get ISA resources
 */
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 =;


/*
 * get RAWMIDI resources
 */

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()