6 #define CSR_FCP_COMMAND 0xfffff0000b00ull
7 #define CSR_FCP_RESPONSE 0xfffff0000d00ull
9 static const char * const ctype_names
[16] = {
28 static const char * const subunit_type_names
[32] = {
33 "tape recorder/player",
59 "subunit_type extended to next byte",
69 const char *name
; /* Short name for field. */
70 int offset
; /* Location of field, specified in bits.
71 * Negative means from end of packet */
72 int width
; /* Width of field, 0 means use data_length. */
73 struct avc_enum
*names
;
76 struct avc_opcode_info
{
78 struct avc_field fields
[8];
81 struct avc_enum power_field_names
[] = {
87 static const struct avc_opcode_info opcode_info
[256] = {
89 /* TA Document 1999026
90 * AV/C Digital Interface Command Set General Specification
94 { "state", 0, 8, power_field_names
}
100 { "unit_type", 8, 5 },
102 { "company id", 16, 24 },
105 [0x31] = { "subunit info" },
106 [0x01] = { "reserve" },
107 [0xb0] = { "version" },
108 [0x00] = { "vendor dependent" },
110 [0x02] = { "plug info" },
111 [0x12] = { "channel usage" },
112 [0x24] = { "connect" },
113 [0x20] = { "connect av" },
114 [0x22] = { "connections" },
115 [0x11] = { "digital input" },
116 [0x10] = { "digital output" },
117 [0x25] = { "disconnect" },
118 [0x21] = { "disconnect av" },
119 [0x19] = { "input plug signal format" },
120 [0x18] = { "output plug signal format" },
121 [0x1f] = { "general bus setup" },
123 /* TA Document 1999025
124 * AV/C Descriptor Mechanism Specification Version 1.0 */
125 [0x0c] = { "create descriptor" },
126 [0x08] = { "open descriptor" },
127 [0x09] = { "read descriptor" },
128 [0x0a] = { "write descriptor" },
129 [0x05] = { "open info block" },
130 [0x06] = { "read info block" },
131 [0x07] = { "write info block" },
132 [0x0b] = { "search descriptor" },
133 [0x0d] = { "object number select" },
135 /* TA Document 1999015
136 * AV/C Command Set for Rate Control of Isochronous Data Flow 1.0 */
138 { "subfunction", 0, 8 },
140 { "plug_type", 16, 8 },
141 { "plug_id", 16, 8 },
145 /* TA Document 1999008
146 * AV/C Audio Subunit Specification 1.0 */
147 [0xb8] = { "function block" },
149 /* TA Document 2001001
150 * AV/C Panel Subunit Specification 1.1 */
151 [0x7d] = { "gui update" },
152 [0x7e] = { "push gui data" },
153 [0x7f] = { "user action" },
154 [0x7c] = { "pass through" },
157 [0x26] = { "asynchronous connection" },
161 unsigned int operand0
: 8;
162 unsigned int opcode
: 8;
163 unsigned int subunit_id
: 3;
164 unsigned int subunit_type
: 5;
165 unsigned int ctype
: 4;
166 unsigned int cts
: 4;
170 decode_avc(struct link_transaction
*t
)
172 struct avc_frame
*frame
= (struct avc_frame
*) t
->request
->packet
.write_block
.data
;
173 const struct avc_opcode_info
*info
;
178 info
= &opcode_info
[frame
->opcode
];
179 if (info
->name
== NULL
) {
180 snprintf(buffer
, sizeof buffer
, "(unknown opcode 0x%02x)", frame
->opcode
);
186 printf("av/c %s, subunit_type=%s, subunit_id=%d, opcode=%s",
187 ctype_names
[frame
->ctype
], subunit_type_names
[frame
->subunit_type
],
188 frame
->subunit_id
, name
);
190 for (i
= 0; info
->fields
[i
].name
!= NULL
; i
++) {
191 printf(", %s", info
->fields
[i
].name
);
199 decode_fcp(struct link_transaction
*t
)
201 struct avc_frame
*frame
= (struct avc_frame
*) t
->request
->packet
.write_block
.data
;
202 unsigned long long offset
;
204 offset
= ((unsigned long long) t
->request
->packet
.common
.offset_high
<< 32) |
205 t
->request
->packet
.common
.offset_low
;
207 if (t
->request
->packet
.common
.tcode
!= TCODE_WRITE_BLOCK
)
210 if (offset
== CSR_FCP_COMMAND
|| offset
== CSR_FCP_RESPONSE
) {
211 switch (frame
->cts
) {
216 printf("cal fcp frame (cts=0x01)\n");
219 printf("ehs fcp frame (cts=0x02)\n");
222 printf("havi fcp frame (cts=0x03)\n");
225 printf("vendor specific fcp frame (cts=0x0e)\n");
228 printf("extended cts\n");
231 printf("reserved fcp frame (ctx=0x%02x)\n", frame
->cts
);