162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
262306a36Sopenharmony_ci#ifndef SOUND_FIREWIRE_LIB_H_INCLUDED
362306a36Sopenharmony_ci#define SOUND_FIREWIRE_LIB_H_INCLUDED
462306a36Sopenharmony_ci
562306a36Sopenharmony_ci#include <linux/firewire-constants.h>
662306a36Sopenharmony_ci#include <linux/types.h>
762306a36Sopenharmony_ci#include <linux/sched.h>
862306a36Sopenharmony_ci#include <sound/rawmidi.h>
962306a36Sopenharmony_ci
1062306a36Sopenharmony_cistruct fw_unit;
1162306a36Sopenharmony_ci
1262306a36Sopenharmony_ci#define FW_GENERATION_MASK	0x00ff
1362306a36Sopenharmony_ci#define FW_FIXED_GENERATION	0x0100
1462306a36Sopenharmony_ci#define FW_QUIET		0x0200
1562306a36Sopenharmony_ci
1662306a36Sopenharmony_ciint snd_fw_transaction(struct fw_unit *unit, int tcode,
1762306a36Sopenharmony_ci		       u64 offset, void *buffer, size_t length,
1862306a36Sopenharmony_ci		       unsigned int flags);
1962306a36Sopenharmony_ci
2062306a36Sopenharmony_ci/* returns true if retrying the transaction would not make sense */
2162306a36Sopenharmony_cistatic inline bool rcode_is_permanent_error(int rcode)
2262306a36Sopenharmony_ci{
2362306a36Sopenharmony_ci	return rcode == RCODE_TYPE_ERROR || rcode == RCODE_ADDRESS_ERROR;
2462306a36Sopenharmony_ci}
2562306a36Sopenharmony_ci
2662306a36Sopenharmony_ci#endif
27