Takashi Sakamoto | 17909c1 | 2017-04-09 21:33:28 +0900 | [diff] [blame] | 1 | /* |
| 2 | * amdtp-motu-trace.h - tracepoint definitions to dump a part of packet data |
| 3 | * |
| 4 | * Copyright (c) 2017 Takashi Sakamoto |
| 5 | * Licensed under the terms of the GNU General Public License, version 2. |
| 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); |
Takashi Sakamoto | c6b0b9e | 2017-04-09 21:33:29 +0900 | [diff] [blame] | 18 | static void copy_message(u64 *frames, __be32 *buffer, unsigned int data_blocks, |
| 19 | unsigned int data_block_quadlets); |
Takashi Sakamoto | 17909c1 | 2017-04-09 21:33:28 +0900 | [diff] [blame] | 20 | |
| 21 | TRACE_EVENT(in_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 | __entry->src = fw_parent_device(s->unit)->node_id; |
| 32 | __entry->dst = fw_parent_device(s->unit)->card->node_id; |
| 33 | __entry->data_blocks = data_blocks; |
| 34 | copy_sph(__get_dynamic_array(tstamps), buffer, data_blocks, s->data_block_quadlets); |
| 35 | ), |
| 36 | TP_printk( |
| 37 | "%04x %04x %u %s", |
| 38 | __entry->src, |
| 39 | __entry->dst, |
| 40 | __entry->data_blocks, |
| 41 | __print_array(__get_dynamic_array(tstamps), __entry->data_blocks, 4) |
| 42 | ) |
| 43 | ); |
| 44 | |
| 45 | TRACE_EVENT(out_data_block_sph, |
| 46 | TP_PROTO(struct amdtp_stream *s, unsigned int data_blocks, __be32 *buffer), |
| 47 | TP_ARGS(s, data_blocks, buffer), |
| 48 | TP_STRUCT__entry( |
| 49 | __field(int, src) |
| 50 | __field(int, dst) |
| 51 | __field(unsigned int, data_blocks) |
| 52 | __dynamic_array(u32, tstamps, data_blocks) |
| 53 | ), |
| 54 | TP_fast_assign( |
| 55 | __entry->src = fw_parent_device(s->unit)->card->node_id; |
| 56 | __entry->dst = fw_parent_device(s->unit)->node_id; |
| 57 | __entry->data_blocks = data_blocks; |
| 58 | copy_sph(__get_dynamic_array(tstamps), buffer, data_blocks, s->data_block_quadlets); |
| 59 | ), |
| 60 | TP_printk( |
| 61 | "%04x %04x %u %s", |
| 62 | __entry->src, |
| 63 | __entry->dst, |
| 64 | __entry->data_blocks, |
| 65 | __print_array(__get_dynamic_array(tstamps), __entry->data_blocks, 4) |
| 66 | ) |
| 67 | ); |
| 68 | |
Takashi Sakamoto | c6b0b9e | 2017-04-09 21:33:29 +0900 | [diff] [blame] | 69 | TRACE_EVENT(in_data_block_message, |
| 70 | TP_PROTO(struct amdtp_stream *s, unsigned int data_blocks, __be32 *buffer), |
| 71 | TP_ARGS(s, data_blocks, buffer), |
| 72 | TP_STRUCT__entry( |
| 73 | __field(int, src) |
| 74 | __field(int, dst) |
| 75 | __field(unsigned int, data_blocks) |
| 76 | __dynamic_array(u64, messages, data_blocks) |
| 77 | ), |
| 78 | TP_fast_assign( |
| 79 | __entry->src = fw_parent_device(s->unit)->node_id; |
| 80 | __entry->dst = fw_parent_device(s->unit)->card->node_id; |
| 81 | __entry->data_blocks = data_blocks; |
| 82 | copy_message(__get_dynamic_array(messages), buffer, data_blocks, s->data_block_quadlets); |
| 83 | ), |
| 84 | TP_printk( |
| 85 | "%04x %04x %u %s", |
| 86 | __entry->src, |
| 87 | __entry->dst, |
| 88 | __entry->data_blocks, |
| 89 | __print_array(__get_dynamic_array(messages), __entry->data_blocks, 8) |
| 90 | ) |
| 91 | ); |
| 92 | |
| 93 | TRACE_EVENT(out_data_block_message, |
| 94 | TP_PROTO(struct amdtp_stream *s, unsigned int data_blocks, __be32 *buffer), |
| 95 | TP_ARGS(s, data_blocks, buffer), |
| 96 | TP_STRUCT__entry( |
| 97 | __field(int, src) |
| 98 | __field(int, dst) |
| 99 | __field(unsigned int, data_blocks) |
| 100 | __dynamic_array(u64, messages, data_blocks) |
| 101 | ), |
| 102 | TP_fast_assign( |
| 103 | __entry->src = fw_parent_device(s->unit)->card->node_id; |
| 104 | __entry->dst = fw_parent_device(s->unit)->node_id; |
| 105 | __entry->data_blocks = data_blocks; |
| 106 | copy_message(__get_dynamic_array(messages), buffer, data_blocks, s->data_block_quadlets); |
| 107 | ), |
| 108 | TP_printk( |
| 109 | "%04x %04x %u %s", |
| 110 | __entry->src, |
| 111 | __entry->dst, |
| 112 | __entry->data_blocks, |
| 113 | __print_array(__get_dynamic_array(messages), __entry->data_blocks, 8) |
| 114 | ) |
| 115 | ); |
| 116 | |
Takashi Sakamoto | 17909c1 | 2017-04-09 21:33:28 +0900 | [diff] [blame] | 117 | #endif |
| 118 | |
| 119 | #undef TRACE_INCLUDE_PATH |
| 120 | #define TRACE_INCLUDE_PATH . |
| 121 | #undef TRACE_INCLUDE_FILE |
| 122 | #define TRACE_INCLUDE_FILE amdtp-motu-trace |
| 123 | #include <trace/define_trace.h> |