linux/sound/drivers/portman2x4.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 *   Driver for Midiman Portman2x4 parallel port midi interface
 *
 *   Copyright (c) by Levent Guendogdu <[email protected]>
 *
 * ChangeLog
 * Jan 24 2007 Matthias Koenig <[email protected]>
 *      - cleanup and rewrite
 * Sep 30 2004 Tobias Gehrig <[email protected]>
 *      - source code cleanup
 * Sep 03 2004 Tobias Gehrig <[email protected]>
 *      - fixed compilation problem with alsa 1.0.6a (removed MODULE_CLASSES,
 *        MODULE_PARM_SYNTAX and changed MODULE_DEVICES to
 *        MODULE_SUPPORTED_DEVICE)
 * Mar 24 2004 Tobias Gehrig <[email protected]>
 *      - added 2.6 kernel support
 * Mar 18 2004 Tobias Gehrig <[email protected]>
 *      - added parport_unregister_driver to the startup routine if the driver fails to detect a portman
 *      - added support for all 4 output ports in portman_putmidi
 * Mar 17 2004 Tobias Gehrig <[email protected]>
 *      - added checks for opened input device in interrupt handler
 * Feb 20 2004 Tobias Gehrig <[email protected]>
 *      - ported from alsa 0.5 to 1.0
 */

#include <linux/init.h>
#include <linux/platform_device.h>
#include <linux/parport.h>
#include <linux/spinlock.h>
#include <linux/delay.h>
#include <linux/slab.h>
#include <linux/module.h>
#include <sound/core.h>
#include <sound/initval.h>
#include <sound/rawmidi.h>
#include <sound/control.h>

#define CARD_NAME
#define DRIVER_NAME
#define PLATFORM_DRIVER

static int index[SNDRV_CARDS]  =;
static char *id[SNDRV_CARDS]   =;
static bool enable[SNDRV_CARDS] =;

static struct platform_device *platform_devices[SNDRV_CARDS]; 
static int device_count;

module_param_array();
MODULE_PARM_DESC();
module_param_array();
MODULE_PARM_DESC();
module_param_array();
MODULE_PARM_DESC();

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

/*********************************************************************
 * Chip specific
 *********************************************************************/
#define PORTMAN_NUM_INPUT_PORTS
#define PORTMAN_NUM_OUTPUT_PORTS

struct portman {};

static int portman_free(struct portman *pm)
{}

static int portman_create(struct snd_card *card,
			  struct pardevice *pardev,
			  struct portman **rchip)
{}

/*********************************************************************
 * HW related constants
 *********************************************************************/

/* Standard PC parallel port status register equates. */
#define PP_STAT_BSY
#define PP_STAT_ACK
#define PP_STAT_POUT
#define PP_STAT_SEL
#define PP_STAT_ERR

/* Standard PC parallel port command register equates. */
#define PP_CMD_IEN
#define PP_CMD_SELI
#define PP_CMD_INIT
#define PP_CMD_FEED
#define PP_CMD_STB

/* Parallel Port Command Register as implemented by PCP2x4. */
#define INT_EN
#define STROBE

/* The parallel port command register field (b1..b3) selects the 
 * various "registers" within the PC/P 2x4.  These are the internal
 * address of these "registers" that must be written to the parallel
 * port command register.
 */
#define RXDATA0
#define RXDATA1
#define GEN_CTL
#define SYNC_CTL
#define TXDATA0
#define TXDATA1
#define TXDATA2
#define TXDATA3

/* Parallel Port Status Register as implemented by PCP2x4. */
#define ESTB
#define INT_REQ
#define BUSY

/* Parallel Port Status Register BUSY and SELECT lines are multiplexed
 * between several functions.  Depending on which 2x4 "register" is
 * currently selected (b1..b3), the BUSY and SELECT lines are
 * assigned as follows:
 *
 *   SELECT LINE:                                                    A3 A2 A1
 *                                                                   --------
 */
#define RXAVAIL
//  RXAVAIL1    PP_STAT_SEL             /* Rx Available, channel 1.   0 0 1 */
#define SYNC_STAT
//                                      /* Reserved.                  0 1 1 */
#define TXEMPTY
//      TXEMPTY1        PP_STAT_SEL     /* Tx Empty, channel 1.       1 0 1 */
//  TXEMPTY2    PP_STAT_SEL             /* Tx Empty, channel 2.       1 1 0 */
//  TXEMPTY3    PP_STAT_SEL             /* Tx Empty, channel 3.       1 1 1 */

/*   BUSY LINE:                                                      A3 A2 A1
 *                                                                   --------
 */
#define RXDATA
//      RXDATA1         PP_STAT_BSY     /* Rx Input Data, channel 1.  0 0 1 */
#define SYNC_DATA
					/* Reserved.                  0 1 1 */
#define DATA_ECHO
#define A0_ECHO
#define A1_ECHO
#define A2_ECHO

#define PORTMAN2X4_MODE_INPUT_TRIGGERED

/*********************************************************************
 * Hardware specific functions
 *********************************************************************/
static inline void portman_write_command(struct portman *pm, u8 value)
{}

static inline u8 portman_read_status(struct portman *pm)
{}

static inline void portman_write_data(struct portman *pm, u8 value)
{}

static void portman_write_midi(struct portman *pm, 
			       int port, u8 mididata)
{}


/*
 *  Read MIDI byte from port
 *  Attempt to read input byte from specified hardware input port (0..).
 *  Return -1 if no data
 */
static int portman_read_midi(struct portman *pm, int port)
{}

/*
 *  Checks if any input data on the given channel is available
 *  Checks RxAvail 
 */
static int portman_data_avail(struct portman *pm, int channel)
{}


/*
 *  Flushes any input
 */
static void portman_flush_input(struct portman *pm, unsigned char port)
{}

static int portman_probe(struct parport *p)
{}

static int portman_device_init(struct portman *pm)
{}

/*********************************************************************
 * Rawmidi
 *********************************************************************/
static int snd_portman_midi_open(struct snd_rawmidi_substream *substream)
{}

static int snd_portman_midi_close(struct snd_rawmidi_substream *substream)
{}

static void snd_portman_midi_input_trigger(struct snd_rawmidi_substream *substream,
					   int up)
{}

static void snd_portman_midi_output_trigger(struct snd_rawmidi_substream *substream,
					    int up)
{}

static const struct snd_rawmidi_ops snd_portman_midi_output =;

static const struct snd_rawmidi_ops snd_portman_midi_input =;

/* Create and initialize the rawmidi component */
static int snd_portman_rawmidi_create(struct snd_card *card)
{}

/*********************************************************************
 * parport stuff
 *********************************************************************/
static void snd_portman_interrupt(void *userdata)
{}

static void snd_portman_attach(struct parport *p)
{}

static void snd_portman_detach(struct parport *p)
{}

static int snd_portman_dev_probe(struct pardevice *pardev)
{}

static struct parport_driver portman_parport_driver =;

/*********************************************************************
 * platform stuff
 *********************************************************************/
static void snd_portman_card_private_free(struct snd_card *card)
{}

static int snd_portman_probe(struct platform_device *pdev)
{}

static void snd_portman_remove(struct platform_device *pdev)
{}


static struct platform_driver snd_portman_driver =;

/*********************************************************************
 * module init stuff
 *********************************************************************/
static void snd_portman_unregister_all(void)
{}

static int __init snd_portman_module_init(void)
{}

static void __exit snd_portman_module_exit(void)
{}

module_init();
module_exit(snd_portman_module_exit);