18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci#ifndef SOUND_FIREWIRE_LIB_H_INCLUDED
38c2ecf20Sopenharmony_ci#define SOUND_FIREWIRE_LIB_H_INCLUDED
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ci#include <linux/firewire-constants.h>
68c2ecf20Sopenharmony_ci#include <linux/types.h>
78c2ecf20Sopenharmony_ci#include <linux/sched.h>
88c2ecf20Sopenharmony_ci#include <sound/rawmidi.h>
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_cistruct fw_unit;
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ci#define FW_GENERATION_MASK	0x00ff
138c2ecf20Sopenharmony_ci#define FW_FIXED_GENERATION	0x0100
148c2ecf20Sopenharmony_ci#define FW_QUIET		0x0200
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ciint snd_fw_transaction(struct fw_unit *unit, int tcode,
178c2ecf20Sopenharmony_ci		       u64 offset, void *buffer, size_t length,
188c2ecf20Sopenharmony_ci		       unsigned int flags);
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ci/* returns true if retrying the transaction would not make sense */
218c2ecf20Sopenharmony_cistatic inline bool rcode_is_permanent_error(int rcode)
228c2ecf20Sopenharmony_ci{
238c2ecf20Sopenharmony_ci	return rcode == RCODE_TYPE_ERROR || rcode == RCODE_ADDRESS_ERROR;
248c2ecf20Sopenharmony_ci}
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_civoid snd_fw_schedule_registration(struct fw_unit *unit,
278c2ecf20Sopenharmony_ci				  struct delayed_work *dwork);
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_ci#endif
30