summaryrefslogtreecommitdiff
path: root/usb/ufxclientsample/event.h
blob: 54532415841898648935ff6bf4c83b16901d1e6c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/*++

Copyright (c) Microsoft Corporation. All rights reserved.

Module Name:

    eventbuffer.h

Abstract:

    Defines the sample controller's events

Environment:

    Kernel mode

--*/
#pragma once

typedef enum _CONTROLLER_EVENT_TYPE {
    EventTypeDevice = 0,
    EventTypeEndpoint = 1
} CONTROLLER_EVENT_TYPE;

typedef enum _DEVICE_EVENT {
    DeviceEventDisconnect = 0,
    DeviceEventUSBReset = 1,
    DeviceEventConnect = 2,
    DeviceEventUSBLinkStateChange = 3,
    DeviceEventWakeUp = 4,
    DeviceEventHibernationRequest = 5,
    DeviceEventSuspend = 6,
    DeviceEventCommandComplete = 7
} DEVICE_EVENT, *PDEVICE_EVENT;

typedef enum _ENDPOINT_EVENT {
    EndpointEventTransferComplete = 0,
    EndpointEventStartTransferComplete = 1,
    EndpointEventEndTransferComplete = 2,
    EndpointEventSetStall = 3,
    EndpointEventClearStall = 4
} ENDPOINT_EVENT, *PENDPOINT_EVENT;

typedef struct _CONTROLLER_EVENT {
    CONTROLLER_EVENT_TYPE Type;
    
    union {
        DEVICE_EVENT DeviceEvent;
        ENDPOINT_EVENT EndpointEvent;
    } u;
} CONTROLLER_EVENT;

_IRQL_requires_(DISPATCH_LEVEL)
VOID
HandleEndpointEvent (
    WDFDEVICE WdfDevice,
    ENDPOINT_EVENT EndpointEvent
    );

_IRQL_requires_(DISPATCH_LEVEL)
VOID
HandleDeviceEvent (
    WDFDEVICE WdfDevice,
    DEVICE_EVENT DeviceEvent
    );