lfn
serial
ticket/834-toolchain-update
topic/msim-upgrade
topic/simplify-dev-export
Last change
on this file since 7ce0fe3 was 7ce0fe3, checked in by Jan Vesely <jano.vesely@…>, 14 years ago |
Root ub driver uses unified debug logging and some other polishing.
|
-
Property mode
set to
100644
|
File size:
849 bytes
|
Line | |
---|
1 | #include <assert.h>
|
---|
2 | #include <stdio.h>
|
---|
3 |
|
---|
4 | #include <usb/debug.h>
|
---|
5 |
|
---|
6 | #include "port_status.h"
|
---|
7 |
|
---|
8 | struct flag_name
|
---|
9 | {
|
---|
10 | unsigned flag;
|
---|
11 | const char *name;
|
---|
12 | };
|
---|
13 |
|
---|
14 | static const struct flag_name flags[] =
|
---|
15 | {
|
---|
16 | { STATUS_SUSPEND, "suspended" },
|
---|
17 | { STATUS_IN_RESET, "in reset" },
|
---|
18 | { STATUS_LOW_SPEED, "low speed device" },
|
---|
19 | { STATUS_ALWAYS_ONE, "always 1 bit" },
|
---|
20 | { STATUS_RESUME, "resume" },
|
---|
21 | { STATUS_LINE_D_MINUS, "line D- value" },
|
---|
22 | { STATUS_LINE_D_PLUS, "line D+ value" },
|
---|
23 | { STATUS_ENABLED_CHANGED, "enabled changed" },
|
---|
24 | { STATUS_ENABLED, "enabled" },
|
---|
25 | { STATUS_CONNECTED_CHANGED, "connected changed" },
|
---|
26 | { STATUS_CONNECTED, "connected" }
|
---|
27 | };
|
---|
28 |
|
---|
29 | void print_port_status(port_status_t value)
|
---|
30 | {
|
---|
31 | unsigned i = 0;
|
---|
32 | for (;i < sizeof(flags)/sizeof(struct flag_name); ++i) {
|
---|
33 | usb_log_debug("\t%s status: %s.\n", flags[i].name,
|
---|
34 | value & flags[i].flag ? "YES" : "NO");
|
---|
35 | }
|
---|
36 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.