extern "C" {
#endif
+#if __BYTE_ORDER != __LITTLE_ENDIAN && __BYTE_ORDER != __BIG_ENDIAN
+#error "Endianness check failed!"
+#endif
+
/** general UMP packet header in 32bit word */
typedef struct _snd_ump_msg_hdr {
-#ifdef SNDRV_BIG_ENDIAN_BITFIELD
+#if __BYTE_ORDER == __BIG_ENDIAN
uint8_t type:4; /**< UMP packet type */
uint8_t group:4; /**< UMP Group */
uint8_t status:4; /**< Status */
/** MIDI 1.0 Note Off / Note On (32bit) */
typedef struct _snd_ump_msg_midi1_note {
-#ifdef SNDRV_BIG_ENDIAN_BITFIELD
+#if __BYTE_ORDER == __BIG_ENDIAN
uint8_t type:4; /**< UMP packet type */
uint8_t group:4; /**< UMP Group */
uint8_t status:4; /**< Status */
/** MIDI 1.0 Poly Pressure (32bit) */
typedef struct _snd_ump_msg_midi1_paf {
-#ifdef SNDRV_BIG_ENDIAN_BITFIELD
+#if __BYTE_ORDER == __BIG_ENDIAN
uint8_t type:4; /**< UMP packet type */
uint8_t group:4; /**< UMP Group */
uint8_t status:4; /**< Status */
/** MIDI 1.0 Control Change (32bit) */
typedef struct _snd_ump_msg_midi1_cc {
-#ifdef SNDRV_BIG_ENDIAN_BITFIELD
+#if __BYTE_ORDER == __BIG_ENDIAN
uint8_t type:4; /**< UMP packet type */
uint8_t group:4; /**< UMP Group */
uint8_t status:4; /**< Status */
/** MIDI 1.0 Program Change (32bit) */
typedef struct _snd_ump_msg_midi1_program {
-#ifdef SNDRV_BIG_ENDIAN_BITFIELD
+#if __BYTE_ORDER == __BIG_ENDIAN
uint8_t type:4; /**< UMP packet type */
uint8_t group:4; /**< UMP Group */
uint8_t status:4; /**< Status */
/** MIDI 1.0 Channel Pressure (32bit) */
typedef struct _snd_ump_msg_midi1_caf {
-#ifdef SNDRV_BIG_ENDIAN_BITFIELD
+#if __BYTE_ORDER == __BIG_ENDIAN
uint8_t type:4; /**< UMP packet type */
uint8_t group:4; /**< UMP Group */
uint8_t status:4; /**< Status */
/** MIDI 1.0 Pitch Bend (32bit) */
typedef struct _snd_ump_msg_midi1_pitchbend {
-#ifdef SNDRV_BIG_ENDIAN_BITFIELD
+#if __BYTE_ORDER == __BIG_ENDIAN
uint8_t type:4; /**< UMP packet type */
uint8_t group:4; /**< UMP Group */
uint8_t status:4; /**< Status */
/** System Common and Real Time messages (32bit); no channel field */
typedef struct snd_ump_msg_system {
-#ifdef SNDRV_BIG_ENDIAN_BITFIELD
+#if __BYTE_ORDER == __BIG_ENDIAN
uint8_t type:4; /**< UMP packet type */
uint8_t group:4; /**< UMP Group */
uint8_t status; /**< Status */
/** MIDI 2.0 Note Off / Note On (64bit) */
typedef struct _snd_ump_msg_midi2_note {
-#ifdef SNDRV_BIG_ENDIAN_BITFIELD
+#if __BYTE_ORDER == __BIG_ENDIAN
uint8_t type:4; /**< UMP packet type */
uint8_t group:4; /**< UMP Group */
uint8_t status:4; /**< Status */
/** MIDI 2.0 Poly Pressure (64bit) */
typedef struct _snd_ump_msg_midi2_paf {
-#ifdef SNDRV_BIG_ENDIAN_BITFIELD
+#if __BYTE_ORDER == __BIG_ENDIAN
uint8_t type:4; /**< UMP packet type */
uint8_t group:4; /**< UMP Group */
uint8_t status:4; /**< Status */
/** MIDI 2.0 Per-Note Controller (64bit) */
typedef struct _snd_ump_msg_midi2_per_note_cc {
-#ifdef SNDRV_BIG_ENDIAN_BITFIELD
+#if __BYTE_ORDER == __BIG_ENDIAN
uint8_t type:4; /**< UMP packet type */
uint8_t group:4; /**< UMP Group */
uint8_t status:4; /**< Status */
/** MIDI 2.0 Per-Note Management (64bit) */
typedef struct _snd_ump_msg_midi2_per_note_mgmt {
-#ifdef SNDRV_BIG_ENDIAN_BITFIELD
+#if __BYTE_ORDER == __BIG_ENDIAN
uint8_t type:4; /**< UMP packet type */
uint8_t group:4; /**< UMP Group */
uint8_t status:4; /**< Status */
/** MIDI 2.0 Control Change (64bit) */
typedef struct _snd_ump_msg_midi2_cc {
-#ifdef SNDRV_BIG_ENDIAN_BITFIELD
+#if __BYTE_ORDER == __BIG_ENDIAN
uint8_t type:4; /**< UMP packet type */
uint8_t group:4; /**< UMP Group */
uint8_t status:4; /**< Status */
/** MIDI 2.0 Registered Controller (RPN) / Assignable Controller (NRPN) (64bit) */
typedef struct _snd_ump_msg_midi2_rpn {
-#ifdef SNDRV_BIG_ENDIAN_BITFIELD
+#if __BYTE_ORDER == __BIG_ENDIAN
uint8_t type:4; /**< UMP packet type */
uint8_t group:4; /**< UMP Group */
uint8_t status:4; /**< Status */
/** MIDI 2.0 Program Change (64bit) */
typedef struct _snd_ump_msg_midi2_program {
-#ifdef SNDRV_BIG_ENDIAN_BITFIELD
+#if __BYTE_ORDER == __BIG_ENDIAN
uint8_t type:4; /**< UMP packet type */
uint8_t group:4; /**< UMP Group */
uint8_t status:4; /**< Status */
/** MIDI 2.0 Channel Pressure (64bit) */
typedef struct _snd_ump_msg_midi2_caf {
-#ifdef SNDRV_BIG_ENDIAN_BITFIELD
+#if __BYTE_ORDER == __BIG_ENDIAN
uint8_t type:4; /**< UMP packet type */
uint8_t group:4; /**< UMP Group */
uint8_t status:4; /**< Status */
/** MIDI 2.0 Pitch Bend (64bit) */
typedef struct _snd_ump_msg_midi2_pitchbend {
-#ifdef SNDRV_BIG_ENDIAN_BITFIELD
+#if __BYTE_ORDER == __BIG_ENDIAN
uint8_t type:4; /**< UMP packet type */
uint8_t group:4; /**< UMP Group */
uint8_t status:4; /**< Status */
/** Stream Message (generic) (128bit) */
typedef struct _snd_ump_msg_stream_gen {
-#ifdef SNDRV_BIG_ENDIAN_BITFIELD
+#if __BYTE_ORDER == __BIG_ENDIAN
uint16_t type:4; /**< UMP packet type */
uint16_t format:2; /**< Format */
uint16_t status:10; /**< Status */
/** Metadata / Text Message (128bit) */
typedef struct _snd_ump_msg_flex_data_meta {
-#ifdef SNDRV_BIG_ENDIAN_BITFIELD
+#if __BYTE_ORDER == __BIG_ENDIAN
uint8_t type:4; /**< UMP packet type */
uint8_t group:4; /**< UMP Group */
uint8_t format:2; /**< Format */
/** Set Tempo Message (128bit) */
typedef struct _snd_ump_msg_set_tempo {
-#ifdef SNDRV_BIG_ENDIAN_BITFIELD
+#if __BYTE_ORDER == __BIG_ENDIAN
uint8_t type:4; /**< UMP packet type */
uint8_t group:4; /**< UMP Group */
uint8_t format:2; /**< Format */
/** Set Time Signature Message (128bit) */
typedef struct _snd_ump_msg_set_time_sig {
-#ifdef SNDRV_BIG_ENDIAN_BITFIELD
+#if __BYTE_ORDER == __BIG_ENDIAN
uint8_t type:4; /**< UMP packet type */
uint8_t group:4; /**< UMP Group */
uint8_t format:2; /**< Format */
/** Set Metronome Message (128bit) */
typedef struct _snd_ump_msg_set_metronome {
-#ifdef SNDRV_BIG_ENDIAN_BITFIELD
+#if __BYTE_ORDER == __BIG_ENDIAN
uint8_t type:4; /**< UMP packet type */
uint8_t group:4; /**< UMP Group */
uint8_t format:2; /**< Format */
/** Set Key Signature Message (128bit) */
typedef struct _snd_ump_msg_set_key_sig {
-#ifdef SNDRV_BIG_ENDIAN_BITFIELD
+#if __BYTE_ORDER == __BIG_ENDIAN
uint8_t type:4; /**< UMP packet type */
uint8_t group:4; /**< UMP Group */
uint8_t format:2; /**< Format */
/** Set Chord Name Message (128bit) */
typedef struct _snd_ump_msg_set_chord_name {
-#ifdef SNDRV_BIG_ENDIAN_BITFIELD
+#if __BYTE_ORDER == __BIG_ENDIAN
uint8_t type:4; /**< UMP packet type */
uint8_t group:4; /**< UMP Group */
uint8_t format:2; /**< Format */
/** Jitter Reduction Clock / Timestamp Message (32bit) */
typedef struct _snd_ump_msg_jr_clock {
-#ifdef SNDRV_BIG_ENDIAN_BITFIELD
+#if __BYTE_ORDER == __BIG_ENDIAN
uint8_t type:4; /**< UMP packet type */
uint8_t group:4; /**< UMP Group */
uint8_t status:4; /**< Status */
/** Delta Clockstamp Ticks Per Quarter Note (DCTPQ) (32bit) */
typedef struct _snd_ump_msg_dctpq {
-#ifdef SNDRV_BIG_ENDIAN_BITFIELD
+#if __BYTE_ORDER == __BIG_ENDIAN
uint8_t type:4; /**< UMP packet type */
uint8_t group:4; /**< UMP Group */
uint8_t status:4; /**< Status */
/** Delta Clockstamp (DC) (32bit) */
typedef struct _snd_ump_msg_dc {
-#ifdef SNDRV_BIG_ENDIAN_BITFIELD
+#if __BYTE_ORDER == __BIG_ENDIAN
uint32_t type:4; /**< UMP packet type */
uint32_t group:4; /**< UMP Group */
uint32_t status:4; /**< Status */
*/
static inline uint8_t snd_ump_get_byte(const uint32_t *ump, unsigned int offset)
{
-#ifdef SNDRV_BIG_ENDIAN
+#if __BYTE_ORDER == __BIG_ENDIAN
return ((const uint8_t *)ump)[offset];
#else
return ((const uint8_t *)ump)[(offset & ~3) | (3 - (offset & 3))];