summaryrefslogtreecommitdiff
path: root/simbatt/func/simbattdriverif.h
blob: 6fb45d8bbecf34b46b8fe8ba9357f1a68cb7d8b9 (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
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
/*++

Copyright (c) Microsoft Corporation. All rights reserved.

Module Name:

    simbattdriverif.h

Abstract:

    This module contains the interfaces used to communicate between usermode
    and the simulated battery driver stack.

    N.B. This code is provided "AS IS" without any expressed or implied warranty.

--*/

//---------------------------------------------------------------------- Pragmas

#pragma once

//--------------------------------------------------------------------- Includes

#include <initguid.h>

//------------------------------------------------------------------ Definitions

//
// Battery bus driver interface
//

// {780AC894-01FF-4b5e-B4C8-9C00709200EB}
DEFINE_GUID(BATTBUS_DEVINTERFACE_GUID,
    0x780ac894, 0x1ff, 0x4b5e, 0xb4, 0xc8, 0x9c, 0x0, 0x70, 0x92, 0x0, 0xeb);

#define BATTBUS_IOCTL(_index_) \
    CTL_CODE(FILE_DEVICE_BUS_EXTENDER, _index_, METHOD_BUFFERED, FILE_READ_DATA)

#define IOCTL_BATTBUS_PLUGIN_HARDWARE                   BATTBUS_IOCTL(0x0)
#define IOCTL_BATTBUS_UNPLUG_HARDWARE                   BATTBUS_IOCTL(0x1)

//
// Simulated battery ioctl interface
//

// {DAD1F940-CDD0-461f-B23F-C2C663D6E9EB}
DEFINE_GUID(SIMBATT_DEVINTERFACE_GUID,
    0xdad1f940, 0xcdd0, 0x461f, 0xb2, 0x3f, 0xc2, 0xc6, 0x63, 0xd6, 0xe9, 0xeb);

#define SIMBATT_IOCTL(_index_) \
    CTL_CODE(FILE_DEVICE_BATTERY, _index_, METHOD_BUFFERED, FILE_WRITE_DATA)

#define IOCTL_SIMBATT_SET_STATUS                        SIMBATT_IOCTL(0x800)
#define IOCTL_SIMBATT_SET_DEVICE_NAME                   SIMBATT_IOCTL(0x801)
#define IOCTL_SIMBATT_SET_ESTIMATED_TIME                SIMBATT_IOCTL(0x802)
#define IOCTL_SIMBATT_SET_GRANULARITY_INFORMATION       SIMBATT_IOCTL(0x803)
#define IOCTL_SIMBATT_SET_INFORMATION                   SIMBATT_IOCTL(0x804)
#define IOCTL_SIMBATT_SET_MANUFACTURE_DATE              SIMBATT_IOCTL(0x805)
#define IOCTL_SIMBATT_SET_MANUFACTURE_NAME              SIMBATT_IOCTL(0x806)
#define IOCTL_SIMBATT_SET_SERIAL_NUMBER                 SIMBATT_IOCTL(0x807)
#define IOCTL_SIMBATT_SET_TEMPERATURE                   SIMBATT_IOCTL(0x808)
#define IOCTL_SIMBATT_SET_UNIQUE_ID                     SIMBATT_IOCTL(0x809)
#define IOCTL_SIMBATT_GET_MAXCHARGINGCURRENT            SIMBATT_IOCTL(0x810)
#define SIMBATT_RATE_CALCULATE                          0x7fffffff
#define MAX_SUPPORTED_SIMBATT_CHILDREN                  20

//------------------------------------------------------------------- Data Types

//
//  Data structure used in PlugIn and UnPlug ioctls
//

#define BATTBUS_TYPE_SIMBATT 0;

typedef struct _BATTBUS_PLUGIN_HARDWARE
{
    //
    // Size of this type.
    //

    ULONG Size;

    //
    // Unique serial number of the device to be enumerated.
    // Enumeration will be failed if another device on the
    // bus has the same serial number.
    //

    ULONG SerialNo;

    //
    // UI number.
    //

    ULONG UINumber;

    //
    // Type of device being enumerated
    //
    // Reserved value, set to 0.
    //

    ULONG Type;

} BATTBUS_PLUGIN_HARDWARE, *PBATTBUS_PLUGIN_HARDWARE;

typedef struct _BATTBUS_UNPLUG_HARDWARE
{
    //
    // size of this type
    //

    ULONG Size;

    //
    // Serial number of the device to be unplugged.
    //

    ULONG SerialNo;

    //
    // Must not be referenced used.
    //

    ULONG Reserved[2];

} BATTBUS_UNPLUG_HARDWARE, *PBATTBUS_UNPLUG_HARDWARE;