ALSA-lib updates for UMP 1.1
cover ALSA-lib updates for UMP 1.1
Hi,
this is a patch set for updating alsa-lib to catch up the changes for MIDI 2.0 UMP v1.1 features. The basic functionality remains, while the uapi header is updated a few API functions for the new features are added.
Takashi
===
Takashi Iwai (3):
uapi: Update rawmidi API to 2.0.4
ump: Add UMP 1.1 features
seq: Add UMP 1.1 features
include/seq.h | 3 ++ include/sound/uapi/asequencer.h | 5 ++- include/sound/uapi/asound.h | 21 ++++++++-- include/ump.h | 22 +++++++++++ include/ump_msg.h | 67 +++++++++++++++++++++++++++++++ src/Versions.in | 2 + src/rawmidi/ump.c | 70 +++++++++++++++++++++++++++++++++ src/seq/seq.c | 32 +++++++++++++++ 8 files changed, 218 insertions(+), 4 deletions(-)
Signature · 1 line
2.35.3
PATCH 1/3 uapi: Update rawmidi API to 2.0.4
Sync with the kernel change of rawmidi API for supporting UMP 1.1 features.
--- include/sound/uapi/asound.h | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-)
include/sound/uapi/asound.h +18 -3
@@ -706,7 +706,7 @@ enum {* Raw MIDI section - /dev/snd/midi?? */ -#define SNDRV_RAWMIDI_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 3) +#define SNDRV_RAWMIDI_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 4)enum {SNDRV_RAWMIDI_STREAM_OUTPUT =0 ,
@@ -776,6 +776,9 @@ struct snd_rawmidi_status {unsigned char reserved[16 ];/* reserved for future use */ }; +/* UMP EP info flags */ +#define SNDRV_UMP_EP_INFO_STATIC_BLOCKS 0x01 +/* UMP EP Protocol / JRTS capability bits */ #define SNDRV_UMP_EP_INFO_PROTO_MIDI_MASK 0x0300#define SNDRV_UMP_EP_INFO_PROTO_MIDI1 0x0100/* MIDI 1.0 */
@@ -793,7 +796,11 @@ struct snd_ump_endpoint_info {unsigned int protocol;/* current protocol */ unsigned int num_blocks;/* # of function blocks */ unsigned short version;/* UMP major/minor version */ -unsigned short padding[7 ]; +unsigned short family_id;/* MIDI device family ID */ +unsigned short model_id;/* MIDI family model ID */ +unsigned int manufacturer_id;/* MIDI manufacturer ID */ +unsigned char sw_revision[4 ];/* software revision */ +unsigned short padding;unsigned char name[128 ];/* endpoint name string */ unsigned char product_id[128 ];/* unique product id string */ unsigned char reserved[32 ];
@@ -808,6 +815,12 @@ struct snd_ump_endpoint_info {#define SNDRV_UMP_BLOCK_IS_MIDI1 (1U << 0)/* MIDI 1.0 port w/o restrict */ #define SNDRV_UMP_BLOCK_IS_LOWSPEED (1U << 1)/* 31.25Kbps B/W MIDI1 port */ +/* UMP block user-interface hint */ +#define SNDRV_UMP_BLOCK_UI_HINT_UNKNOWN 0x00 +#define SNDRV_UMP_BLOCK_UI_HINT_RECEIVER 0x01 +#define SNDRV_UMP_BLOCK_UI_HINT_SENDER 0x02 +#define SNDRV_UMP_BLOCK_UI_HINT_BOTH 0x03 +/* UMP groups and blocks */ #define SNDRV_UMP_MAX_GROUPS 16#define SNDRV_UMP_MAX_BLOCKS 32
@@ -821,7 +834,9 @@ struct snd_ump_block_info {unsigned char active;/* Activeness */ unsigned char first_group;/* first group ID */ unsigned char num_groups;/* number of groups */ -unsigned char padding[3 ]; +unsigned char midi_ci_version;/* MIDI-CI support version */ +unsigned char sysex8_streams;/* max number of sysex8 streams */ +unsigned char ui_hint;/* user interface hint */ unsigned int flags;/* various info flags */ unsigned char name[128 ];/* block name string */ unsigned char reserved[32 ];
Signature · 1 line
2.35.3
PATCH 2/3 ump: Add UMP 1.1 features
In reply to Takashi IwaiAdd a few new features for UMP 1.1:
- New attributes in UMP Endpoint and Block info
- Static block bit flag for EP info
--- include/ump.h | 22 +++++++++++++++ include/ump_msg.h | 67 +++++++++++++++++++++++++++++++++++++++++++++ src/rawmidi/ump.c | 70 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 159 insertions(+)
include/ump.h +22 -0
@@ -53,6 +53,9 @@ enum _snd_ump_direction { SND_UMP_DIR_BIDIRECTION = 0x03, }; +/** UMP EP holds only static blocks */ +#define SND_UMP_EP_INFO_STATIC_BLOCKS 0x01 +/** Bitmask for UMP EP MIDI protocols */ #define SND_UMP_EP_INFO_PROTO_MIDI_MASK 0x0300/** Bit flag for MIDI 1.0 protocol */
@@ -82,6 +85,10 @@ unsigned int snd_ump_endpoint_info_get_protocol_caps(const snd_ump_endpoint_infounsigned int snd_ump_endpoint_info_get_protocol (const snd_ump_endpoint_info_t *info);unsigned int snd_ump_endpoint_info_get_num_blocks (const snd_ump_endpoint_info_t *info);unsigned int snd_ump_endpoint_info_get_version (const snd_ump_endpoint_info_t *info); +unsigned int snd_ump_endpoint_info_get_manufacturer_id (const snd_ump_endpoint_info_t *info); +unsigned int snd_ump_endpoint_info_get_family_id (const snd_ump_endpoint_info_t *info); +unsigned int snd_ump_endpoint_info_get_model_id (const snd_ump_endpoint_info_t *info); +const unsigned char *snd_ump_endpoint_info_get_sw_revision (const snd_ump_endpoint_info_t *info);const char *snd_ump_endpoint_info_get_name (const snd_ump_endpoint_info_t *info);const char *snd_ump_endpoint_info_get_product_id (const snd_ump_endpoint_info_t *info);int snd_ump_endpoint_info (snd_ump_t *ump,snd_ump_endpoint_info_t *info);
@@ -91,6 +98,18 @@ int snd_ump_endpoint_info(snd_ump_t *ump, snd_ump_endpoint_info_t *info);/** Bit flag for 31.25Kbps B/W MIDI1 port in UMP Block info flags */ #define SND_UMP_BLOCK_IS_LOWSPEED (1U << 1) +/** UMP block user-interface hint */ +enum _snd_ump_block_ui_hint { +/** Unknown or undeclared */ +SND_UMP_BLOCK_UI_HINT_UNKNOWN =0x00 , +/** Primarily a receiver or a destination for MIDI messages */ +SND_UMP_BLOCK_UI_HINT_RECEIVER =0x01 , +/** Primarily a sender or a source of MIDI messages */ +SND_UMP_BLOCK_UI_HINT_SENDER =0x02 , +/** Both a sender and receiver of MIDI messages */ +SND_UMP_BLOCK_UI_HINT_BOTH =0x03 , +}; +size_t snd_ump_block_info_sizeof (void );/** \hideinitializer * \brief allocate an invalid #snd_ump_block_info_t using standard alloca
@@ -109,6 +128,9 @@ unsigned int snd_ump_block_info_get_flags(const snd_ump_block_info_t *info);unsigned int snd_ump_block_info_get_direction (const snd_ump_block_info_t *info);unsigned int snd_ump_block_info_get_first_group (const snd_ump_block_info_t *info);unsigned int snd_ump_block_info_get_num_groups (const snd_ump_block_info_t *info); +unsigned int snd_ump_block_info_get_midi_ci_version (const snd_ump_block_info_t *info); +unsigned int snd_ump_block_info_get_sysex8_streams (const snd_ump_block_info_t *info); +unsigned int snd_ump_block_info_get_ui_hint (const snd_ump_block_info_t *info);const char *snd_ump_block_info_get_name (const snd_ump_block_info_t *info);int snd_ump_block_info (snd_ump_t *ump,snd_ump_block_info_t *info);
include/ump_msg.h +67 -0
90 lines not on this page · raw message
src/rawmidi/ump.c +70 -0
82 lines not on this page · raw message
Signature · 1 line
2.35.3
PATCH 3/3 seq: Add UMP 1.1 features
In reply to Takashi IwaiAdd APIs for groupless message filtering.
--- include/seq.h | 3 +++ include/sound/uapi/asequencer.h | 5 ++++- src/Versions.in | 2 ++ src/seq/seq.c | 32 ++++++++++++++++++++++++++++++++ 4 files changed, 41 insertions(+), 1 deletion(-)
include/seq.h +3 -0
@@ -159,6 +159,7 @@ int snd_seq_client_info_get_event_lost(const snd_seq_client_info_t *info);int snd_seq_client_info_get_midi_version (const snd_seq_client_info_t *info);int snd_seq_client_info_get_ump_group_enabled (const snd_seq_client_info_t *info,int group); +int snd_seq_client_info_get_ump_groupless_enabled (const snd_seq_client_info_t *info);int snd_seq_client_info_get_ump_conversion (const snd_seq_client_info_t *info);void snd_seq_client_info_set_client (snd_seq_client_info_t *info,int client);void snd_seq_client_info_set_name (snd_seq_client_info_t *info,const char *name);
@@ -168,6 +169,8 @@ void snd_seq_client_info_set_event_filter(snd_seq_client_info_t *info, unsignedvoid snd_seq_client_info_set_midi_version (snd_seq_client_info_t *info,int midi_version);void snd_seq_client_info_set_ump_group_enabled (snd_seq_client_info_t *info,int group,int enable); +void snd_seq_client_info_set_ump_groupless_enabled (snd_seq_client_info_t *info, +int enable);void snd_seq_client_info_set_ump_conversion (snd_seq_client_info_t *info,int enable);void snd_seq_client_info_event_filter_clear (snd_seq_client_info_t *info);
include/sound/uapi/asequencer.h +4 -1
@@ -378,7 +378,10 @@ struct snd_seq_client_info {int card;/* RO: card number[kernel] */ int pid;/* RO: pid[user] */ unsigned int midi_version;/* MIDI version */ -unsigned int group_filter;/* UMP group filter bitmap */ +unsigned int group_filter;/* UMP group filter bitmap +* (bit 0 = groupless messages, +* bit 1-16 = messages for groups 1-16) +*/ char reserved[48 ];/* for future use */ };
src/Versions.in +2 -0
@@ -159,9 +159,11 @@ ALSA_1.2.10 { @SYMBOL_PREFIX@snd_seq_ump_*; @SYMBOL_PREFIX@snd_seq_client_info_get_midi_version; @SYMBOL_PREFIX@snd_seq_seq_client_info_get_ump_group_enabled; + @SYMBOL_PREFIX@snd_seq_client_info_get_ump_groupless_enabled; @SYMBOL_PREFIX@snd_seq_seq_client_get_ump_conversion; @SYMBOL_PREFIX@snd_seq_client_info_set_midi_version; @SYMBOL_PREFIX@snd_seq_seq_client_info_set_ump_group_enabled; + @SYMBOL_PREFIX@snd_seq_client_info_set_ump_groupless_enabled; @SYMBOL_PREFIX@snd_seq_seq_client_set_ump_conversion; @SYMBOL_PREFIX@snd_seq_get_ump_endpoint_info; @SYMBOL_PREFIX@snd_seq_get_ump_block_info;
src/seq/seq.c +32 -0
@@ -1763,6 +1763,21 @@ int snd_seq_client_info_get_ump_group_enabled(const snd_seq_client_info_t *info,return !(info->group_filter & (1U << group)); } +#define UMP_GROUPLESS_FILTER (1U << 0) + +/** +* \brief Get the UMP groupless message handling status +* \param info client_info container +* \return 1 if UMP groupless messages is processed, 0 if filtered/disabled +* +* \sa snd_seq_get_client_info() +*/ +int snd_seq_client_info_get_ump_groupless_enabled (const snd_seq_client_info_t *info) +{ +assert (info); +return !(info->group_filter &UMP_GROUPLESS_FILTER ); +} +/** * \brief Get the automatic conversion mode for UMP * \param info client_info container
@@ -1850,6 +1865,23 @@ void snd_seq_client_info_set_ump_group_enabled(snd_seq_client_info_t *info, info->group_filter |= (1U << group); } +/** +* \brief Enable/disable the UMP groupless message handling +* \param info client_info container +* \param enable enable the UMP groupless messages +* +* \sa snd_seq_set_client_info(), snd_seq_client_info_get_ump_groupless_enabled() +*/ +void snd_seq_client_info_set_ump_groupless_enabled (snd_seq_client_info_t *info, +int enable) +{ +assert (info); +if (enable) + info->group_filter &= ~UMP_GROUPLESS_FILTER ; +else + info->group_filter |=UMP_GROUPLESS_FILTER ; +} +/** * \brief Set the automatic conversion mode for UMP * \param info client_info container
Signature · 1 line
2.35.3