2 * Line6 Linux USB driver - 0.8.0
4 * Copyright (C) 2004-2009 Markus Grabner (grabner@icg.tugraz.at)
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation, version 2.
13 PCM interface to POD series devices.
20 #include <sound/pcm.h>
27 #define LINE6_ISO_BUFFERS 8
29 /* number of USB frames per URB */
30 #define LINE6_ISO_PACKETS 2
32 /* in a "full speed" device (such as the PODxt Pro) this means 1ms */
33 #define LINE6_ISO_INTERVAL 1
35 /* this should be queried dynamically from the USB interface! */
36 #define LINE6_ISO_PACKET_SIZE_MAX 252
40 Extract the messaging device from the substream instance
42 #define s2m(s) (((struct snd_line6_pcm *) \
43 snd_pcm_substream_chip(s))->line6->ifcdev)
53 struct line6_pcm_properties {
54 struct snd_pcm_hardware snd_line6_playback_hw, snd_line6_capture_hw;
55 struct snd_pcm_hw_constraint_ratdens snd_line6_rates;
59 struct snd_line6_pcm {
61 Pointer back to the Line6 driver data structure.
63 struct usb_line6 *line6;
68 struct line6_pcm_properties *properties;
76 URBs for audio playback.
78 struct urb *urb_audio_out[LINE6_ISO_BUFFERS];
81 URBs for audio capture.
83 struct urb *urb_audio_in[LINE6_ISO_BUFFERS];
86 Temporary buffer to hold data when playback buffer wraps.
88 unsigned char *wrap_out;
91 Temporary buffer for capture.
92 Since the packet size is not known in advance, this buffer is
93 large enough to store maximum size packets.
95 unsigned char *buffer_in;
98 Free frame position in the playback buffer.
100 snd_pcm_uframes_t pos_out;
103 Count processed bytes for playback.
104 This is modulo period size (to determine when a period is
110 Counter to create desired playback sample rate.
115 Playback period size in bytes
120 Processed frame position in the playback buffer.
121 The contents of the output ring buffer have been consumed by
122 the USB subsystem (i.e., sent to the USB device) up to this
125 snd_pcm_uframes_t pos_out_done;
128 Count processed bytes for capture.
129 This is modulo period size (to determine when a period is
135 Counter to create desired capture sample rate.
140 Capture period size in bytes
145 Processed frame position in the capture buffer.
146 The contents of the output ring buffer have been consumed by
147 the USB subsystem (i.e., sent to the USB device) up to this
150 snd_pcm_uframes_t pos_in_done;
153 Bit mask of active playback URBs.
155 unsigned long active_urb_out;
158 Maximum size of USB packet.
163 USB endpoint for listening to audio data.
168 USB endpoint for writing audio data.
173 Bit mask of active capture URBs.
175 unsigned long active_urb_in;
178 Bit mask of playback URBs currently being unlinked.
180 unsigned long unlink_urb_out;
183 Bit mask of capture URBs currently being unlinked.
185 unsigned long unlink_urb_in;
188 Spin lock to protect updates of the playback buffer positions (not
191 spinlock_t lock_audio_out;
194 Spin lock to protect updates of the capture buffer positions (not
197 spinlock_t lock_audio_in;
200 Spin lock to protect trigger.
202 spinlock_t lock_trigger;
205 PCM playback volume (left and right).
210 Several status bits (see BIT_*).
216 extern int line6_init_pcm(struct usb_line6 *line6,
217 struct line6_pcm_properties *properties);
218 extern int snd_line6_trigger(struct snd_pcm_substream *substream, int cmd);
219 extern int snd_line6_prepare(struct snd_pcm_substream *substream);