-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDevice.h
95 lines (76 loc) · 1.82 KB
/
Device.h
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
/*++
Module Name:
device.h
Abstract:
This file contains the device definitions.
Environment:
Kernel-mode Driver Framework
--*/
#include "public.h"
EXTERN_C_START
//
// The device context performs the same job as
// a WDM device extension in the driver frameworks
//
typedef struct _DEVICE_CONTEXT
{
WDFUSBDEVICE UsbDevice;
ULONG PrivateDeviceData; // just a placeholder
UINT16 DeviceNumber; // ???
STRING DebugLog;
union {
USHORT VersionAsUshort;
struct {
BYTE Minor;
BYTE Major;
} Version;
} Firmware; // firmware version.
} DEVICE_CONTEXT, *PDEVICE_CONTEXT;
//
// This macro will generate an inline function called DeviceGetContext
// which will be used to get a pointer to the device context memory
// in a type safe manner.
//
WDF_DECLARE_CONTEXT_TYPE_WITH_NAME(DEVICE_CONTEXT, DeviceGetContext)
//
// Function to initialize the device's queues and callbacks
//
NTSTATUS
WacomPracticeCreateDevice(
_Inout_ PWDFDEVICE_INIT DeviceInit
);
//
// Function to select the device's USB configuration and get a WDFUSBDEVICE
// handle
//
EVT_WDF_DEVICE_PREPARE_HARDWARE WacomPracticeEvtDevicePrepareHardware;
//
// Callback function called when a specific time period has elapsed.
//
EVT_WDF_TIMER BlinkLEDColorCallback;
//
// Higher-level, functional routines that can be invoked to trigger certain behaviours
//
VOID BlinkLEDColor(
__in PDEVICE_CONTEXT DeviceContext,
__in int duration,
__in int r,
__in int g,
__in int b
);
VOID CycleLEDColor(
__in PDEVICE_CONTEXT DeviceContext,
__in int num_cycles,
__in int h,
__in int s
);
VOID SetLEDColor(
__in PDEVICE_CONTEXT DeviceContext,
__in int r,
__in int g,
__in int b
);
VOID GetFirmwareVersion(
__in PDEVICE_CONTEXT DeviceContext
);
EXTERN_C_END