0001
0002 #ifndef __SOUND_MPU401_H
0003 #define __SOUND_MPU401_H
0004
0005
0006
0007
0008
0009
0010 #include <sound/rawmidi.h>
0011 #include <linux/interrupt.h>
0012
0013 #define MPU401_HW_MPU401 1
0014 #define MPU401_HW_SB 2
0015 #define MPU401_HW_ES1688 3
0016 #define MPU401_HW_OPL3SA2 4
0017 #define MPU401_HW_SONICVIBES 5
0018 #define MPU401_HW_CS4232 6
0019 #define MPU401_HW_ES18XX 7
0020 #define MPU401_HW_FM801 8
0021 #define MPU401_HW_TRID4DWAVE 9
0022 #define MPU401_HW_AZT2320 10
0023 #define MPU401_HW_ALS100 11
0024 #define MPU401_HW_ICE1712 12
0025 #define MPU401_HW_VIA686A 13
0026 #define MPU401_HW_YMFPCI 14
0027 #define MPU401_HW_CMIPCI 15
0028 #define MPU401_HW_ALS4000 16
0029 #define MPU401_HW_INTEL8X0 17
0030 #define MPU401_HW_PC98II 18
0031 #define MPU401_HW_AUREAL 19
0032
0033 #define MPU401_INFO_INPUT (1 << 0)
0034 #define MPU401_INFO_OUTPUT (1 << 1)
0035 #define MPU401_INFO_INTEGRATED (1 << 2)
0036 #define MPU401_INFO_MMIO (1 << 3)
0037 #define MPU401_INFO_TX_IRQ (1 << 4)
0038 #define MPU401_INFO_IRQ_HOOK (1 << 5)
0039
0040 #define MPU401_INFO_NO_ACK (1 << 6)
0041 #define MPU401_INFO_USE_TIMER (1 << 15)
0042
0043 #define MPU401_MODE_BIT_INPUT 0
0044 #define MPU401_MODE_BIT_OUTPUT 1
0045 #define MPU401_MODE_BIT_INPUT_TRIGGER 2
0046 #define MPU401_MODE_BIT_OUTPUT_TRIGGER 3
0047
0048 #define MPU401_MODE_INPUT (1<<MPU401_MODE_BIT_INPUT)
0049 #define MPU401_MODE_OUTPUT (1<<MPU401_MODE_BIT_OUTPUT)
0050 #define MPU401_MODE_INPUT_TRIGGER (1<<MPU401_MODE_BIT_INPUT_TRIGGER)
0051 #define MPU401_MODE_OUTPUT_TRIGGER (1<<MPU401_MODE_BIT_OUTPUT_TRIGGER)
0052
0053 #define MPU401_MODE_INPUT_TIMER (1<<0)
0054 #define MPU401_MODE_OUTPUT_TIMER (1<<1)
0055
0056 struct snd_mpu401 {
0057 struct snd_rawmidi *rmidi;
0058
0059 unsigned short hardware;
0060 unsigned int info_flags;
0061 unsigned long port;
0062 unsigned long cport;
0063 struct resource *res;
0064 int irq;
0065
0066 unsigned long mode;
0067 int timer_invoked;
0068
0069 int (*open_input) (struct snd_mpu401 * mpu);
0070 void (*close_input) (struct snd_mpu401 * mpu);
0071 int (*open_output) (struct snd_mpu401 * mpu);
0072 void (*close_output) (struct snd_mpu401 * mpu);
0073 void *private_data;
0074
0075 struct snd_rawmidi_substream *substream_input;
0076 struct snd_rawmidi_substream *substream_output;
0077
0078 spinlock_t input_lock;
0079 spinlock_t output_lock;
0080 spinlock_t timer_lock;
0081
0082 struct timer_list timer;
0083
0084 void (*write) (struct snd_mpu401 * mpu, unsigned char data, unsigned long addr);
0085 unsigned char (*read) (struct snd_mpu401 *mpu, unsigned long addr);
0086 };
0087
0088
0089
0090 #define MPU401C(mpu) (mpu)->cport
0091 #define MPU401D(mpu) (mpu)->port
0092
0093
0094
0095
0096
0097 #define MPU401_RX_EMPTY 0x80
0098 #define MPU401_TX_FULL 0x40
0099
0100
0101 #define MPU401_RESET 0xff
0102 #define MPU401_ENTER_UART 0x3f
0103
0104
0105 #define MPU401_ACK 0xfe
0106
0107
0108
0109
0110
0111
0112 irqreturn_t snd_mpu401_uart_interrupt(int irq, void *dev_id);
0113 irqreturn_t snd_mpu401_uart_interrupt_tx(int irq, void *dev_id);
0114
0115 int snd_mpu401_uart_new(struct snd_card *card,
0116 int device,
0117 unsigned short hardware,
0118 unsigned long port,
0119 unsigned int info_flags,
0120 int irq,
0121 struct snd_rawmidi ** rrawmidi);
0122
0123 #endif