mirror of
https://github.com/torvalds/linux.git
synced 2024-11-10 22:21:40 +00:00
0b5288f5fe
This patch extends the UMP core code to support the legacy MIDI 1.0 rawmidi devices. When the new kconfig CONFIG_SND_UMP_LEGACY_RAWMIDI is set, the UMP core allows to attach an additional rawmidi device for each UMP Endpoint. The rawmidi device contains 16 substreams where each substream corresponds to a UMP Group belonging to the EP. The device reads/writes the legacy MIDI 1.0 byte streams and translates from/to UMP packets. The legacy rawmidi devices are exclusive with the UMP rawmidi devices, hence both of them can't be opened at the same time unless the UMP rawmidi is opened in APPEND mode. Reviewed-by: Jaroslav Kysela <perex@perex.cz> Link: https://lore.kernel.org/r/20230523075358.9672-15-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
44 lines
1.2 KiB
C
44 lines
1.2 KiB
C
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
#ifndef __UMP_CONVERT_H
|
|
#define __UMP_CONVERT_H
|
|
|
|
#include <sound/ump_msg.h>
|
|
|
|
/* context for converting from legacy control messages to UMP packet */
|
|
struct ump_cvt_to_ump_bank {
|
|
bool rpn_set;
|
|
bool nrpn_set;
|
|
bool bank_set;
|
|
unsigned char cc_rpn_msb, cc_rpn_lsb;
|
|
unsigned char cc_nrpn_msb, cc_nrpn_lsb;
|
|
unsigned char cc_data_msb, cc_data_lsb;
|
|
unsigned char cc_bank_msb, cc_bank_lsb;
|
|
};
|
|
|
|
/* context for converting from MIDI1 byte stream to UMP packet */
|
|
struct ump_cvt_to_ump {
|
|
/* MIDI1 intermediate buffer */
|
|
unsigned char buf[4];
|
|
int len;
|
|
int cmd_bytes;
|
|
|
|
/* UMP output packet */
|
|
u32 ump[4];
|
|
int ump_bytes;
|
|
|
|
/* various status */
|
|
unsigned int in_sysex;
|
|
struct ump_cvt_to_ump_bank bank[16]; /* per channel */
|
|
};
|
|
|
|
int snd_ump_convert_init(struct snd_ump_endpoint *ump);
|
|
void snd_ump_convert_free(struct snd_ump_endpoint *ump);
|
|
int snd_ump_convert_from_ump(struct snd_ump_endpoint *ump,
|
|
const u32 *data, unsigned char *dst,
|
|
unsigned char *group_ret);
|
|
void snd_ump_convert_to_ump(struct snd_ump_endpoint *ump,
|
|
unsigned char group, unsigned char c);
|
|
void snd_ump_reset_convert_to_ump(struct snd_ump_endpoint *ump,
|
|
unsigned char group);
|
|
#endif /* __UMP_CONVERT_H */
|