linux/sound/drivers/mpu401/mpu401_uart.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 *  Copyright (c) by Jaroslav Kysela <[email protected]>
 *  Routines for control of MPU-401 in UART mode
 *
 *  MPU-401 supports UART mode which is not capable generate transmit
 *  interrupts thus output is done via polling. Without interrupt,
 *  input is done also via polling. Do not expect good performance.
 *
 *   13-03-2003:
 *      Added support for different kind of hardware I/O. Build in choices
 *      are port and mmio. For other kind of I/O, set mpu->read and
 *      mpu->write to your own I/O functions.
 */

#include <linux/io.h>
#include <linux/delay.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/ioport.h>
#include <linux/module.h>
#include <linux/interrupt.h>
#include <linux/errno.h>
#include <sound/core.h>
#include <sound/mpu401.h>

MODULE_AUTHOR();
MODULE_DESCRIPTION();
MODULE_LICENSE();

static void snd_mpu401_uart_input_read(struct snd_mpu401 * mpu);
static void snd_mpu401_uart_output_write(struct snd_mpu401 * mpu);

/*

 */

#define snd_mpu401_input_avail(mpu)
#define snd_mpu401_output_ready(mpu)

/* Build in lowlevel io */
static void mpu401_write_port(struct snd_mpu401 *mpu, unsigned char data,
			      unsigned long addr)
{}

static unsigned char mpu401_read_port(struct snd_mpu401 *mpu,
				      unsigned long addr)
{}

static void mpu401_write_mmio(struct snd_mpu401 *mpu, unsigned char data,
			      unsigned long addr)
{}

static unsigned char mpu401_read_mmio(struct snd_mpu401 *mpu,
				      unsigned long addr)
{}
/*  */

static void snd_mpu401_uart_clear_rx(struct snd_mpu401 *mpu)
{}

static void uart_interrupt_tx(struct snd_mpu401 *mpu)
{}

static void _snd_mpu401_uart_interrupt(struct snd_mpu401 *mpu)
{}

/**
 * snd_mpu401_uart_interrupt - generic MPU401-UART interrupt handler
 * @irq: the irq number
 * @dev_id: mpu401 instance
 *
 * Processes the interrupt for MPU401-UART i/o.
 *
 * Return: %IRQ_HANDLED if the interrupt was handled. %IRQ_NONE otherwise.
 */
irqreturn_t snd_mpu401_uart_interrupt(int irq, void *dev_id)
{}

EXPORT_SYMBOL();

/**
 * snd_mpu401_uart_interrupt_tx - generic MPU401-UART transmit irq handler
 * @irq: the irq number
 * @dev_id: mpu401 instance
 *
 * Processes the interrupt for MPU401-UART output.
 *
 * Return: %IRQ_HANDLED if the interrupt was handled. %IRQ_NONE otherwise.
 */
irqreturn_t snd_mpu401_uart_interrupt_tx(int irq, void *dev_id)
{}

EXPORT_SYMBOL();

/*
 * timer callback
 * reprogram the timer and call the interrupt job
 */
static void snd_mpu401_uart_timer(struct timer_list *t)
{}

/*
 * initialize the timer callback if not programmed yet
 */
static void snd_mpu401_uart_add_timer (struct snd_mpu401 *mpu, int input)
{}

/*
 * remove the timer callback if still active
 */
static void snd_mpu401_uart_remove_timer (struct snd_mpu401 *mpu, int input)
{}

/*
 * send a UART command
 * return zero if successful, non-zero for some errors
 */

static int snd_mpu401_uart_cmd(struct snd_mpu401 * mpu, unsigned char cmd,
			       int ack)
{}

static int snd_mpu401_do_reset(struct snd_mpu401 *mpu)
{}

/*
 * input/output open/close - protected by open_mutex in rawmidi.c
 */
static int snd_mpu401_uart_input_open(struct snd_rawmidi_substream *substream)
{}

static int snd_mpu401_uart_output_open(struct snd_rawmidi_substream *substream)
{}

static int snd_mpu401_uart_input_close(struct snd_rawmidi_substream *substream)
{}

static int snd_mpu401_uart_output_close(struct snd_rawmidi_substream *substream)
{}

/*
 * trigger input callback
 */
static void
snd_mpu401_uart_input_trigger(struct snd_rawmidi_substream *substream, int up)
{}

/*
 * transfer input pending data
 * call with input_lock spinlock held
 */
static void snd_mpu401_uart_input_read(struct snd_mpu401 * mpu)
{}

/*
 *  Tx FIFO sizes:
 *    CS4237B			- 16 bytes
 *    AudioDrive ES1688         - 12 bytes
 *    S3 SonicVibes             -  8 bytes
 *    SoundBlaster AWE 64       -  2 bytes (ugly hardware)
 */

/*
 * write output pending bytes
 * call with output_lock spinlock held
 */
static void snd_mpu401_uart_output_write(struct snd_mpu401 * mpu)
{}

/*
 * output trigger callback
 */
static void
snd_mpu401_uart_output_trigger(struct snd_rawmidi_substream *substream, int up)
{}

/*

 */

static const struct snd_rawmidi_ops snd_mpu401_uart_output =;

static const struct snd_rawmidi_ops snd_mpu401_uart_input =;

static void snd_mpu401_uart_free(struct snd_rawmidi *rmidi)
{}

/**
 * snd_mpu401_uart_new - create an MPU401-UART instance
 * @card: the card instance
 * @device: the device index, zero-based
 * @hardware: the hardware type, MPU401_HW_XXXX
 * @port: the base address of MPU401 port
 * @info_flags: bitflags MPU401_INFO_XXX
 * @irq: the ISA irq number, -1 if not to be allocated
 * @rrawmidi: the pointer to store the new rawmidi instance
 *
 * Creates a new MPU-401 instance.
 *
 * Note that the rawmidi instance is returned on the rrawmidi argument,
 * not the mpu401 instance itself.  To access to the mpu401 instance,
 * cast from rawmidi->private_data (with struct snd_mpu401 magic-cast).
 *
 * Return: Zero if successful, or a negative error code.
 */
int snd_mpu401_uart_new(struct snd_card *card, int device,
			unsigned short hardware,
			unsigned long port,
			unsigned int info_flags,
			int irq,
			struct snd_rawmidi ** rrawmidi)
{}

EXPORT_SYMBOL();