summaryrefslogtreecommitdiff
path: root/src/usbh_driver_hub_private.h
diff options
context:
space:
mode:
authorAmir Hammad <amir.hammad@hotmail.com>2016-09-06 09:53:20 +0200
committerAmir Hammad <amir.hammad@hotmail.com>2016-09-11 13:31:47 +0200
commitfe54644237156b7b19ca8a9cfd699c0f4e6a0c9a (patch)
treec4a9dadd9d8191cb7a026a8a0e4a7e2136d24aa1 /src/usbh_driver_hub_private.h
parent66b801b01eecf3750ff8f03e30a658f2e7f7b9e7 (diff)
downloadsecure-hid-fe54644237156b7b19ca8a9cfd699c0f4e6a0c9a.tar.gz
secure-hid-fe54644237156b7b19ca8a9cfd699c0f4e6a0c9a.tar.bz2
secure-hid-fe54644237156b7b19ca8a9cfd699c0f4e6a0c9a.zip
HUB: make use of control wrappers + use enums
Until now, hardcoded numbers were used as states. Signed-off-by: Amir Hammad <amir.hammad@hotmail.com>
Diffstat (limited to 'src/usbh_driver_hub_private.h')
-rw-r--r--src/usbh_driver_hub_private.h17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/usbh_driver_hub_private.h b/src/usbh_driver_hub_private.h
index df38243..8c9bc44 100644
--- a/src/usbh_driver_hub_private.h
+++ b/src/usbh_driver_hub_private.h
@@ -61,7 +61,19 @@
#define CURRENT_PORT_NONE -1
-#define EMPTY_PACKET_READ_STATE 255
+enum EVENT_STATE {
+ EVENT_STATE_NONE,
+ EVENT_STATE_INITIAL,
+ EVENT_STATE_POLL_REQ,
+ EVENT_STATE_POLL,
+ EVENT_STATE_READ_HUB_DESCRIPTOR_COMPLETE,
+ EVENT_STATE_ENABLE_PORTS,
+ EVENT_STATE_GET_PORT_STATUS,
+ EVENT_STATE_PORT_RESET_REQ,
+ EVENT_STATE_PORT_RESET_COMPLETE,
+ EVENT_STATE_SLEEP_500_MS,
+ EVENT_STATE_GET_STATUS_COMPLETE,
+};
struct _hub_device {
usbh_device_t *device[USBH_HUB_MAX_DEVICES + 1];
@@ -69,8 +81,7 @@ struct _hub_device {
uint16_t endpoint_in_maxpacketsize;
uint8_t endpoint_in_address;
uint8_t endpoint_in_toggle;
- uint8_t state;
- uint8_t state_after_empty_read;
+ enum EVENT_STATE state;
uint8_t desc_len;
uint16_t ports_num;