xref: /openbmc/linux/sound/usb/line6/midibuf.h (revision 27121864ab366992583d894961ecdc6e2ffe0ca1)
1a10e763bSThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-only */
261864d84STakashi Iwai /*
3c078a4aaSChris Rorvick  * Line 6 Linux USB driver
461864d84STakashi Iwai  *
561864d84STakashi Iwai  * Copyright (C) 2004-2010 Markus Grabner (grabner@icg.tugraz.at)
661864d84STakashi Iwai  */
761864d84STakashi Iwai 
861864d84STakashi Iwai #ifndef MIDIBUF_H
961864d84STakashi Iwai #define MIDIBUF_H
1061864d84STakashi Iwai 
11*8508fa2eSArtem Egorkine #define LINE6_MIDIBUF_READ_TX 0
12*8508fa2eSArtem Egorkine #define LINE6_MIDIBUF_READ_RX 1
13*8508fa2eSArtem Egorkine 
1461864d84STakashi Iwai struct midi_buffer {
1561864d84STakashi Iwai 	unsigned char *buf;
1661864d84STakashi Iwai 	int size;
1761864d84STakashi Iwai 	int split;
1861864d84STakashi Iwai 	int pos_read, pos_write;
1961864d84STakashi Iwai 	int full;
2061864d84STakashi Iwai 	int command_prev;
2161864d84STakashi Iwai };
2261864d84STakashi Iwai 
2361864d84STakashi Iwai extern int line6_midibuf_bytes_used(struct midi_buffer *mb);
2461864d84STakashi Iwai extern int line6_midibuf_bytes_free(struct midi_buffer *mb);
2561864d84STakashi Iwai extern void line6_midibuf_destroy(struct midi_buffer *mb);
2661864d84STakashi Iwai extern int line6_midibuf_ignore(struct midi_buffer *mb, int length);
2761864d84STakashi Iwai extern int line6_midibuf_init(struct midi_buffer *mb, int size, int split);
2861864d84STakashi Iwai extern int line6_midibuf_read(struct midi_buffer *mb, unsigned char *data,
29*8508fa2eSArtem Egorkine 			      int length, int read_type);
3061864d84STakashi Iwai extern void line6_midibuf_reset(struct midi_buffer *mb);
3161864d84STakashi Iwai extern int line6_midibuf_write(struct midi_buffer *mb, unsigned char *data,
3261864d84STakashi Iwai 			       int length);
3361864d84STakashi Iwai 
3461864d84STakashi Iwai #endif
35