linux/sound/usb/line6/driver.h

/* SPDX-License-Identifier: GPL-2.0-only */
/*
 * Line 6 Linux USB driver
 *
 * Copyright (C) 2004-2010 Markus Grabner ([email protected])
 */

#ifndef DRIVER_H
#define DRIVER_H

#include <linux/usb.h>
#include <linux/mutex.h>
#include <linux/kfifo.h>
#include <sound/core.h>

#include "midi.h"

/* USB 1.1 speed configuration */
#define USB_LOW_INTERVALS_PER_SECOND
#define USB_LOW_ISO_BUFFERS

/* USB 2.0+ speed configuration */
#define USB_HIGH_INTERVALS_PER_SECOND
#define USB_HIGH_ISO_BUFFERS

/* Fallback USB interval and max packet size values */
#define LINE6_FALLBACK_INTERVAL
#define LINE6_FALLBACK_MAXPACKETSIZE

#define LINE6_TIMEOUT
#define LINE6_BUFSIZE_LISTEN
#define LINE6_MIDI_MESSAGE_MAXLEN

#define LINE6_RAW_MESSAGES_MAXCOUNT_ORDER
/* 4k packets are common, BUFSIZE * MAXCOUNT should be bigger... */
#define LINE6_RAW_MESSAGES_MAXCOUNT


#if LINE6_BUFSIZE_LISTEN > 65535
#error "Use dynamic fifo instead"
#endif

/*
	Line 6 MIDI control commands
*/
#define LINE6_PARAM_CHANGE
#define LINE6_PROGRAM_CHANGE
#define LINE6_SYSEX_BEGIN
#define LINE6_SYSEX_END
#define LINE6_RESET

/*
	MIDI channel for messages initiated by the host
	(and eventually echoed back by the device)
*/
#define LINE6_CHANNEL_HOST

/*
	MIDI channel for messages initiated by the device
*/
#define LINE6_CHANNEL_DEVICE

#define LINE6_CHANNEL_UNKNOWN

#define LINE6_CHANNEL_MASK

extern const unsigned char line6_midi_id[3];

#define SYSEX_DATA_OFS
#define SYSEX_EXTRA_SIZE

/*
	 Common properties of Line 6 devices.
*/
struct line6_properties {};

/* Capability bits */
enum {};

/*
	 Common data shared by all Line 6 devices.
	 Corresponds to a pair of USB endpoints.
*/
struct usb_line6 {};

extern char *line6_alloc_sysex_buffer(struct usb_line6 *line6, int code1,
				      int code2, int size);
extern int line6_read_data(struct usb_line6 *line6, unsigned address,
			   void *data, unsigned datalen);
extern int line6_read_serial_number(struct usb_line6 *line6,
				    u32 *serial_number);
extern int line6_send_raw_message(struct usb_line6 *line6,
					const char *buffer, int size);
extern int line6_send_raw_message_async(struct usb_line6 *line6,
					const char *buffer, int size);
extern int line6_send_sysex_message(struct usb_line6 *line6,
				    const char *buffer, int size);
extern int line6_version_request_async(struct usb_line6 *line6);
extern int line6_write_data(struct usb_line6 *line6, unsigned address,
			    void *data, unsigned datalen);

int line6_probe(struct usb_interface *interface,
		const struct usb_device_id *id,
		const char *driver_name,
		const struct line6_properties *properties,
		int (*private_init)(struct usb_line6 *, const struct usb_device_id *id),
		size_t data_size);

void line6_disconnect(struct usb_interface *interface);

#ifdef CONFIG_PM
int line6_suspend(struct usb_interface *interface, pm_message_t message);
int line6_resume(struct usb_interface *interface);
#endif

#endif