ReactOS  0.4.14-dev-1233-gf5658fd
smbus.h
Go to the documentation of this file.
1 /*
2  * smbus.h
3  *
4  * System Management Bus driver interface
5  *
6  * This file is part of the w32api package.
7  *
8  * Contributors:
9  * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
10  *
11  * THIS SOFTWARE IS NOT COPYRIGHTED
12  *
13  * This source code is offered for use in the public domain. You may
14  * use, modify or distribute it freely.
15  *
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.
20  *
21  */
22 
23 #ifndef __SMBUS_H
24 #define __SMBUS_H
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
30 #if !defined(SMBCLASS)
31 #define SMBCLASSAPI DECLSPEC_IMPORT
32 #else
33 #define SMBCLASSAPI
34 #endif
35 
36 #define SMB_BUS_REQUEST \
37  CTL_CODE(FILE_DEVICE_UNKNOWN, 0, METHOD_NEITHER, FILE_ANY_ACCESS)
38 
39 #define SMB_DEREGISTER_ALARM_NOTIFY \
40  CTL_CODE(FILE_DEVICE_UNKNOWN, 2, METHOD_NEITHER, FILE_ANY_ACCESS)
41 
42 #define SMB_REGISTER_ALARM_NOTIFY \
43  CTL_CODE(FILE_DEVICE_UNKNOWN, 1, METHOD_NEITHER, FILE_ANY_ACCESS)
44 
45 
46 struct _SMB_CLASS;
47 
48 #define SMB_MAX_DATA_SIZE 32
49 
50 /* SMB_REQUEST.Status constants */
51 #define SMB_STATUS_OK 0x00
52 #define SMB_UNKNOWN_FAILURE 0x07
53 #define SMB_ADDRESS_NOT_ACKNOWLEDGED 0x10
54 #define SMB_DEVICE_ERROR 0x11
55 #define SMB_COMMAND_ACCESS_DENIED 0x12
56 #define SMB_UNKNOWN_ERROR 0x13
57 #define SMB_DEVICE_ACCESS_DENIED 0x17
58 #define SMB_TIMEOUT 0x18
59 #define SMB_UNSUPPORTED_PROTOCOL 0x19
60 #define SMB_BUS_BUSY 0x1A
61 
62 /* SMB_REQUEST.Protocol constants */
63 #define SMB_WRITE_QUICK 0x00
64 #define SMB_READ_QUICK 0x01
65 #define SMB_SEND_BYTE 0x02
66 #define SMB_RECEIVE_BYTE 0x03
67 #define SMB_WRITE_BYTE 0x04
68 #define SMB_READ_BYTE 0x05
69 #define SMB_WRITE_WORD 0x06
70 #define SMB_READ_WORD 0x07
71 #define SMB_WRITE_BLOCK 0x08
72 #define SMB_READ_BLOCK 0x09
73 #define SMB_PROCESS_CALL 0x0A
74 #define SMB_MAXIMUM_PROTOCOL 0x0A
75 
76 typedef struct _SMB_REQUEST {
84 
85 typedef VOID
87  PVOID Context,
88  UCHAR Address,
89  USHORT Data);
90 
91 typedef struct _SMB_REGISTER_ALARM {
97 
98 /* SMB_CLASS.XxxVersion constants */
99 #define SMB_CLASS_MAJOR_VERSION 0x0001
100 #define SMB_CLASS_MINOR_VERSION 0x0000
101 
102 typedef NTSTATUS
104  IN struct _SMB_CLASS *SmbClass,
105  IN PVOID SmbMiniport);
106 
107 typedef VOID
109  IN struct _SMB_CLASS *SmbClass,
110  IN PVOID SmbMiniport);
111 
112 typedef NTSTATUS
114  IN struct _SMB_CLASS *SmbClass,
115  IN PVOID SmbMiniport);
116 
117 typedef struct _SMB_CLASS {
130 
132 VOID
133 NTAPI
135  IN PSMB_CLASS SmbClass,
136  IN UCHAR Address,
137  IN USHORT Data);
138 
140 VOID
141 NTAPI
143  IN PSMB_CLASS SmbClass);
144 
145 typedef NTSTATUS
147  IN PSMB_CLASS SmbClass,
148  IN PVOID MiniportExtension,
149  IN PVOID MiniportContext);
150 
152 NTSTATUS
153 NTAPI
156  IN PDEVICE_OBJECT PDO,
157  IN ULONG MiniportExtensionSize,
159  IN PVOID MiniportContext,
160  OUT PDEVICE_OBJECT *FDO);
161 
163 NTSTATUS
164 NTAPI
169 
171 VOID
172 NTAPI
174  IN PSMB_CLASS SmbClass);
175 
177 VOID
178 NTAPI
180  IN PSMB_CLASS SmbClass);
181 
182 #ifdef __cplusplus
183 }
184 #endif
185 
186 #endif /* __SMBUS_H */
SMBCLASSAPI VOID NTAPI SmbClassLockDevice(IN PSMB_CLASS SmbClass)
#define IN
Definition: typedefs.h:39
ULONG MinorVersion
Definition: ros_glue.cpp:5
ULONG MajorVersion
Definition: ros_glue.cpp:4
UCHAR Status
Definition: smbus.h:77
struct _SMB_REGISTER_ALARM SMB_REGISTER_ALARM
UCHAR MaxAddress
Definition: smbus.h:93
SMBCLASSAPI VOID NTAPI SmbClassAlarm(IN PSMB_CLASS SmbClass, IN UCHAR Address, IN USHORT Data)
LONG NTSTATUS
Definition: precomp.h:26
#define SMB_MAX_DATA_SIZE
Definition: smbus.h:48
UCHAR BlockLength
Definition: smbus.h:81
PVOID Miniport
Definition: smbus.h:120
SMBCLASSAPI VOID NTAPI SmbClassCompleteRequest(IN PSMB_CLASS SmbClass)
VOID(NTAPI * SMB_START_IO)(IN struct _SMB_CLASS *SmbClass, IN PVOID SmbMiniport)
Definition: smbus.h:108
SMBCLASSAPI VOID NTAPI SmbClassUnlockDevice(IN PSMB_CLASS SmbClass)
struct _SMB_REQUEST SMB_REQUEST
NTSTATUS(NTAPI * SMB_STOP_DEVICE)(IN struct _SMB_CLASS *SmbClass, IN PVOID SmbMiniport)
Definition: smbus.h:113
PDEVICE_OBJECT PDO
Definition: smbus.h:122
NTSTATUS(NTAPI * PSMB_INITIALIZE_MINIPORT)(IN PSMB_CLASS SmbClass, IN PVOID MiniportExtension, IN PVOID MiniportContext)
Definition: smbus.h:146
struct _SMB_CLASS * PSMB_CLASS
USHORT MajorVersion
Definition: smbus.h:118
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
SMB_START_IO StartIo
Definition: smbus.h:127
static WCHAR Address[46]
Definition: ping.c:68
_In_ LPGUID _In_ PVOID Data
Definition: classpnp.h:778
static PDRIVER_OBJECT DriverObject
Definition: template.c:42
SMBCLASSAPI NTSTATUS NTAPI SmbClassCreateFdo(IN PDRIVER_OBJECT DriverObject, IN PDEVICE_OBJECT PDO, IN ULONG MiniportExtensionSize, IN PSMB_INITIALIZE_MINIPORT MiniportInitialize, IN PVOID MiniportContext, OUT PDEVICE_OBJECT *FDO)
SMB_RESET_DEVICE ResetDevice
Definition: smbus.h:126
UCHAR Protocol
Definition: smbus.h:78
#define SMBCLASSAPI
Definition: smbus.h:31
PIRP CurrentIrp
Definition: smbus.h:124
UCHAR Address
Definition: smbus.h:79
unsigned char UCHAR
Definition: xmlstorage.h:181
PDEVICE_OBJECT DeviceObject
Definition: smbus.h:121
NDIS_STATUS NTAPI MiniportInitialize(OUT PNDIS_STATUS OpenErrorStatus, OUT PUINT SelectedMediumIndex, IN PNDIS_MEDIUM MediumArray, IN UINT MediumArraySize, IN NDIS_HANDLE MiniportAdapterHandle, IN NDIS_HANDLE WrapperConfigurationContext)
Definition: ndis.c:88
#define NTSTATUS
Definition: precomp.h:20
SMB_ALARM_NOTIFY NotifyFunction
Definition: smbus.h:94
#define VOID
Definition: acefi.h:82
SMBCLASSAPI NTSTATUS NTAPI SmbClassInitializeDevice(IN ULONG MajorVersion, IN ULONG MinorVersion, IN PDRIVER_OBJECT DriverObject)
NTSTATUS(NTAPI * SMB_RESET_DEVICE)(IN struct _SMB_CLASS *SmbClass, IN PVOID SmbMiniport)
Definition: smbus.h:103
PVOID NotifyContext
Definition: smbus.h:95
SMB_STOP_DEVICE StopDevice
Definition: smbus.h:128
unsigned short USHORT
Definition: pedump.c:61
struct _SMB_CLASS SMB_CLASS
PDEVICE_OBJECT LowerDeviceObject
Definition: smbus.h:123
struct _SMB_REQUEST * PSMB_REQUEST
#define OUT
Definition: typedefs.h:40
USHORT MinorVersion
Definition: smbus.h:119
struct tagContext Context
Definition: acpixf.h:1034
unsigned int ULONG
Definition: retypes.h:1
UCHAR Command
Definition: smbus.h:80
struct _SMB_REGISTER_ALARM * PSMB_REGISTER_ALARM
PSMB_REQUEST CurrentSmb
Definition: smbus.h:125
UCHAR MinAddress
Definition: smbus.h:92
VOID(NTAPI * SMB_ALARM_NOTIFY)(PVOID Context, UCHAR Address, USHORT Data)
Definition: smbus.h:86