| 1 |
/* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 |
/* |
| 3 |
* amdtp-motu-trace.h - tracepoint definitions to dump a part of packet data |
| 4 |
* |
| 5 |
* Copyright (c) 2017 Takashi Sakamoto |
| 6 |
*/ |
| 7 |
|
| 8 |
#undef TRACE_SYSTEM |
| 9 |
#define TRACE_SYSTEM snd_firewire_motu |
| 10 |
|
| 11 |
#if !defined(_SND_FIREWIRE_MOTU_TRACE_H) || defined(TRACE_HEADER_MULTI_READ) |
| 12 |
#define _SND_FIREWIRE_MOTU_TRACE_H |
| 13 |
|
| 14 |
#include <linux/tracepoint.h> |
| 15 |
|
| 16 |
static void copy_sph(u32 *frame, __be32 *buffer, unsigned int data_blocks, |
| 17 |
unsigned int data_block_quadlets); |
| 18 |
static void copy_message(u64 *frames, __be32 *buffer, unsigned int data_blocks, |
| 19 |
unsigned int data_block_quadlets); |
| 20 |
|
| 21 |
TRACE_EVENT(data_block_sph, |
| 22 |
TP_PROTO(struct amdtp_stream *s, unsigned int data_blocks, __be32 *buffer), |
| 23 |
TP_ARGS(s, data_blocks, buffer), |
| 24 |
TP_STRUCT__entry( |
| 25 |
__field(int, src) |
| 26 |
__field(int, dst) |
| 27 |
__field(unsigned int, data_blocks) |
| 28 |
__dynamic_array(u32, tstamps, data_blocks) |
| 29 |
), |
| 30 |
TP_fast_assign( |
| 31 |
if (s->direction == AMDTP_IN_STREAM) { |
| 32 |
__entry->src = fw_parent_device(s->unit)->node_id; |
| 33 |
__entry->dst = fw_parent_device(s->unit)->card->node_id; |
| 34 |
} else { |
| 35 |
__entry->src = fw_parent_device(s->unit)->card->node_id; |
| 36 |
__entry->dst = fw_parent_device(s->unit)->node_id; |
| 37 |
} |
| 38 |
__entry->data_blocks = data_blocks; |
| 39 |
copy_sph(__get_dynamic_array(tstamps), buffer, data_blocks, s->data_block_quadlets); |
| 40 |
), |
| 41 |
TP_printk( |
| 42 |
"%04x %04x %u %s", |
| 43 |
__entry->src, |
| 44 |
__entry->dst, |
| 45 |
__entry->data_blocks, |
| 46 |
__print_array(__get_dynamic_array(tstamps), __entry->data_blocks, 4) |
| 47 |
) |
| 48 |
); |
| 49 |
|
| 50 |
TRACE_EVENT(data_block_message, |
| 51 |
TP_PROTO(struct amdtp_stream *s, unsigned int data_blocks, __be32 *buffer), |
| 52 |
TP_ARGS(s, data_blocks, buffer), |
| 53 |
TP_STRUCT__entry( |
| 54 |
__field(int, src) |
| 55 |
__field(int, dst) |
| 56 |
__field(unsigned int, data_blocks) |
| 57 |
__dynamic_array(u64, messages, data_blocks) |
| 58 |
), |
| 59 |
TP_fast_assign( |
| 60 |
if (s->direction == AMDTP_IN_STREAM) { |
| 61 |
__entry->src = fw_parent_device(s->unit)->node_id; |
| 62 |
__entry->dst = fw_parent_device(s->unit)->card->node_id; |
| 63 |
} else { |
| 64 |
__entry->src = fw_parent_device(s->unit)->card->node_id; |
| 65 |
__entry->dst = fw_parent_device(s->unit)->node_id; |
| 66 |
} |
| 67 |
__entry->data_blocks = data_blocks; |
| 68 |
copy_message(__get_dynamic_array(messages), buffer, data_blocks, s->data_block_quadlets); |
| 69 |
), |
| 70 |
TP_printk( |
| 71 |
"%04x %04x %u %s", |
| 72 |
__entry->src, |
| 73 |
__entry->dst, |
| 74 |
__entry->data_blocks, |
| 75 |
__print_array(__get_dynamic_array(messages), __entry->data_blocks, 8) |
| 76 |
) |
| 77 |
); |
| 78 |
|
| 79 |
#endif |
| 80 |
|
| 81 |
#undef TRACE_INCLUDE_PATH |
| 82 |
#define TRACE_INCLUDE_PATH . |
| 83 |
#undef TRACE_INCLUDE_FILE |
| 84 |
#define TRACE_INCLUDE_FILE amdtp-motu-trace |
| 85 |
#include <trace/define_trace.h> |