summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKristian Høgsberg <krh@redhat.com>2006-11-22 11:46:25 -0500
committerKristian Høgsberg <krh@redhat.com>2006-11-22 11:46:25 -0500
commit6a54efc71097c48157e89508b416c918c5f43cb8 (patch)
treed825efbfceb7799f59675715f79015db3d155adf
parente87daabac6553264cdfec3fc9d8b72b97f6d874a (diff)
Add decoding of iso data and lock packets.
-rw-r--r--nosy-dump.c50
1 files changed, 40 insertions, 10 deletions
diff --git a/nosy-dump.c b/nosy-dump.c
index 7a7e4fb..d139578 100644
--- a/nosy-dump.c
+++ b/nosy-dump.c
@@ -305,6 +305,16 @@ struct link_packet {
unsigned long crc;
} write_response;
+ struct {
+ unsigned int sy : 4;
+ unsigned int tcode : 4;
+ unsigned int channel : 6;
+ unsigned int tag : 2;
+ unsigned int data_length : 16;
+
+ unsigned long crc;
+ } iso_data;
+
};
};
@@ -536,7 +546,7 @@ struct packet_field read_block_request_fields[] = {
{ "ack", 188, 4, 0, ack_names },
};
-struct packet_field read_block_response_fields[] = {
+struct packet_field block_response_fields[] = {
COMMON_RESPONSE_FIELDS,
{ "data_length", 96, 16 },
{ "extended_tcode", 112, 16 },
@@ -552,7 +562,7 @@ struct packet_field write_quadlet_request_fields[] = {
{ "ack", -4, 4, 0, ack_names }
};
-struct packet_field write_block_request_fields[] = {
+struct packet_field block_request_fields[] = {
COMMON_REQUEST_FIELDS,
{ "data_length", 96, 16 },
{ "extended_tcode", 112, 16 },
@@ -572,6 +582,17 @@ struct packet_field cycle_start_fields[] = {
{ "tcode", 24, 4, 0, tcode_names },
};
+struct packet_field iso_data_fields[] = {
+ { "data_length", 0, 16 },
+ { "tag", 16, 2 },
+ { "channel", 18, 6 },
+ { "tcode", 24, 4, 0, tcode_names },
+ { "sy", 28, 4 },
+ { "crc", 32, 32, PACKET_FIELD_DETAIL },
+ { "data", 64, 0 },
+ { "crc", -64, 32, PACKET_FIELD_DETAIL },
+ { "ack", -4, 4, 0, ack_names }
+};
static struct packet_info packet_info[] = {
{
@@ -585,8 +606,8 @@ static struct packet_info packet_info[] = {
.name = "write_block_request",
.type = PACKET_REQUEST,
.response_tcode = TCODE_WRITE_RESPONSE,
- .fields = write_block_request_fields,
- .field_count = array_length(write_block_request_fields)
+ .fields = block_request_fields,
+ .field_count = array_length(block_request_fields)
},
{
.name = "write_response",
@@ -621,8 +642,8 @@ static struct packet_info packet_info[] = {
{
.name = "read_block_response",
.type = PACKET_RESPONSE,
- .fields = read_block_response_fields,
- .field_count = array_length(read_block_response_fields)
+ .fields = block_response_fields,
+ .field_count = array_length(block_response_fields)
},
{
.name = "cycle_start",
@@ -633,14 +654,20 @@ static struct packet_info packet_info[] = {
{
.name = "lock_request",
.type = PACKET_REQUEST,
+ .fields = block_request_fields,
+ .field_count = array_length(block_request_fields)
},
{
.name = "iso_data",
- .type = PACKET_OTHER
+ .type = PACKET_OTHER,
+ .fields = iso_data_fields,
+ .field_count = array_length(iso_data_fields)
},
{
.name = "lock_response",
- .type = PACKET_RESPONSE
+ .type = PACKET_RESPONSE,
+ .fields = block_response_fields,
+ .field_count = array_length(block_response_fields)
}
};
@@ -834,9 +861,12 @@ void decode_link_packet(struct link_packet *packet, size_t length)
/* The way I'd like to do this instead is to have a way to
* specify which of the other fields designate the length of the
* data field. */
+ if (packet->common.tcode == TCODE_ISO_DATA)
+ length = packet->iso_data.data_length;
+ else
+ length = packet->write_block.data_length;
printf("%s=[", f->name);
- dump_data((unsigned char *) packet + (offset / 8 + 4),
- packet->write_block.data_length);
+ dump_data((unsigned char *) packet + (offset / 8 + 4), length);
printf("] ");
}
else {