static int parse_ir_ctx_header(struct amdtp_stream *s, unsigned int cycle,
const __be32 *ctx_header,
unsigned int *payload_length,
- unsigned int *data_blocks,
+ unsigned int *data_blocks, unsigned int *dbc,
unsigned int *syt, unsigned int index)
{
const __be32 *cip_header;
- unsigned int dbc;
int err;
*payload_length = be32_to_cpu(ctx_header[0]) >> ISO_DATA_LENGTH_SHIFT;
if (!(s->flags & CIP_NO_HEADER)) {
cip_header = ctx_header + 2;
err = check_cip_header(s, cip_header, *payload_length,
- data_blocks, &dbc, syt);
+ data_blocks, dbc, syt);
if (err < 0) {
if (err != -EAGAIN)
return err;
*data_blocks = 0;
- dbc = s->data_block_counter;
}
} else {
cip_header = NULL;
err = 0;
*data_blocks = *payload_length / sizeof(__be32) /
s->data_block_quadlets;
- dbc = s->data_block_counter;
+ *dbc = s->data_block_counter;
*syt = 0;
}
if (err >= 0 && s->flags & CIP_DBC_IS_END_EVENT)
- s->data_block_counter = dbc;
+ s->data_block_counter = *dbc;
trace_amdtp_packet(s, cycle, cip_header, *payload_length, *data_blocks,
index);
- if (err >= 0 && !(s->flags & CIP_DBC_IS_END_EVENT))
- s->data_block_counter = (dbc + *data_blocks) & 0xff;
-
return err;
}
for (i = 0; i < packets; i++) {
u32 cycle;
unsigned int payload_length;
- unsigned int data_block;
+ unsigned int data_blocks;
+ unsigned int dbc;
unsigned int syt;
__be32 *buffer;
unsigned int pcm_frames = 0;
cycle = compute_cycle_count(ctx_header[1]);
err = parse_ir_ctx_header(s, cycle, ctx_header, &payload_length,
- &data_block, &syt, i);
+ &data_blocks, &dbc, &syt, i);
if (err < 0 && err != -EAGAIN)
break;
+
if (err >= 0) {
buffer = s->buffer.packets[s->packet_index].buffer;
pcm_frames = s->process_data_blocks(s, buffer,
- data_block, &syt);
+ data_blocks, &syt);
+
+ if (!(s->flags & CIP_DBC_IS_END_EVENT)) {
+ s->data_block_counter =
+ (dbc + data_blocks) & 0xff;
+ }
}
if (queue_in_packet(s, ¶ms) < 0)