xref: /openbmc/linux/sound/firewire/lib.h (revision 762f99f4f3cb41a775b5157dd761217beba65873)
1*b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */
231ef9134SClemens Ladisch #ifndef SOUND_FIREWIRE_LIB_H_INCLUDED
331ef9134SClemens Ladisch #define SOUND_FIREWIRE_LIB_H_INCLUDED
431ef9134SClemens Ladisch 
531ef9134SClemens Ladisch #include <linux/firewire-constants.h>
631ef9134SClemens Ladisch #include <linux/types.h>
7585d7cbaSTakashi Sakamoto #include <linux/sched.h>
8585d7cbaSTakashi Sakamoto #include <sound/rawmidi.h>
931ef9134SClemens Ladisch 
1031ef9134SClemens Ladisch struct fw_unit;
1131ef9134SClemens Ladisch 
121b70485fSClemens Ladisch #define FW_GENERATION_MASK	0x00ff
131b70485fSClemens Ladisch #define FW_FIXED_GENERATION	0x0100
141b70485fSClemens Ladisch #define FW_QUIET		0x0200
151b70485fSClemens Ladisch 
1631ef9134SClemens Ladisch int snd_fw_transaction(struct fw_unit *unit, int tcode,
171b70485fSClemens Ladisch 		       u64 offset, void *buffer, size_t length,
181b70485fSClemens Ladisch 		       unsigned int flags);
1931ef9134SClemens Ladisch 
2031ef9134SClemens Ladisch /* returns true if retrying the transaction would not make sense */
rcode_is_permanent_error(int rcode)2131ef9134SClemens Ladisch static inline bool rcode_is_permanent_error(int rcode)
2231ef9134SClemens Ladisch {
2331ef9134SClemens Ladisch 	return rcode == RCODE_TYPE_ERROR || rcode == RCODE_ADDRESS_ERROR;
2431ef9134SClemens Ladisch }
2531ef9134SClemens Ladisch 
2631ef9134SClemens Ladisch #endif
27