summaryrefslogtreecommitdiffstats
path: root/sound/firewire/amdtp-stream.h
diff options
context:
space:
mode:
Diffstat (limited to 'sound/firewire/amdtp-stream.h')
-rw-r--r--sound/firewire/amdtp-stream.h47
1 files changed, 37 insertions, 10 deletions
diff --git a/sound/firewire/amdtp-stream.h b/sound/firewire/amdtp-stream.h
index 3942894c11ac..bbbca964b9b4 100644
--- a/sound/firewire/amdtp-stream.h
+++ b/sound/firewire/amdtp-stream.h
@@ -33,6 +33,8 @@
33 * @CIP_HEADER_WITHOUT_EOH: Only for in-stream. CIP Header doesn't include 33 * @CIP_HEADER_WITHOUT_EOH: Only for in-stream. CIP Header doesn't include
34 * valid EOH. 34 * valid EOH.
35 * @CIP_NO_HEADERS: a lack of headers in packets 35 * @CIP_NO_HEADERS: a lack of headers in packets
36 * @CIP_UNALIGHED_DBC: Only for in-stream. The value of dbc is not alighed to
37 * the value of current SYT_INTERVAL; e.g. initial value is not zero.
36 */ 38 */
37enum cip_flags { 39enum cip_flags {
38 CIP_NONBLOCKING = 0x00, 40 CIP_NONBLOCKING = 0x00,
@@ -45,6 +47,7 @@ enum cip_flags {
45 CIP_JUMBO_PAYLOAD = 0x40, 47 CIP_JUMBO_PAYLOAD = 0x40,
46 CIP_HEADER_WITHOUT_EOH = 0x80, 48 CIP_HEADER_WITHOUT_EOH = 0x80,
47 CIP_NO_HEADER = 0x100, 49 CIP_NO_HEADER = 0x100,
50 CIP_UNALIGHED_DBC = 0x200,
48}; 51};
49 52
50/** 53/**
@@ -91,12 +94,20 @@ enum amdtp_stream_direction {
91 AMDTP_IN_STREAM 94 AMDTP_IN_STREAM
92}; 95};
93 96
97struct pkt_desc {
98 u32 cycle;
99 u32 syt;
100 unsigned int data_blocks;
101 unsigned int data_block_counter;
102 __be32 *ctx_payload;
103};
104
94struct amdtp_stream; 105struct amdtp_stream;
95typedef unsigned int (*amdtp_stream_process_data_blocks_t)( 106typedef unsigned int (*amdtp_stream_process_ctx_payloads_t)(
96 struct amdtp_stream *s, 107 struct amdtp_stream *s,
97 __be32 *buffer, 108 const struct pkt_desc *desc,
98 unsigned int data_blocks, 109 unsigned int packets,
99 unsigned int *syt); 110 struct snd_pcm_substream *pcm);
100struct amdtp_stream { 111struct amdtp_stream {
101 struct fw_unit *unit; 112 struct fw_unit *unit;
102 enum cip_flags flags; 113 enum cip_flags flags;
@@ -107,6 +118,7 @@ struct amdtp_stream {
107 struct fw_iso_context *context; 118 struct fw_iso_context *context;
108 struct iso_packets_buffer buffer; 119 struct iso_packets_buffer buffer;
109 int packet_index; 120 int packet_index;
121 struct pkt_desc *pkt_descs;
110 int tag; 122 int tag;
111 union { 123 union {
112 struct { 124 struct {
@@ -119,8 +131,6 @@ struct amdtp_stream {
119 // Fixed interval of dbc between previos/current 131 // Fixed interval of dbc between previos/current
120 // packets. 132 // packets.
121 unsigned int dbc_interval; 133 unsigned int dbc_interval;
122 // Indicate the value of dbc field in a first packet.
123 unsigned int first_dbc;
124 } tx; 134 } tx;
125 struct { 135 struct {
126 // To calculate CIP data blocks and tstamp. 136 // To calculate CIP data blocks and tstamp.
@@ -131,6 +141,7 @@ struct amdtp_stream {
131 141
132 // To generate CIP header. 142 // To generate CIP header.
133 unsigned int fdf; 143 unsigned int fdf;
144 int syt_override;
134 } rx; 145 } rx;
135 } ctx_data; 146 } ctx_data;
136 147
@@ -158,13 +169,18 @@ struct amdtp_stream {
158 169
159 /* For backends to process data blocks. */ 170 /* For backends to process data blocks. */
160 void *protocol; 171 void *protocol;
161 amdtp_stream_process_data_blocks_t process_data_blocks; 172 amdtp_stream_process_ctx_payloads_t process_ctx_payloads;
173
174 // For domain.
175 int channel;
176 int speed;
177 struct list_head list;
162}; 178};
163 179
164int amdtp_stream_init(struct amdtp_stream *s, struct fw_unit *unit, 180int amdtp_stream_init(struct amdtp_stream *s, struct fw_unit *unit,
165 enum amdtp_stream_direction dir, enum cip_flags flags, 181 enum amdtp_stream_direction dir, enum cip_flags flags,
166 unsigned int fmt, 182 unsigned int fmt,
167 amdtp_stream_process_data_blocks_t process_data_blocks, 183 amdtp_stream_process_ctx_payloads_t process_ctx_payloads,
168 unsigned int protocol_size); 184 unsigned int protocol_size);
169void amdtp_stream_destroy(struct amdtp_stream *s); 185void amdtp_stream_destroy(struct amdtp_stream *s);
170 186
@@ -172,9 +188,7 @@ int amdtp_stream_set_parameters(struct amdtp_stream *s, unsigned int rate,
172 unsigned int data_block_quadlets); 188 unsigned int data_block_quadlets);
173unsigned int amdtp_stream_get_max_payload(struct amdtp_stream *s); 189unsigned int amdtp_stream_get_max_payload(struct amdtp_stream *s);
174 190
175int amdtp_stream_start(struct amdtp_stream *s, int channel, int speed);
176void amdtp_stream_update(struct amdtp_stream *s); 191void amdtp_stream_update(struct amdtp_stream *s);
177void amdtp_stream_stop(struct amdtp_stream *s);
178 192
179int amdtp_stream_add_pcm_hw_constraints(struct amdtp_stream *s, 193int amdtp_stream_add_pcm_hw_constraints(struct amdtp_stream *s,
180 struct snd_pcm_runtime *runtime); 194 struct snd_pcm_runtime *runtime);
@@ -256,4 +270,17 @@ static inline bool amdtp_stream_wait_callback(struct amdtp_stream *s,
256 msecs_to_jiffies(timeout)) > 0; 270 msecs_to_jiffies(timeout)) > 0;
257} 271}
258 272
273struct amdtp_domain {
274 struct list_head streams;
275};
276
277int amdtp_domain_init(struct amdtp_domain *d);
278void amdtp_domain_destroy(struct amdtp_domain *d);
279
280int amdtp_domain_add_stream(struct amdtp_domain *d, struct amdtp_stream *s,
281 int channel, int speed);
282
283int amdtp_domain_start(struct amdtp_domain *d);
284void amdtp_domain_stop(struct amdtp_domain *d);
285
259#endif 286#endif