[ARM] pxa: Gumstix Verdex PCMCIA support
[linux-2.6/verdex.git] / drivers / staging / line6 / pcm.h
blob53db217cd42d4fcc015293e21e088ea24d18068a
1 /*
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.
16 #ifndef PCM_H
17 #define PCM_H
20 #include <sound/pcm.h>
22 #include "driver.h"
23 #include "usbdefs.h"
26 /* number of URBs */
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)
46 enum {
47 BIT_RUNNING_PLAYBACK,
48 BIT_RUNNING_CAPTURE,
49 BIT_PAUSE_PLAYBACK,
50 BIT_PREPARED
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;
56 int bytes_per_frame;
59 struct snd_line6_pcm {
60 /**
61 Pointer back to the Line6 driver data structure.
63 struct usb_line6 *line6;
65 /**
66 Properties.
68 struct line6_pcm_properties *properties;
70 /**
71 ALSA pcm stream
73 struct snd_pcm *pcm;
75 /**
76 URBs for audio playback.
78 struct urb *urb_audio_out[LINE6_ISO_BUFFERS];
80 /**
81 URBs for audio capture.
83 struct urb *urb_audio_in[LINE6_ISO_BUFFERS];
85 /**
86 Temporary buffer to hold data when playback buffer wraps.
88 unsigned char *wrap_out;
90 /**
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;
97 /**
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
105 finished).
107 unsigned bytes_out;
110 Counter to create desired playback sample rate.
112 unsigned count_out;
115 Playback period size in bytes
117 unsigned period_out;
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
123 position.
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
130 finished).
132 unsigned bytes_in;
135 Counter to create desired capture sample rate.
137 unsigned count_in;
140 Capture period size in bytes
142 unsigned period_in;
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
148 position.
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.
160 int max_packet_size;
163 USB endpoint for listening to audio data.
165 int ep_audio_read;
168 USB endpoint for writing audio data.
170 int ep_audio_write;
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
189 contents!)
191 spinlock_t lock_audio_out;
194 Spin lock to protect updates of the capture buffer positions (not
195 contents!)
197 spinlock_t lock_audio_in;
200 Spin lock to protect trigger.
202 spinlock_t lock_trigger;
205 PCM playback volume (left and right).
207 int volume[2];
210 Several status bits (see BIT_*).
212 unsigned long flags;
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);
222 #endif