}
}
+static void probe_tracepoints_events(struct amdtp_stream *s,
+ const struct pkt_desc *descs,
+ unsigned int packets)
+{
+ int i;
+
+ for (i = 0; i < packets; ++i) {
+ const struct pkt_desc *desc = descs + i;
+ __be32 *buf = desc->ctx_payload;
+ unsigned int data_blocks = desc->data_blocks;
+
+ trace_data_block_sph(s, data_blocks, buf);
+ trace_data_block_message(s, data_blocks, buf);
+ }
+}
+
static unsigned int process_ir_ctx_payloads(struct amdtp_stream *s,
const struct pkt_desc *descs,
unsigned int packets,
unsigned int pcm_frames = 0;
int i;
+ // For data block processing.
for (i = 0; i < packets; ++i) {
const struct pkt_desc *desc = descs + i;
__be32 *buf = desc->ctx_payload;
unsigned int data_blocks = desc->data_blocks;
- trace_data_block_sph(s, data_blocks, buf);
- trace_data_block_message(s, data_blocks, buf);
-
- if (p->midi_ports)
- read_midi_messages(s, buf, data_blocks);
-
if (pcm) {
read_pcm_s32(s, pcm, buf, data_blocks, pcm_frames);
pcm_frames += data_blocks;
}
+
+ if (p->midi_ports)
+ read_midi_messages(s, buf, data_blocks);
}
+ // For tracepoints.
+ if (trace_data_block_sph_enabled() ||
+ trace_data_block_message_enabled())
+ probe_tracepoints_events(s, descs, packets);
+
return pcm_frames;
}
unsigned int pcm_frames = 0;
int i;
+ // For data block processing.
for (i = 0; i < packets; ++i) {
const struct pkt_desc *desc = descs + i;
__be32 *buf = desc->ctx_payload;
unsigned int data_blocks = desc->data_blocks;
- // TODO: how to interact control messages between userspace?
-
- if (p->midi_ports)
- write_midi_messages(s, buf, data_blocks);
-
if (pcm) {
write_pcm_s32(s, pcm, buf, data_blocks, pcm_frames);
pcm_frames += data_blocks;
write_pcm_silence(s, buf, data_blocks);
}
- write_sph(s, buf, data_blocks);
+ if (p->midi_ports)
+ write_midi_messages(s, buf, data_blocks);
- trace_data_block_sph(s, data_blocks, buf);
- trace_data_block_message(s, data_blocks, buf);
+ // TODO: how to interact control messages between userspace?
+
+ write_sph(s, buf, data_blocks);
}
+ // For tracepoints.
+ if (trace_data_block_sph_enabled() ||
+ trace_data_block_message_enabled())
+ probe_tracepoints_events(s, descs, packets);
+
return pcm_frames;
}