sound/firewire/amdtp-stream.h

Source file repositories/reference/linux-study-clean/sound/firewire/amdtp-stream.h

File Facts

System
Linux kernel
Corpus path
sound/firewire/amdtp-stream.h
Extension
.h
Size
11027 bytes
Lines
373
Domain
Driver Families
Bucket
sound/firewire
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 pkt_desc {
	u32 cycle;
	u32 syt;
	unsigned int data_blocks;
	unsigned int data_block_counter;
	__be32 *ctx_payload;
	struct list_head link;
};

struct amdtp_stream;
typedef void (*amdtp_stream_process_ctx_payloads_t)(struct amdtp_stream *s,
						    const struct pkt_desc *desc,
						    unsigned int count,
						    struct snd_pcm_substream *pcm);

struct amdtp_domain;
struct amdtp_stream {
	struct fw_unit *unit;
	// The combination of cip_flags enumeration-constants.
	unsigned int flags;
	enum amdtp_stream_direction direction;
	struct mutex mutex;

	/* For packet processing. */
	struct fw_iso_context *context;
	struct iso_packets_buffer buffer;
	unsigned int queue_size;
	int packet_index;
	struct pkt_desc *packet_descs;
	struct list_head packet_descs_list;
	struct pkt_desc *packet_descs_cursor;
	int tag;
	union {
		struct {
			unsigned int ctx_header_size;

			// limit for payload of iso packet.
			unsigned int max_ctx_payload_length;

			// For quirks of CIP headers.
			// Fixed interval of dbc between previos/current
			// packets.
			unsigned int dbc_interval;

			// The device starts multiplexing events to the packet.
			bool event_starts;

			struct {
				struct seq_desc *descs;
				unsigned int size;
				unsigned int pos;
			} cache;
		} tx;
		struct {
			// To generate CIP header.
			unsigned int fdf;

			// To generate constant hardware IRQ.
			unsigned int event_count;

			// To calculate CIP data blocks and tstamp.
			struct {
				struct seq_desc *descs;
				unsigned int size;
				unsigned int pos;
			} seq;

			unsigned int data_block_state;
			unsigned int syt_offset_state;
			unsigned int last_syt_offset;

			struct amdtp_stream *replay_target;
			unsigned int cache_pos;
		} rx;
	} ctx_data;

	/* For CIP headers. */
	unsigned int source_node_id_field;
	unsigned int data_block_quadlets;
	unsigned int data_block_counter;
	unsigned int sph;
	unsigned int fmt;

	// Internal flags.
	unsigned int transfer_delay;
	enum cip_sfc sfc;
	unsigned int syt_interval;

	/* For a PCM substream processing. */
	struct snd_pcm_substream *pcm;

Annotation

Implementation Notes