4 * System Management Bus driver interface
6 * This file is part of the w32api package.
9 * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
11 * THIS SOFTWARE IS NOT COPYRIGHTED
13 * This source code is offered for use in the public domain. You may
14 * use, modify or distribute it freely.
16 * This code is distributed in the hope that it will be useful but
17 * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
18 * DISCLAIMED. This includes but is not limited to warranties of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
27 #pragma GCC system_header
34 #if !defined(SMBCLASS)
35 #define SMBCLASSAPI DECLSPEC_IMPORT
37 #define SMBCLASSAPI DECLSPEC_EXPORT
40 #define SMB_BUS_REQUEST \
41 CTL_CODE(FILE_DEVICE_UNKNOWN, 0, METHOD_NEITHER, FILE_ANY_ACCESS)
43 #define SMB_DEREGISTER_ALARM_NOTIFY \
44 CTL_CODE(FILE_DEVICE_UNKNOWN, 2, METHOD_NEITHER, FILE_ANY_ACCESS)
46 #define SMB_REGISTER_ALARM_NOTIFY \
47 CTL_CODE(FILE_DEVICE_UNKNOWN, 1, METHOD_NEITHER, FILE_ANY_ACCESS)
52 #define SMB_MAX_DATA_SIZE 32
54 /* SMB_REQUEST.Status constants */
55 #define SMB_STATUS_OK 0x00
56 #define SMB_UNKNOWN_FAILURE 0x07
57 #define SMB_ADDRESS_NOT_ACKNOWLEDGED 0x10
58 #define SMB_DEVICE_ERROR 0x11
59 #define SMB_COMMAND_ACCESS_DENIED 0x12
60 #define SMB_UNKNOWN_ERROR 0x13
61 #define SMB_DEVICE_ACCESS_DENIED 0x17
62 #define SMB_TIMEOUT 0x18
63 #define SMB_UNSUPPORTED_PROTOCOL 0x19
64 #define SMB_BUS_BUSY 0x1A
66 /* SMB_REQUEST.Protocol constants */
67 #define SMB_WRITE_QUICK 0x00
68 #define SMB_READ_QUICK 0x01
69 #define SMB_SEND_BYTE 0x02
70 #define SMB_RECEIVE_BYTE 0x03
71 #define SMB_WRITE_BYTE 0x04
72 #define SMB_READ_BYTE 0x05
73 #define SMB_WRITE_WORD 0x06
74 #define SMB_READ_WORD 0x07
75 #define SMB_WRITE_BLOCK 0x08
76 #define SMB_READ_BLOCK 0x09
77 #define SMB_PROCESS_CALL 0x0A
78 #define SMB_MAXIMUM_PROTOCOL 0x0A
80 typedef struct _SMB_REQUEST
{
86 UCHAR Data
[SMB_MAX_DATA_SIZE
];
87 } SMB_REQUEST
, *PSMB_REQUEST
;
95 typedef struct _SMB_REGISTER_ALARM
{
98 SMB_ALARM_NOTIFY NotifyFunction
;
100 } SMB_REGISTER_ALARM
, *PSMB_REGISTER_ALARM
;
102 /* SMB_CLASS.XxxVersion constants */
103 #define SMB_CLASS_MAJOR_VERSION 0x0001
104 #define SMB_CLASS_MINOR_VERSION 0x0000
106 typedef NTSTATUS DDKAPI
108 /*IN*/ struct _SMB_CLASS
*SmbClass
,
109 /*IN*/ PVOID SmbMiniport
);
113 /*IN*/ struct _SMB_CLASS
*SmbClass
,
114 /*IN*/ PVOID SmbMiniport
);
116 typedef NTSTATUS DDKAPI
118 /*IN*/ struct _SMB_CLASS
*SmbClass
,
119 /*IN*/ PVOID SmbMiniport
);
121 typedef struct _SMB_CLASS
{
125 PDEVICE_OBJECT DeviceObject
;
127 PDEVICE_OBJECT LowerDeviceObject
;
129 PSMB_REQUEST CurrentSmb
;
130 SMB_RESET_DEVICE ResetDevice
;
131 SMB_START_IO StartIo
;
132 SMB_STOP_DEVICE StopDevice
;
133 } SMB_CLASS
, *PSMB_CLASS
;
139 /*IN*/ PSMB_CLASS SmbClass
,
140 /*IN*/ UCHAR Address
,
146 SmbClassCompleteRequest(
147 /*IN*/ PSMB_CLASS SmbClass
);
149 typedef NTSTATUS DDKAPI
150 (*PSMB_INITIALIZE_MINIPORT
)(
151 /*IN*/ PSMB_CLASS SmbClass
,
152 /*IN*/ PVOID MiniportExtension
,
153 /*IN*/ PVOID MiniportContext
);
159 /*IN*/ PDRIVER_OBJECT DriverObject
,
160 /*IN*/ PDEVICE_OBJECT PDO
,
161 /*IN*/ ULONG MiniportExtensionSize
,
162 /*IN*/ PSMB_INITIALIZE_MINIPORT MiniportInitialize
,
163 /*IN*/ PVOID MiniportContext
,
164 /*OUT*/ PDEVICE_OBJECT
*FDO
);
169 SmbClassInitializeDevice(
170 /*IN*/ ULONG MajorVersion
,
171 /*IN*/ ULONG MinorVersion
,
172 /*IN*/ PDRIVER_OBJECT DriverObject
);
178 /*IN*/ PSMB_CLASS SmbClass
);
183 SmbClassUnlockDevice(
184 /*IN*/ PSMB_CLASS SmbClass
);
190 #endif /* __SMBUS_H */