ump_convert.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. // SPDX-License-Identifier: GPL-2.0-or-later
  2. #ifndef __SOUND_UMP_CONVERT_H
  3. #define __SOUND_UMP_CONVERT_H
  4. #include <sound/ump_msg.h>
  5. /* context for converting from legacy control messages to UMP packet */
  6. struct ump_cvt_to_ump_bank {
  7. bool rpn_set;
  8. bool nrpn_set;
  9. bool bank_set;
  10. unsigned char cc_rpn_msb, cc_rpn_lsb;
  11. unsigned char cc_nrpn_msb, cc_nrpn_lsb;
  12. unsigned char cc_data_msb, cc_data_lsb;
  13. unsigned char cc_bank_msb, cc_bank_lsb;
  14. bool cc_data_msb_set, cc_data_lsb_set;
  15. };
  16. /* context for converting from MIDI1 byte stream to UMP packet */
  17. struct ump_cvt_to_ump {
  18. /* MIDI1 intermediate buffer */
  19. unsigned char buf[6]; /* up to 6 bytes for SysEx */
  20. int len;
  21. int cmd_bytes;
  22. /* UMP output packet */
  23. u32 ump[4];
  24. int ump_bytes;
  25. /* various status */
  26. unsigned int in_sysex;
  27. struct ump_cvt_to_ump_bank bank[16]; /* per channel */
  28. };
  29. int snd_ump_convert_from_ump(const u32 *data, unsigned char *dst,
  30. unsigned char *group_ret);
  31. void snd_ump_convert_to_ump(struct ump_cvt_to_ump *cvt, unsigned char group,
  32. unsigned int protocol, unsigned char c);
  33. /* reset the converter context, called at each open to ump */
  34. static inline void snd_ump_convert_reset(struct ump_cvt_to_ump *ctx)
  35. {
  36. memset(ctx, 0, sizeof(*ctx));
  37. }
  38. #endif /* __SOUND_UMP_CONVERT_H */