2 * Linux driver for TerraTec DMX 6Fire USB
4 * Author: Torsten Schenk <torsten.schenk@zoho.com>
5 * Created: Jan 01, 2011
6 * Copyright: (C) Torsten Schenk
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
14 #ifndef USB6FIRE_PCM_H
15 #define USB6FIRE_PCM_H
17 #include <sound/pcm.h>
18 #include <linux/mutex.h>
22 enum /* settings for pcm */
24 /* maximum of EP_W_MAX_PACKET_SIZE[] (see firmware.c) */
25 PCM_N_URBS = 16, PCM_N_PACKETS_PER_URB = 8, PCM_MAX_PACKET_SIZE = 604
29 struct sfire_chip *chip;
31 /* BEGIN DO NOT SEPARATE */
33 struct usb_iso_packet_descriptor packets[PCM_N_PACKETS_PER_URB];
34 /* END DO NOT SEPARATE */
40 struct pcm_substream {
42 struct snd_pcm_substream *instance;
46 snd_pcm_uframes_t dma_off; /* current position in alsa dma_area */
47 snd_pcm_uframes_t period_off; /* current position in current period */
51 struct sfire_chip *chip;
52 struct snd_pcm *instance;
54 struct pcm_substream playback;
55 struct pcm_substream capture;
56 bool panic; /* if set driver won't do anymore pcm on device */
58 struct pcm_urb in_urbs[PCM_N_URBS];
59 struct pcm_urb out_urbs[PCM_N_URBS];
62 int in_n_analog; /* number of analog channels soundcard sends */
63 int out_n_analog; /* number of analog channels soundcard receives */
65 struct mutex stream_mutex;
66 u8 stream_state; /* one of STREAM_XXX (pcm.c) */
67 u8 rate; /* one of PCM_RATE_XXX */
68 wait_queue_head_t stream_wait_queue;
69 bool stream_wait_cond;
72 int usb6fire_pcm_init(struct sfire_chip *chip);
73 void usb6fire_pcm_abort(struct sfire_chip *chip);
74 void usb6fire_pcm_destroy(struct sfire_chip *chip);
75 #endif /* USB6FIRE_PCM_H */