xref: /haiku/src/tests/add-ons/kernel/busses/usb/uhci_decode.cpp (revision ba51713c8fe31ba0df3821616f40bf30b8742913)
1d548f131SMichael Lotz #include <stdio.h>
2*ba51713cSMichael Lotz #include <string.h>
3d548f131SMichael Lotz #include <SupportDefs.h>
4d548f131SMichael Lotz 
5d548f131SMichael Lotz struct uhci_td_control_status {
6d548f131SMichael Lotz 	uint32	actual_length : 11;
7d548f131SMichael Lotz 	uint32	reserved_1 : 6;
8d548f131SMichael Lotz 	uint32	bitstuff_error : 1;
9d548f131SMichael Lotz 	uint32	crc_timeout : 1;
10d548f131SMichael Lotz 	uint32	nak_received : 1;
11d548f131SMichael Lotz 	uint32	babble_detected : 1;
12d548f131SMichael Lotz 	uint32	data_buffer_error : 1;
13d548f131SMichael Lotz 	uint32	stalled : 1;
14d548f131SMichael Lotz 	uint32	active : 1;
15d548f131SMichael Lotz 	uint32	interrupt_on_complete : 1;
16d548f131SMichael Lotz 	uint32	isochronous_select : 1;
17d548f131SMichael Lotz 	uint32	low_speed_device : 1;
18d548f131SMichael Lotz 	uint32	error_counter : 2;
19d548f131SMichael Lotz 	uint32	short_packet_detect : 1;
20d548f131SMichael Lotz 	uint32	reserved_2 : 2;
21d548f131SMichael Lotz };
22d548f131SMichael Lotz 
23d548f131SMichael Lotz 
24d548f131SMichael Lotz int
main(int argc,char * argv[])25d548f131SMichael Lotz main(int argc, char *argv[])
26d548f131SMichael Lotz {
27d548f131SMichael Lotz 	if (argc < 2)
28d548f131SMichael Lotz 		return 1;
29d548f131SMichael Lotz 
30d548f131SMichael Lotz 	uint32 value;
31d548f131SMichael Lotz 	if (sscanf(argv[1], "%lx", &value) != 1)
32d548f131SMichael Lotz 		return 2;
33d548f131SMichael Lotz 
34d548f131SMichael Lotz 	uhci_td_control_status status;
35d548f131SMichael Lotz 	memcpy(&status, &value, sizeof(status));
36d548f131SMichael Lotz 
37d548f131SMichael Lotz 	printf("value: 0x%08lx\n", value);
38d548f131SMichael Lotz 	printf("actual_length: %ld\n", status.actual_length);
39d548f131SMichael Lotz 	printf("reserved_1: %ld\n", status.reserved_1);
40d548f131SMichael Lotz 	printf("bitstuff_error: %ld\n", status.bitstuff_error);
41d548f131SMichael Lotz 	printf("crc_timeout: %ld\n", status.crc_timeout);
42d548f131SMichael Lotz 	printf("nak_received: %ld\n", status.nak_received);
43d548f131SMichael Lotz 	printf("babble_detected: %ld\n", status.babble_detected);
44d548f131SMichael Lotz 	printf("data_buffer_error: %ld\n", status.data_buffer_error);
45d548f131SMichael Lotz 	printf("stalled: %ld\n", status.stalled);
46d548f131SMichael Lotz 	printf("active: %ld\n", status.active);
47d548f131SMichael Lotz 	printf("interrupt_on_complete: %ld\n", status.interrupt_on_complete);
48d548f131SMichael Lotz 	printf("isochronous_select: %ld\n", status.isochronous_select);
49d548f131SMichael Lotz 	printf("low_speed_device: %ld\n", status.low_speed_device);
50d548f131SMichael Lotz 	printf("error_counter: %ld\n", status.error_counter);
51d548f131SMichael Lotz 	printf("short_packet_detect: %ld\n", status.short_packet_detect);
52d548f131SMichael Lotz 	printf("reserved_2: %ld\n", status.reserved_2);
53d548f131SMichael Lotz 
54d548f131SMichael Lotz 	return 0;
55d548f131SMichael Lotz }
56