1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Universal MIDI Packet (UMP): Message Definitions
5 #ifndef __SOUND_UMP_MSG_H
6 #define __SOUND_UMP_MSG_H
8 /* MIDI 1.0 / 2.0 Status Code (4bit) */
10 UMP_MSG_STATUS_PER_NOTE_RCC = 0x0,
11 UMP_MSG_STATUS_PER_NOTE_ACC = 0x1,
12 UMP_MSG_STATUS_RPN = 0x2,
13 UMP_MSG_STATUS_NRPN = 0x3,
14 UMP_MSG_STATUS_RELATIVE_RPN = 0x4,
15 UMP_MSG_STATUS_RELATIVE_NRPN = 0x5,
16 UMP_MSG_STATUS_PER_NOTE_PITCH_BEND = 0x6,
17 UMP_MSG_STATUS_NOTE_OFF = 0x8,
18 UMP_MSG_STATUS_NOTE_ON = 0x9,
19 UMP_MSG_STATUS_POLY_PRESSURE = 0xa,
20 UMP_MSG_STATUS_CC = 0xb,
21 UMP_MSG_STATUS_PROGRAM = 0xc,
22 UMP_MSG_STATUS_CHANNEL_PRESSURE = 0xd,
23 UMP_MSG_STATUS_PITCH_BEND = 0xe,
24 UMP_MSG_STATUS_PER_NOTE_MGMT = 0xf,
27 /* MIDI 1.0 Channel Control (7bit) */
29 UMP_CC_BANK_SELECT = 0,
30 UMP_CC_MODULATION = 1,
33 UMP_CC_PORTAMENTO_TIME = 5,
38 UMP_CC_EXPRESSION = 11,
39 UMP_CC_EFFECT_CONTROL_1 = 12,
40 UMP_CC_EFFECT_CONTROL_2 = 13,
45 UMP_CC_BANK_SELECT_LSB = 32,
46 UMP_CC_MODULATION_LSB = 33,
47 UMP_CC_BREATH_LSB = 34,
49 UMP_CC_PORTAMENTO_TIME_LSB = 37,
51 UMP_CC_VOLUME_LSB = 39,
52 UMP_CC_BALANCE_LSB = 40,
54 UMP_CC_EXPRESSION_LSB = 43,
55 UMP_CC_EFFECT1_LSB = 44,
56 UMP_CC_EFFECT2_LSB = 45,
62 UMP_CC_PORTAMENTO_SWITCH = 65,
63 UMP_CC_SOSTENUTO = 66,
64 UMP_CC_SOFT_PEDAL = 67,
67 UMP_CC_SOUND_CONTROLLER_1 = 70,
68 UMP_CC_SOUND_CONTROLLER_2 = 71,
69 UMP_CC_SOUND_CONTROLLER_3 = 72,
70 UMP_CC_SOUND_CONTROLLER_4 = 73,
71 UMP_CC_SOUND_CONTROLLER_5 = 74,
72 UMP_CC_SOUND_CONTROLLER_6 = 75,
73 UMP_CC_SOUND_CONTROLLER_7 = 76,
74 UMP_CC_SOUND_CONTROLLER_8 = 77,
75 UMP_CC_SOUND_CONTROLLER_9 = 78,
76 UMP_CC_SOUND_CONTROLLER_10 = 79,
81 UMP_CC_PORTAMENTO_CONTROL = 84,
93 UMP_CC_ALL_SOUND_OFF = 120,
94 UMP_CC_RESET_ALL = 121,
95 UMP_CC_LOCAL_CONTROL = 122,
96 UMP_CC_ALL_NOTES_OFF = 123,
97 UMP_CC_OMNI_OFF = 124,
99 UMP_CC_POLY_OFF = 126,
100 UMP_CC_POLY_ON = 127,
103 /* MIDI 1.0 / 2.0 System Messages (0xfx) */
105 UMP_SYSTEM_STATUS_MIDI_TIME_CODE = 0xf1,
106 UMP_SYSTEM_STATUS_SONG_POSITION = 0xf2,
107 UMP_SYSTEM_STATUS_SONG_SELECT = 0xf3,
108 UMP_SYSTEM_STATUS_TUNE_REQUEST = 0xf6,
109 UMP_SYSTEM_STATUS_TIMING_CLOCK = 0xf8,
110 UMP_SYSTEM_STATUS_START = 0xfa,
111 UMP_SYSTEM_STATUS_CONTINUE = 0xfb,
112 UMP_SYSTEM_STATUS_STOP = 0xfc,
113 UMP_SYSTEM_STATUS_ACTIVE_SENSING = 0xfe,
114 UMP_SYSTEM_STATUS_RESET = 0xff,
117 /* MIDI 1.0 Realtime and SysEx status messages (0xfx) */
119 UMP_MIDI1_MSG_REALTIME = 0xf0, /* mask */
120 UMP_MIDI1_MSG_SYSEX_START = 0xf0,
121 UMP_MIDI1_MSG_SYSEX_END = 0xf7,
125 * UMP Message Definitions
128 /* MIDI 1.0 Note Off / Note On (32bit) */
129 struct snd_ump_midi1_msg_note {
130 #ifdef __BIG_ENDIAN_BITFIELD
147 /* MIDI 1.0 Poly Pressure (32bit) */
148 struct snd_ump_midi1_msg_paf {
149 #ifdef __BIG_ENDIAN_BITFIELD
166 /* MIDI 1.0 Control Change (32bit) */
167 struct snd_ump_midi1_msg_cc {
168 #ifdef __BIG_ENDIAN_BITFIELD
185 /* MIDI 1.0 Program Change (32bit) */
186 struct snd_ump_midi1_msg_program {
187 #ifdef __BIG_ENDIAN_BITFIELD
204 /* MIDI 1.0 Channel Pressure (32bit) */
205 struct snd_ump_midi1_msg_caf {
206 #ifdef __BIG_ENDIAN_BITFIELD
223 /* MIDI 1.0 Pitch Bend (32bit) */
224 struct snd_ump_midi1_msg_pitchbend {
225 #ifdef __BIG_ENDIAN_BITFIELD
242 /* System Common and Real Time messages (32bit); no channel field */
243 struct snd_ump_system_msg {
244 #ifdef __BIG_ENDIAN_BITFIELD
259 /* MIDI 1.0 UMP CVM (32bit) */
260 union snd_ump_midi1_msg {
261 struct snd_ump_midi1_msg_note note;
262 struct snd_ump_midi1_msg_paf paf;
263 struct snd_ump_midi1_msg_cc cc;
264 struct snd_ump_midi1_msg_program pg;
265 struct snd_ump_midi1_msg_caf caf;
266 struct snd_ump_midi1_msg_pitchbend pb;
267 struct snd_ump_system_msg system;
271 /* MIDI 2.0 Note Off / Note On (64bit) */
272 struct snd_ump_midi2_msg_note {
273 #ifdef __BIG_ENDIAN_BITFIELD
280 u32 attribute_type:8;
283 u32 attribute_data:16;
286 u32 attribute_type:8;
293 u32 attribute_data:16;
298 /* MIDI 2.0 Poly Pressure (64bit) */
299 struct snd_ump_midi2_msg_paf {
300 #ifdef __BIG_ENDIAN_BITFIELD
323 /* MIDI 2.0 Per-Note Controller (64bit) */
324 struct snd_ump_midi2_msg_pernote_cc {
325 #ifdef __BIG_ENDIAN_BITFIELD
348 /* MIDI 2.0 Per-Note Management (64bit) */
349 struct snd_ump_midi2_msg_pernote_mgmt {
350 #ifdef __BIG_ENDIAN_BITFIELD
373 /* MIDI 2.0 Control Change (64bit) */
374 struct snd_ump_midi2_msg_cc {
375 #ifdef __BIG_ENDIAN_BITFIELD
398 /* MIDI 2.0 Registered Controller (RPN) / Assignable Controller (NRPN) (64bit) */
399 struct snd_ump_midi2_msg_rpn {
400 #ifdef __BIG_ENDIAN_BITFIELD
423 /* MIDI 2.0 Program Change (64bit) */
424 struct snd_ump_midi2_msg_program {
425 #ifdef __BIG_ENDIAN_BITFIELD
454 /* MIDI 2.0 Channel Pressure (64bit) */
455 struct snd_ump_midi2_msg_caf {
456 #ifdef __BIG_ENDIAN_BITFIELD
477 /* MIDI 2.0 Pitch Bend (64bit) */
478 struct snd_ump_midi2_msg_pitchbend {
479 #ifdef __BIG_ENDIAN_BITFIELD
500 /* MIDI 2.0 Per-Note Pitch Bend (64bit) */
501 struct snd_ump_midi2_msg_pernote_pitchbend {
502 #ifdef __BIG_ENDIAN_BITFIELD
525 /* MIDI 2.0 UMP CVM (64bit) */
526 union snd_ump_midi2_msg {
527 struct snd_ump_midi2_msg_note note;
528 struct snd_ump_midi2_msg_paf paf;
529 struct snd_ump_midi2_msg_pernote_cc pernote_cc;
530 struct snd_ump_midi2_msg_pernote_mgmt pernote_mgmt;
531 struct snd_ump_midi2_msg_cc cc;
532 struct snd_ump_midi2_msg_rpn rpn;
533 struct snd_ump_midi2_msg_program pg;
534 struct snd_ump_midi2_msg_caf caf;
535 struct snd_ump_midi2_msg_pitchbend pb;
536 struct snd_ump_midi2_msg_pernote_pitchbend pernote_pb;
540 /* UMP Stream Message: Endpoint Discovery (128bit) */
541 struct snd_ump_stream_msg_ep_discovery {
542 #ifdef __BIG_ENDIAN_BITFIELD
547 u32 ump_version_major:8;
548 u32 ump_version_minor:8;
556 u32 ump_version_minor:8;
557 u32 ump_version_major:8;
569 /* UMP Stream Message: Endpoint Info Notification (128bit) */
570 struct snd_ump_stream_msg_ep_info {
571 #ifdef __BIG_ENDIAN_BITFIELD
576 u32 ump_version_major:8;
577 u32 ump_version_minor:8;
579 u32 static_function_block:1;
580 u32 num_function_blocks:7;
589 u32 ump_version_minor:8;
590 u32 ump_version_major:8;
599 u32 num_function_blocks:7;
600 u32 static_function_block:1;
606 /* UMP Stream Message: Device Info Notification (128bit) */
607 struct snd_ump_stream_msg_devince_info {
608 #ifdef __BIG_ENDIAN_BITFIELD
641 /* UMP Stream Message: Stream Config Request / Notification (128bit) */
642 struct snd_ump_stream_msg_stream_cfg {
643 #ifdef __BIG_ENDIAN_BITFIELD
666 /* UMP Stream Message: Function Block Discovery (128bit) */
667 struct snd_ump_stream_msg_fb_discovery {
668 #ifdef __BIG_ENDIAN_BITFIELD
673 u32 function_block_id:8;
680 u32 function_block_id:8;
689 /* UMP Stream Message: Function Block Info Notification (128bit) */
690 struct snd_ump_stream_msg_fb_info {
691 #ifdef __BIG_ENDIAN_BITFIELD
697 u32 function_block_id:7;
705 u32 midi_ci_version:8;
706 u32 sysex8_streams:8;
715 u32 function_block_id:7;
721 u32 sysex8_streams:8;
722 u32 midi_ci_version:8;
730 /* UMP Stream Message: Function Block Name Notification (128bit) */
731 struct snd_ump_stream_msg_fb_name {
732 #ifdef __BIG_ENDIAN_BITFIELD
737 u8 function_block_id;
744 u8 function_block_id;
749 u8 name[12]; // FIXME: byte order
753 /* MIDI 2.0 Stream Messages (128bit) */
754 union snd_ump_stream_msg {
755 struct snd_ump_stream_msg_ep_discovery ep_discovery;
756 struct snd_ump_stream_msg_ep_info ep_info;
757 struct snd_ump_stream_msg_devince_info device_info;
758 struct snd_ump_stream_msg_stream_cfg stream_cfg;
759 struct snd_ump_stream_msg_fb_discovery fb_discovery;
760 struct snd_ump_stream_msg_fb_info fb_info;
761 struct snd_ump_stream_msg_fb_name fb_name;
765 #endif /* __SOUND_UMP_MSG_H */