sound/usb/line6/pcm.h

Source file repositories/reference/linux-study-clean/sound/usb/line6/pcm.h

File Facts

System
Linux kernel
Corpus path
sound/usb/line6/pcm.h
Extension
.h
Size
5259 bytes
Lines
196
Domain
Driver Families
Bucket
sound/usb
Inferred role
Driver Families: implementation source
Status
source implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

struct line6_pcm_properties {
	struct snd_pcm_hardware playback_hw, capture_hw;
	struct snd_pcm_hw_constraint_ratdens rates;
	int bytes_per_channel;
};

struct line6_pcm_stream {
	/* allocated URBs */
	struct urb **urbs;

	/* Temporary buffer;
	 * Since the packet size is not known in advance, this buffer is
	 * large enough to store maximum size packets.
	 */
	unsigned char *buffer;

	/* Free frame position in the buffer. */
	snd_pcm_uframes_t pos;

	/* Count processed bytes;
	 * This is modulo period size (to determine when a period is finished).
	 */
	unsigned bytes;

	/* Counter to create desired sample rate */
	unsigned count;

	/* period size in bytes */
	unsigned period;

	/* Processed frame position in the buffer;
	 * The contents of the ring buffer have been consumed by the USB
	 * subsystem (i.e., sent to the USB device) up to this position.
	 */
	snd_pcm_uframes_t pos_done;

	/* Bit mask of active URBs */
	unsigned long active_urbs;

	/* Bit mask of URBs currently being unlinked */
	unsigned long unlink_urbs;

	/* Spin lock to protect updates of the buffer positions (not contents)
	 */
	spinlock_t lock;

	/* Bit flags for operational stream types */
	unsigned long opened;

	/* Bit flags for running stream types */
	unsigned long running;

	int last_frame;
};

struct snd_line6_pcm {
	/* Pointer back to the Line 6 driver data structure */
	struct usb_line6 *line6;

	/* Properties. */
	struct line6_pcm_properties *properties;

	/* ALSA pcm stream */
	struct snd_pcm *pcm;

	/* protection to state changes of in/out streams */
	struct mutex state_mutex;

	/* Capture and playback streams */
	struct line6_pcm_stream in;
	struct line6_pcm_stream out;

	/* Previously captured frame (for software monitoring) */
	unsigned char *prev_fbuf;

	/* Size of previously captured frame (for software monitoring/sync) */
	int prev_fsize;

	/* Maximum size of USB packet */
	int max_packet_size_in;
	int max_packet_size_out;

	/* PCM playback volume (left and right) */
	int volume_playback[2];

	/* PCM monitor volume */
	int volume_monitor;

	/* Volume of impulse response test signal (if zero, test is disabled) */
	int impulse_volume;

Annotation

Implementation Notes